Hi Geroge,
I have applied your fix to both phpdoc and smarty. Thank you.
Mehdi
George Miroshnikov wrote:
Please review this patch (general and smarty versions). It hides the files table (header) if no outdated files found. Well, this is not a "mission-critical" patch, but why not? :)
------------------------------------------------------------------------
Index: docs/scripts/revcheck.php
===================================================================
RCS file: /repository/smarty/docs/scripts/revcheck.php,v
retrieving revision 1.4
diff -u -u -r1.4 revcheck.php
--- docs/scripts/revcheck.php 25 Oct 2004 11:13:34 -0000 1.4
+++ docs/scripts/revcheck.php 29 Oct 2004 11:51:18 -0000
@@ -721,6 +721,8 @@
// Files table goes here
// =========================================================================
+if (count($files_status) != 0) {
+
print <<<END_OF_MULTILINE
<a name="files"></a>
<table width="820" border="0" cellpadding="4" cellspacing="1" align="center">
@@ -745,63 +747,64 @@
</tr>
END_OF_MULTILINE;
-// This was the previous directory [first]
-$prev_dir = $new_dir = $DOCDIR."en";
-
-// Go through all files collected
-foreach ($files_status as $num => $file) {
-
- // Make the maintainer a link, if we have that maintainer in the list
- if (isset($maint_by_nick[$file["maintainer"]])) {
- $file["maintainer"] = '<a href="#maint' . $maint_by_nick[$file["maintainer"]] .
- '">' . $file["maintainer"] . '</a>';
- }
-
- // If we have a 'numeric' revision diff and it is not zero,
- // make a link to the CVS repository's diff script
- if ($file["revision"][2] != "n/a" && $file["revision"][2] !== 0) {
- $file["short_name"] = "<a href=\"http://cvs.php.net/diff.php/" .
- preg_replace( "'^".$DOCDIR."'", "smarty/docs/", $file["full_name"]) .
- "?r1=" . $file["revision"][1] . - "&r2=" . $file["revision"][0] .
- CVS_OPT . "\">" . $file["short_name"] . "</a>";
- }
-
- // Guess the new directory from the full name of the file
- $new_dir = dirname($file["full_name"]);
- - // If this is a new directory, put out dir headline
- if ($new_dir != $prev_dir) {
- - // Drop out the unneeded parts from the dirname...
- $display_dir = str_replace($DOCDIR."en/", "", dirname($file["full_name"]));
- - // Print out directory header
- print "<tr class=blue><th colspan=12>$display_dir</th></tr>\n";
- - // Store the new actual directory
- $prev_dir = $new_dir;
- }
- - // Write out the line for the current file (get file name shorter)
- print "<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";
+ // This was the previous directory [first]
+ $prev_dir = $new_dir = $DOCDIR."en";
+ + // Go through all files collected
+ foreach ($files_status as $num => $file) {
+ + // Make the maintainer a link, if we have that maintainer in the list
+ if (isset($maint_by_nick[$file["maintainer"]])) {
+ $file["maintainer"] = '<a href="#maint' . $maint_by_nick[$file["maintainer"]] .
+ '">' . $file["maintainer"] . '</a>';
+ }
+ + // If we have a 'numeric' revision diff and it is not zero,
+ // make a link to the CVS repository's diff script
+ if ($file["revision"][2] != "n/a" && $file["revision"][2] !== 0) {
+ $file["short_name"] = "<a href=\"http://cvs.php.net/diff.php/" .
+ preg_replace( "'^".$DOCDIR."'", "smarty/docs/", $file["full_name"]) .
+ "?r1=" . $file["revision"][1] . + "&r2=" . $file["revision"][0] .
+ CVS_OPT . "\">" . $file["short_name"] . "</a>";
+ }
+ + // Guess the new directory from the full name of the file
+ $new_dir = dirname($file["full_name"]);
+ + // If this is a new directory, put out dir headline
+ if ($new_dir != $prev_dir) {
+ + // Drop out the unneeded parts from the dirname...
+ $display_dir = str_replace($DOCDIR."en/", "", dirname($file["full_name"]));
+ + // Print out directory header
+ print "<tr class=blue><th colspan=12>$display_dir</th></tr>\n";
+ + // Store the new actual directory
+ $prev_dir = $new_dir;
+ }
+ + // Write out the line for the current file (get file name shorter)
+ print "<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";
+ + }
+ + print("</table>\n<p> </p>\n$navbar<p> </p>\n");
}
-print("</table>\n<p> </p>\n$navbar<p> </p>\n");
-
-
// =========================================================================
// Work in progress table goes here
// =========================================================================
------------------------------------------------------------------------
Index: scripts/revcheck.php
===================================================================
RCS file: /repository/phpdoc/scripts/revcheck.php,v
retrieving revision 1.47
diff -u -u -r1.47 revcheck.php
--- scripts/revcheck.php 5 Sep 2004 22:11:53 -0000 1.47
+++ scripts/revcheck.php 29 Oct 2004 12:00:44 -0000
@@ -727,6 +727,8 @@
// Files table goes here
// =========================================================================
+if (count($files_status) != 0) {
+
print <<<END_OF_MULTILINE
<a name="files"></a>
<table width="820" border="0" cellpadding="4" cellspacing="1" align="center">
@@ -751,70 +753,72 @@
</tr>
END_OF_MULTILINE;
-// This was the previous directory [first]
-$prev_dir = $new_dir = $DOCDIR."en";
-
-// Go through all files collected
-foreach ($files_status as $num => $file) {
-
- // Make the maintainer a link, if we have that maintainer in the list
- if (isset($maint_by_nick[$file["maintainer"]])) {
- $file["maintainer"] = '<a href="#maint' . $maint_by_nick[$file["maintainer"]] .
- '">' . $file["maintainer"] . '</a>';
- }
-
- // If we have a 'numeric' revision diff and it is not zero,
- // make a link to the CVS repository's diff script
- if ($file["revision"][2] != "n/a" && $file["revision"][2] !== 0) {
- $file["short_name"] = "<a href=\"http://cvs.php.net/diff.php/" .
- preg_replace( "'^".$DOCDIR."'", "phpdoc/", $file["full_name"]) .
- "?r1=" . $file["revision"][1] . - "&r2=" . $file["revision"][0] .
- CVS_OPT . "\">" . $file["short_name"] . "</a>";
- }
-
- // Guess the new directory from the full name of the file
- $new_dir = dirname($file["full_name"]);
- - // If this is a new directory, put out old dir lines
- if ($new_dir != $prev_dir && isset($lines)) {
- echo $prev_diplay_dir;
- echo " ($line_number)</th></tr>";
- echo $lines;
-
- $lines = '';
- $line_number = 0;
- - // Store the new actual directory
- $prev_dir = $new_dir;
- }
- // 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";
- - // Save the line for the current file (get file name shorter)
- $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";
- $line_number++;
-
+ // This was the previous directory [first]
+ $prev_dir = $new_dir = $DOCDIR."en";
+ + // Go through all files collected
+ foreach ($files_status as $num => $file) {
+ + // Make the maintainer a link, if we have that maintainer in the list
+ if (isset($maint_by_nick[$file["maintainer"]])) {
+ $file["maintainer"] = '<a href="#maint' . $maint_by_nick[$file["maintainer"]] .
+ '">' . $file["maintainer"] . '</a>';
+ }
+ + // If we have a 'numeric' revision diff and it is not zero,
+ // make a link to the CVS repository's diff script
+ if ($file["revision"][2] != "n/a" && $file["revision"][2] !== 0) {
+ $file["short_name"] = "<a href=\"http://cvs.php.net/diff.php/" .
+ preg_replace( "'^".$DOCDIR."'", "phpdoc/", $file["full_name"]) .
+ "?r1=" . $file["revision"][1] . + "&r2=" . $file["revision"][0] .
+ CVS_OPT . "\">" . $file["short_name"] . "</a>";
+ }
+ + // Guess the new directory from the full name of the file
+ $new_dir = dirname($file["full_name"]);
+ + // If this is a new directory, put out old dir lines
+ if ($new_dir != $prev_dir && isset($lines)) {
+ echo $prev_diplay_dir;
+ echo " ($line_number)</th></tr>";
+ echo $lines;
+
+ $lines = '';
+ $line_number = 0;
+ + // Store the new actual directory
+ $prev_dir = $new_dir;
+ }
+ // 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";
+ + // Save the line for the current file (get file name shorter)
+ $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";
+ $line_number++;
+ + }
+ + // echo the last dir and $lines
+ echo "$prev_diplay_dir ($line_number)</th></tr>";
+ echo $lines;
+ + print("</table>\n<p> </p>\n$navbar<p> </p>\n");
+ }
-// echo the last dir and $lines
-echo "$prev_diplay_dir ($line_number)</th></tr>";
-echo $lines;
-
-print("</table>\n<p> </p>\n$navbar<p> </p>\n");
-
// =========================================================================
// Work in progress table goes here
