Diff for /loncom/homework/grades.pm between versions 1.344 and 1.349

version 1.344, 2006/03/28 18:07:24 version 1.349, 2006/04/10 06:34:07
Line 722  LISTJAVASCRIPT Line 722  LISTJAVASCRIPT
     $gradeTable.='<label><input type="radio" name="lastSub" value="lastonly" '.$checklastsub.' /> last submission only </label>'."\n".      $gradeTable.='<label><input type="radio" name="lastSub" value="lastonly" '.$checklastsub.' /> last submission only </label>'."\n".
  '<label><input type="radio" name="lastSub" value="last" /> last submission & parts info </label>'."\n".   '<label><input type="radio" name="lastSub" value="last" /> last submission & parts info </label>'."\n".
  '<label><input type="radio" name="lastSub" value="datesub" /> by dates and submissions </label>'."\n".   '<label><input type="radio" name="lastSub" value="datesub" /> by dates and submissions </label>'."\n".
  '<label><input type="radio" name="lastSub" value="all" /> all details</label>'."\n".   '<label><input type="radio" name="lastSub" value="all" /> all details</label><br />'."\n".
           '&nbsp;<b>Grading Increments:</b> <select name="increment">'.
           '<option value="1">Whole Points</option>'.
           '<option value=".5">Half Points</option>'.
           '<option value=".25">Quarter Points</option>'.
           '<option value=".1">Tenths of a Point</option>'.
           '</select>'.
   
  '<input type="hidden" name="section"     value="'.$getsec.'" />'."\n".   '<input type="hidden" name="section"     value="'.$getsec.'" />'."\n".
  '<input type="hidden" name="submitonly"  value="'.$submitonly.'" />'."\n".   '<input type="hidden" name="submitonly"  value="'.$submitonly.'" />'."\n".
  '<input type="hidden" name="handgrade"   value="'.$env{'form.handgrade'}.'" /><br />'."\n".   '<input type="hidden" name="handgrade"   value="'.$env{'form.handgrade'}.'" /><br />'."\n".
