[LON-CAPA-cvs] cvs: loncom /homework chemresponse.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Mon, 07 Jun 2004 21:17:42 -0000
albertel Mon Jun 7 17:17:42 2004 EDT
Modified files:
/loncom/homework chemresponse.pm
Log:
- BUG#3054
Index: loncom/homework/chemresponse.pm
diff -u loncom/homework/chemresponse.pm:1.32 loncom/homework/chemresponse.pm:1.33
--- loncom/homework/chemresponse.pm:1.32 Wed Mar 31 00:23:59 2004
+++ loncom/homework/chemresponse.pm Mon Jun 7 17:17:42 2004
@@ -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 @@
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,