--- loncom/homework/inputtags.pm 2006/11/01 23:24:52 1.210 +++ loncom/homework/inputtags.pm 2006/12/22 18:30:07 1.212 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # input definitons # -# $Id: inputtags.pm,v 1.210 2006/11/01 23:24:52 albertel Exp $ +# $Id: inputtags.pm,v 1.212 2006/12/22 18:30:07 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -372,12 +372,18 @@ sub end_textline { sub start_hiddenline { my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; my $result = ""; + my $input_id = &start_input($parstack,$safeeval); 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"},'<>&"'); + my $oldresponse = $Apache::lonhomework::history{"resource.$partid.$id.submission"}; + if (ref($oldresponse) eq 'ARRAY') { + $oldresponse = $oldresponse->[$#Apache::inputtags::inputlist]; + } + $oldresponse = &HTML::Entities::encode($oldresponse,'<>&"'); + if ($Apache::lonhomework::type ne 'exam') { $result= ''; @@ -400,6 +406,7 @@ sub end_hiddenline { my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; if ($target eq 'web') { $Apache::lonxml::evaluate++; } elsif ($target eq 'edit') { return ('','no'); } + &end_input(); return ""; } @@ -694,10 +701,8 @@ sub decideoutput { $button=1; } elsif ($award eq 'SIG_FAIL') { my ($used,$min,$max)=split(':',$awardmsg); - my $word; - if ($used < $min) { $word=&mt('more'); } - if ($used > $max) { $word=&mt('fewer'); } - $message = &mt("Submission not graded. Use [_2] digits.",$used,$word); + my $word = ($used < $min) ? 'more' : 'fewer'; + $message = &mt("Submission not graded. Use $word digits.",$used); $bgcolor=$possiblecolors{'not_charged_try'}; $button=1; } elsif ($award eq 'UNIT_INVALID_INSTRUCTOR') {