--- loncom/interface/coursecatalog.pm 2007/12/10 23:54:40 1.24
+++ loncom/interface/coursecatalog.pm 2008/02/15 02:30:14 1.26
@@ -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.26 2008/02/15 02:30:14 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -231,8 +231,10 @@ function setCourseId(caller) {
$r->print(&mt('Choose which course(s) to list.
'));
$r->print('
');
for (my $k=0; $k<$lasttitle-1; $k++) {
- my @unsorted = @{$cat_items{$codetitles[$k]}};
- my @items;
+ my (@items,@unsorted);
+ if (ref($cat_items{$codetitles[$k]}) eq 'ARRAY') {
+ @unsorted = @{$cat_items{$codetitles[$k]}};
+ }
&Apache::courseclassifier::sort_cats($k,\%cat_order,\@codetitles,\@unsorted,\@items);
my @longitems;
if (defined($cat_titles{$codetitles[$k]})) {
@@ -496,7 +498,12 @@ sub construct_data_table {
} 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;