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

raeburn lon-capa-cvs@mail.lon-capa.org
Sat, 04 Dec 2004 18:53:25 -0000


raeburn		Sat Dec  4 13:53:25 2004 EDT

  Modified files:              
    /loncom/interface	lonmenu.pm 
  Log:
  Prevent javascript errors when trying to print resources that are not problems (e.g., rights files etc.) in remoteless mode.
  
  
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.137 loncom/interface/lonmenu.pm:1.138
--- loncom/interface/lonmenu.pm:1.137	Fri Dec  3 21:01:04 2004
+++ loncom/interface/lonmenu.pm	Sat Dec  4 13:53:24 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines to control the menu
 #
-# $Id: lonmenu.pm,v 1.137 2004/12/04 02:01:04 raeburn Exp $
+# $Id: lonmenu.pm,v 1.138 2004/12/04 18:53:24 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1023,14 +1023,18 @@
     if (url == '/adm/printout') {
         this.document.cstrprint.postdata.value = filename
         this.document.cstrprint.curseed.value = 0;
-        if ((this.document.lonhomework.rndseed.value != null) && (this.document.lonhomework.rndseed.value != '')) {
-            this.document.cstrprint.curseed.value = this.document.lonhomework.rndseed.value
-        }
         this.document.cstrprint.problemtype.value = 0;
-        for (var i=0; i<this.document.lonhomework.problemtype.options.length; i++) {
-            if (this.document.lonhomework.problemtype.options[i].selected) {
-                if (this.document.lonhomework.problemtype.options[i].value != null && this.document.lonhomework.problemtype.options[i].value != '') { 
-                    this.document.cstrprint.problemtype.value = this.document.lonhomework.problemtype.options[i].value
+        if (this.document.lonhomework) {
+            if ((this.document.lonhomework.rndseed) && (this.document.lonhomework.rndseed.value != null) && (this.document.lonhomework.rndseed.value != '')) {
+                this.document.cstrprint.curseed.value = this.document.lonhomework.rndseed.value
+            }
+            if (this.document.lonhomework.problemtype) {
+                for (var i=0; i<this.document.lonhomework.problemtype.options.length; i++) {
+                    if (this.document.lonhomework.problemtype.options[i].selected) {
+                        if (this.document.lonhomework.problemtype.options[i].value != null && this.document.lonhomework.problemtype.options[i].value != '') { 
+                            this.document.cstrprint.problemtype.value = this.document.lonhomework.problemtype.options[i].value
+                        }
+                    }
                 }
             }
         }