--- loncom/homework/chemresponse.pm 2004/03/31 05:23:59 1.32 +++ loncom/homework/chemresponse.pm 2004/06/07 21:17:42 1.33 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # chemical equation style response # -# $Id: chemresponse.pm,v 1.32 2004/03/31 05:23:59 albertel Exp $ +# $Id: chemresponse.pm,v 1.33 2004/06/07 21:17:42 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -304,7 +304,15 @@ sub start_reactionresponse { my $partid = $Apache::inputtags::part; my $id = $Apache::inputtags::response['-1']; my $reaction=$Apache::lonhomework::history{"resource.$partid.$id.submission"}; - $result.=&edit_reaction_button($id,"HWVAL_$id",$reaction); + my $status=$Apache::inputtags::status['-1']; + if ($status eq 'CAN_ANSWER') { + $result.=&edit_reaction_button($id,"HWVAL_$id",$reaction); + } + if ( &Apache::response::show_answer() ) { + my $ans=&Apache::lonxml::get_param('answer',$parstack,$safeeval); + $ans=~s/(\\|\')/\\$1/g; + $Apache::inputtags::answertxt{$id}=&Apache::run::run("return &chemparse('$ans');",$safeeval); + } } elsif ($target eq "edit") { $result .=&Apache::edit::tag_start($target,$token); my $answer=&Apache::lonxml::get_param('answer',$parstack,