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

raeburn lon-capa-cvs@mail.lon-capa.org
Tue, 28 Dec 2004 05:55:12 -0000


raeburn		Tue Dec 28 00:55:12 2004 EDT

  Modified files:              
    /loncom/interface	lonpickcourse.pm 
  Log:
  When lonpickcourse is being used to display existing sections in CUSR, use a select box with single select if there is only one existing section, to minimize confusion.
  
  
Index: loncom/interface/lonpickcourse.pm
diff -u loncom/interface/lonpickcourse.pm:1.22 loncom/interface/lonpickcourse.pm:1.23
--- loncom/interface/lonpickcourse.pm:1.22	Thu Dec 23 13:46:48 2004
+++ loncom/interface/lonpickcourse.pm	Tue Dec 28 00:55:11 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Pick a course
 #
-# $Id: lonpickcourse.pm,v 1.22 2004/12/23 18:46:48 raeburn Exp $
+# $Id: lonpickcourse.pm,v 1.23 2004/12/28 05:55:11 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -158,17 +158,26 @@
         opener.document.$ENV{"form.form"}.currsec.options[0] = new Option('No existing sections','',false,false)
     }
     else {
-        for (var i=0; i<numSections; i++) {
-            opener.document.$ENV{"form.form"}.currsec.options[i] = new Option(sectionsArray[i],sectionsArray[i],false,false)
-        }
-        opener.document.$ENV{"form.form"}.currsec.multiple=true
-        if (numSections < 3) {
-            opener.document.$ENV{"form.form"}.currsec.size=numSections;
+        if (numSections == 1) {
+            opener.document.$ENV{"form.form"}.currsec.multiple=false;
+            opener.document.$ENV{"form.form"}.currsec.size=1;
+            opener.document.$ENV{"form.form"}.currsec.options[0] = new Option('Select','',true,true);
+            opener.document.$ENV{"form.form"}.currsec.options[1] = new Option('No section','',false,false) 
+            opener.document.$ENV{"form.form"}.currsec.options[2] = new Option(sectionsArray[0],sectionsArray[0],false,false);
         }
         else {
-            opener.document.$ENV{"form.form"}.currsec.size=3;
+            for (var i=0; i<numSections; i++) {
+                opener.document.$ENV{"form.form"}.currsec.options[i] = new Option(sectionsArray[i],sectionsArray[i],false,false)
+            }
+            opener.document.$ENV{"form.form"}.currsec.multiple=true
+            if (numSections < 3) {
+                opener.document.$ENV{"form.form"}.currsec.size=numSections;
+            }
+            else {
+                opener.document.$ENV{"form.form"}.currsec.size=3;
+            }
+            opener.document.$ENV{"form.form"}.currsec.options[0].selected = false
         }
-        opener.document.$ENV{"form.form"}.currsec.options[0].selected = false
     }
     self.close()
 }