--- loncom/homework/chemresponse.pm 2004/03/12 18:41:43 1.31 +++ 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.31 2004/03/12 18:41:43 albertel Exp $ +# $Id: chemresponse.pm,v 1.33 2004/06/07 21:17:42 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -92,7 +92,7 @@ $molecule CHEMPAGE - $body=&HTML::Entities::encode($body); + $body=&HTML::Entities::encode($body,'<>&"'); $body=~s/\n/ /g; my $result=< @@ -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,