--- 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 < 1) { + $lt{'miss'} .= ' '.&mt('If you confirm you are done you will be unable to submit answers for them.').''; + } else { + $lt{'miss'} .= ' '.&mt('If you confirm you are done you will be unable to submit an answer for it.').'

'; + } + } + if ($proctor) { + if ($height !~ /^\d+$/) { + $height = 400; + if ($missing) { + $height += 60; + } + } + if ($width !~ /^\d+$/) { + $width = 400; + if ($missing) { + $width += 60; + } + } + return < @@ -1612,6 +1664,7 @@ sub done_button_js {

$lt{'preamble'} $lt{$type}

+ $lt{'miss'}

$lt{'proctor'}

@@ -1667,14 +1720,23 @@ sub done_button_js { END - } else { - if ($height !~ /^\d+$/) { - $height = 320; + } else { + if ($height !~ /^\d+$/) { + $height = 320; + if ($missing) { + $height += 60; } - if ($width !~ /^\d+$/) { - $width = 320; + } + if ($width !~ /^\d+$/) { + $width = 320; + if ($missing) { + $width += 60; } - return <'; + } + return < @@ -1682,7 +1744,7 @@ END
-

$lt{'preamble'} $lt{$type} $lt{'okdone'} $lt{'cancel'}

+

$lt{'preamble'} $lt{$type} $lt{'miss'} $lt{'okdone'} $lt{'cancel'}

END - } - } else { - return; } }