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

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Mon, 10 Dec 2007 23:54:41 -0000


raeburn		Mon Dec 10 18:54:41 2007 EDT

  Modified files:              
    /loncom/interface	coursecatalog.pm 
  Log:
  Include row count as fits column in course catalog.
  
  
Index: loncom/interface/coursecatalog.pm
diff -u loncom/interface/coursecatalog.pm:1.23 loncom/interface/coursecatalog.pm:1.24
--- loncom/interface/coursecatalog.pm:1.23	Sat Oct  6 00:32:49 2007
+++ loncom/interface/coursecatalog.pm	Mon Dec 10 18:54:40 2007
@@ -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.24 2007/12/10 23:54:40 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -461,7 +461,7 @@
     }
     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 @@
         $output .= '<th>';
         if (defined($sortname{$item})) {
             $output .= '<a href="javascript:changeSort('."'$sortname{$item}'".')">'.&mt($item).'</a>';
+        } elsif ($item eq 'Count') {
+            $output .= '&nbsp;&nbsp;';
         } else {
             $output .= &mt($item);
         }
@@ -503,10 +505,11 @@
     } 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 +653,7 @@
 }
 
 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 +674,8 @@
                                          $code).'</td>';
         return $output;
     }
-    $output .= '<td>'.$code.'</td>'.
+    $output .= '<td>'.$$countref.'</td>'.
+               '<td>'.$code.'</td>'.
                '<td>'.$seclist.'</td>'.
                '<td>'.$xlist_items.'</td>'.
                '<td>'.$title.'&nbsp;<font size="-2">';
@@ -692,6 +696,7 @@
             $output .= "<td><a href=\"javascript:setCourseId('$cnum')\">".&mt('Show more details').'</a></td>';
         }
     }
+    $$countref ++;
     return $output;
 }