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

albertel lon-capa-cvs-allow@mail.lon-capa.org
Wed, 18 Apr 2007 00:48:07 -0000


albertel		Tue Apr 17 20:48:07 2007 EDT

  Modified files:              
    /loncom/homework	chemresponse.pm 
  Log:
  - 2822 organic
  
  
Index: loncom/homework/chemresponse.pm
diff -u loncom/homework/chemresponse.pm:1.72 loncom/homework/chemresponse.pm:1.73
--- loncom/homework/chemresponse.pm:1.72	Tue Apr 17 20:19:37 2007
+++ loncom/homework/chemresponse.pm	Tue Apr 17 20:48:06 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # chemical equation style response
 #
-# $Id: chemresponse.pm,v 1.72 2007/04/18 00:19:37 albertel Exp $
+# $Id: chemresponse.pm,v 1.73 2007/04/18 00:48:06 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -327,6 +327,10 @@
 	}
 	$result.=&Apache::response::answer_footer('organicresponse');
     }
+    if ($target eq 'web') {
+	&Apache::response::setup_prior_tries_hash(\&format_prior_answer_organic,
+						  ['molecule'])
+    }
 
     if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' || 
 	$target eq 'tex' || $target eq 'analyze') {
@@ -336,6 +340,14 @@
     return $result;
 }
 
+sub format_prior_answer_organic {
+    my ($mode,$answer,$other_data) = @_;
+    my $result=&mt('Smile representation: "[_1]"','<tt>'.$answer.'</tt>');
+    my $jme=$other_data->[0];
+    $result.=&jme_img($jme,$answer,400);
+    return $result;
+}
+
 sub start_organicstructure {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
     my $result;