[LON-CAPA-cvs] cvs: loncom /interface lonmenu.pm
raeburn
raeburn at source.lon-capa.org
Wed Mar 16 09:54:07 EDT 2016
raeburn Wed Mar 16 13:54:07 2016 EDT
Modified files:
/loncom/interface lonmenu.pm
Log:
- Bug 6763. Include a warning in the modal dialog used to end a timed event
if problem parts within the timed event have no tries.
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.440 loncom/interface/lonmenu.pm:1.441
--- loncom/interface/lonmenu.pm:1.440 Tue Mar 15 14:25:26 2016
+++ loncom/interface/lonmenu.pm Wed Mar 16 13:54:06 2016
@@ -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 @@
#
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 @@
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 <<END;
+ }
+ }
+ if ($missing) {
+ $lt{'miss'} .= '<p class="LC_error">';
+ if ($type eq 'map') {
+ $lt{'miss'} .= &mt('Submissions are missing for [quant,_1,question part,question parts] in this folder.',$missing);
+ } else {
+ $lt{'miss'} .= &mt('Submissions are missing for [quant,_1,part] in this question.',$missing);
+ }
+ if ($missing > 1) {
+ $lt{'miss'} .= ' '.&mt('If you confirm you are done you will be unable to submit answers for them.').'</span>';
+ } else {
+ $lt{'miss'} .= ' '.&mt('If you confirm you are done you will be unable to submit an answer for it.').'</p>';
+ }
+ }
+ if ($proctor) {
+ if ($height !~ /^\d+$/) {
+ $height = 400;
+ if ($missing) {
+ $height += 60;
+ }
+ }
+ if ($width !~ /^\d+$/) {
+ $width = 400;
+ if ($missing) {
+ $width += 60;
+ }
+ }
+ return <<END;
<form method="post" name="LCdoneButton" action="">
<input type="hidden" name="LC_interval_done" value="" />
<input type="hidden" name="LC_interval_done_proctorpass" value="" />
@@ -1612,6 +1664,7 @@
<div id="LC_done-confirm" title="$lt{'title'}">
<p>$lt{'preamble'} $lt{$type}</p>
+ $lt{'miss'}
<p>$lt{'proctor'}</p>
<form>
<label>$lt{'key'}<input type="password" name="LC_interval_done_proctorkey" value="" /></label>
@@ -1667,14 +1720,23 @@
</script>
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 <<END;
+ }
+ if ($missing) {
+ $lt{'miss'} = '</p>'.$lt{'miss'}.'<p>';
+ }
+ return <<END;
<form method="post" name="LCdoneButton" action="">
<input type="hidden" name="LC_interval_done" value="" />
@@ -1682,7 +1744,7 @@
</form>
<div id="LC_done-confirm" title="$lt{'title'}">
- <p>$lt{'preamble'} $lt{$type} $lt{'okdone'} $lt{'cancel'}</p>
+ <p>$lt{'preamble'} $lt{$type} $lt{'miss'} $lt{'okdone'} $lt{'cancel'}</p>
</div>
<script type="text/javascript">
@@ -1717,9 +1779,6 @@
</script>
END
- }
- } else {
- return;
}
}
More information about the LON-CAPA-cvs
mailing list