[PATCH] Show alternating colors for rows in some tables

Paul Vriens Paul.Vriens.Wine at gmail.com
Wed Jul 22 06:40:12 CDT 2009


---
 transl/php/index.php |    5 ++++-
 transl/php/lang.php  |    5 ++++-
 transl/php/style.css |   12 ++++++++----
 3 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/transl/php/index.php b/transl/php/index.php
index 6cd0c7e..74b4307 100644
--- a/transl/php/index.php
+++ b/transl/php/index.php
@@ -82,11 +82,12 @@ $missing_sum = 0;
 $errors_sum = 0;
 $transl_sum = 0;
 $serial = 0;
+$class = "dark";
 for ($i = 0; $i < count($transl); $i++)
 {
     extract($transl[$i]);
 
-    echo "<tr>";
+    echo "<tr class=\"$class\">";
     if ($serial == 0)
     {
         for ($j = $i; $j < count($transl); $j++)
@@ -106,6 +107,8 @@ for ($i = 0; $i < count($transl); $i++)
     $missing_sum += $missing;
     $errors_sum += $errors;
     $serial--;
+    if ($serial == 0)
+        $class = ($class == "dark") ? "light" : "dark";
 }
 ?>
 <tr><td></td><td><b>Sum:</b></td>
diff --git a/transl/php/lang.php b/transl/php/lang.php
index 1ecb4fa..c74270a 100644
--- a/transl/php/lang.php
+++ b/transl/php/lang.php
@@ -63,16 +63,19 @@ function dump_table($table)
     }
     echo "<table>\n";
     echo "<tr><th>name</th><th>translated</th><th>missing</th><th>errors</th></tr>\n";
+
+    $class = "dark";
     foreach ($table as $key => $value)
     {
         $extra = "";
         if ($value[3] > 0)
             $extra = "(<img src=\"img/icon-warning.png\" height=\"16\"> warnings: ".$value[3].")";
-        echo "<tr><td>".gen_resfile_a($lang, $key).$key."</a> $extra</td>";
+        echo "<tr class=\"$class\"><td>".gen_resfile_a($lang, $key).$key."</a> $extra</td>";
         echo "<td>".$value[0]."</td>";
         echo "<td>".$value[1]."</td>";
         echo "<td>".$value[2]."</td>";
         echo "</tr>";
+        $class = ($class == "dark") ? "light" : "dark";
     }
     echo "</table>\n";
 }
diff --git a/transl/php/style.css b/transl/php/style.css
index affea71..56dc204 100644
--- a/transl/php/style.css
+++ b/transl/php/style.css
@@ -63,12 +63,16 @@ th {
         border-bottom-color: #601919;
 }
 
-table.index th {
-        background-color: #f0d2d2;
+tr.dark {
+        background-color: #ffe0e0;
+}
+
+tr.light {
+        background-color: #fff0f0;
 }
 
-table.index td {
-        background-color: #fff4f4;
+table.index th {
+        background-color: #f0d2d2;
 }
 
 /* used to mark resource parts that are not literaly in the string, like \0, \n etc*/
-- 
1.6.0.6


--------------080500030800000100040903--



More information about the wine-patches mailing list