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

onken onken@source.lon-capa.org
Mon, 22 Mar 2010 13:24:17 -0000


onken		Mon Mar 22 13:24:17 2010 EDT

  Modified files:              
    /loncom/interface	londocs.pm loncommon.pm 
  Log:
  Fix the randomly starting row-color(odd/even) of the documentlist in Course Editor.
  
  
  
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.423 loncom/interface/londocs.pm:1.424
--- loncom/interface/londocs.pm:1.423	Thu Mar 18 16:33:44 2010
+++ loncom/interface/londocs.pm	Mon Mar 22 13:24:16 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.423 2010/03/18 16:33:44 onken Exp $
+# $Id: londocs.pm,v 1.424 2010/03/22 13:24:16 onken Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1637,7 +1637,9 @@
         $r->print('</div>');
     }
 
-    my $output;
+    my $output;  
+
+    &Apache::loncommon::start_data_table_count(); #setup a row counter 
     foreach my $res (@LONCAPA::map::order) {
         my ($name,$url)=split(/\:/,$LONCAPA::map::resources[$res]);
         $name=&LONCAPA::map::qtescape($name);
@@ -1649,6 +1651,8 @@
         $idx++;
         $shown++;
     }
+    &Apache::loncommon::end_data_table_count();
+    
     if ($shown) {
         $r->print(&Apache::loncommon::start_data_table());
         if ($allowed) {
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.960 loncom/interface/loncommon.pm:1.961
--- loncom/interface/loncommon.pm:1.960	Thu Mar 18 17:25:52 2010
+++ loncom/interface/loncommon.pm	Mon Mar 22 13:24:16 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.960 2010/03/18 17:25:52 bisitz Exp $
+# $Id: loncommon.pm,v 1.961 2010/03/22 13:24:16 onken Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -6931,15 +6931,26 @@
 
 {
     my @row_count;
+
+    sub start_data_table_count {
+        unshift(@row_count, 0);
+        return;
+    }
+
+    sub end_data_table_count {
+        shift(@row_count);
+        return;
+    }
+
     sub start_data_table {
 	my ($add_class) = @_;
 	my $css_class = (join(' ','LC_data_table',$add_class));
-	unshift(@row_count,0);
+	&start_data_table_count();
 	return '<table class="'.$css_class.'">'."\n";
     }
 
     sub end_data_table {
-	shift(@row_count);
+	&end_data_table_count();
 	return '</table>'."\n";;
     }