--- loncom/homework/chemresponse.pm 2005/04/07 06:56:21 1.50
+++ loncom/homework/chemresponse.pm 2005/05/25 14:33:00 1.52
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# chemical equation style response
#
-# $Id: chemresponse.pm,v 1.50 2005/04/07 06:56:21 albertel Exp $
+# $Id: chemresponse.pm,v 1.52 2005/05/25 14:33:00 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -123,7 +123,7 @@ CHEMPAGE
$body=~s/\n/ /g;
my $docopen=&Apache::lonhtmlcommon::javascript_docopen();
my $result=<
+
CHEMINPUT
return $result;
}
@@ -364,8 +364,11 @@ sub start_reactionresponse {
}
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);
+ if (!$Apache::lonxml::default_homework_loaded) {
+ &Apache::lonxml::default_homework_load($safeeval);
+ }
+ @Apache::scripttag::parser_env = @_;
+ $Apache::inputtags::answertxt{$id}=&Apache::run::run("return &chemparse(q\0$ans\0);",$safeeval);
}
} elsif ($target eq "edit") {
$result .=&Apache::edit::tag_start($target,$token);