Diff for /loncom/homework/grades.pm between versions 1.191 and 1.192

version 1.191, 2004/04/29 04:47:47 version 1.192, 2004/04/29 07:21:16
Line 3517  sub scantron_selectphase { Line 3517  sub scantron_selectphase {
           <tr bgcolor="#ffffe6">            <tr bgcolor="#ffffe6">
     <td> Options: </td>      <td> Options: </td>
             <td>              <td>
                 <input type="checkbox" name="scantron_options_redo" value="redo_skipped"/> Redo skipped records <br />                  <input type="checkbox" name="scantron_options_redo" value="redo_skipped"/> Do only skipped records <br />
                 <input type="checkbox" name="scantron_options_ignore" value="ignore_corrections"/> Ignore Original Corrections                  <input type="checkbox" name="scantron_options_ignore" value="ignore_corrections"/> Remove any exisiting corrections
     </td>      </td>
           </tr>            </tr>
           <tr bgcolor="#ffffe6">            <tr bgcolor="#ffffe6">
Line 3685  sub scantron_fixup_scanline { Line 3685  sub scantron_fixup_scanline {
        $args->{'username'}.':'.$args->{'domain'});         $args->{'username'}.':'.$args->{'domain'});
  }   }
     } elsif ($field eq 'CODE') {      } elsif ($field eq 'CODE') {
  if ($args->{'CODE'} eq 'use_unfound') {   if ($args->{'CODE_ignore_dup'}) {
     &scan_data($scan_data,"$whichline.useCODE",'1');      &scan_data($scan_data,"$whichline.CODE_ignore_dup",'1');
  } else {   }
    &scan_data($scan_data,"$whichline.useCODE",'1');
    if ($args->{'CODE'} ne 'use_unfound') {
     if (length($args->{'CODE'}) > $$scantron_config{'CODElength'}) {      if (length($args->{'CODE'}) > $$scantron_config{'CODElength'}) {
  return ($line,1,'New CODE value too large');   return ($line,1,'New CODE value too large');
     }      }
Line 3696  sub scantron_fixup_scanline { Line 3698  sub scantron_fixup_scanline {
     }      }
     substr($line,$$scantron_config{'CODEstart'}-1,      substr($line,$$scantron_config{'CODEstart'}-1,
    $$scantron_config{'CODElength'})=$args->{'CODE'};     $$scantron_config{'CODElength'})=$args->{'CODE'};
 #    if ($args->{'CODE'}=~/^\s*$/) {  
 # &scan_data($scan_data,"$whichline.CODE",$args->{'CODE'});  
 #    }  
  }   }
     } elsif ($field eq 'answer') {      } elsif ($field eq 'answer') {
  my $length=$scantron_config->{'Qlength'};   my $length=$scantron_config->{'Qlength'};
Line 3742  sub scantron_parse_scanline { Line 3741  sub scantron_parse_scanline {
     if (&scan_data($scan_data,"$whichline.useCODE")) {      if (&scan_data($scan_data,"$whichline.useCODE")) {
  $record{'scantron.useCODE'}=1;   $record{'scantron.useCODE'}=1;
     }      }
       if (&scan_data($scan_data,"$whichline.CODE_ignore_dup")) {
    $record{'scantron.CODE_ignore_dup'}=1;
       }
  } else {   } else {
     #FIXME interpret first N questions      #FIXME interpret first N questions
  }   }
Line 3841  sub scantron_process_corrections { Line 3843  sub scantron_process_corrections {
     } elsif ($ENV{'form.scantron_corrections'} =~ /^(duplicate|incorrect)CODE$/) {      } elsif ($ENV{'form.scantron_corrections'} =~ /^(duplicate|incorrect)CODE$/) {
  my $resolution=$ENV{'form.scantron_CODE_resolution'};   my $resolution=$ENV{'form.scantron_CODE_resolution'};
  my $newCODE;   my $newCODE;
    my %args;
  if      ($resolution eq 'use_unfound') {   if      ($resolution eq 'use_unfound') {
     $newCODE='use_unfound';      $newCODE='use_unfound';
  } elsif ($resolution eq 'use_found') {   } elsif ($resolution eq 'use_found') {
Line 3848  sub scantron_process_corrections { Line 3851  sub scantron_process_corrections {
  } elsif ($resolution eq 'use_typed') {   } elsif ($resolution eq 'use_typed') {
     $newCODE=$ENV{'form.scantron_CODE_newvalue'};      $newCODE=$ENV{'form.scantron_CODE_newvalue'};
  }   }
    if ($ENV{'form.scantron_corrections'} eq 'duplicateCODE') {
       $args{'CODE_ignore_dup'}=1;
    }
    $args{'CODE'}=$newCODE;
  ($line,$err,$errmsg)=   ($line,$err,$errmsg)=
     &scantron_fixup_scanline(\%scantron_config,$scan_data,$line,$which,      &scantron_fixup_scanline(\%scantron_config,$scan_data,$line,$which,
      'CODE',{'CODE'=>$newCODE});       'CODE',\%args);
     } elsif ($ENV{'form.scantron_corrections'} =~ /^(missing|double)bubble$/) {      } elsif ($ENV{'form.scantron_corrections'} =~ /^(missing|double)bubble$/) {
  foreach my $question (split(',',$ENV{'form.scantron_questions'})) {   foreach my $question (split(',',$ENV{'form.scantron_questions'})) {
     ($line,$err,$errmsg)=      ($line,$err,$errmsg)=
Line 3875  sub scantron_validate_file { Line 3882  sub scantron_validate_file {
     my ($symb,$url)=&get_symb_and_url($r);      my ($symb,$url)=&get_symb_and_url($r);
     if (!$symb) {return '';}      if (!$symb) {return '';}
     my $default_form_data=&defaultFormData($symb,$url);      my $default_form_data=&defaultFormData($symb,$url);
       if ($ENV{'form.scantron_options_ignore'} eq 'ignore_corrections') {
    my $result=&scantron_remove('corrected');
    &Apache::lonnet::logthis("result was $result");
    if ($result ne 'ok' && $result ne 'not_found' ) {
       $r->print("An error occured ($result) when trying to Remove the existing corrections.");
    }
    $ENV{'form.scantron_options_ignore'}='done';
       }
     if ($ENV{'form.scantron_corrections'}) {      if ($ENV{'form.scantron_corrections'}) {
  &scantron_process_corrections($r);   &scantron_process_corrections($r);
     }      }
Line 3891  sub scantron_validate_file { Line 3905  sub scantron_validate_file {
   <input type="hidden" name="scantron_maxbubble" value="$max_bubble'" />    <input type="hidden" name="scantron_maxbubble" value="$max_bubble'" />
   <input type="hidden" name="scantron_CODElist" value="$ENV{'form.scantron_CODElist'}" />    <input type="hidden" name="scantron_CODElist" value="$ENV{'form.scantron_CODElist'}" />
   <input type="hidden" name="scantron_CODEunique" value="$ENV{'form.scantron_CODEunique'}" />    <input type="hidden" name="scantron_CODEunique" value="$ENV{'form.scantron_CODEunique'}" />
   <input type="hidden" name="scantron_options_redo" value="$ENV{'form.scantron_optiond_redo'}" />    <input type="hidden" name="scantron_options_redo" value="$ENV{'form.scantron_options_redo'}" />
   <input type="hidden" name="scantron_options_ignore" value="$ENV{'form.scantron_optiond_ignore'}" />    <input type="hidden" name="scantron_options_ignore" value="$ENV{'form.scantron_options_ignore'}" />
   $default_form_data    $default_form_data
 SCANTRONFORM  SCANTRONFORM
     $r->print($result);      $r->print($result);
Line 3939  SCANTRONFORM Line 3953  SCANTRONFORM
     return '';      return '';
 }  }
   
   sub scantron_remove {
       my ($which)=@_;
       my $cname=$ENV{'course.'.$ENV{'request.course.id'}.'.num'};
       my $cdom=$ENV{'course.'.$ENV{'request.course.id'}.'.domain'};
       my $file='scantron_';
       if ($which eq 'corrected') {
    $file.='corrected_';
       } else {
    return 'refused';
       }
       $file.=$ENV{'form.scantron_selectfile'};
       &Apache::lonnet::logthis("removeing $file");
       my $result=&Apache::lonnet::removeuserfile($cname,$cdom,$file);
       my @keys=&Apache::lonnet::getkeys('nohist_scantrondata',$cdom,$cname);
       &Apache::lonnet::logthis('got keys '.join(':',@keys));
       &Apache::lonnet::logthis("cdom $cdom cname $cname");
       my @todelete;
       my $filename=$ENV{'form.scantron_selectfile'};
       &Apache::lonnet::logthis('filename '.$filename);
       foreach my $key (@keys) {
    if ($key=~/^\Q$filename\E_/) {
       push(@todelete,$key);
    }
       }
       &Apache::lonnet::logthis('todelete '.join(':',@todelete));
       if (@todelete) {
    &Apache::lonnet::del('nohist_scantrondata',\@todelete,$cdom,$cname);
       }
       return $result;
   }
   
 sub scantron_getfile {  sub scantron_getfile {
     #FIXME really would prefer a scantron directory but tokenwrapper      #FIXME really would prefer a scantron directory but tokenwrapper
     # doesn't allow access to subdirs of userfiles      # doesn't allow access to subdirs of userfiles
Line 4240  sub scantron_validate_CODE { Line 4285  sub scantron_validate_CODE {
      $line,'incorrectCODE',$CODE);       $line,'incorrectCODE',$CODE);
     return(1);      return(1);
  }   }
  if (exists($usedCODEs{$CODE}) && $ENV{'form.scantron_CODEunique'}) {   if (exists($usedCODEs{$CODE}) && $ENV{'form.scantron_CODEunique'}
       && !$$scan_record{'scantron.CODE_ignore_dup'}) {
     &scantron_get_correction($r,$i,$scan_record,      &scantron_get_correction($r,$i,$scan_record,
      \%scantron_config,       \%scantron_config,
      $line,'duplicateCODE',$CODE);       $line,'duplicateCODE',$CODE);

Removed from v.1.191  
changed lines
  Added in v.1.192


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