[LON-CAPA-cvs] cvs: loncom /homework chemresponse.pm

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 22 Apr 2005 14:10:47 -0000


albertel		Fri Apr 22 10:10:47 2005 EDT

  Modified files:              
    /loncom/homework	chemresponse.pm 
  Log:
  - BUG # 4071 
  
  
Index: loncom/homework/chemresponse.pm
diff -u loncom/homework/chemresponse.pm:1.50 loncom/homework/chemresponse.pm:1.51
--- loncom/homework/chemresponse.pm:1.50	Thu Apr  7 02:56:21 2005
+++ loncom/homework/chemresponse.pm	Fri Apr 22 10:10:47 2005
@@ -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.51 2005/04/22 14:10:47 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -364,8 +364,11 @@
 	}
 	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);