--- loncom/interface/coursecatalog.pm 2007/10/03 19:57:29 1.22
+++ loncom/interface/coursecatalog.pm 2007/12/10 23:54:40 1.24
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler for displaying the course catalog interface
#
-# $Id: coursecatalog.pm,v 1.22 2007/10/03 19:57:29 raeburn Exp $
+# $Id: coursecatalog.pm,v 1.24 2007/12/10 23:54:40 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);
}
@@ -503,10 +505,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();
}
}
@@ -522,10 +525,6 @@ sub build_courseinfo_hash {
my $descr;
if (ref($courses->{$course}) eq 'HASH') {
$descr = $courses->{$course}{'description'};
- } elsif ($courses->{$course} =~ m/^([^:]*):/i) {
- $descr = &unescape($1);
- } else {
- $descr = &unescape($courses->{$course});
}
my $cleandesc=&HTML::Entities::encode($descr,'<>&"');
$cleandesc=~s/'/\\'/g;
@@ -534,7 +533,7 @@ sub build_courseinfo_hash {
my ($descr,$instcode,$singleowner,$ttype,@owners,%ownernames);
if (ref($courses->{$course}) eq 'HASH') {
$descr = $courses->{$course}{'description'};
- $instcode = $courses->{$course}{'instcode'};
+ $instcode = $courses->{$course}{'inst_code'};
$singleowner = $courses->{$course}{'owner'};
$ttype = $courses->{$course}{'type'};
push(@owners,$singleowner);
@@ -543,10 +542,6 @@ sub build_courseinfo_hash {
push(@owners,$item);
}
}
- } else {
- ($descr,$instcode,$singleowner,$ttype) =
- split(/:/,$courses->{$course});
- push(@owners,$singleowner);
}
foreach my $owner (@owners) {
my ($ownername,$ownerdom) = @_;
@@ -658,7 +653,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') {
@@ -679,7 +674,8 @@ sub courseinfo_row {
$code).'';
return $output;
}
- $output .= ' | '.$code.' | '.
+ $output .= ''.$$countref.' | '.
+ ''.$code.' | '.
''.$seclist.' | '.
''.$xlist_items.' | '.
''.$title.' ';
@@ -700,6 +696,7 @@ sub courseinfo_row {
$output .= " | ".&mt('Show more details').' | ';
}
}
+ $$countref ++;
return $output;
}