--- loncom/interface/lonmenu.pm 2016/02/26 21:44:39 1.439 +++ loncom/interface/lonmenu.pm 2016/03/15 14:25:26 1.440 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines to control the menu # -# $Id: lonmenu.pm,v 1.439 2016/02/26 21:44:39 raeburn Exp $ +# $Id: lonmenu.pm,v 1.440 2016/03/15 14:25:26 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1568,28 +1568,113 @@ END } # This creates a "done button" for timed events. The confirmation box is a jQuery -# dialog widget. Clicking OK will set (LC_interval_done = 'true') which is checked in -# lonhomework.pm. +# dialog widget. If the interval parameter requires a proctor key for the timed +# event to be marked done, there will also be a textbox where that can be entered. +# Clicking OK will set the value of LC_interval_done to 'true', and, if needed will +# set the value of LC_interval_done_proctorpass to the text entered in that box, +# and submit the corresponding form. +# +# The &zero_time() routine in lonhomework.pm is called when a page is rendered if +# LC_interval_done is true. +# sub done_button_js { - my ($type,$height) = @_; - if ($height !~ /^\d+$/) { - $height = 320; - } + my ($type,$width,$height,$proctor) = @_; my %lt = &Apache::lonlocal::texthash( title => 'WARNING!', button => 'Done', preamble => 'You are trying to end this timed event early.', map => 'Confirming that you are done will cause the time to expire and prevent you from changing any answers in the current folder.', resource => 'Confirming that you are done will cause the time to expire for this question, and prevent you from changing your answer(s).', - ok => 'Click "OK" if you are completely finished.', + okdone => 'Click "OK" if you are completely finished.', cancel => 'Click "Cancel" to continue working.', + proctor => 'Ask a proctor to enter the key, then click "OK" if you are completely finished.', + ok => 'OK', + exit => 'Cancel', + key => 'Key:', + nokey => 'A proctor key is required', ); my $confirm; if (($type eq 'map') || ($type eq 'resource')) { - $confirm = $lt{'preamble'}.' '.$lt{$type}.' '.$lt{'ok'}.' '.$lt{'cancel'}; - } - if ($confirm) { - return < + + + + + +
+

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

+

$lt{'proctor'}

+
+ + +
+

$lt{'cancel'}

+
+ + + +END + } else { + if ($height !~ /^\d+$/) { + $height = 320; + } + if ($width !~ /^\d+$/) { + $width = 320; + } + return < @@ -1597,7 +1682,7 @@ sub done_button_js {
-

$confirm

+

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

END + } } else { return; } @@ -2293,9 +2386,9 @@ sub countdown_timer { } my $duedate = &Apache::lonnet::EXT("resource.0.duedate"); my @interval=&Apache::lonnet::EXT("resource.0.interval"); - my ($timelimit,$usesdone); + my ($timelimit,$usesdone,$proctor,$secret); if (@interval > 1) { - ($timelimit,$usesdone) = split(/_/,$interval[0]); + ($timelimit,$usesdone,$proctor,$secret) = split(/_/,$interval[0]); my $first_access=&Apache::lonnet::get_first_access($interval[1]); if ($first_access > 0) { if ($first_access+$timelimit > time) { @@ -2313,7 +2406,7 @@ sub countdown_timer { $collapse = '► '; if ((@interval > 1) && ($hastimeleft)) { if ($usesdone eq 'done') { - $donebutton = &done_button_js($interval[1]); + $donebutton = &done_button_js($interval[1],'','',$proctor); } } } else {