Diff for /loncom/homework/inputtags.pm between versions 1.70 and 1.75

version 1.70, 2002/10/28 19:19:19 version 1.75, 2002/11/27 19:25:56
Line 47  sub initialize_inputtags { Line 47  sub initialize_inputtags {
   @Apache::inputtags::responselist=();    @Apache::inputtags::responselist=();
   # list of whether or not a specific response was previously used    # list of whether or not a specific response was previously used
   @Apache::inputtags::previous=();    @Apache::inputtags::previous=();
     # submission it was used in
     @Apache::inputtags::previous_version=();
   # id of current part, 0 means that no part is current (inside <problem> only    # id of current part, 0 means that no part is current (inside <problem> only
   $Apache::inputtags::part='';    $Apache::inputtags::part='';
   # list of problem date statuses, the first element is for <problem>    # list of problem date statuses, the first element is for <problem>
Line 146  sub start_textline { Line 148  sub start_textline {
     $Apache::lonxml::evaluate--;      $Apache::lonxml::evaluate--;
     if ($Apache::inputtags::status[-1] eq 'CAN_ANSWER') {      if ($Apache::inputtags::status[-1] eq 'CAN_ANSWER') {
       my $size = &Apache::lonxml::get_param('size',$parstack,$safeeval);        my $size = &Apache::lonxml::get_param('size',$parstack,$safeeval);
       if ($size eq '') { $size=20; }        my $maxlength;
         if ($size eq '') { $size=20; } else {
    if ($size < 20) { $maxlength=$size; }
         }
       my $partid=$Apache::inputtags::part;        my $partid=$Apache::inputtags::part;
       my $id=$Apache::inputtags::response[-1];        my $id=$Apache::inputtags::response[-1];
       my $oldresponse = &HTML::Entities::encode($Apache::lonhomework::history{"resource.$partid.$id.submission"});        my $oldresponse = &HTML::Entities::encode($Apache::lonhomework::history{"resource.$partid.$id.submission"});
       $result= '<input type="text" name="HWVAL'.$id.'" value="'.        if ($Apache::lonhomework::type ne 'exam') {
  $oldresponse.'" size="'.$size.'" />';          $result= '<input type="text" name="HWVAL'.$id.'" value="'.
       $oldresponse.'" size="'.$size.'" maxlength="'.$maxlength.'" />';
         }
     } else {      } else {
       #right or wrong don't show what was last typed in.        #right or wrong don't show what was last typed in.
       #$result='<i>'.$oldresponse.'</i>';        #$result='<i>'.$oldresponse.'</i>';
Line 164  sub start_textline { Line 171  sub start_textline {
   } elsif ($target eq 'modified') {    } elsif ($target eq 'modified') {
     my $constructtag=&Apache::edit::get_new_args($token,$parstack,$safeeval,'size');      my $constructtag=&Apache::edit::get_new_args($token,$parstack,$safeeval,'size');
     if ($constructtag) { $result = &Apache::edit::rebuild_tag($token); }      if ($constructtag) { $result = &Apache::edit::rebuild_tag($token); }
     } elsif ($target eq 'tex') {
         $result='\framebox[1cm][s]{\hfill}';
   }    }
   return $result;    return $result;
 }  }
Line 308  sub decideoutput { Line 317  sub decideoutput {
 sub setgradedata {  sub setgradedata {
   my ($award,$id,$previously_used) = @_;    my ($award,$id,$previously_used) = @_;
   # if the student already has it correct, don't modify the status    # if the student already has it correct, don't modify the status
   if ($Apache::inputtags::status['-1'] ne 'CAN_ANSWER') {    if ($Apache::inputtags::status['-1'] ne 'CAN_ANSWER' &&
         $Apache::inputtags::status['-1'] ne 'CANNOT_ANSWER') {
     $Apache::lonhomework::results{"resource.$id.afterduedate"}=$award;      $Apache::lonhomework::results{"resource.$id.afterduedate"}=$award;
     return '';      return '';
   } elsif ( $Apache::lonhomework::history{"resource.$id.solved"} !~    } elsif ( $Apache::lonhomework::history{"resource.$id.solved"} !~
Line 380  sub grade { Line 390  sub grade {
     my $finalaward = &finalizeawards(@awards);      my $finalaward = &finalizeawards(@awards);
     my $previously_used;      my $previously_used;
     if ( $#Apache::inputtags::previous eq $#awards ) {      if ( $#Apache::inputtags::previous eq $#awards ) {
       $previously_used = 'PREVIOUSLY_LAST';   my $match=0;
       foreach my $value (@Apache::inputtags::previous) {   my @matches;
  if ($value eq 'PREVIOUSLY_USED' ) {   foreach my $versionar (@Apache::inputtags::previous_version) {
   $previously_used = $value;      foreach my $version (@$versionar) {
   last;   $matches[$version]++;
       }
    }
    foreach my $elem (@matches) {if ($elem eq ($#awards+1)) {$match=1;}}
    if ($match) {
       $previously_used = 'PREVIOUSLY_LAST';
       foreach my $value (@Apache::inputtags::previous) {
    if ($value eq 'PREVIOUSLY_USED' ) {
       $previously_used = $value;
       last;
    }
       }
  }   }
       }  
     }      }
     &Apache::lonxml::debug("final award $finalaward, $previously_used");      &Apache::lonxml::debug("final award $finalaward, $previously_used");
     &setgradedata($finalaward,$id,$previously_used);      &setgradedata($finalaward,$id,$previously_used);

Removed from v.1.70  
changed lines
  Added in v.1.75


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