Diff for /loncom/homework/inputtags.pm between versions 1.97 and 1.99

version 1.97, 2003/04/30 13:44:30 version 1.99, 2003/05/08 15:22:03
Line 33  use strict; Line 33  use strict;
 use Apache::loncommon;  use Apache::loncommon;
   
 BEGIN {  BEGIN {
   &Apache::lonxml::register('Apache::inputtags',('textfield','textline'));    &Apache::lonxml::register('Apache::inputtags',('hiddenline','textfield','textline'));
 }  }
   
   
Line 82  sub start_textfield { Line 82  sub start_textfield {
   my $resid=$Apache::inputtags::response[-1];    my $resid=$Apache::inputtags::response[-1];
   if ($target eq 'web') {    if ($target eq 'web') {
     $Apache::lonxml::evaluate--;      $Apache::lonxml::evaluate--;
     if ($Apache::inputtags::status[-1] eq 'CAN_ANSWER') {      if ($Apache::inputtags::status[-1] eq 'CAN_ANSWER'  &&
           $Apache::lonhomework::history{"resource.$id.solved"} =~/^correct/
    ) {
  my $partid=$Apache::inputtags::part;   my $partid=$Apache::inputtags::part;
  my $oldresponse = &HTML::Entities::encode($Apache::lonhomework::history{"resource.$partid.$resid.submission"});   my $oldresponse = &HTML::Entities::encode($Apache::lonhomework::history{"resource.$partid.$resid.submission"});
  my $cols = &Apache::lonxml::get_param('cols',$parstack,$safeeval);   my $cols = &Apache::lonxml::get_param('cols',$parstack,$safeeval);
Line 160  sub start_textline { Line 162  sub start_textline {
   my $result = "";    my $result = "";
   if ($target eq 'web') {    if ($target eq 'web') {
     $Apache::lonxml::evaluate--;      $Apache::lonxml::evaluate--;
     if ($Apache::inputtags::status[-1] eq 'CAN_ANSWER') {      my $partid=$Apache::inputtags::part;
       my $id=$Apache::inputtags::response[-1];
       if ($Apache::inputtags::status[-1] eq 'CAN_ANSWER' &&
           $Apache::lonhomework::history{"resource.$id.solved"} =~/^correct/
    ) {
       my $size = &Apache::lonxml::get_param('size',$parstack,$safeeval);        my $size = &Apache::lonxml::get_param('size',$parstack,$safeeval);
       my $maxlength;        my $maxlength;
       if ($size eq '') { $size=20; } else {        if ($size eq '') { $size=20; } else {
  if ($size < 20) { $maxlength=$size; }   if ($size < 20) { $maxlength=$size; }
       }        }
       my $partid=$Apache::inputtags::part;  
       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"});
       if ($Apache::lonhomework::type ne 'exam') {        if ($Apache::lonhomework::type ne 'exam') {
         $result= '<input type="text" name="HWVAL_'.$id.'" value="'.          $result= '<input type="text" name="HWVAL_'.$id.'" value="'.
Line 200  sub end_textline { Line 204  sub end_textline {
   return "";    return "";
 }  }
   
   sub start_hiddenline {
       my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
       my $result = "";
       if ($target eq 'web') {
    $Apache::lonxml::evaluate--;
    if ($Apache::inputtags::status[-1] eq 'CAN_ANSWER') {
       my $partid=$Apache::inputtags::part;
       my $id=$Apache::inputtags::response[-1];
       my $oldresponse = &HTML::Entities::encode($Apache::lonhomework::history{"resource.$partid.$id.submission"});
       if ($Apache::lonhomework::type ne 'exam') {
    $result= '<input type="hidden" name="HWVAL_'.$id.'" value="'.
       $oldresponse.'" />';
       }
    }
       } elsif ($target eq 'edit') {
    $result=&Apache::edit::tag_start($target,$token);
    $result.=&Apache::edit::end_table;
       }
       return $result;
   }
   
   sub end_hiddenline {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
     if    ($target eq 'web') { $Apache::lonxml::evaluate++; }
     elsif ($target eq 'edit') { return ('','no'); }
     return "";
   }
   
 sub finalizeawards {  sub finalizeawards {
   my $result='';    my $result='';
   my $award;    my $award;
Line 350  sub decideoutput { Line 382  sub decideoutput {
   } else {    } else {
       $message = "Unknown message: $award";        $message = "Unknown message: $award";
       $button=1;        $button=1;
   }     }
   if (lc($Apache::lonhomework::problemstatus) ne 'yes') {    if (lc($Apache::lonhomework::problemstatus) eq 'no') {
       $message = "Answer Submitted";        $message = "Answer Submitted";
       $button=1;        $button=1;
   }    }

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


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