Diff for /loncom/homework/grades.pm between versions 1.109 and 1.110

version 1.109, 2003/07/02 15:30:21 version 1.110, 2003/07/11 12:54:07
Line 367  sub listStudents { Line 367  sub listStudents {
   
     $request->print(<<LISTJAVASCRIPT);      $request->print(<<LISTJAVASCRIPT);
 <script type="text/javascript" language="javascript">  <script type="text/javascript" language="javascript">
   function checkSelect(checkBox) {      function checkSelect(checkBox) {
     var ctr=0;   var ctr=0;
     var sense="";   var sense="";
     if (checkBox.length > 1) {   if (checkBox.length > 1) {
        for (var i=0; i<checkBox.length; i++) {      for (var i=0; i<checkBox.length; i++) {
   if (checkBox[i].checked) {   if (checkBox[i].checked) {
      ctr++;      ctr++;
   }   }
        }      }
        sense = "a student or group of students";      sense = "a student or group of students";
     } else {   } else {
        if (checkBox.checked) {      if (checkBox.checked) {
    ctr = 1;   ctr = 1;
        }      }
        sense = "the student";      sense = "the student";
     }   }
     if (ctr == 0) {   if (ctr == 0) {
        alert("Please select "+sense+" before clicking on the $viewgrade button.");      alert("Please select "+sense+" before clicking on the $viewgrade button.");
        return false;      return false;
    }
    document.gradesub.submit();
       }
   
       function reLoadList(formname) {
    if (formname.saveStatusOld.value == pullDownSelection(formname.status)) {return;}
    formname.command.value = 'submission';
    formname.submit();
       }
   
       function pullDownSelection(selectOne) {
    var selection="";
    if (selectOne.length > 1) {
       for (var i=0; i<selectOne.length; i++) {
    if (selectOne[i].selected) {
       return selectOne[i].value;
    }
       }
    } else {
       if (selectOne.selected) return selectOne.value;
    }
     }      }
     document.gradesub.submit();  
   }  
 </script>  </script>
 LISTJAVASCRIPT  LISTJAVASCRIPT
   
Line 405  LISTJAVASCRIPT Line 424  LISTJAVASCRIPT
     if ($ENV{'form.handgrade'} eq 'yes') {      if ($ENV{'form.handgrade'} eq 'yes') {
  $gradeTable.='<input type="radio" name="lastSub" value="hdgrade" '.$checkhdgrade.' /> handgrade only'."\n";   $gradeTable.='<input type="radio" name="lastSub" value="hdgrade" '.$checkhdgrade.' /> handgrade only'."\n";
     }      }
   
       my $saveStatus = $ENV{'form.status'} eq '' ? 'Active' : $ENV{'form.status'};
       $ENV{'form.status'} = $saveStatus;
   
     $gradeTable.='<input type="radio" name="lastSub" value="lastonly" '.$checklastsub.' /> last sub only'."\n".      $gradeTable.='<input type="radio" name="lastSub" value="lastonly" '.$checklastsub.' /> last sub only'."\n".
  '<input type="radio" name="lastSub" value="last" /> last sub & parts info'."\n".   '<input type="radio" name="lastSub" value="last" /> last sub & parts info'."\n".
  '<input type="radio" name="lastSub" value="all" /> all details'."\n".   '<input type="radio" name="lastSub" value="all" /> all details'."\n".
Line 417  LISTJAVASCRIPT Line 440  LISTJAVASCRIPT
  '<input type="hidden" name="probTitle"   value="'.$ENV{'form.probTitle'}.'" />'."\n".   '<input type="hidden" name="probTitle"   value="'.$ENV{'form.probTitle'}.'" />'."\n".
  '<input type="hidden" name="url"  value="'.$url.'" />'."\n".   '<input type="hidden" name="url"  value="'.$url.'" />'."\n".
  '<input type="hidden" name="symb" value="'.$symb.'" />'."\n".   '<input type="hidden" name="symb" value="'.$symb.'" />'."\n".
  'To '.lc($viewgrade).' a submission, click on the check box next to the student\'s name. Then '."\n".   '<input type="hidden" name="saveStatusOld" value="'.$saveStatus.'" />'."\n";
   
       $gradeTable.='<b>Student Status:</b> <select onchange="javascript:reLoadList(this.form);" name="status">'.
    '<option value="Active" '.($saveStatus eq 'Active' ? 'selected' : '').'>Active</option>'.
    '<option value="Expired" '.($saveStatus eq 'Expired' ? 'selected' : '').'>Expired</option>'.
    '<option value="Any" '.($saveStatus eq 'Any' ? 'selected' : '').'>Any</option>'.
    '</select><br />'."\n";
    
       $gradeTable.='To '.lc($viewgrade).' a submission, click on the check box next to the student\'s name. Then '."\n".
  'click on the '.$viewgrade.' button. To view the submissions for a group of students, click'."\n".   'click on the '.$viewgrade.' button. To view the submissions for a group of students, click'."\n".
  ' on the check boxes for the group of students.<br />'."\n".   ' on the check boxes for the group of students.<br />'."\n".
  '<input type="hidden" name="command" value="processGroup" />'."\n".   '<input type="hidden" name="command" value="processGroup" />'."\n";
  '<input type="button" '."\n".      $gradeTable.='<input type="button" '."\n".
  'onClick="javascript:checkSelect(this.form.stuinfo);" '."\n".   'onClick="javascript:checkSelect(this.form.stuinfo);" '."\n".
  'value="'.$viewgrade.'" />'."\n";   'value="'.$viewgrade.'" />'."\n";
    
     my (undef,undef,$fullname) = &getclasslist($getsec,$ENV{'form.showgrading'} eq 'yes' ? '1' : '0');      my (undef, undef, $fullname) = &getclasslist($getsec,'1');  
       
     $gradeTable.='<table border="0"><tr><td bgcolor="#777777">'.      $gradeTable.='<table border="0"><tr><td bgcolor="#777777">'.
  '<table border="0"><tr bgcolor="#e6ffff">'.   '<table border="0"><tr bgcolor="#e6ffff">';
  '<td><b>&nbsp;Select&nbsp;</b></td><td><b>&nbsp;Fullname&nbsp;</b></td>'.      my $loop = 0;
  '<td><b>&nbsp;Username&nbsp;</b></td><td><b>&nbsp;Domain&nbsp;</b></td>';      while ($loop < 2) {
     foreach (sort(@$partlist)) {   $gradeTable.='<td><b>&nbsp;Select&nbsp;</b></td><td><b>&nbsp;Fullname&nbsp;</b>'.
  $gradeTable.='<td><b>&nbsp;Part '.(split(/_/))[0].' Status&nbsp;</b></td>';      '<font color="#999999">(Username)</font>&nbsp;</td>';
    if ($ENV{'form.showgrading'} eq 'yes' && $submitonly ne 'all') {
       foreach (sort(@$partlist)) {
    $gradeTable.='<td><b>&nbsp;Part '.(split(/_/))[0].' Status&nbsp;</b></td>';
       }
    }
    $loop++;
     }      }
     $gradeTable.='</tr>'."\n";      $gradeTable.='</tr>'."\n";
   
     my $ctr = 0;      my $ctr = 0;
     foreach my $student (sort {lc($$fullname{$a}) cmp lc($$fullname{$b}) } keys %$fullname) {      foreach my $student (sort {lc($$fullname{$a}) cmp lc($$fullname{$b}) } keys %$fullname) {
  my ($uname,$udom) = split(/:/,$student);   my ($uname,$udom) = split(/:/,$student);
  my (%status) =&student_gradeStatus($url,$symb,$udom,$uname,$partlist);   my %status = ();
  my $statusflg = '';   if ($ENV{'form.showgrading'} eq 'yes' && $submitonly ne 'all') {
  foreach (keys(%status)) {      (%status) =&student_gradeStatus($url,$symb,$udom,$uname,$partlist);
     $statusflg = 1 if ($status{$_} ne 'nothing');      my $statusflg = '';
     my ($foo,$partid,$foo1) = split(/\./,$_);      foreach (keys(%status)) {
     if ($status{'resource.'.$partid.'.submitted_by'} ne '') {   $statusflg = 1 if ($status{$_} ne 'nothing');
  $statusflg = '';   my ($foo,$partid,$foo1) = split(/\./,$_);
  $gradeTable.='<input type="hidden" name="'.   if ($status{'resource.'.$partid.'.submitted_by'} ne '') {
     $student.':submitted_by" value="'.      $statusflg = '';
     $status{'resource.'.$partid.'.submitted_by'}.'" />';      $gradeTable.='<input type="hidden" name="'.
    $student.':submitted_by" value="'.
    $status{'resource.'.$partid.'.submitted_by'}.'" />';
    }
     }      }
       next if ($statusflg eq '' && $submitonly eq 'yes');
  }   }
  next if ($statusflg eq '' && $submitonly eq 'yes');  
   
  $ctr++;   $ctr++;
  if ( $perm{'vgr'} eq 'F' ) {   if ( $perm{'vgr'} eq 'F' ) {
     $gradeTable.='<tr bgcolor="#ffffe6">'.      $gradeTable.='<tr bgcolor="#ffffe6">' if ($ctr%2 ==1);
  '<td align="center"><input type=checkbox name="stuinfo" value="'.      $gradeTable.='<td align="center"><input type=checkbox name="stuinfo" value="'.
  $student.':'.$$fullname{$student}.'"></td>'."\n".   $student.':'.$$fullname{$student}.'&nbsp;"></td>'."\n".
  '<td>&nbsp;'.$$fullname{$student}.'&nbsp;</td>'."\n".   '<td>&nbsp;'.$$fullname{$student}.'&nbsp;'."\n".
  '<td>&nbsp;'.$uname.'&nbsp;</td>'."\n".   '<font color="#999999">('.$uname.')</font></td>'."\n";
  '<td align="middle">&nbsp;'.$udom.'&nbsp;</td>'."\n";  
           if ($ENV{'form.showgrading'} eq 'yes' && $submitonly ne 'all') {
     foreach (sort keys(%status)) {   foreach (sort keys(%status)) {
  next if (/^resource.*?submitted_by$/);      next if (/^resource.*?submitted_by$/);
  $gradeTable.='<td align="middle">&nbsp;'.$status{$_}.'&nbsp;</td>'."\n";      $gradeTable.='<td align="middle">&nbsp;'.$status{$_}.'&nbsp;</td>'."\n";
    }
     }      }
     $gradeTable.='</tr>'."\n";      $gradeTable.='</tr>'."\n" if ($ctr%2 ==0);
  }   }
     }      }
       if ($ctr%2 ==1) {
    $gradeTable.='<td>&nbsp;</td><td>&nbsp;</td>';
       if ($ENV{'form.showgrading'} eq 'yes' && $submitonly ne 'all') {
    foreach (@$partlist) {
       $gradeTable.='<td>&nbsp;</td>';
    }
       }
    $gradeTable.='</tr>';
       }
   
     $gradeTable.='</table></td></tr></table>'.      $gradeTable.='</table></td></tr></table>'.
  '<input type="button" '.   '<input type="button" '.
  'onClick="javascript:checkSelect(this.form.stuinfo);" '.   'onClick="javascript:checkSelect(this.form.stuinfo);" '.
Line 479  LISTJAVASCRIPT Line 529  LISTJAVASCRIPT
     $gradeTable='<br />&nbsp;<font color="red">There are no students currently enrolled.</font>';      $gradeTable='<br />&nbsp;<font color="red">There are no students currently enrolled.</font>';
  } else {   } else {
     $gradeTable='<br />&nbsp;<font color="red">'.      $gradeTable='<br />&nbsp;<font color="red">'.
  'No submissions found for this resource for any students. ('.$num_students.' checked for submissions</font><br />';   'No submissions found for this resource for any students. ('.$num_students.
    ' checked for submissions</font><br />';
  }   }
     } elsif ($ctr == 1) {      } elsif ($ctr == 1) {
  $gradeTable =~ s/type=checkbox/type=checkbox checked/;   $gradeTable =~ s/type=checkbox/type=checkbox checked/;

Removed from v.1.109  
changed lines
  Added in v.1.110


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