--- loncom/interface/lonmenu.pm 2016/03/15 14:25:26 1.440
+++ loncom/interface/lonmenu.pm 2016/03/16 13:54:06 1.441
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines to control the menu
#
-# $Id: lonmenu.pm,v 1.440 2016/03/15 14:25:26 raeburn Exp $
+# $Id: lonmenu.pm,v 1.441 2016/03/16 13:54:06 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1579,6 +1579,7 @@ END
#
sub done_button_js {
my ($type,$width,$height,$proctor) = @_;
+ return unless (($type eq 'map') || ($type eq 'resource'));
my %lt = &Apache::lonlocal::texthash(
title => 'WARNING!',
button => 'Done',
@@ -1593,17 +1594,68 @@ sub done_button_js {
key => 'Key:',
nokey => 'A proctor key is required',
);
- my $confirm;
- if (($type eq 'map') || ($type eq 'resource')) {
- if ($proctor) {
- $confirm = $lt{'preamble'}.' '.$lt{$type};
- if ($height !~ /^\d+$/) {
- $height = 400;
+ my $navmap = Apache::lonnavmaps::navmap->new();
+ my ($missing,$tried);
+ if (ref($navmap)) {
+ $missing=0;
+ $tried=0;
+ my @resources=();
+ if ($type eq 'map') {
+ my ($mapurl,$rid,$resurl)=&Apache::lonnet::decode_symb($env{'request.symb'});
+ @resources=$navmap->retrieveResources(undef,sub { $_[0]->is_problem() },1,0);
+ } else {
+ my $res = $navmap->getBySymb($env{'request.symb'});
+ if (ref($res)) {
+ if ($res->is_problem()) {
+ push(@resources,$res);
+ }
}
- if ($width !~ /^\d+$/) {
- $width = 400;
+ }
+ foreach my $res (@resources) {
+ if ($res->singlepart()) {
+ if (!$res->tries()) {
+ $missing++;
+ } else {
+ $tried++;
+ }
+ } else {
+ foreach my $part (@{$res->parts()}) {
+ if (!$res->tries($part)) {
+ $missing++;
+ } else {
+ $tried++;
+ }
+ }
}
- return <
$lt{'preamble'} $lt{$type}
+ $lt{'miss'}$lt{'proctor'}
$lt{'preamble'} $lt{$type} $lt{'okdone'} $lt{'cancel'}
+$lt{'preamble'} $lt{$type} $lt{'miss'} $lt{'okdone'} $lt{'cancel'}