Hello all,

I have made some modifications on revcheck script.

It is now in conformity with the xhtml 1.0 strict specification (semantics is 
also respected) and navigation was improved using Javascript.

Sections are display or not using the menu and Javascript.
By default, "Intro" & "translator" are display.

I think that these changes can help the translators in their daily work.

What do you think about it ?

Regards,
-- 
Yannick
--- phpdoc-fr/scripts/revcheck.php	2004-09-06 00:10:10.000000000 +0200
+++ phpdoc-fr/scripts/revcheck.php	2004-09-07 14:36:06.000000000 +0200
@@ -516,14 +516,23 @@
 $files_status = get_dir_status($DOCDIR."en/");
 
 
-$navbar = "<p class=c><a href=\"#intro\">Introduction</a> | " .
-          "<a href=\"#translators\">Translators</a> | " .
-          "<a href=\"#filesummary\">File summary by type</a> | " .
-          "<a href=\"#files\">Files</a> | ";
-if (count($translation["files"]) != 0)
-	$navbar .= "<a href=\"#wip\">Work in progress</a> | ";
-$navbar .= "<a href=\"#misstags\">Missing revision numbers</a> | " .
-           "<a href=\"#missfiles\">Untranslated files</a></p>\n";
+$navbar = "
+<ul>
+  <li><a href=\"javascript:void(0)\" onclick=\"javascript:go('Dintro', 'Aintro')\" id=\"Aintro\">Introduction</a></li>
+  <li><a href=\"javascript:void(0)\" onclick=\"javascript:go('Dtranslators', 'Atranslators')\" id=\"Atranslators\">Translators</a></li>
+  <li><a href=\"javascript:void(0)\" onclick=\"javascript:go('Dfilesummary', 'Afilesummary')\" id=\"Afilesummary\">File summary by type</a></li>
+  <li><a href=\"javascript:void(0)\" onclick=\"javascript:go('Dfiles', 'Afiles')\" id=\"Afiles\">Files</a></li>
+";
+
+if (count($translation["files"]) != 0) {
+ $navbar .= "<li><a href=\"javascript:void(0)\" onclick=\"javascript:go('Dwip', 'Awip')\" id=\"Awip\">Work in progress</a></li>";
+}
+
+$navbar .= "
+  <li><a href=\"javascript:void(0)\" onclick=\"javascript:go('Dmisstags', 'Amisstags')\" id=\"Amisstags\">Missing revision numbers</a></li>
+  <li><a href=\"javascript:void(0)\" onclick=\"javascript:go('Dmissfiles', 'Amissfiles')\" id=\"Amissfiles\">Untranslated files</a></li>
+</ul>
+";
 
 
 // Figure out generation date
@@ -534,42 +543,98 @@
 // =========================================================================
 
 print <<<END_OF_MULTILINE
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd";>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
 <html>
 <head>
 <title>PHPDOC Revision-check</title>
-<meta http-equiv="Content-Type" content="text/html; charset={$charset}">
+<meta http-equiv="Content-Type" content="text/html; charset={$charset}" />
 <style type="text/css">
 <!--
