Diff for /loncom/interface/lonmenu.pm between versions 1.447 and 1.450

version 1.447, 2016/05/04 05:54:51 version 1.450, 2016/06/02 01:43:46
Line 1634  END Line 1634  END
 # LC_interval_done is true.  # LC_interval_done is true.
 #  #
 sub done_button_js {  sub done_button_js {
     my ($type,$width,$height,$proctor) = @_;      my ($type,$width,$height,$proctor,$donebuttontext) = @_;
     return unless (($type eq 'map') || ($type eq 'resource'));      return unless (($type eq 'map') || ($type eq 'resource'));
     my %lt = &Apache::lonlocal::texthash(      my %lt = &Apache::lonlocal::texthash(
                  title    => 'WARNING!',                   title    => 'WARNING!',
                  button   => 'Done',  
                  preamble => 'You are trying to end this timed event early.',                   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.',                   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).',                    resource => 'Confirming that you are done will cause the time to expire for this question, and prevent you from changing your answer(s).', 
Line 1651  sub done_button_js { Line 1650  sub done_button_js {
                  nokey    => 'A proctor key is required',                    nokey    => 'A proctor key is required', 
     );      );
     my $navmap = Apache::lonnavmaps::navmap->new();       my $navmap = Apache::lonnavmaps::navmap->new(); 
     my ($missing,$tried);      my ($missing,$tried) = (0,0);
     if (ref($navmap)) {      if (ref($navmap)) {
         $missing=0;  
         $tried=0;  
         my @resources=();          my @resources=();
         if ($type eq 'map') {          if ($type eq 'map') {
             my ($mapurl,$rid,$resurl)=&Apache::lonnet::decode_symb($env{'request.symb'});              my ($mapurl,$rid,$resurl)=&Apache::lonnet::decode_symb($env{'request.symb'});
Line 1668  sub done_button_js { Line 1665  sub done_button_js {
             }              }
         }          }
         foreach my $res (@resources) {          foreach my $res (@resources) {
             if ($res->singlepart()) {              if (ref($res->parts()) eq 'ARRAY') {
                 if (!$res->tries()) {  
                     $missing++;  
                 } else {  
                     $tried++;  
                 }  
             } else {  
                 foreach my $part (@{$res->parts()}) {                  foreach my $part (@{$res->parts()}) {
                     if (!$res->tries($part)) {                      if (!$res->tries($part)) {
                         $missing++;                          $missing++;
Line 1698  sub done_button_js { Line 1689  sub done_button_js {
             $lt{'miss'} .= ' '.&mt('If you confirm you are done you will be unable to submit an answer for it.').'</p>';              $lt{'miss'} .= ' '.&mt('If you confirm you are done you will be unable to submit an answer for it.').'</p>';
         }          }
     }      }
       $donebuttontext = &HTML::Entities::encode($donebuttontext,'<>&"');
     if ($proctor) {      if ($proctor) {
         if ($height !~ /^\d+$/) {          if ($height !~ /^\d+$/) {
             $height = 400;              $height = 400;
Line 1715  sub done_button_js { Line 1707  sub done_button_js {
 <form method="post" name="LCdoneButton" action="">  <form method="post" name="LCdoneButton" action="">
     <input type="hidden" name="LC_interval_done" value="" />      <input type="hidden" name="LC_interval_done" value="" />
     <input type="hidden" name="LC_interval_done_proctorpass" value="" />      <input type="hidden" name="LC_interval_done_proctorpass" value="" />
     <button id="LC_done-confirm-opener" type="button">$lt{'button'}</button>      <button id="LC_done-confirm-opener" type="button">$donebuttontext</button>
 </form>  </form>
   
 <div id="LC_done-confirm" title="$lt{'title'}">  <div id="LC_done-confirm" title="$lt{'title'}">
   <p>$lt{'preamble'} $lt{$type}</p>    <p>$lt{'preamble'} $lt{$type}</p>
   $lt{'miss'}    $lt{'miss'}
   <p>$lt{'proctor'}</p>    <p>$lt{'proctor'}</p>
   <form>    <form name="LCdoneButtonProctor" action="">
     <label>$lt{'key'}<input type="password" name="LC_interval_done_proctorkey" value="" /></label>      <label>$lt{'key'}<input type="password" name="LC_interval_done_proctorkey" value="" /></label>
     <input type="submit" tabindex="-1" style="position:absolute; top:-1000px" />      <input type="submit" tabindex="-1" style="position:absolute; top:-1000px" />
   </form>    </form>
Line 1796  END Line 1788  END
   
 <form method="post" name="LCdoneButton" action="">  <form method="post" name="LCdoneButton" action="">
     <input type="hidden" name="LC_interval_done" value="" />      <input type="hidden" name="LC_interval_done" value="" />
     <button id="LC_done-confirm-opener" type="button">$lt{'button'}</button>      <button id="LC_done-confirm-opener" type="button">$donebuttontext</button>
 </form>  </form>
   
 <div id="LC_done-confirm" title="$lt{'title'}">  <div id="LC_done-confirm" title="$lt{'title'}">
Line 2501  sub countdown_timer { Line 2493  sub countdown_timer {
         }          }
         my $duedate = &Apache::lonnet::EXT("resource.0.duedate");          my $duedate = &Apache::lonnet::EXT("resource.0.duedate");
         my @interval=&Apache::lonnet::EXT("resource.0.interval");          my @interval=&Apache::lonnet::EXT("resource.0.interval");
         my ($timelimit,$usesdone,$proctor,$secret);          my ($timelimit,$usesdone,$donebuttontext,$proctor,$secret);
         if (@interval > 1) {          if (@interval > 1) {
             ($timelimit,$usesdone,$proctor,$secret) = split(/_/,$interval[0]);               ($timelimit,my $donesuffix) = split(/_/,$interval[0],2);
               if ($donesuffix =~ /^done\:([^\:]+)\:(.*)$/) {
                   $usesdone = 'done';
                   $donebuttontext = $1;
                   (undef,$proctor,$secret) = split(/_/,$2);
               } elsif ($donesuffix =~ /^done(|_.+)$/) {
                   $donebuttontext = &mt('Done');
                   ($usesdone,$proctor,$secret) = split(/_/,$donesuffix);
               }
             my $first_access=&Apache::lonnet::get_first_access($interval[1]);              my $first_access=&Apache::lonnet::get_first_access($interval[1]);
             if ($first_access > 0) {              if ($first_access > 0) {
                 if ($first_access+$timelimit > time) {                  if ($first_access+$timelimit > time) {
Line 2521  sub countdown_timer { Line 2521  sub countdown_timer {
                 $collapse = '&#9658;&nbsp;';                  $collapse = '&#9658;&nbsp;';
                 if ((@interval > 1) && ($hastimeleft)) {                  if ((@interval > 1) && ($hastimeleft)) {
                     if ($usesdone eq 'done') {                      if ($usesdone eq 'done') {
                         $donebutton = &done_button_js($interval[1],'','',$proctor);                          $donebutton = &done_button_js($interval[1],'','',$proctor,$donebuttontext);
                     }                      }
                 }                  }
             } else {              } else {

Removed from v.1.447  
changed lines
  Added in v.1.450


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>