[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm
banghart
lon-capa-cvs@mail.lon-capa.org
Mon, 15 Jan 2007 20:48:35 -0000
banghart Mon Jan 15 15:48:35 2007 EDT
Modified files:
/loncom/interface loncommon.pm
Log:
Make multiple_select_form act like select_form, allowing order
of select options to be defined by 'select_form_order' key
contents.
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.500 loncom/interface/loncommon.pm:1.501
--- loncom/interface/loncommon.pm:1.500 Mon Jan 15 13:04:12 2007
+++ loncom/interface/loncommon.pm Mon Jan 15 15:48:34 2007
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.500 2007/01/15 18:04:12 albertel Exp $
+# $Id: loncommon.pm,v 1.501 2007/01/15 20:48:34 banghart Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1335,8 +1335,15 @@
}
}
$output.="\n<select name='$name' size='$size' multiple='1'>";
- my @order = ref($order) ? @$order
- : sort(keys(%$hash));
+ my @order;
+ if ($order) {
+ @order = ref($order) ? @$order
+ : sort(keys(%$hash));
+ }
+ if (exists($$hash{'select_form_order'})) {
+ @order = @{$$hash{'select_form_order'}};
+ }
+
foreach my $key (@order) {
$output.='<option value="'.&HTML::Entities::encode($key,'"<>&').'" ';
$output.='selected="selected" ' if ($selected{$key});