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

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 13 Oct 2003 22:45:09 -0000


albertel		Mon Oct 13 18:45:09 2003 EDT

  Modified files:              
    /loncom/interface	lonpickcourse.pm 
  Log:
  - sort them by description, not by internal ID number
  
  
Index: loncom/interface/lonpickcourse.pm
diff -u loncom/interface/lonpickcourse.pm:1.9 loncom/interface/lonpickcourse.pm:1.10
--- loncom/interface/lonpickcourse.pm:1.9	Mon Oct 13 18:24:51 2003
+++ loncom/interface/lonpickcourse.pm	Mon Oct 13 18:45:09 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Pick a course
 #
-# $Id: lonpickcourse.pm,v 1.9 2003/10/13 22:24:51 albertel Exp $
+# $Id: lonpickcourse.pm,v 1.10 2003/10/13 22:45:09 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -121,10 +121,15 @@
 	    &Apache::lonnet::courseiddump
 	    ($domainfilter,$descriptfilter,$timefilter);
 	$r->print('<form>');
-	foreach (keys %courses) {
-	    my ($cdom,$cnum)=split(/\_/,$_);
+	my %by_descrip;
+	foreach my $course (keys %courses) {
+	    $by_descrip{lc($courses{$course})}=$course;
+	}
+	foreach my $description (sort(keys(%by_descrip))) {
+	    my $course=$by_descrip{$description};
+	    my ($cdom,$cnum)=split(/\_/,$course);
 	    $r->print('<input type="button" value="Select" onClick="gochoose('.
-		  "'".$cnum."','".$cdom."')".'" /> '.$courses{$_}.' ('.
+		  "'".$cnum."','".$cdom."')".'" /> '.$courses{$course}.' ('.
 		  ($Apache::lonnet::domaindescription{$cdom}?
                    $Apache::lonnet::domaindescription{$cdom}:$cdom).
                  ")<br />\n");