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

albertel lon-capa-cvs@mail.lon-capa.org
Sat, 22 Apr 2006 01:06:48 -0000


albertel		Fri Apr 21 21:06:48 2006 EDT

  Modified files:              
    /loncom/interface	loncommon.pm londropadd.pm 
  Log:
  -adding a LC_data_table that has the CC color in the th row and alternates the row colors
  
  
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.346 loncom/interface/loncommon.pm:1.347
--- loncom/interface/loncommon.pm:1.346	Fri Apr 21 18:00:56 2006
+++ loncom/interface/loncommon.pm	Fri Apr 21 21:06:48 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.346 2006/04/21 22:00:56 albertel Exp $
+# $Id: loncommon.pm,v 1.347 2006/04/22 01:06:48 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3054,6 +3054,9 @@
     my $vlink  = &designparm($function.'.vlink',$domain);
     my $link   = &designparm($function.'.link',$domain);
     my $sans   = 'Arial,Helvetica,sans-serif';
+    my $data_table_head = '#CCCCFF';
+    my $data_table_light = '#EEEEEE';
+    my $data_table_dark = '#DDD';
     return <<END;
 <style type="text/css">
 h1, h2, h3, th { font-family: $sans }
@@ -3112,6 +3115,24 @@
   font-family: $sans;
   font-weight: bold;
 }
+
+table.LC_data_table {
+  border: 1px solid #000000;
+  border-collapse: seperate;
+}
+table.LC_data_table tr th {
+    background-color: $data_table_head;
+}
+table.LC_data_table tr td {
+    background-color: $data_table_light;
+}
+table.LC_data_table tr.LC_even_row td {
+    background-color: $data_table_dark;
+}
+table.LC_data_table tr.LC_empty td {
+  background-color: #FFFFFF;
+}
+
 </style>
 END
 }
@@ -3456,6 +3477,29 @@
     }
     return $page;
 }
+
+{
+    my $row_count;
+    sub start_data_table {
+	undef($row_count);
+	return '<table class="LC_data_table">';
+    }
+
+    sub end_data_table {
+	undef($row_count);
+	return '</table>';
+    }
+
+    sub start_data_table_row {
+	$row_count++;
+	return  '<tr '.(($row_count % 2)?'':'class="LC_even_row"').'>';
+    }
+
+    sub end_data_table_row {
+	return '</tr>';
+    }
+}
+
 ###############################################
 
 =pod
Index: loncom/interface/londropadd.pm
diff -u loncom/interface/londropadd.pm:1.138 loncom/interface/londropadd.pm:1.139
--- loncom/interface/londropadd.pm:1.138	Tue Mar 21 13:34:23 2006
+++ loncom/interface/londropadd.pm	Fri Apr 21 21:06:48 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to drop and add students in courses 
 #
-# $Id: londropadd.pm,v 1.138 2006/03/21 18:34:23 albertel Exp $
+# $Id: londropadd.pm,v 1.139 2006/04/22 01:06:48 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1181,10 +1181,11 @@
         $env{'form.output'} = 'html';
     }
     #
-    $r->print('<br /><table border="2">');
+    $r->print('<br />'.&Apache::loncommon::start_data_table());
     foreach my $role (sort keys %coursepersonnel) {
         next if ($role =~ /^\s*$/);
-	$r->print('<tr><td>'.$role.'</td><td>');
+	$r->print(&Apache::loncommon::start_data_table_row().
+		  '<td>'.$role.'</td><td>');
         foreach my $user (split(',',$coursepersonnel{$role})) {
 	    my ($puname,$pudom)=split(':',$user);
 	    $r->print(' '.&Apache::loncommon::aboutmewrapper(
@@ -1192,9 +1193,9 @@
                                                                   $pudom),
                                                              $puname,$pudom));
 	}
-        $r->print('</td></tr>');
+        $r->print('</td>'.&Apache::loncommon::end_data_table_row());
     }
-    $r->print('</table>');
+    $r->print(&Apache::loncommon::end_data_table());
     #
     # Interface output
     $r->print('<input type="hidden" name="action" value="'.
@@ -1304,7 +1305,7 @@
         }
         $r->print("
 <p>
-<table border=2>
+".&Apache::loncommon::start_data_table()."
 <tr>
         ");
         if ($mode eq 'autoenroll') {
@@ -1439,7 +1440,7 @@
             } else {
                 $end = &Apache::lonlocal::locallocaltime($end);
             }
-            $r->print("<tr>\n    ");
+	    $r->print(&Apache::loncommon::start_data_table_row());
             if ($mode eq 'autoenroll') {
                 my $lockedtype = $sdata->[$index{'lockedtype'}];
                 $studentcount++;
@@ -1500,7 +1501,7 @@
                     $r->print('    <td>&nbsp;</td>  ');
                 }
             }
-            $r->print('  </tr>  ');
+	    $r->print(&Apache::loncommon::end_data_table_row());
         } elsif ($mode eq 'csv') {
             next if (! defined($CSVfile));
             # no need to bother with $linkto
@@ -1540,7 +1541,7 @@
         }
     }
     if ($mode eq 'view' || $mode eq 'html' || $mode eq 'autoenroll') {
-        $r->print('</table><br>');
+	$r->print(&Apache::loncommon::end_data_table().'<br />');
     } elsif ($mode eq 'excel') {
         $excel_workbook->close();
         $r->print('<p><a href="'.$excel_filename.'">'.
@@ -1924,8 +1925,8 @@
                                    'end'    => "end date",
                                    );
     if ($nosort) {
+	$r->print(&Apache::loncommon::start_data_table());
         $r->print(<<END);
-<table border=2>
 <tr>
     <th>&nbsp;</th>
     <th>$lt{'usrn'}</th>
@@ -1939,8 +1940,8 @@
 END
 
     } else  {
+	$r->print(&Apache::loncommon::start_data_table());
         $r->print(<<END);
-<table border=2>
 <tr><th>&nbsp;</th>
     <th>
        <a href="/adm/dropadd?action=$action&sortby=username">$lt{'usrn'}</a>
@@ -2000,8 +2001,8 @@
         my $status   = $sdata->[$index{'status'}];
         next if ($status ne 'Active');
         #
+        $r->print(&Apache::loncommon::start_data_table_row());
         $r->print(<<"END");
-<tr>
     <td><input type="checkbox" name="droplist" value="$student"></td>
     <td>$username</td>
     <td>$domain</td>
@@ -2010,10 +2011,10 @@
     <td>$section</td>
     <td>$start</td>
     <td>$end</td>
-</tr>
 END
+        $r->print(&Apache::loncommon::end_data_table_row());
     }
-    $r->print('</table><br>');
+    $r->print(&Apache::loncommon::end_data_table().'<br />');
     %lt=&Apache::lonlocal::texthash(
 	               'dp'   => "Drop Students",
                        'ca'   => "check all",