[LON-CAPA-cvs] cvs: loncom /interface lonhelper.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Tue, 09 May 2006 18:15:40 -0000
albertel Tue May 9 14:15:40 2006 EDT
Modified files:
/loncom/interface lonhelper.pm
Log:
- sort section listing so
- 'No section' heads the list
- case insenstive
- Group selctor also list in case insensitive order
Index: loncom/interface/lonhelper.pm
diff -u loncom/interface/lonhelper.pm:1.142 loncom/interface/lonhelper.pm:1.143
--- loncom/interface/lonhelper.pm:1.142 Tue May 9 10:38:10 2006
+++ loncom/interface/lonhelper.pm Tue May 9 14:15:39 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# .helper XML handler to implement the LON-CAPA helper
#
-# $Id: lonhelper.pm,v 1.142 2006/05/09 14:38:10 albertel Exp $
+# $Id: lonhelper.pm,v 1.143 2006/05/09 18:15:39 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -3162,17 +3162,22 @@
my $section = Apache::loncoursedata::CL_SECTION();
my $classlist = Apache::loncoursedata::get_classlist();
- foreach (keys %$classlist) {
- my $sectionName = $classlist->{$_}->[$section];
- if (!$sectionName) {
+ foreach my $user (keys(%$classlist)) {
+ my $section_name = $classlist->{$user}[$section];
+ if (!$section_name) {
$choices{"No section assigned"} = "";
} else {
- $choices{$sectionName} = $sectionName;
+ $choices{$section_name} = $section_name;
}
}
- for my $sectionName (sort(keys(%choices))) {
- push @{$paramHash->{CHOICES}}, [$sectionName, $sectionName];
+ if (exists($choices{"No section assigned"})) {
+ push(@{$paramHash->{CHOICES}},
+ ['No section assigned','No section assigned']);
+ delete($choices{"No section assigned"});
+ }
+ for my $section_name (sort {lc($a) cmp lc($b) } (keys(%choices))) {
+ push @{$paramHash->{CHOICES}}, [$section_name, $section_name];
}
return if ($token->[2]{'onlysections'});
@@ -3242,7 +3247,7 @@
my %choices;
my %curr_groups = &Apache::loncommon::coursegroups();
- foreach my $group_name (sort(keys(%curr_groups))) {
+ foreach my $group_name (sort {lc($a) cmp lc($b)} (keys(%curr_groups))) {
push(@{$paramHash->{CHOICES}}, [$group_name, $group_name]);
}
}