--- loncom/interface/coursecatalog.pm 2007/10/06 04:32:49 1.23
+++ loncom/interface/coursecatalog.pm 2008/01/12 22:32:04 1.25
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler for displaying the course catalog interface
#
-# $Id: coursecatalog.pm,v 1.23 2007/10/06 04:32:49 raeburn Exp $
+# $Id: coursecatalog.pm,v 1.25 2008/01/12 22:32:04 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -461,7 +461,7 @@ sub construct_data_table {
}
my $output = &Apache::loncommon::start_data_table().
&Apache::loncommon::start_data_table_header_row();
- my @coltitles = ('Code','Sections','Crosslisted','Title','Owner(s)');
+ my @coltitles = ('Count','Code','Sections','Crosslisted','Title','Owner(s)');
if (ref($usersections) eq 'HASH') {
$coltitles[1] = 'Your Section';
}
@@ -469,6 +469,8 @@ sub construct_data_table {
$output .= '
';
if (defined($sortname{$item})) {
$output .= ''.&mt($item).'';
+ } elsif ($item eq 'Count') {
+ $output .= ' ';
} else {
$output .= &mt($item);
}
@@ -494,7 +496,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;
@@ -503,10 +510,11 @@ sub construct_data_table {
} else {
@sorted_courses = sort { lc($a) cmp lc($b) } (keys(%Sortby));
}
+ my $count = 1;
foreach my $item (@sorted_courses) {
foreach my $course (@{$Sortby{$item}}) {
$output.=&Apache::loncommon::start_data_table_row();
- $output.=&courseinfo_row($courseinfo{$course},$knownuser,$details);
+ $output.=&courseinfo_row($courseinfo{$course},$knownuser,$details,\$count);
$output.=&Apache::loncommon::end_data_table_row();
}
}
@@ -650,7 +658,7 @@ sub count_students {
}
sub courseinfo_row {
- my ($info,$knownuser,$details) = @_;
+ my ($info,$knownuser,$details,$countref) = @_;
my ($cdom,$cnum,$title,$ownerlast,$code,$owner,$seclist,$xlist_items,
$accessdates,$showsyllabus,$counts,$autoenrollment,$output);
if (ref($info) eq 'HASH') {
@@ -671,7 +679,8 @@ sub courseinfo_row {
$code).'';
return $output;
}
- $output .= ' | '.$code.' | '.
+ $output .= ''.$$countref.' | '.
+ ''.$code.' | '.
''.$seclist.' | '.
''.$xlist_items.' | '.
''.$title.' ';
@@ -692,6 +701,7 @@ sub courseinfo_row {
$output .= " | ".&mt('Show more details').' | ';
}
}
+ $$countref ++;
return $output;
}