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

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Sat, 12 Jan 2008 22:32:05 -0000


raeburn		Sat Jan 12 17:32:05 2008 EDT

  Modified files:              
    /loncom/interface	coursecatalog.pm 
  Log:
  Bug 5569.  Eliminate non-word characters from the key to sort on, when courses are sorted by title.
  
  
Index: loncom/interface/coursecatalog.pm
diff -u loncom/interface/coursecatalog.pm:1.24 loncom/interface/coursecatalog.pm:1.25
--- loncom/interface/coursecatalog.pm:1.24	Mon Dec 10 18:54:40 2007
+++ loncom/interface/coursecatalog.pm	Sat Jan 12 17:32:04 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler for displaying the course catalog interface
 #
-# $Id: coursecatalog.pm,v 1.24 2007/12/10 23:54:40 raeburn Exp $
+# $Id: coursecatalog.pm,v 1.25 2008/01/12 22:32:04 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -496,7 +496,12 @@
         } elsif ($env{'form.sortby'} eq 'owner') {
             push(@{$Sortby{$courseinfo{$course}{'ownerlastnames'}}},$course);
         } else {
-            push(@{$Sortby{$courseinfo{$course}{'title'}}},$course);
+            my $clean_title = $courseinfo{$course}{'title'};
+            $clean_title =~ s/\W+//g;
+            if ($clean_title eq '') {
+                $clean_title = $courseinfo{$course}{'title'};
+            }
+            push(@{$Sortby{$clean_title}},$course);
         }
     }
     my @sorted_courses;