Line 1436  sub sub_page_kw_js { Line 1443  sub sub_page_kw_js {
 SUBJAVASCRIPT  SUBJAVASCRIPT
 }  }
   
   sub get_increment {
       my $increment = $env{'form.increment'};
       if ($increment != 1 && $increment != .5 && $increment != .25 &&
           $increment != .1) {
           $increment = 1;
       }
       return $increment;
   }
   
 #--- displays the grading box, used in essay type problem and grading by page/sequence  #--- displays the grading box, used in essay type problem and grading by page/sequence
 sub gradeBox {  sub gradeBox {
     my ($request,$symb,$uname,$udom,$counter,$partid,$record) = @_;      my ($request,$symb,$uname,$udom,$counter,$partid,$record) = @_;
Line 1458  sub gradeBox { Line 1474  sub gradeBox {
     $result.='<table border="0"><tr><td>'.      $result.='<table border="0"><tr><td>'.
  '<b>Part: </b>'.$display_part.' <b>Points: </b></td><td>'."\n";   '<b>Part: </b>'.$display_part.' <b>Points: </b></td><td>'."\n";
     my $ctr = 0;      my $ctr = 0;
       my $thisweight = 0;
       my $increment = &get_increment();
     $result.='<table border="0"><tr>'."\n";  # display radio buttons in a nice table 10 across      $result.='<table border="0"><tr>'."\n";  # display radio buttons in a nice table 10 across
     while ($ctr<=$wgt) {      while ($thisweight<=$wgt) {
  $result.= '<td><nobr><label><input type="radio" name="RADVAL'.$counter.'_'.$partid.'" '.   $result.= '<td><nobr><label><input type="radio" name="RADVAL'.$counter.'_'.$partid.'" '.
     'onclick="javascript:writeBox(this.form,\''.$counter.'_'.$partid.'\','.      'onclick="javascript:writeBox(this.form,\''.$counter.'_'.$partid.'\','.
     $ctr.')" value="'.$ctr.'" '.      $thisweight.')" value="'.$thisweight.'" '.
     ($score eq $ctr ? 'checked':'').' /> '.$ctr."</label></nobr></td>\n";      ($score eq $thisweight ? 'checked':'').' /> '.$thisweight."</label></nobr></td>\n";
  $result.=(($ctr+1)%10 == 0 ? '</tr><tr>' : '');   $result.=(($ctr+1)%10 == 0 ? '</tr><tr>' : '');
           $thisweight += $increment;
  $ctr++;   $ctr++;
     }      }
     $result.='</tr></table>';      $result.='</tr></table>';
Line 1517  sub handback_box { Line 1536  sub handback_box {
  next if (!@$files);   next if (!@$files);
  my $file_counter = 1;   my $file_counter = 1;
  foreach my $file (@$files) {   foreach my $file (@$files) {
     my ($file_disp) = ($file =~ m|.+/(.+)$|);      my ($file_path, $file_disp) = ($file =~ m|(.+/)(.+)$|);
       my ($name,$version,$ext) = &file_name_version_ext($file_disp);
       $file_disp = "$name.$ext";
       $file = $file_path.$file_disp;
     $result.=&mt('Return commented version of [_1] to student.',      $result.=&mt('Return commented version of [_1] to student.',
  '<span class="filename">'.$file_disp.'</span>');   '<span class="filename">'.$file_disp.'</span>');
     $result.='<input type="file"   name="'.$prefix.'returndoc'.$file_counter.'" />'."\n";      $result.='<input type="file"   name="'.$prefix.'returndoc'.$file_counter.'" />'."\n";
Line 1992  KEYWORDS Line 2014  KEYWORDS
     '<input type="button" value="Next" '.      '<input type="button" value="Next" '.
     'onClick="javascript:checksubmit(this.form,\'Next\');" TARGET=_self> &nbsp;';      'onClick="javascript:checksubmit(this.form,\'Next\');" TARGET=_self> &nbsp;';
  $endform.='(Next and Previous (student) do not save the scores.)'."\n" ;   $endform.='(Next and Previous (student) do not save the scores.)'."\n" ;
           $endform.="<input type='hidden' value='".&get_increment().
               "' name='increment' />";
  $endform.='</td><tr></table></form>';   $endform.='</td><tr></table></form>';
  $endform.=&show_grading_menu_form($symb);   $endform.=&show_grading_menu_form($symb);
  $request->print($endform);   $request->print($endform);
Line 2326  sub saveHandGrade { Line 2350  sub saveHandGrade {
     my $partial= $pts/$wgt;      my $partial= $pts/$wgt;
     if ($partial eq $record{'resource.'.$new_part.'.awarded'}) {      if ($partial eq $record{'resource.'.$new_part.'.awarded'}) {
  #do not update score for part if not changed.   #do not update score for part if not changed.
                   &handback_files($request,$symb,$stuname,$domain,$newflg,$new_part,\%newrecord);
  next;   next;
     } else {      } else {
         push @parts_graded, $new_part;          push @parts_graded, $new_part;
Line 3510  sub csvuploadassign { Line 3535  sub csvuploadassign {
     my ($request)= @_;      my ($request)= @_;
     my ($symb)=&get_symb($request);      my ($symb)=&get_symb($request);
     if (!$symb) {return '';}      if (!$symb) {return '';}
       my $error_msg = '';
     &Apache::loncommon::load_tmp_file($request);      &Apache::loncommon::load_tmp_file($request);
     my @gradedata = &Apache::loncommon::upfile_record_sep();      my @gradedata = &Apache::loncommon::upfile_record_sep();
     if ($env{'form.noFirstLine'}) { shift(@gradedata); }      if ($env{'form.noFirstLine'}) { shift(@gradedata); }
Line 3562  sub csvuploadassign { Line 3588  sub csvuploadassign {
  my $part=$1;   my $part=$1;
  my $wgt =&Apache::lonnet::EXT('resource.'.$part.'.weight',   my $wgt =&Apache::lonnet::EXT('resource.'.$part.'.weight',
       $symb,$domain,$username);        $symb,$domain,$username);
  $entries{$fields{$dest}}=~s/\s//g;                  if ($wgt) {
  my $pcr=$entries{$fields{$dest}} / $wgt;                      $entries{$fields{$dest}}=~s/\s//g;
  my $award='correct_by_override';                      my $pcr=$entries{$fields{$dest}} / $wgt;
  $grades{"resource.$part.awarded"}=$pcr;                      my $award='correct_by_override';
  $grades{"resource.$part.solved"}=$award;                      $grades{"resource.$part.awarded"}=$pcr;
  $points{$part}=1;                      $grades{"resource.$part.solved"}=$award;
                       $points{$part}=1;
                   } else {
                       $error_msg = "<br />" .
                           &mt("Some point values were assigned"
                               ." for problems with a weight "
                               ."of zero. These values were "
                               ."ignored.");
                   }
     } else {      } else {
  if ($dest=~/stores_(.*)_awarded/) { if ($points{$1}) {next;} }   if ($dest=~/stores_(.*)_awarded/) { if ($points{$1}) {next;} }
  if ($dest=~/stores_(.*)_solved/)  { if ($points{$1}) {next;} }   if ($dest=~/stores_(.*)_solved/)  { if ($points{$1}) {next;} }
Line 3607  sub csvuploadassign { Line 3641  sub csvuploadassign {
     }      }
     $request->print("<br />\n");      $request->print("<br />\n");
     $request->print(&show_grading_menu_form($symb));      $request->print(&show_grading_menu_form($symb));
     return '';      return $error_msg;
 }  }
 #------------- end of section for handling csv file upload ---------  #------------- end of section for handling csv file upload ---------
 #  #

Removed from v.1.344  
changed lines
  Added in v.1.349


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