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

raeburn lon-capa-cvs@mail.lon-capa.org
Mon, 05 Feb 2007 18:40:43 -0000


raeburn		Mon Feb  5 13:40:43 2007 EDT

  Modified files:              
    /loncom/interface	loncommon.pm 
  Log:
  Fix bug 5174.
  
  
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.505 loncom/interface/loncommon.pm:1.506
--- loncom/interface/loncommon.pm:1.505	Mon Jan 29 15:17:55 2007
+++ loncom/interface/loncommon.pm	Mon Feb  5 13:40:41 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.505 2007/01/29 20:17:55 albertel Exp $
+# $Id: loncommon.pm,v 1.506 2007/02/05 18:40:41 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1315,11 +1315,11 @@
 
 Args:
   $name - name of the <select> element
-  $value - sclara or array ref of values that should already be selected
+  $value - scalar or array ref of values that should already be selected
   $size - number of rows long the select element is
   $hash - the elements should be 'option' => 'shown text'
           (shown text should already have been &mt())
-  $order - (optional) array ref of the order to show the elments in
+  $order - (optional) array ref of the order to show the elements in
 
 =cut
 
@@ -1336,9 +1336,10 @@
     }
     $output.="\n<select name='$name' size='$size' multiple='1'>";
     my @order;
-    if ($order) {
-        @order = ref($order) ? @$order
-                             : sort(keys(%$hash));
+    if (ref($order) eq 'ARRAY')  {
+        @order = @{$order};
+    } else {
+        @order = sort(keys(%$hash));
     }
     if (exists($$hash{'select_form_order'})) {
         @order = @{$$hash{'select_form_order'}};