-h2,td,a,p,a.ref,th { font-family:Arial,Helvetica,sans-serif; font-size:14px; }
-h2,th,a.ref { color:#FFFFFF; }
-td,a,p { color:#000000; }
-h2     { font-size:28px; }
-th     { font-weight:bold; }
-.blue  { background-color:#666699; }
-.act   { background-color:#68D888; }
-.norev { background-color:#f4a460; }
-.old   { background-color:#eee8aa; }
-.crit  { background-color:#ff6347; }
-.wip   { background-color:#dcdcdc; }
-.r     { text-align:right }
-.rb    { text-align:right; font-weight:bold; }
-.c     { text-align:center }
-body   { margin:0px 0px 0px 0px; background-color:#F0F0F0; }
+body   { margin: 0 0 0 0; background-color: #F0F0F0; }
+
+#header { background-color: #9999CC; border: 1px solid #666699; }
+#header p { font-size: 12px; }
+
+table { width: 450px; border: 0; margin-left: auto; margin-right: auto; border-spacing : 1px; margin-top: 5px; margin-bottom: 5px;}
+th, td { padding : 6px; white-space: nowrap; }
+
+h2,td,a,p,a.ref,th { font-family: Arial,Helvetica,sans-serif; font-size: 14px; }
+h2,th,a.ref { color: #FFFFFF; }
+
+ul { text-align: center; }
+li { display: inline; }
+
+li a { border: 1px solid #A4A4A4; padding: 3px; text-decoration: none; color: #A4A4A4; }
+
+td,a,p { color: #000000; }
+h2     { font-size: 28px; }
+th     { font-weight: bold; }
+.blue  { background-color: #666699; }
+.act   { background-color: #68D888; }
+.norev { background-color: #f4a460; }
+.old   { background-color: #eee8aa; }
+.crit  { background-color: #ff6347; }
+.wip   { background-color: #dcdcdc; }
+.r     { text-align: right; }
+.rb    { text-align: right; font-weight: bold; }
+.c     { text-align: center }
+
+
+#Dintro, #Dtranslators, #Dfilesummary, #Dfiles, #Dwip, #Dmisstags, #Dmissfiles {
+visibility: hidden;
+display: none;
+}
+
+
 //-->
 </style>
 </head>
 <body>
-<table width="100%" border="0" cellspacing="0" bgcolor="#666699">
-<tr><td>
-<table width="100%" border="0" cellspacing="1" bgcolor="#9999CC">
-<tr><td><h2 class=c>Status of the translated PHP Manual</h2><p class=c style="font-size:12px;">Generated: {$date} &nbsp; / &nbsp; Language: $LANG<br></p></td></tr>
-</table>
-</td></tr>
-</table>
+<div><a name="top" id="top"></a></div>
+<script type="text/javascript">
+
+function go(block, lien) {
+
+	var nava = (document.layers);
+	var dom = (document.getElementById);
+	var iex = (document.all);
+	
+	if (nava) {
+	chg = document.block
+	chg2 = document.lien
+	} else if (dom) {
+	chg = document.getElementById(block).style
+	chg2 = document.getElementById(lien).style
+	} else if (iex) {
+	chg = block.style
+	chg2 = lien.style
+	}
+	
+	 if( chg.visibility == 'visible' ) {
+		chg.visibility = "hidden";
+	 chg.display = "none";
+		chg2.borderColor = '#A4A4A4';
+		chg2.color = '#A4A4A4';
+		
+		} else {
+	 chg.visibility = "visible";
+	 chg.display = "block";
+		chg2.borderColor = '#000';
+		chg2.color = '#000';
+	}
+	
+
+}
+</script>
+
+<div id="header">
+ <h2 class="c">Status of the translated PHP Manual</h2>
+ <p class="c">Generated: {$date} &nbsp; / &nbsp; Language: $LANG</p>
+</div>
+
 END_OF_MULTILINE;
 
-print ($navbar);
+echo $navbar;
 
 // =========================================================================
 // Intro block goes here
@@ -577,9 +642,13 @@
 
 // If we have an introduction text, print it out, with an anchor
 if (!empty($translation["intro"])) {
-    print '<a name="intro"></a>';
-    print '<table width="800" align="center"><tr><td class=c>' .
-           $translation['intro'] . '</td></tr></table><p></p>';
+    echo '<div id="Dintro">
+             <a name="intro" id="intro"></a>';
+    echo '<p class="c">' .
+           $translation['intro'] . '</p>
+      <p class="c"><a href="#top">^Top^</a></p>
+    
+            </div>';
 }
 
 // =========================================================================
@@ -591,21 +660,22 @@
 if (!empty($translation["persons"])) {
 
 print <<<END_OF_MULTILINE
-<a name="translators"></a>
-<table width="820" border="0" cellpadding="4" cellspacing="1" align="center">
-<tr class=blue>
-<th rowspan=2>Translator's name</th>
-<th rowspan=2>Contact email</th>
-<th rowspan=2>Nick</th>
-<th rowspan=2>C<br>V<br>S</th>
-<th colspan=7>Files maintained</th>
+<div id="Dtranslators">
+<a name="translators" id="translators"></a>
+<table>
+<tr class="blue">
+<th rowspan="2">Translator's name</th>
+<th rowspan="2">Contact email</th>
+<th rowspan="2">Nick</th>
+<th rowspan="2">C<br />V<br />S</th>
+<th colspan="7">Files maintained</th>
 </tr>
 <tr>
-<th class="{$CSS[REV_CREDIT]}" style="color:#000000">cre-<br>dits</th>
-<th class="{$CSS[REV_UPTODATE]}" style="color:#000000">upto-<br>date</th>
+<th class="{$CSS[REV_CREDIT]}" style="color:#000000">cre-<br />dits</th>
+<th class="{$CSS[REV_UPTODATE]}" style="color:#000000">upto-<br />date</th>
 <th class="{$CSS[REV_OLD]}" style="color:#000000">old</th>
-<th class="{$CSS[REV_CRITICAL]}" style="color:#000000">cri-<br>tical</th>
-<th class="{$CSS[REV_NOREV]}" style="color:#000000">no<br>rev</th>
+<th class="{$CSS[REV_CRITICAL]}" style="color:#000000">cri-<br />tical</th>
+<th class="{$CSS[REV_NOREV]}" style="color:#000000">no<br />rev</th>
 <th class="{$CSS[REV_WIP]}" style="color:#000000">wip</th>
 <th class="blue">sum</th>
 </tr>
@@ -653,22 +723,24 @@
             $pi = array();
         }
         
-        print("<tr class=$col>" .
+        print("<tr class=\"$col\">" .
               "<td><a name=\"maint$num\">$person[name]</a></td>" .
               "<td>$person[email]</td>" .
               "<td>$person[nick]</td>" .
-              "<td class=c>$cvsu</td>" .
-              "<td class=c>" . $pi[REV_CREDIT]   . "</td>" .
-              "<td class=c>" . $pi[REV_UPTODATE] . "</td>" .
-              "<td class=c>" . $pi[REV_OLD]      . "</td>" .
-              "<td class=c>" . $pi[REV_CRITICAL] . "</td>" .
-              "<td class=c>" . $pi[REV_NOREV]    . "</td>" .
-              "<td class=c>" . $pi[REV_WIP]      . "</td>" .
-              "<th class=blue>" . array_sum($pi) . "</th>" .
+              "<td class=\"c\">$cvsu</td>" .
+              "<td class=\"c\">" . $pi[REV_CREDIT]   . "</td>" .
+              "<td class=\"c\">" . $pi[REV_UPTODATE] . "</td>" .
+              "<td class=\"c\">" . $pi[REV_OLD]      . "</td>" .
+              "<td class=\"c\">" . $pi[REV_CRITICAL] . "</td>" .
+              "<td class=\"c\">" . $pi[REV_NOREV]    . "</td>" .
+              "<td class=\"c\">" . $pi[REV_WIP]      . "</td>" .
+              "<th class=\"blue\">" . array_sum($pi) . "</th>" .
               "</tr>\n");
     }
   
-    print "</table>\n<p>&nbsp;</p>\n";
+    echo "</table>\n
+      <p class=\"c\"><a href=\"#top\">^Top^</a></p>
+    </div>\n";
 } 
 
 // =========================================================================
@@ -680,9 +752,10 @@
 if (empty($MAINT)) {
 
 	print <<<END_OF_MULTILINE
-<a name="filesummary"></a>
-<table width="450" border="0" cellpadding="4" cellspacing="1" align="center">
-<tr class=blue>
+<div id="Dfilesummary">
+<a name="filesummary" id="filesummary"></a>
+<table>
+<tr class="blue">
 <th>File status type</th>
 <th>Number of files</th>
 <th>Percent of files</th>
@@ -705,22 +778,24 @@
     );
     
     foreach ($file_types as $num => $type) {
-    	print "<tr class=".$CSS[$type[0]].">".
+     print "<tr class=\"".$CSS[$type[0]]."\">".
     		  "<td>".$type[1]."</td>".
-    		  "<td class=c>".intval($files_by_mark[$type[0]])."</td>".
-    		  "<td class=c>".number_format($files_by_mark[$type[0]] * 100 / $files_sum, 2 ).
+        "<td class=\"c\">".intval($files_by_mark[$type[0]])."</td>".
+        "<td class=\"c\">".number_format($files_by_mark[$type[0]] * 100 / $files_sum, 2 ).
     		  "%</td>".
-                  "<td class=c>".intval($file_sizes_by_mark[$type[0]])."</td>".
-                  "<td class=c>".number_format($file_sizes_by_mark[$type[0]] * 100 / $file_sizes_sum, 2).
+                  "<td class=\"c\">".intval($file_sizes_by_mark[$type[0]])."</td>".
+                  "<td class=\"c\">".number_format($file_sizes_by_mark[$type[0]] * 100 / $file_sizes_sum, 2).
                   "%</td></tr>\n";
     }
 
-	print "<tr class=blue><th>Files total</th><th>$files_sum</th><th>100%</th><th>$file_sizes_sum</th><th>100%</th></tr>\n".
-		  "</table>\n<p>&nbsp;</p>\n";
+ print "<tr class=\"blue\"><th>Files total</th><th>$files_sum</th><th>100%</th><th>$file_sizes_sum</th><th>100%</th></tr>\n".
+    "</table>\n
+      <p class=\"c\"><a href=\"#top\">^Top^</a></p>
+    </div>\n";
 
 }
 
-print ($navbar."<p>&nbsp;</p>\n");
+// print ($navbar."<p>&nbsp;</p>\n");
 
 
 // =========================================================================
@@ -728,17 +803,18 @@
 // =========================================================================
 
 print <<<END_OF_MULTILINE
-<a name="files"></a>
-<table width="820" border="0" cellpadding="4" cellspacing="1" align="center">
-<tr class=blue>
-<th rowspan=2>Translated file</th>
-<th colspan=3>Revision</th>
-<th colspan=3>Size in kB</th>
-<th colspan=3>Age in days</th>
-<th rowspan=2>Maintainer</th>
-<th rowspan=2>Status</th>
+<div id="Dfiles">
+<a name="files" id="files"></a>
+<table>
+<tr class="blue">
+<th rowspan="2">Translated file</th>
+<th colspan="3">Revision</th>
+<th colspan="3">Size in kB</th>
+<th colspan="3">Age in days</th>
+<th rowspan="2">Maintainer</th>
+<th rowspan="2">Status</th>
 </tr>
-<tr class=blue>
+<tr class="blue">
 <th>en</th>
 <th>$LANG</th>
 <th>diff</th>
@@ -790,21 +866,21 @@
     }
     // Drop out the unneeded parts from the dirname...
     $display_dir = str_replace($DOCDIR."en/", "", dirname($file["full_name"]));
-    $prev_diplay_dir = "<tr class=blue><th colspan=12>$display_dir";
+    $prev_diplay_dir = "<tr class=\"blue\"><th colspan=\"12\">$display_dir";
     
     // Save the line for the current file (get file name shorter)
-    $lines .= "<tr class={$CSS[$file['mark']]}><td>{$file['short_name']}</td>".
+    $lines .= "<tr class=\"{$CSS[$file['mark']]}\"><td>{$file['short_name']}</td>".
           "<td> {$file['revision'][0]}</td>" .
           "<td> {$file['revision'][1]}</td>".
-          "<td class=rb>{$file['revision'][2]} </td>".
-          "<td class=r>{$file['size'][0]} </td>".
-          "<td class=r>{$file['size'][1]} </td>".
-          "<td class=rb>{$file['size'][2]} </td>".
-          "<td class=r>{$file['date'][0]} </td>".
-          "<td class=r>{$file['date'][1]} </td>".
-          "<td class=rb>{$file['date'][2]} </td>".
-          "<td class=c>{$file['maintainer']}</td>".
-          "<td class=c>".trim($file['status'])."</td></tr>\n";
+          "<td class=\"rb\">{$file['revision'][2]} </td>".
+          "<td class=\"r\">{$file['size'][0]} </td>".
+          "<td class=\"r\">{$file['size'][1]} </td>".
+          "<td class=\"rb\">{$file['size'][2]} </td>".
+          "<td class=\"r\">{$file['date'][0]} </td>".
+          "<td class=\"r\">{$file['date'][1]} </td>".
+          "<td class=\"rb\">{$file['date'][2]} </td>".
+          "<td class=\"c\">{$file['maintainer']}</td>".
+          "<td class=\"c\">".trim($file['status'])."</td></tr>\n";
      $line_number++;
 
 }
@@ -813,8 +889,9 @@
 echo "$prev_diplay_dir ($line_number)</th></tr>";
 echo $lines;
 
-print("</table>\n<p>&nbsp;</p>\n$navbar<p>&nbsp;</p>\n");
-
+echo "</table>\n
+      <p class=\"c\"><a href=\"#top\">^Top^</a></p>
+    </div>\n";
 
 // =========================================================================
 // Work in progress table goes here
@@ -824,9 +901,10 @@
 if (count($translation["files"]) != 0) {
 
     // Print out files table header
-    print "<a name=\"wip\"></a>\n" .
-    "<table width=\"820\" border=\"0\" cellpadding=\"4\" cellspacing=\"1\" align=\"center\">\n" .
-    "<tr class=blue>".
+    print "<div id=\"Dwip\">
+     <a name=\"wip\" id=\"wip\"></a>\n" .
+    "<table>\n" .
+    "<tr class=\"blue\">".
     "<th>Work in progress files</th>".
     "<th>Translator</th>".
     "<th>Type</th>";
@@ -851,7 +929,7 @@
         }
        
         // Print out the line with the first columns
-        print "<tr class=wip><td>$finfo[name]</td>" .
+        print "<tr class=\"wip\"><td>$finfo[name]</td>" .
               "<td>$finfo[person]</td><td>$finfo[type]</td>";
 
         // If we need the date column, print it out
@@ -873,18 +951,20 @@
         $wip_files[$finfo["name"]] = TRUE;
     } 
   
-    print "</table>\n<p>&nbsp;</p>\n$navbar<p>&nbsp;</p>\n";
-    
+    print "</table>\n
+      <p class=\"c\"><a href=\"#top\">^Top^</a></p>
+    </div>\n";
 } 
 
 // Files translated, but without a revision comment
 $count = count($missing_tags);
 if ($count > 0) {
-    print "<a name=\"misstags\"></a>" .
-          "<table width=\"400\" border=\"0\" cellpadding=\"3\" cellspacing=\"1\" align=\"center\">\n".
-          "<tr class=blue><th rowspan=2>Files without Revision-comment ($count files):</th>".
-          "<th colspan=3>Sizes in kB</th></tr>\n".
-          "<tr class=blue><th>en</th><th>$LANG</th><th>diff</th></tr>\n";
+    print "<div id=\"Dmisstags\">
+           <a name=\"misstags\" id=\"misstags\"></a>" .
+          "<table>\n".
+          "<tr class=\"blue\"><th rowspan=\"2\">Files without Revision-comment ($count files):</th>".
+          "<th colspan=\"3\">Sizes in kB</th></tr>\n".
+          "<tr class=\"blue\"><th>en</th><th>$LANG</th><th>diff</th></tr>\n";
     foreach($missing_tags as $val) {
         // Shorten the filename (we have directory headers)
         $short_file = basename($val[0]);
@@ -896,15 +976,17 @@
         if ($new_dir != $prev_dir) {
         
             // Print out directory header
-            print "<tr class=blue><th colspan=4>$new_dir</th></tr>\n";
+            echo "<tr class=\"blue\"><th colspan=\"4\">$new_dir</th></tr>\n";
         
             // Store the new actual directory
             $prev_dir = $new_dir;
         }
-        print "<tr class=wip><td>$short_file</td><td class=r>$val[1]</td>".
-              "<td class=r>$val[2]</td><td class=r>$val[3]</td></tr>\n";
+        echo "<tr class=\"wip\"><td>$short_file</td><td class=\"r\">$val[1]</td>".
+              "<td class=\"r\">$val[2]</td><td class=\"r\">$val[3]</td></tr>\n";
     }
-    print "</table>\n<p>&nbsp;</p>\n$navbar<p>&nbsp;</p>\n";
+    echo "</table>\n
+      <p class=\"c\"><a href=\"#top\">^Top^</a></p>
+    </div>\n";
 }
 
 // Merge all work in progress files collected
@@ -923,9 +1005,10 @@
 // Files not translated and not "wip"
 $count = count($missing_files);
 if ($count > 0) {
-    print "<a name=\"missfiles\"></a>" .
-          "<table width=\"400\" border=\"0\" cellpadding=\"3\" cellspacing=\"1\" align=\"center\">\n" .
-          "<tr class=blue><th><a name=\"avail\" class=\"ref\">" .
+    print "<div id=\"Dmissfiles\">
+            <a name=\"missfiles\" id=\"missfiles\"></a>" .
+          "<table>\n" .
+          "<tr class=\"blue\"><th><a name=\"avail\" class=\"ref\">" .
           " Available for translation</a> ($count files):</th><th>kB</th></tr>\n";
     foreach($missing_files as $file => $info) {
         // Shorten the filename (we have directory headers)
@@ -938,20 +1021,27 @@
         if ($new_dir != $prev_dir) {
         
             // Print out directory header if not "."
-            print "<tr class=blue><th colspan=2>$new_dir</th></tr>\n";
+            print "<tr class=\"blue\"><th colspan=\"2\">$new_dir</th></tr>\n";
         
             // Store the new actual directory
             $prev_dir = $new_dir;
         }
 
-        print "<tr class=wip><td><a href=\"http://cvs.php.net/co.php/phpdoc/en/$file\";>$short_file</a></td>" .
-              "<td class=r>$info[0]</td></tr>\n";
+        print "<tr class=\"wip\"><td><a href=\"http://cvs.php.net/co.php/phpdoc/en/$file\";>$short_file</a></td>" .
+              "<td class=\"r\">$info[0]</td></tr>\n";
     }
-    print "</table>\n<p>&nbsp;</p>\n$navbar<p>&nbsp;</p>\n";
+    print "</table>\n
+     <p class=\"c\"><a href=\"#top\">^Top^</a></p>
+    </div>\n";
 
 }
 
 // All OK, end the file
-print "</body>\n</html>\n";
+print "
+<script type=\"text/javascript\">
+go('Dintro', 'Aintro');
+go('Dtranslators', 'Atranslators');
+</script>
+</body>\n</html>\n";
 
 ?>

Reply via email to