Diff for /loncom/homework/grades.pm between versions 1.300 and 1.301

version 1.300, 2005/12/02 19:40:47 version 1.301, 2005/12/02 19:56:36
Line 704  LISTJAVASCRIPT Line 704  LISTJAVASCRIPT
     while ($loop < 2) {      while ($loop < 2) {
  $gradeTable.='<td><b>&nbsp;No.</b>&nbsp;</td><td><b>&nbsp;Select&nbsp;</b></td>'.   $gradeTable.='<td><b>&nbsp;No.</b>&nbsp;</td><td><b>&nbsp;Select&nbsp;</b></td>'.
     '<td>'.&nameUserString('header').'&nbsp;Section/Group</td>';      '<td>'.&nameUserString('header').'&nbsp;Section/Group</td>';
  if ($env{'form.showgrading'} eq 'yes' && $submitonly ne 'all') {   if ($env{'form.showgrading'} eq 'yes' 
       && $submitonly ne 'queued'
       && $submitonly ne 'all') {
     foreach (sort(@$partlist)) {      foreach (sort(@$partlist)) {
  my $display_part=&get_display_part((split(/_/))[0],$url,$symb);   my $display_part=&get_display_part((split(/_/))[0],$url,$symb);
  $gradeTable.='<td><b>&nbsp;Part: '.$display_part.   $gradeTable.='<td><b>&nbsp;Part: '.$display_part.
     ' Status&nbsp;</b></td>';      ' Status&nbsp;</b></td>';
     }      }
    } elsif ($submitonly eq 'queued') {
       $gradeTable.='<td><b>&nbsp;'.&mt('Queue Status').'&nbsp;</b></td>';
  }   }
  $loop++;   $loop++;
 # $gradeTable.='<td></td>' if ($loop%2 ==1);  # $gradeTable.='<td></td>' if ($loop%2 ==1);
Line 726  LISTJAVASCRIPT Line 730  LISTJAVASCRIPT
  }   }
  (keys(%$fullname))) {   (keys(%$fullname))) {
  my ($uname,$udom) = split(/:/,$student);   my ($uname,$udom) = split(/:/,$student);
   
  my %status = ();   my %status = ();
  if ($env{'form.showgrading'} eq 'yes' && $submitonly ne 'all') {  
    if ($submitonly eq 'queued') {
       my %queue_status = 
    &Apache::bridgetask::get_student_status($symb,$cdom,$cnum,
    $udom,$uname);
       next if (!defined($queue_status{'gradingqueue'}));
       $status{'gradingqueue'} = $queue_status{'gradingqueue'};
    }
   
    if ($env{'form.showgrading'} eq 'yes' 
       && $submitonly ne 'queued'
       && $submitonly ne 'all') {
     (%status) =&student_gradeStatus($url,$symb,$udom,$uname,$partlist);      (%status) =&student_gradeStatus($url,$symb,$udom,$uname,$partlist);
     my $submitted = 0;      my $submitted = 0;
     my $graded = 0;      my $graded = 0;
Line 778  LISTJAVASCRIPT Line 794  LISTJAVASCRIPT
     }      }
     if ($ctr%2 ==1) {      if ($ctr%2 ==1) {
  $gradeTable.='<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>';   $gradeTable.='<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>';
     if ($env{'form.showgrading'} eq 'yes' && $submitonly ne 'all') {      if ($env{'form.showgrading'} eq 'yes' 
    && $submitonly ne 'queued'
    && $submitonly ne 'all') {
  foreach (@$partlist) {   foreach (@$partlist) {
     $gradeTable.='<td>&nbsp;</td>';      $gradeTable.='<td>&nbsp;</td>';
  }   }
       } elsif ($submitonly eq 'queued') {
    $gradeTable.='<td>&nbsp;</td>';
     }      }
  $gradeTable.='</tr>';   $gradeTable.='</tr>';
     }      }
Line 798  LISTJAVASCRIPT Line 818  LISTJAVASCRIPT
     my $submissions='submissions';      my $submissions='submissions';
     if ($submitonly eq 'incorrect') { $submissions = 'incorrect submissions'; }      if ($submitonly eq 'incorrect') { $submissions = 'incorrect submissions'; }
     if ($submitonly eq 'graded'   ) { $submissions = 'ungraded submissions'; }      if ($submitonly eq 'graded'   ) { $submissions = 'ungraded submissions'; }
       if ($submitonly eq 'queued'   ) { $submissions = 'queued submissions'; }
     $gradeTable='<br />&nbsp;<font color="red">'.      $gradeTable='<br />&nbsp;<font color="red">'.
  'No '.$submissions.' found for this resource for any students. ('.$num_students.   'No '.$submissions.' found for this resource for any students. ('.$num_students.
  ' students checked for '.$submissions.')</font><br />';   ' students checked for '.$submissions.')</font><br />';
Line 1960  sub processHandGrade { Line 1981  sub processHandGrade {
     my $button = $env{'form.gradeOpt'};      my $button = $env{'form.gradeOpt'};
     my $ngrade = $env{'form.NCT'};      my $ngrade = $env{'form.NCT'};
     my $ntstu  = $env{'form.NTSTU'};      my $ntstu  = $env{'form.NTSTU'};
       my $cdom   = $env{'course.'.$env{'request.course.id'}.'.domain'};
       my $cnum   = $env{'course.'.$env{'request.course.id'}.'.num'};
   
     if ($button eq 'Save & Next') {      if ($button eq 'Save & Next') {
  my $ctr = 0;   my $ctr = 0;
  while ($ctr < $ngrade) {   while ($ctr < $ngrade) {
Line 2057  sub processHandGrade { Line 2081  sub processHandGrade {
  $env{'form.savemsgN'} = --$idx;   $env{'form.savemsgN'} = --$idx;
  $keyhash{$symb.'_savemsgN'} = $env{'form.savemsgN'};   $keyhash{$symb.'_savemsgN'} = $env{'form.savemsgN'};
  my $putresult = &Apache::lonnet::put   my $putresult = &Apache::lonnet::put
     ('nohist_handgrade',\%keyhash,      ('nohist_handgrade',\%keyhash,$cdom,$cnum);
      $env{'course.'.$env{'request.course.id'}.'.domain'},  
      $env{'course.'.$env{'request.course.id'}.'.num'});  
     }      }
     # Called by Save & Refresh from Highlight Attribute Window      # Called by Save & Refresh from Highlight Attribute Window
     my (undef,undef,$fullname) = &getclasslist($env{'form.section'},'1');      my (undef,undef,$fullname) = &getclasslist($env{'form.section'},'1');
Line 2125  sub processHandGrade { Line 2147  sub processHandGrade {
     foreach my $student (@parsedlist) {      foreach my $student (@parsedlist) {
  my $submitonly=$env{'form.submitonly'};   my $submitonly=$env{'form.submitonly'};
  my ($uname,$udom) = split(/:/,$student);   my ($uname,$udom) = split(/:/,$student);
   
    if ($submitonly eq 'queued') {
       my %queue_status = 
    &Apache::bridgetask::get_student_status($symb,$cdom,$cnum,
    $udom,$uname);
       next if (!defined($queue_status{'gradingqueue'}));
    }
   
  if ($submitonly =~ /^(yes|graded|incorrect)$/) {   if ($submitonly =~ /^(yes|graded|incorrect)$/) {
 #    my %record = &Apache::lonnet::restore($symb,$env{'request.course.id'},$udom,$uname);  #    my %record = &Apache::lonnet::restore($symb,$env{'request.course.id'},$udom,$uname);
     my %status=&student_gradeStatus($url,$symb,$udom,$uname,$partlist);      my %status=&student_gradeStatus($url,$symb,$udom,$uname,$partlist);
Line 2166  sub processHandGrade { Line 2196  sub processHandGrade {
  my $the_end = '<h3><font color="red">LON-CAPA User Message</font></h3><br />'."\n";   my $the_end = '<h3><font color="red">LON-CAPA User Message</font></h3><br />'."\n";
  $the_end.='<b>Message: </b> No more students for this section or class.<br /><br />'."\n";   $the_end.='<b>Message: </b> No more students for this section or class.<br /><br />'."\n";
  $the_end.='Click on the button below to return to the grading menu.<br /><br />'."\n";   $the_end.='Click on the button below to return to the grading menu.<br /><br />'."\n";
  $the_end.=&show_grading_menu_form ($symb,$url);   $the_end.=&show_grading_menu_form($symb,$url);
  $request->print($the_end);   $request->print($the_end);
     }      }
     return '';      return '';
Line 2185  sub saveHandGrade { Line 2215  sub saveHandGrade {
     my ($pts,$wgt) = ('','');      my ($pts,$wgt) = ('','');
     my %aggregate = ();      my %aggregate = ();
     my $aggregateflag = 0;      my $aggregateflag = 0;
     foreach my $new_part (split(/:/,$env{'form.partlist'.$newflg})) {  
       my @parts = split(/:/,$env{'form.partlist'.$newflg});
       foreach my $new_part (@parts) {
  #collaborator may vary for different parts   #collaborator may vary for different parts
  if ($submitter && $new_part ne $part) { next; }   if ($submitter && $new_part ne $part) { next; }
  my $dropMenu = $env{'form.GD_SEL'.$newflg.'_'.$new_part};   my $dropMenu = $env{'form.GD_SEL'.$newflg.'_'.$new_part};
Line 2260  sub saveHandGrade { Line 2292  sub saveHandGrade {
     push (@v_flag,$new_part);      push (@v_flag,$new_part);
  }   }
     }      }
       my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
       my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
   
     if (scalar(keys(%newrecord)) > 0) {      if (scalar(keys(%newrecord)) > 0) {
         if (scalar(@v_flag)) {          if (scalar(@v_flag)) {
             &version_portfiles(\%record, \@parts_graded, $env{'request.course.id'}, $symb, $domain, $stuname, \@v_flag);              &version_portfiles(\%record, \@parts_graded, $env{'request.course.id'}, $symb, $domain, $stuname, \@v_flag);
         }          }
  &Apache::lonnet::cstore(\%newrecord,$symb,   &Apache::lonnet::cstore(\%newrecord,$symb,
  $env{'request.course.id'},$domain,$stuname);   $env{'request.course.id'},$domain,$stuname);
   
    my @ungraded_parts;
    foreach my $part (@parts) {
       if ( !defined($record{'resource.'.$part.'.awarded'})
    && !defined($newrecord{'resource.'.$part.'.awarded'}) ) {
    push(@ungraded_parts, $part);
       }
    }
    if ( !@ungraded_parts ) {
       &Apache::bridgetask::remove_from_queue('gradingqueue',$symb,$cdom,
      $cnum,$domain,$stuname);
    }
     }      }
     if ($aggregateflag) {      if ($aggregateflag) {
         &Apache::lonnet::cinc('nohist_resourcetracker',\%aggregate,          &Apache::lonnet::cinc('nohist_resourcetracker',\%aggregate,
                   $env{'course.'.$env{'request.course.id'}.'.domain'},        $cdom,$cnum);
                   $env{'course.'.$env{'request.course.id'}.'.num'});  
     }      }
     return '',$pts,$wgt;      return ('',$pts,$wgt);
 }  }
   
 # ----------- Provides number of tries since last reset.  # ----------- Provides number of tries since last reset.
Line 2922  sub editgrades { Line 2968  sub editgrades {
     }      }
  }   }
  $line.='</tr>'."\n";   $line.='</tr>'."\n";
   
    my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
    my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
   
  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);
   
       if (&Apache::bridgetask::in_queue('gradingqueue',$symb,$cdom,
         $cnum,$udom,$uname)) {
    # need to figure out if should be in queue.
    my %record =  
       &Apache::lonnet::restore($symb,$env{'request.course.id'},
        $udom,$uname);
    my $all_graded = 1;
    my $none_graded = 1;
    foreach my $part (@parts) {
       if ( $record{'resource.'.$part.'.awarded'} eq '' ) {
    $all_graded = 0;
       } else {
    $none_graded = 0;
       }
    }
   
    if ($all_graded || $none_graded) {
       &Apache::bridgetask::remove_from_queue('gradingqueue',
      $symb,$cdom,$cnum,
      $udom,$uname);
    }
       }
   
     $result.='<tr bgcolor="#ffffde"><td align="right">&nbsp;'.$updateCtr.'&nbsp;</td>'.$line;      $result.='<tr bgcolor="#ffffde"><td align="right">&nbsp;'.$updateCtr.'&nbsp;</td>'.$line;
     $updateCtr++;      $updateCtr++;
  } else {   } else {
Line 2934  sub editgrades { Line 3008  sub editgrades {
  }   }
         if ($aggregateflag) {          if ($aggregateflag) {
             &Apache::lonnet::cinc('nohist_resourcetracker',\%aggregate,              &Apache::lonnet::cinc('nohist_resourcetracker',\%aggregate,
                       $env{'course.'.$env{'request.course.id'}.'.domain'},    $cdom,$cnum);
                       $env{'course.'.$env{'request.course.id'}.'.num'});  
         }          }
     }      }
     if ($noupdate) {      if ($noupdate) {
Line 5466  GRADINGMENUJS Line 5539  GRADINGMENUJS
  ($saveCmd eq 'submission' ? 'checked' : '').'> '.'<b>'.&mt('Current Resource').':</b> '.&mt('For one or more students').   ($saveCmd eq 'submission' ? 'checked' : '').'> '.'<b>'.&mt('Current Resource').':</b> '.&mt('For one or more students').
  '</label> <select name="submitonly">'.   '</label> <select name="submitonly">'.
  '<option value="yes" '.   '<option value="yes" '.
  ($saveSub eq 'yes' ? 'selected="on"' : '').'>with submissions</option>'.   ($saveSub eq 'yes' ? 'selected="on"' : '').'>'.&mt('with submissions').'</option>'.
    '<option value="queued" '.
    ($saveSub eq 'queued' ? 'selected="on"' : '').'>'.&mt('in grading queue').'</option>'.
  '<option value="graded" '.   '<option value="graded" '.
  ($saveSub eq 'graded' ? 'selected="on"' : '').'>with ungraded submissions</option>'.   ($saveSub eq 'graded' ? 'selected="on"' : '').'>'.&mt('with ungraded submissions').'</option>'.
  '<option value="incorrect" '.   '<option value="incorrect" '.
  ($saveSub eq 'incorrect' ? 'selected="on"' : '').'>with incorrect submissions</option>'.   ($saveSub eq 'incorrect' ? 'selected="on"' : '').'>'.&mt('with incorrect submissions').'</option>'.
  '<option value="all" '.   '<option value="all" '.
  ($saveSub eq 'all' ? 'selected="on"' : '').'>with any status</option></select></td></tr>'."\n";   ($saveSub eq 'all' ? 'selected="on"' : '').'>'.&mt('with any status').'</option></select></td></tr>'."\n";
   
     $result.='<tr bgcolor="#ffffe6"valign="top"><td>'.      $result.='<tr bgcolor="#ffffe6"valign="top"><td>'.
  '<label><input type="radio" name="radioChoice" value="viewgrades" '.   '<label><input type="radio" name="radioChoice" value="viewgrades" '.

Removed from v.1.300  
changed lines
  Added in v.1.301


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