--- loncom/homework/inputtags.pm 2003/04/30 13:44:30 1.97 +++ loncom/homework/inputtags.pm 2003/05/08 15:22:03 1.99 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # input definitons # -# $Id: inputtags.pm,v 1.97 2003/04/30 13:44:30 sakharuk Exp $ +# $Id: inputtags.pm,v 1.99 2003/05/08 15:22:03 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -33,7 +33,7 @@ use strict; use Apache::loncommon; BEGIN { - &Apache::lonxml::register('Apache::inputtags',('textfield','textline')); + &Apache::lonxml::register('Apache::inputtags',('hiddenline','textfield','textline')); } @@ -82,7 +82,9 @@ sub start_textfield { my $resid=$Apache::inputtags::response[-1]; if ($target eq 'web') { $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 $oldresponse = &HTML::Entities::encode($Apache::lonhomework::history{"resource.$partid.$resid.submission"}); my $cols = &Apache::lonxml::get_param('cols',$parstack,$safeeval); @@ -160,14 +162,16 @@ sub start_textline { 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]; + 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 $maxlength; if ($size eq '') { $size=20; } else { 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"}); if ($Apache::lonhomework::type ne 'exam') { $result= ''; + } + } + } 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 { my $result=''; my $award; @@ -350,8 +382,8 @@ sub decideoutput { } else { $message = "Unknown message: $award"; $button=1; - } - if (lc($Apache::lonhomework::problemstatus) ne 'yes') { + } + if (lc($Apache::lonhomework::problemstatus) eq 'no') { $message = "Answer Submitted"; $button=1; }