--- loncom/homework/inputtags.pm 2000/12/05 22:07:26 1.12 +++ loncom/homework/inputtags.pm 2000/12/11 23:47:36 1.14 @@ -11,6 +11,7 @@ sub BEGIN { sub initialize_inputtags { @Apache::inputtags::input=(); + @Apache::inputtags::inputlist=(); @Apache::inputtags::response=(); @Apache::inputtags::responselist=(); @Apache::inputtags::answergroup=(); @@ -18,11 +19,27 @@ sub initialize_inputtags { %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 { my ($target,$token,$parstack,$parser,$safeeval)=@_; my $result = ""; + my $id = &start_input($parstack,$safeeval); if ($target eq 'web') { - $result= '"; } + &end_input; return ''; } @@ -43,7 +61,8 @@ sub start_textline { if ( $#$parstack > -1 ) { $args=$$parstack[$#$parstack]; } my $size = &Apache::run::run("{$args;".'return $size}',$safeeval); if ($size eq '') { $size=20; } - $result= ''; + my $oldresponse = $Apache::lonhomework::history{"resource.submission.$Apache::inputtags::part.$Apache::inputtags::response['-1']"}; + $result= ''; } return $result; } @@ -139,6 +158,12 @@ sub decideoutput { if ($award eq 'EXACT_ANS' || $award eq 'APPROX_ANS' ) { $message = "Correct computer gets %s"; $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') { $message = "This question expects a numeric answer"; $button=1; @@ -228,9 +253,12 @@ sub gradestatus { my $tries = $Apache::lonhomework::history{"resource.tries.$id"}; my $maxtries = $Apache::lonhomework::history{"resource.maxtries.$id"}; if ( $tries eq '' ) { $tries = '0'; } - if ( $maxtries eq '' ) { $maxtries = '99'; } + if ( $maxtries eq '' ) { $maxtries = '2'; } + my $trystr=''; + if ( $showbutton ) { + $trystr = "

Tries $tries/$maxtries"; + } if ( $tries >= $maxtries ) { $showbutton = 0; } - my $trystr = "Tries $tries/$maxtries"; if ( $showbutton ) { $button = '

'; }