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

www lon-capa-cvs@mail.lon-capa.org
Wed, 29 Sep 2004 15:17:56 -0000


www		Wed Sep 29 11:17:56 2004 EDT

  Modified files:              
    /loncom/homework	chemresponse.pm 
  Log:
  Bug #3449, Safari workaround for document.open
  
  
Index: loncom/homework/chemresponse.pm
diff -u loncom/homework/chemresponse.pm:1.40 loncom/homework/chemresponse.pm:1.41
--- loncom/homework/chemresponse.pm:1.40	Tue Sep 28 16:32:00 2004
+++ loncom/homework/chemresponse.pm	Wed Sep 29 11:17:56 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # chemical equation style response
 #
-# $Id: chemresponse.pm,v 1.40 2004/09/28 20:32:00 www Exp $
+# $Id: chemresponse.pm,v 1.41 2004/09/29 15:17:56 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -121,8 +121,9 @@
 CHEMPAGE
     $body=&HTML::Entities::encode($body,'<>&"');
     $body=~s/\n/ /g;
+    my $docopen=&Apache::lonhtmlcommon::javascript_docopen();
     my $result=<<CHEMINPUT;
-<input type="button" value="Draw Molecule" onClick="javascript:editor=window.open('','','width=500,height=500,scrollbars=no,resizable=yes');editor.document.open('text/html','replace');editor.document.writeln('$body')" />
+<input type="button" value="Draw Molecule" onClick="javascript:editor=window.open('','','width=500,height=500,scrollbars=no,resizable=yes');editor.$docopen;editor.document.writeln('$body')" />
 CHEMINPUT
     return $result;
 }
@@ -308,11 +309,12 @@
     my $id_es=&Apache::lonnet::escape($id);
     my $field_es=&Apache::lonnet::escape($field);
     my $reaction_es=&Apache::lonnet::escape($reaction);
+    my $docopen=&Apache::lonhtmlcommon::javascript_docopen();
     my $result=<<EDITREACTION;
 <script type="text/javascript">
     function create_reaction_window_${id}_${field} () {
 	editor=window.open('','','width=500,height=270,scrollbars=no,resizable=yes');
-	editor.document.open('text/html','replace');
+	editor.$docopen;
 	editor.document.writeln('<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"><html> <head><title>LON-CAPA Reaction Editor</title></head><frameset rows="30%,*" border="0">  <frame src="/res/adm/pages/reactionresponse/reaction_viewer.html?inhibitmenu=yes" name="viewer" scrolling="no" />  <frame src="/res/adm/pages/reactionresponse/reaction_editor.html?inhibitmenu=yes&reaction=$reaction_es&id=$id_es&field=$field_es" name="editor" scrolling="no" /> </frameset> </html>');
     }
 </script>