[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm

raeburn lon-capa-cvs@mail.lon-capa.org
Mon, 20 Dec 2004 19:57:14 -0000


raeburn		Mon Dec 20 14:57:14 2004 EDT

  Modified files:              
    /loncom/interface	loncommon.pm 
  Log:
  Eliminate Javascript error messages when launching Help menu.
  
  
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.242 loncom/interface/loncommon.pm:1.243
--- loncom/interface/loncommon.pm:1.242	Tue Dec  7 19:56:00 2004
+++ loncom/interface/loncommon.pm	Mon Dec 20 14:57:14 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.242 2004/12/08 00:56:00 albertel Exp $
+# $Id: loncommon.pm,v 1.243 2004/12/20 19:57:14 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -691,20 +691,30 @@
     $template .= <<"ENDTEMPLATE";
  <script type="text/javascript">
 //<!-- BEGIN LON-CAPA Internal
-function helpMenu(caller) {
-    if (caller == 'open') {
-        newWindow =  window.open("","helpmenu","HEIGHT=$height,WIDTH=$width,resize=yes,scrollbars=yes" )
-        caller = newWindow.document
-    } else {
-        caller = this.document
-    }
-    caller.write("<html><head><title>LON-CAPA Help Menu</title><meta http-equiv='pragma' content='no-cache'></head>")
-    caller.write("<frameset rows='105,*' border='0'><frame name='bannerframe'  src='$banner_link'><frame name='bodyframe' src='$details_link'></frameset>")
-    caller.write("</html>")
-    caller.close()
-    if (caller == newWindow.document) {
-        caller.focus()
+function helpMenu(target) {
+    var caller = this;
+    if (target == 'open') {
+        var newWindow = null;
+        try {
+            newWindow =  window.open("","helpmenu","HEIGHT=$height,WIDTH=$width,resize=yes,scrollbars=yes" )
+        }
+        catch(error) {
+            writeHelp(caller);
+            return;
+        }
+        if (newWindow) {
+            caller = newWindow;
+        }
     }
+    writeHelp(caller);
+    return;
+}
+function writeHelp(caller) {
+    caller.document.write("<html><head><title>LON-CAPA Help Menu</title><meta http-equiv='pragma' content='no-cache'></head>")
+    caller.document.write("<frameset rows='105,*' border='0'><frame name='bannerframe'  src='$banner_link'><frame name='bodyframe' src='$details_link'></frameset>")
+    caller.document.write("</html>")
+    caller.document.close()
+    caller.focus()
 }
 // END LON-CAPA Internal -->
  </script>