[LON-CAPA-cvs] cvs: loncom /publisher publisher.html

albertel lon-capa-cvs@mail.lon-capa.org
Wed, 15 Dec 2004 19:02:45 -0000


albertel		Wed Dec 15 14:02:45 2004 EDT

  Modified files:              
    /loncom/publisher	publisher.html 
  Log:
   fix BUG#3679, remote CSTR, print on problem in edit mode blows up
  
  
Index: loncom/publisher/publisher.html
diff -u loncom/publisher/publisher.html:1.38 loncom/publisher/publisher.html:1.39
--- loncom/publisher/publisher.html:1.38	Thu Apr 15 15:32:37 2004
+++ loncom/publisher/publisher.html	Wed Dec 15 14:02:45 2004
@@ -82,18 +82,25 @@
 }
 
 function getproblemtype() {
-  if (parent.LONCAPAToBePublished.document.lonhomework) {
-     var optionelement;
-     var valueIndex=0;
-     for (var optionIndex=0;
-          optionIndex < parent.LONCAPAToBePublished.document.lonhomework.problemtype.options.length;
-	  optionIndex++)
-     {
-         optionElement=parent.LONCAPAToBePublished.document.lonhomework.problemtype.options[optionIndex];
-	 if (optionElement.selected) {
-	    return optionElement.value;
-         }	  
-     } 	  
+  if (parent.LONCAPAToBePublished.document.lonhomework
+       &&
+      parent.LONCAPAToBePublished.document.lonhomework.problemtype) {
+    if (parent.LONCAPAToBePublished.document.lonhomework.problemtype.value) {
+      return parent.LONCAPAToBePublished.document.lonhomework.problemtype.value;
+    }
+    if (parent.LONCAPAToBePublished.document.lonhomework.problemtype.options) {
+       var optionelement;
+       var valueIndex=0;
+       for (var optionIndex=0;
+            optionIndex < parent.LONCAPAToBePublished.document.lonhomework.problemtype.options.length;
+	    optionIndex++)
+       {
+           optionElement=parent.LONCAPAToBePublished.document.lonhomework.problemtype.options[optionIndex];
+	   if (optionElement.selected) {
+	      return optionElement.value;
+           }	  
+       } 	  
+    }
   }
   return 0;
 }