Diff for /loncom/interface/lonmenu.pm between versions 1.440 and 1.441

version 1.440, 2016/03/15 14:25:26 version 1.441, 2016/03/16 13:54:06
Line 1579  END Line 1579  END
 #  #
 sub done_button_js {  sub done_button_js {
     my ($type,$width,$height,$proctor) = @_;      my ($type,$width,$height,$proctor) = @_;
       return unless (($type eq 'map') || ($type eq 'resource'));
     my %lt = &Apache::lonlocal::texthash(      my %lt = &Apache::lonlocal::texthash(
                  title    => 'WARNING!',                   title    => 'WARNING!',
                  button   => 'Done',                   button   => 'Done',
Line 1593  sub done_button_js { Line 1594  sub done_button_js {
                  key      => 'Key:',                   key      => 'Key:',
                  nokey    => 'A proctor key is required',                    nokey    => 'A proctor key is required', 
     );      );
     my $confirm;      my $navmap = Apache::lonnavmaps::navmap->new(); 
     if (($type eq 'map') || ($type eq 'resource')) {      my ($missing,$tried);
         if ($proctor) {      if (ref($navmap)) {
             $confirm = $lt{'preamble'}.' '.$lt{$type};          $missing=0;
             if ($height !~ /^\d+$/) {          $tried=0;
                 $height = 400;          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);
                   }
               }
           }
           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++;
                       }
                   }
               }
           }
       }
       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 ($width !~ /^\d+$/) {
               $width = 400;
               if ($missing) {
                   $width += 60;
             }              }
             return <<END;          }
           return <<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="" />
     <input type="hidden" name="LC_interval_done_proctorpass" value="" />      <input type="hidden" name="LC_interval_done_proctorpass" value="" />
Line 1612  sub done_button_js { Line 1664  sub done_button_js {
   
 <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'}
   <p>$lt{'proctor'}</p>    <p>$lt{'proctor'}</p>
   <form>    <form>
     <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>
Line 1667  sub done_button_js { Line 1720  sub done_button_js {
 </script>  </script>
   
 END  END
         } else {      } else {
             if ($height !~ /^\d+$/) {          if ($height !~ /^\d+$/) {
                 $height = 320;              $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="">  <form method="post" name="LCdoneButton" action="">
     <input type="hidden" name="LC_interval_done" value="" />      <input type="hidden" name="LC_interval_done" value="" />
Line 1682  END Line 1744  END
 </form>  </form>
   
 <div id="LC_done-confirm" title="$lt{'title'}">  <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>  </div>
   
 <script type="text/javascript">  <script type="text/javascript">
Line 1717  END Line 1779  END
 </script>  </script>
   
 END  END
         }  
     } else {  
         return;  
     }      }
 }  }
   

Removed from v.1.440  
changed lines
  Added in v.1.441


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