--- loncom/homework/chemresponse.pm 2005/04/07 06:56:21 1.50
+++ loncom/homework/chemresponse.pm 2005/05/25 21:45:07 1.53
@@ -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.53 2005/05/25 21:45:07 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -121,9 +121,10 @@ $molecule
CHEMPAGE
$body=&HTML::Entities::encode($body,'<>&"');
$body=~s/\n/ /g;
+ my $nothing=&Apache::lonhtmlcommon::javascript_nothing();
my $docopen=&Apache::lonhtmlcommon::javascript_docopen();
my $result=<
+
CHEMINPUT
return $result;
}
@@ -364,8 +365,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);