Diff for /loncom/homework/inputtags.pm between versions 1.12 and 1.14

version 1.12, 2000/12/05 22:07:26 version 1.14, 2000/12/11 23:47:36
Line 11  sub BEGIN { Line 11  sub BEGIN {
   
 sub initialize_inputtags {  sub initialize_inputtags {
   @Apache::inputtags::input=();    @Apache::inputtags::input=();
     @Apache::inputtags::inputlist=();
   @Apache::inputtags::response=();    @Apache::inputtags::response=();
   @Apache::inputtags::responselist=();    @Apache::inputtags::responselist=();
   @Apache::inputtags::answergroup=();    @Apache::inputtags::answergroup=();
Line 18  sub initialize_inputtags { Line 19  sub initialize_inputtags {
   %Apache::inputtags::params=();    %Apache::inputtags::params=();
 }  }
   
   sub start_input {
     my ($parstack,$safeeval)=@_;
     my $args ='';
     if ( $#$parstack > -1 ) { $args=$$parstack[$#$parstack]; }
     my $id = &Apache::run::run("{$args;".'return $id}',$safeeval);
     push (@Apache::inputtags::input,$id);
     push (@Apache::inputtags::inputlist,$id);
     return $id;
   }
   
   sub end_input {
     pop @Apache::inputtags::input;
     return '';
   }
   
 sub start_textarea {  sub start_textarea {
   my ($target,$token,$parstack,$parser,$safeeval)=@_;    my ($target,$token,$parstack,$parser,$safeeval)=@_;
   my $result = "";    my $result = "";
     my $id = &start_input($parstack,$safeeval);
   if ($target eq 'web') {    if ($target eq 'web') {
     $result= '<textarea name="HWVAL'.$Apache::inputtags::curvalue.'" value="">';      $result= '<textarea name="HWVAL'.$id.'" value="">';
   }    }
   return $result;    return $result;
 }  }
Line 32  sub end_textarea { Line 49  sub end_textarea {
   if ($target eq 'web') {    if ($target eq 'web') {
     return "</textarea>";      return "</textarea>";
   }     } 
     &end_input;
   return '';    return '';
 }  }
   
Line 43  sub start_textline { Line 61  sub start_textline {
     if ( $#$parstack > -1 ) { $args=$$parstack[$#$parstack]; }      if ( $#$parstack > -1 ) { $args=$$parstack[$#$parstack]; }
     my $size = &Apache::run::run("{$args;".'return $size}',$safeeval);      my $size = &Apache::run::run("{$args;".'return $size}',$safeeval);
     if ($size eq '') { $size=20; }      if ($size eq '') { $size=20; }
     $result= '<input type="text" name="HWVAL'.$Apache::inputtags::curvalue.'" value="" size="'.$size.'">';      my $oldresponse = $Apache::lonhomework::history{"resource.submission.$Apache::inputtags::part.$Apache::inputtags::response['-1']"};
       $result= '<input type="text" name="HWVAL'.$Apache::inputtags::response['-1'].'" value="'.$oldresponse.'" size="'.$size.'">';
   }    }
   return $result;    return $result;
 }  }
Line 139  sub decideoutput { Line 158  sub decideoutput {
   if      ($award eq 'EXACT_ANS' || $award eq 'APPROX_ANS' ) {    if      ($award eq 'EXACT_ANS' || $award eq 'APPROX_ANS' ) {
     $message = "Correct computer gets %s";      $message = "Correct computer gets %s";
     $button=0;      $button=0;
     } elsif ($award eq 'NO_RESPONSE') {
       $message = '';
       $button=1;
     } elsif ($award eq 'MISSING_ANSWER') {
       $message = 'Some parts were not submitted';
       $button = 1;
   } elsif ($award eq 'WANTED_NUMERIC') {    } elsif ($award eq 'WANTED_NUMERIC') {
     $message = "This question expects a numeric answer";      $message = "This question expects a numeric answer";
     $button=1;      $button=1;
Line 228  sub gradestatus { Line 253  sub gradestatus {
   my $tries = $Apache::lonhomework::history{"resource.tries.$id"};    my $tries = $Apache::lonhomework::history{"resource.tries.$id"};
   my $maxtries = $Apache::lonhomework::history{"resource.maxtries.$id"};    my $maxtries = $Apache::lonhomework::history{"resource.maxtries.$id"};
   if ( $tries eq '' ) { $tries = '0'; }    if ( $tries eq '' ) { $tries = '0'; }
   if ( $maxtries eq '' ) { $maxtries = '99'; }     if ( $maxtries eq '' ) { $maxtries = '2'; } 
     my $trystr='';
     if ( $showbutton ) {
       $trystr = "<br></br>Tries $tries/$maxtries";
     }
   if ( $tries >= $maxtries ) { $showbutton = 0; }    if ( $tries >= $maxtries ) { $showbutton = 0; }
   my $trystr = "Tries $tries/$maxtries";  
   if ( $showbutton ) {     if ( $showbutton ) { 
     $button = '<input type="submit" name="submit" value="Submit All Answers"><br></br>';      $button = '<input type="submit" name="submit" value="Submit All Answers"><br></br>';
   }    }

Removed from v.1.12  
changed lines
  Added in v.1.14


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