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

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 30 Jun 2006 01:43:06 -0000


albertel		Thu Jun 29 21:43:06 2006 EDT

  Modified files:              
    /loncom/interface	lonselstudent.pm 
  Log:
  - improve sorting of users with no names (nand those with mixed case)
  BUG#4877
  - improve output of the modes where there aren't any students to select.
  
  
  
Index: loncom/interface/lonselstudent.pm
diff -u loncom/interface/lonselstudent.pm:1.7 loncom/interface/lonselstudent.pm:1.8
--- loncom/interface/lonselstudent.pm:1.7	Tue May 23 17:41:26 2006
+++ loncom/interface/lonselstudent.pm	Thu Jun 29 21:43:06 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # lonselstudent.pm : Reusable subs for student selection.
 #
-# $Id: lonselstudent.pm,v 1.7 2006/05/23 21:41:26 foxr Exp $
+# $Id: lonselstudent.pm,v 1.8 2006/06/30 01:43:06 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -112,10 +112,9 @@
     my @keys = keys(%{$classlist});
     # Sort by: Section, name
     @keys = sort {
-        if ($classlist->{$a}->[$section] ne $classlist->{$b}->[$section]) {
-            return $classlist->{$a}->[$section] cmp $classlist->{$b}->[$section];
-        }
-        return $classlist->{$a}->[$fullname] cmp $classlist->{$b}->[$fullname];
+	lc($classlist->{$a}[$section])  cmp lc($classlist->{$b}[$section])  ||
+	lc($classlist->{$a}[$fullname]) cmp lc($classlist->{$b}[$fullname]) ||
+	lc($a) cmp lc($b)
     } (@keys);
  
 
@@ -188,6 +187,9 @@
 
     my $result = "";
 
+    # no students so no output
+    return if (!@$students);
+
     if ($javascript && $multiselect) {
         $result .= <<SCRIPT;
 <script type="text/javascript">