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

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 05 May 2003 21:14:11 -0000


albertel		Mon May  5 17:14:11 2003 EDT

  Modified files:              
    /loncom/homework	chemresponse.pm 
  Log:
  - had some typos, and modified it to genrate arrows on moz
  
  
Index: loncom/homework/chemresponse.pm
diff -u loncom/homework/chemresponse.pm:1.4 loncom/homework/chemresponse.pm:1.5
--- loncom/homework/chemresponse.pm:1.4	Mon May  5 16:43:46 2003
+++ loncom/homework/chemresponse.pm	Mon May  5 17:14:10 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # chemical equation style response
 #
-# $Id: chemresponse.pm,v 1.4 2003/05/05 20:43:46 albertel Exp $
+# $Id: chemresponse.pm,v 1.5 2003/05/05 21:14:10 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -215,8 +215,14 @@
 }
 
 sub reaction_javascript {
+    my $rightarrow;
+    if ($ENV{'browser.unicode'}) {
+	$rightarrow=" → "
+    } else {
+	$rightarrow=" <font face=symbol>&reg;</font> ";
+    }
     my $result=<<REACTIONJAVASCRIPT;
-    <SCRIPT language="JavaScript">
+    <script language="JavaScript">
 
 var level;
 var reactants;
@@ -312,7 +318,7 @@
     reaction += html_component(reactants[i]);
 
   if (products.length > 0) {
-    reaction += " <font face=symbol>&reg;</font> ";
+    reaction += " $rightarrow ";
     for (i = 0; i < products.length-1; i++) {
       reaction += html_component(products[i]);
       reaction += " + ";
@@ -394,7 +400,7 @@
     parent.opener.document.CAPA.submit();
   }
 }
-</SCRIPT>
+</script>
 REACTIONJAVASCRIPT
     return $result;
 }
@@ -406,7 +412,7 @@
     if ($target eq 'web') {
 	$result.=&reaction_javascript();
 #	$result.='<iframe name="REACTION_'.$id.'" width="200" height="100" src="/adm/jme/reaction_viewer.html"></iframe>';
-	$result.='<input type="button" value="Check" onClick = "javascript:newWindow=open(\'\',\'new_W\',\'width=500,height=200,scrollbars=1\');newWindow.document.open(\'text/html\',\'replace\');newWindow.document.writeln(\'<center><br />\'+to_html(document.lonhomework.HWVAL_'.$id.'.value)+\'</center><input type="button" value="  Close  " onClick = "parent.window.close()" />\');newWindow.document.close()" />'
+	$result.='<input type="button" value="Check" onClick = "javascript:newWindow=open(\'\',\'new_W\',\'width=500,height=200,scrollbars=1\');newWindow.document.open(\'text/html\',\'replace\');newWindow.document.writeln(\'<center><br />\'+to_html(document.lonhomework.HWVAL_'.$id.'.value)+\'</center><input type=&quot;button&quot; value=&quot;  Close  &quot; onClick = &quot;parent.window.close()&quot; />\');newWindow.document.close()" />'
     } elsif ($target eq "edit") {
     }
     return $result;