Diff for /loncom/homework/grades.pm between versions 1.90 and 1.99

version 1.90, 2003/05/30 20:57:40 version 1.99, 2003/06/18 17:37:10
Line 466  LISTJAVASCRIPT Line 466  LISTJAVASCRIPT
  'onClick="javascript:checkSelect(this.form.stuinfo);" '.   'onClick="javascript:checkSelect(this.form.stuinfo);" '.
  'value="'.$viewgrade.'" /></form>'."\n";   'value="'.$viewgrade.'" /></form>'."\n";
     if ($ctr == 0) {      if ($ctr == 0) {
  $gradeTable='<br />&nbsp;<font color="red">'.   my $num_students=(scalar(keys(%$fullname)));
     'No submission found for this resource.</font><br />';   if ($num_students eq 0) {
       $gradeTable='<br />&nbsp;<font color="red">There are no students currently enrolled.</font>';
    } else {
       $gradeTable='<br />&nbsp;<font color="red">'.
    '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/;
     }      }
Line 1924  sub viewgrades { Line 1929  sub viewgrades {
     $result.='<input type="hidden" name="total" value="'.$ctr.'" />'."\n";      $result.='<input type="hidden" name="total" value="'.$ctr.'" />'."\n";
     $result.='<input type="button" value="Submit Changes" '.      $result.='<input type="button" value="Submit Changes" '.
  'onClick="javascript:submit();" TARGET=_self /></form>'."\n";   'onClick="javascript:submit();" TARGET=_self /></form>'."\n";
       if (scalar(%$fullname) eq 0) {
    my $colspan=3+scalar(@parts);
    $result='<font color="red">There are no students in section "'.$ENV{'form.section'}.'" with enrollment status "'.$ENV{'form.status'}.'" to modify or grade.</font>';
       }
     $result.=&show_grading_menu_form($symb,$url);      $result.=&show_grading_menu_form($symb,$url);
     return $result;      return $result;
 }  }
Line 2035  sub editgrades { Line 2044  sub editgrades {
     $result .= '</tr><tr bgcolor="#deffff">';      $result .= '</tr><tr bgcolor="#deffff">';
     $result .= $header;      $result .= $header;
     $result .= '</tr>'."\n";      $result .= '</tr>'."\n";
       my $noupdate;
     for ($i=0; $i<$ENV{'form.total'}; $i++) {      for ($i=0; $i<$ENV{'form.total'}; $i++) {
    my $line;
  my $user = $ENV{'form.ctr'.$i};   my $user = $ENV{'form.ctr'.$i};
  my ($uname,$udom)=split(/:/,$user);   my $usercolon = $user;
    $usercolon =~s/_/:/;
    my ($uname,$udom)=split(/_/,$user);
  my %newrecord;   my %newrecord;
  my $updateflag = 0;   my $updateflag = 0;
   
  $result .= '<tr bgcolor="#ffffde"><td>'.$uname.'&nbsp;</td><td>'.   $line .= '<tr bgcolor="#ffffde"><td>'.$uname.'&nbsp;</td><td>'.
     $udom.'&nbsp;</td><td>'.      $udom.'&nbsp;</td><td>'.
  $$fullname{$user}.'&nbsp;</td>';   $$fullname{$usercolon}.'&nbsp;</td>';
  foreach (@partid) {   foreach (@partid) {
     my $old_aw    = $ENV{'form.GD_'.$user.'_'.$_.'_awarded_s'};      my $old_aw    = $ENV{'form.GD_'.$user.'_'.$_.'_awarded_s'};
     my $old_part_pcr = $old_aw/($weight{$_} ne '0' ? $weight{$_}:1);      my $old_part_pcr = $old_aw/($weight{$_} ne '0' ? $weight{$_}:1);
Line 2064  sub editgrades { Line 2076  sub editgrades {
     }      }
     $score = 'excused' if (($ENV{'form.GD_'.$user.'_'.$_.'_solved'} eq 'excused') &&      $score = 'excused' if (($ENV{'form.GD_'.$user.'_'.$_.'_solved'} eq 'excused') &&
    ($score ne 'excused'));     ($score ne 'excused'));
     $result .= '<td align="center">'.$old_aw.'&nbsp;</td>'.      $line .= '<td align="center">'.$old_aw.'&nbsp;</td>'.
  '<td align="center">'.$awarded.   '<td align="center">'.$awarded.
  ($score eq 'excused' ? $score : '').'&nbsp;</td>';   ($score eq 'excused' ? $score : '').'&nbsp;</td>';
   
Line 2087  sub editgrades { Line 2099  sub editgrades {
     $newrecord{'resource.'.$part.'regrader'}="$ENV{'user.name'}:$ENV{'user.domain'}";      $newrecord{'resource.'.$part.'regrader'}="$ENV{'user.name'}:$ENV{'user.domain'}";
     $updateflag=1;      $updateflag=1;
  }   }
  $result .= '<td align="center">'.$old_aw.'&nbsp;</td>'.   $line .= '<td align="center">'.$old_aw.'&nbsp;</td>'.
     '<td align="center">'.$awarded.'&nbsp;</td>';      '<td align="center">'.$awarded.'&nbsp;</td>';
     }      }
  }   }
  $result .= '</tr>'."\n";   $line.='</tr>'."\n";
  if ($updateflag) {   if ($updateflag) {
     $count++;      $count++;
     &Apache::lonnet::cstore(\%newrecord,$symb,$ENV{'request.course.id'},      &Apache::lonnet::cstore(\%newrecord,$symb,$ENV{'request.course.id'},
     $udom,$uname);      $udom,$uname);
       $result.=$line;
    } else {
       $noupdate.=$line;
  }   }
     }      }
       if ($noupdate) {
    $result .= '<tr bgcolor="#ffffff"><td align="center" colspan="7">No Changes Occured For the Students Below</td></tr>'.$noupdate;
       }
     $result .= '</table></td></tr></table>'."\n".      $result .= '</table></td></tr></table>'."\n".
  &show_grading_menu_form ($symb,$url);   &show_grading_menu_form ($symb,$url);
     my $msg = '<b>Number of records updated = '.$rec_update.      my $msg = '<b>Number of records updated = '.$rec_update.
Line 2377  sub csvuploadassign { Line 2395  sub csvuploadassign {
     }      }
     $request->print('<h3>Assigning Grades</h3>');      $request->print('<h3>Assigning Grades</h3>');
     my $courseid=$ENV{'request.course.id'};      my $courseid=$ENV{'request.course.id'};
     my ($classlist) = &getclasslist('all','1');      my ($classlist) = &getclasslist('all',0);
     my @skipped;      my @skipped;
     my $countdone=0;      my $countdone=0;
     foreach my $grade (@gradedata) {      foreach my $grade (@gradedata) {
Line 2409  sub csvuploadassign { Line 2427  sub csvuploadassign {
  $request->print('<br /><font size="+1"><b>Skipped Students</b></font><br />');   $request->print('<br /><font size="+1"><b>Skipped Students</b></font><br />');
  foreach my $student (@skipped) { $request->print("<br />$student"); }   foreach my $student (@skipped) { $request->print("<br />$student"); }
     }      }
     $request->print(&view_edit_entire_class_form($symb,$url));  
     $request->print(&show_grading_menu_form($symb,$url));      $request->print(&show_grading_menu_form($symb,$url));
     return '';      return '';
 }  }
Line 2581  sub getSymbMap { Line 2598  sub getSymbMap {
     $mapiterator->next(); # skip the first BEGIN_MAP      $mapiterator->next(); # skip the first BEGIN_MAP
     my $mapcurRes = $mapiterator->next(); # for "current resource"      my $mapcurRes = $mapiterator->next(); # for "current resource"
     my $ctr=0;      my $ctr=0;
     while ($mapdepth > 0 && $ctr < 100) {      while ($mapdepth > 0) {
  if($mapcurRes == $mapiterator->BEGIN_MAP) { $mapdepth++; }   if($mapcurRes == $mapiterator->BEGIN_MAP) { $mapdepth++; }
  if($mapcurRes == $mapiterator->END_MAP) { $mapdepth++; }   if($mapcurRes == $mapiterator->END_MAP) { $mapdepth++; }
   
  if (ref($mapcurRes) && $mapcurRes->is_problem() && !$mapcurRes->randomout) {   if (ref($mapcurRes) && $mapcurRes->is_problem() && !$mapcurRes->randomout) {
     $countProblems++;      $countProblems++;
  }   }
  $ctr++;   $mapcurRes = $mapiterator->next();
     }      }
     if ($countProblems > 0) {      if ($countProblems > 0) {
  my $title = $curRes->compTitle();   my $title = $curRes->compTitle();
Line 2659  sub displayPage { Line 2676  sub displayPage {
         if($curRes == $iterator->END_MAP) { $depth++; }          if($curRes == $iterator->END_MAP) { $depth++; }
   
         if (ref($curRes) && $curRes->is_problem() && !$curRes->randomout) {          if (ref($curRes) && $curRes->is_problem() && !$curRes->randomout) {
     my $parts = ['0',@{$curRes->parts()}];      my $parts = $curRes->parts();
     &APache::lonnet::logthis("parts ".join(':',@$parts));  
             my $title = $curRes->compTitle();              my $title = $curRes->compTitle();
     my $symbx = $curRes->symb();      my $symbx = $curRes->symb();
     $studentTable.='<tr bgcolor="#ffffe6"><td align="center" valign="top" >'.$question.      $studentTable.='<tr bgcolor="#ffffe6"><td align="center" valign="top" >'.$question.
Line 2743  sub displayPage { Line 2759  sub displayPage {
  $ctr++;   $ctr++;
     }      }
   
       $navmap->untieHashes();
   
     $studentTable.='</td></tr></table></td></tr></table>'."\n".      $studentTable.='</td></tr></table></td></tr></table>'."\n".
  '&nbsp;&nbsp;<input type="button" value="Save" '.   '&nbsp;&nbsp;<input type="button" value="Save" '.
  'onClick="javascript:checkSubmitPage(this.form,'.$question.');" TARGET=_self />'.   'onClick="javascript:checkSubmitPage(this.form,'.$question.');" TARGET=_self />'.
Line 2792  sub updateGradeByPage { Line 2810  sub updateGradeByPage {
         if($curRes == $iterator->END_MAP) { $depth++; }          if($curRes == $iterator->END_MAP) { $depth++; }
   
         if (ref($curRes) && $curRes->is_problem() && !$curRes->randomout) {          if (ref($curRes) && $curRes->is_problem() && !$curRes->randomout) {
     my $parts = ['0',@{$curRes->parts()}];      my $parts = $curRes->parts();
     &APache::lonnet::logthis("parts ".join(':',@$parts));  
             my $title = $curRes->compTitle();              my $title = $curRes->compTitle();
     my $symbx = $curRes->symb();      my $symbx = $curRes->symb();
     $studentTable.='<tr bgcolor="#ffffe6"><td align="center" valign="top" >'.$question.      $studentTable.='<tr bgcolor="#ffffe6"><td align="center" valign="top" >'.$question.
Line 2853  sub updateGradeByPage { Line 2870  sub updateGradeByPage {
  $ctr++;   $ctr++;
     }      }
   
       $navmap->untieHashes();
   
     $studentTable.='</td></tr></table></td></tr></table>';      $studentTable.='</td></tr></table></td></tr></table>';
     $studentTable.=&show_grading_menu_form($ENV{'form.symb'},$ENV{'form.url'});      $studentTable.=&show_grading_menu_form($ENV{'form.symb'},$ENV{'form.url'});
     my $grademsg=($changeflag == 0 ? 'No score was changed or updated.' :      my $grademsg=($changeflag == 0 ? 'No score was changed or updated.' :
Line 3409  sub handler { Line 3428  sub handler {
  if ($tsymb) {   if ($tsymb) {
     my ($map,$id,$url)=split(/\_\_\_/,$tsymb);      my ($map,$id,$url)=split(/\_\_\_/,$tsymb);
     if (&Apache::lonnet::allowed('mgr',$tcrsid)) {      if (&Apache::lonnet::allowed('mgr',$tcrsid)) {
  $request->print(   $request->print(&Apache::lonnet::ssi_body('/res/'.$url,
  &Apache::lonnet::ssi('/res/'.$url,    ('grade_username' => $tuname,
      ('grade_username' => $tuname,     'grade_domain' => $tudom,
       'grade_domain' => $tudom,     'grade_courseid' => $tcrsid,
       'grade_courseid' => $tcrsid,     'grade_symb' => $tsymb)));
       'grade_symb' => $tsymb)));  
     } else {      } else {
  $request->print('<h3>Not authorized: '.$token.'</h3>');   $request->print('<h3>Not authorized: '.$token.'</h3>');
     }                 }
  } else {   } else {
     $request->print('<h3>Not a valid DocID: '.$token.'</h3>');      $request->print('<h3>Not a valid DocID: '.$token.'</h3>');
  }   }

Removed from v.1.90  
changed lines
  Added in v.1.99


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