]> SAFE projects GIT repository - jmp/mailleur/commitdiff
Adding table with background color
authorJean-Marc Pigeon <jmp@safe.c>
Sun, 7 Sep 2025 20:40:50 +0000 (16:40 -0400)
committerJean-Marc Pigeon <jmp@safe.c>
Sun, 7 Sep 2025 20:40:50 +0000 (16:40 -0400)
www/directives.js [new file with mode: 0644]
www/lvlusr.php

diff --git a/www/directives.js b/www/directives.js
new file mode 100644 (file)
index 0000000..ea33a6d
--- /dev/null
@@ -0,0 +1,18 @@
+// vim: smarttab tabstop=8 shiftwidth=2 expandtab
+
+.table-userlist tr:nth-child(odd)
+  {
+  background-color: #66ff99;
+  color: yellow ;
+  }
+
+.table-userlist tr:nth-child(even)
+  {
+  background-color: #e6f7ff ;
+  color: black ;
+  }
+
+.myTable { background-color:#eee;border-collapse:collapse; }
+.myTable th { background-color:#000;color:white;width:50%; }
+.myTable td, .myTable th { padding:5px;border:1px solid #000; }
+
index ef839a4a936d383399c39eb7c7c79ead09627d07..80917c7f5f6a1baae72bc69d41fe53987b40539d 100644 (file)
@@ -17,9 +17,14 @@ function body($logname)
 global $isadmin;
 
 $line="";
+$count=0;
 $dbsql=sql_connect();
 $emails=sql_getemaillist($dbsql,NULL,NULL);
 foreach($emails as $email) {
+  $bgcolor="white";
+  if ($count & 1 ) {
+    $bgcolor="green";
+    }
   $name=$email['email'];
   $last=$email['lastemail'];
   $max=$email['mxspace'];
@@ -30,6 +35,7 @@ foreach($emails as $email) {
   $line=$line."<TD align=center>$max</TD>";
   $line=$line."<TD align=center>$lock</TD>";
   $line=$line."</TR>";
+  $count++;
   }
 sql_close($dbsql);
 
@@ -42,8 +48,22 @@ $footer=footer("lvlusr");
 $STR  = <<<EOT
 $start
 $top
+<style type="text/css">
+.table-userlist tr:nth-child(odd)
+  {
+  background-color: #66ff99;    /*light green   */
+  color: black ;
+  }
+
+.table-userlist tr:nth-child(even)
+  {
+  background-color: white;
+  color: black ;
+  }
+</style>
+
 <CENTER>
-<table WIDTH="80%" BORDER="1" CellSpacing="0">
+<table class="table-userlist" WIDTH="80%" BORDER="1" CellSpacing="0">
 <TR>
 <TH align=center>Email</TH>
 <TH align=center>lastemail</TH>