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

matthew lon-capa-cvs@mail.lon-capa.org
Mon, 14 Jul 2003 19:26:24 -0000


matthew		Mon Jul 14 15:26:24 2003 EDT

  Modified files:              
    /loncom/interface	lonsearchcat.pm 
  Log:
  Bug 1752: import fails with only one resource.  Updated javascript to detect
  the case of a non-array of the form element "returnvalues".  
  
  
Index: loncom/interface/lonsearchcat.pm
diff -u loncom/interface/lonsearchcat.pm:1.184 loncom/interface/lonsearchcat.pm:1.185
--- loncom/interface/lonsearchcat.pm:1.184	Mon Jul 14 09:54:02 2003
+++ loncom/interface/lonsearchcat.pm	Mon Jul 14 15:26:24 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Search Catalog
 #
-# $Id: lonsearchcat.pm,v 1.184 2003/07/14 13:54:02 matthew Exp $
+# $Id: lonsearchcat.pm,v 1.185 2003/07/14 19:26:24 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2741,10 +2741,19 @@
     $result.=<<SCRIPT if $ENV{'form.catalogmode'} eq 'groupsearch';
 <script type="text/javascript">
     function queue(checkbox_num,val) {
-        if (document.forms.results.returnvalues[checkbox_num].checked) {
-            parent.statusframe.document.forms.statusform.elements.Queue.value +='1a'+val+'b';
+        if (document.forms.results.returnvalues.length != "undefined" &&
+            typeof(document.forms.results.returnvalues.length) == "number") {
+            if (document.forms.results.returnvalues[checkbox_num].checked) {
+                parent.statusframe.document.forms.statusform.elements.Queue.value +='1a'+val+'b';
+            } else {
+                parent.statusframe.document.forms.statusform.elements.Queue.value +='0a'+val+'b';
+            }
         } else {
-            parent.statusframe.document.forms.statusform.elements.Queue.value +='0a'+val+'b';
+            if (document.forms.results.returnvalues.checked) {
+                parent.statusframe.document.forms.statusform.elements.Queue.value +='1a'+val+'b';
+            } else {
+                parent.statusframe.document.forms.statusform.elements.Queue.value +='0a'+val+'b';
+            }
         }
     }
     function select_group() {