[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Mon, 13 Oct 2003 22:35:05 -0000
albertel Mon Oct 13 18:35:05 2003 EDT
Modified files:
/loncom/interface loncommon.pm
Log:
- sorted order ain't always the best, use the key select_form_order to pass in a specific order for the keys to be showm
- use this in to sort the data specifiers in lonpickcourse
- enable use of the domain filter at instantiation time
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.127 loncom/interface/loncommon.pm:1.128
--- loncom/interface/loncommon.pm:1.127 Thu Oct 9 18:07:08 2003
+++ loncom/interface/loncommon.pm Mon Oct 13 18:35:05 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.127 2003/10/09 22:07:08 matthew Exp $
+# $Id: loncommon.pm,v 1.128 2003/10/13 22:35:05 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -362,7 +362,8 @@
}
sub coursebrowser_javascript {
- return (<<'ENDSTDBRW');
+ my ($domainfilter)=@_;
+ return (<<ENDSTDBRW);
<script type="text/javascript" language="Javascript" >
var stdeditbrowser;
function opencrsbrowser(formname,uname,udom) {
@@ -373,6 +374,12 @@
url += 'filter='+filter+'&';
}
}
+ var domainfilter='$domainfilter';
+ if (domainfilter != null) {
+ if (domainfilter != '') {
+ url += 'domainfilter='+domainfilter+'&';
+ }
+ }
url += 'form=' + formname + '&cnumelement='+uname+
'&cdomelement='+udom;
var title = 'Course_Browser';
@@ -768,7 +775,13 @@
sub select_form {
my ($def,$name,%hash) = @_;
my $selectform = "<select name=\"$name\" size=\"1\">\n";
- foreach (sort keys %hash) {
+ my @keys;
+ if (exists($hash{'select_form_order'})) {
+ @keys=@{$hash{'select_form_order'}};
+ } else {
+ @keys=sort(keys(%hash));
+ }
+ foreach (@keys) {
$selectform.="<option value=\"$_\" ".
($_ eq $def ? 'selected' : '').
">".&mt($hash{$_})."</option>\n";