tom Fri Nov 1 04:52:44 2002 EDT Modified files: /phpdoc/scripts revcheck.php Log: speed up the stuff, let navbar only link to really shown sections, a small reduction of html-size
Index: phpdoc/scripts/revcheck.php diff -u phpdoc/scripts/revcheck.php:1.31 phpdoc/scripts/revcheck.php:1.32 --- phpdoc/scripts/revcheck.php:1.31 Wed Oct 23 16:26:27 2002 +++ phpdoc/scripts/revcheck.php Fri Nov 1 04:52:43 2002 @@ -92,23 +92,14 @@ // in cvs). We do need the trailing slash! $DOCDIR = "../"; -$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> | " . - "<a href=\"#wip\">Work in progress</a> | " . - "<a href=\"#misstags\">Missing revision numbers</a> | " . - "<a href=\"#missfiles\">Untranslated files</a></p>\n"; - // ========================================================================= // Functions to get revision info and credits from a file // ========================================================================= -// Grabs the revision tag from the file given -function get_tag($file, $val = "en-rev") +// Grabs the revision tag and stores credits from the file given +function get_tags($file, $val = "en-rev") { - // Read the first 500 chars. The comment should be at // the begining of the file $fp = @fopen($file, "r") or die ("Unable to read $file."); @@ -121,7 +112,27 @@ preg_match("/<!-- .Revision: \d+\.(\d+) . -->/", $line, $match); return $match[1]; } + + // Handle credits (only if no maintainer is specified) + if ($val == "\\S*") { + global $files_by_maint; + + // Find credits info, let more credits then one, + // using commas as list separator + if (preg_match("'<!--\s*CREDITS:\s*(.+)\s*-->'U", $line, $match_credit)) { + + // Explode with commas a separators + $credits = explode(",", $match_credit[1]); + + // Store all elements + foreach ($credits as $num => $credit) { + $files_by_maint[trim($credit)][REV_CREDIT]++; + } + + } + } + // No match before the preg $match = array(); @@ -145,240 +156,117 @@ // Return with found revision info (number, maint, status) return $match; -} // get_tag() function end - -// Grab CREDITS tag, the place to store previous credits -function get_credits ($file) { - - // Read the first 500 chars, the comment should be at - // the begining of the file, if it is there - $fp = @fopen($file, "r") or die ("Unable to read $file."); - $line = fread($fp, 500); - fclose($fp); - - // Try to find credits info in file, let more credits - // then one, using commas as list separator - if (preg_match("'<!--\s*CREDITS:\s*(.+)\s*-->'U", - $line, - $match)) { - - // Explode with commas a separators - $credits = explode(",", $match[1]); - - // Trim all elements (let spaces to be - // between credit info) - foreach ($credits as $num => $credit) { - $credits[$num] = trim($credit); - } - - return $credits; - - } else { - - // No credits info in this file - return array(); - } +} // get_tags() function end -} // get_credits() end // ========================================================================= // Functions to check file status in translated directory, and store info // ========================================================================= -// Collect or return missing files depending on -// the parameters passed to this function -function missing_file() -{ - // Static var to store info, and return if asked - static $missing_files = array(); - global $DOCDIR, $LANG; - - // Return with the missing files, - // in case of no parameters to this function - if (func_num_args() == 0) { - return $missing_files; - } - - // Get the parameters if we have them - list($en_file, $trans_file) = func_get_args(); - - // Compute new index for missing file (name without language dir) - $index = substr($trans_file, strlen($DOCDIR) + strlen($LANG) + 1); - - // Compute new value for missing file (size and EN revision) - $value = array( - round(filesize($en_file)/1024, 1), - "1." . get_tag($en_file) - ); - - // Push file into array - $missing_files[$index] = $value; - -} // missing_file() function end - -// Collect or return files with missing tags depending on -// the parameters passed to this function -function missing_tag() -{ - // Static var to store info, and return if asked - static $missing_tags = array(); - global $DOCDIR; - - // Return with the file with missing tags, - // in case of no parameters to this function - if (func_num_args() == 0) { - return $missing_tags; - } - - // Get the parameter if we have it - list($trans_file, $en_size, $trans_size, $size_diff) = func_get_args(); - - // Push data of file with missing tag onto the list - $missing_tags[] = array(substr($trans_file, strlen($DOCDIR)), $en_size, $trans_size, $size_diff); -} - -// Collect files by status mark -function files_by_mark() -{ - // Static var to store info, and return if asked - static $files_by_mark = array(); - - // Return with the file with missing tags, - // in case of no parameters to this function - if (func_num_args() == 0) { - return $files_by_mark; - } - - // Get the parameter if we have it - list($mark, $inc) = func_get_args(); - - // Add one to the count of this type of files - $files_by_mark[$mark] += $inc; - -} - -// Collect files by maintainer and status mark -function files_by_maint() -{ - // Static var to store info, and return if asked - static $files_by_maint = array(); - - // Return with the file with missing tags, - // in case of no parameters to this function - if (func_num_args() == 0) { - return $files_by_maint; - } - - // Get the parameter if we have it - list($mark, $maint) = func_get_args(); - - // Add one to the maintainers files list, - // especially counting this type of file - $files_by_maint[$maint][$mark]++; - -} - // Checks a file, and gather status info function get_file_status($file) { // The information is contained in these global arrays and vars - global $DOCDIR, $LANG, $MAINT; - - // Transform english file name to translated file nme - $trans_file = preg_replace("'^{$DOCDIR}en/'", "{$DOCDIR}{$LANG}/", $file); + global $DOCDIR, $LANG, $MAINT, $files_by_mark, $files_by_maint; + global $missing_files, $missing_tags, $using_rev; + + // Transform english file name to translated file name + $trans_file = preg_replace("'^".$DOCDIR."en/'", $DOCDIR.$LANG."/", $file); // If we cannot find the file, we push it into the missing files list if (!@file_exists($trans_file)) { - files_by_mark(REV_NOTRANS, 1); - missing_file($file, $trans_file); + $files_by_mark[REV_NOTRANS]++; + $trans_name = substr($trans_file, strlen($DOCDIR) + strlen($LANG) + 1); + $missing_files[$trans_name] = array( round(filesize($file)/1024, 1) ); + // compute en-tags just if they're needed in the WIP-Table + if($using_rev) { + $missing_files[$trans_name][] = "1.".get_tags($file); + } return FALSE; } - // Get credits from file and collect it - $this_credits = get_credits($trans_file); - - // Add credits to file by maintainer list - foreach ($this_credits as $nick) { - files_by_maint(REV_CREDIT, $nick); + // No specific maintainer, check for a revision tag + if (empty($MAINT)) { + $trans_tag = get_tags($trans_file, "\\S*"); } - // If we need to check for a specific translator - if (!empty($MAINT)) { + else { // Get translated files tag, with maintainer - $trans_tag = get_tag($trans_file, $MAINT); + $trans_tag = get_tags($trans_file, $MAINT); // If this is a file belonging to another // maintainer, than we would not like to // deal with it anymore if (count($trans_tag) == 0) { - $trans_tag = get_tag($trans_file, "\\S*"); + $trans_tag = get_tags($trans_file, "\\S*"); // We found a tag for another maintainer if (count($trans_tag) > 0) { return FALSE; } } } - // No specific maintainer, check for a revision tag - else { - $trans_tag = get_tag($trans_file, "\\S*"); + + // Compute sizes and diffs + $en_size = intval(filesize($file) / 1024); + $trans_size = intval(filesize($trans_file) / 1024); + $size_diff = intval($en_size) - intval($trans_size); + + // If we found no revision tag, then collect this + // file in the missing tags list + if (count($trans_tag) == 0) { + $files_by_mark[REV_NOTAG]++; + $missing_tags[] = array(substr($trans_file, strlen($DOCDIR)), $en_size, +$trans_size, $size_diff); + return FALSE; } // Distribute values in separate vars for further processing list(, $this_rev, $this_maint, $this_status) = $trans_tag; - // Get translated file name (without directories) - $trans_name = substr($trans_file, strlen($DOCDIR) + strlen($LANG) + 1); - - // Get English file revision for revision computing - $en_rev = get_tag($file); + // Get English file revision + $en_rev = get_tags($file); // If we have a numeric revision number (not n/a), compute rev. diff if (is_numeric($this_rev)) { $rev_diff = intval($en_rev) - intval($this_rev); - $trans_rev = "1.{$this_rev}"; - $en_rev = "1.{$en_rev}"; + $trans_rev = "1." . $this_rev; + $en_rev = "1." . $en_rev; } else { - // If we have no numeric revision, make all revision - // columns hold the rev from the translated file - $rev_diff = $trans_rev = $this_rev; - $en_rev = "1.{$en_rev}"; + // If we have no numeric revision, make all revision + // columns hold the rev from the translated file + $rev_diff = $trans_rev = $this_rev; + $en_rev = "1." . $en_rev; } - // Compute sizes, times and diffs - $en_size = intval(filesize($file) / 1024); - $trans_size = intval(filesize($trans_file) / 1024); - $size_diff = intval($en_size) - intval($trans_size); - + // If the file is up-to-date + if ($rev_diff === 0) { + // Store file by status and maintainer + $files_by_mark[REV_UPTODATE]++; + $files_by_maint[$this_maint][REV_UPTODATE]++; + + return FALSE; + } + + // Compute times and diffs $en_date = intval((time() - filemtime($file)) / 86400); $trans_date = intval((time() - filemtime($trans_file)) / 86400); $date_diff = $en_date - $trans_date; - // If we found no revision tag, then collect this - // file in the missing tags list - if (count($trans_tag) == 0) { - files_by_mark(REV_NOTAG, 1); - missing_tag($trans_file, $en_size, $trans_size, $size_diff); - return FALSE; - } - // Make decision on file category by revision, date and size - if ($rev_diff === 0) { - $status_mark = REV_UPTODATE; + if ($rev_diff >= ALERT_REV || $size_diff >= ALERT_SIZE || $date_diff <= +ALERT_DATE) { + $status_mark = REV_CRITICAL; } elseif ($rev_diff === "n/a") { $status_mark = REV_NOREV; - } elseif ($rev_diff >= ALERT_REV || $size_diff >= ALERT_SIZE || $date_diff <= ALERT_DATE) { - $status_mark = REV_CRITICAL; } else { $status_mark = REV_OLD; } - + // Store files by status, and by maintainer too - files_by_mark ($status_mark, 1); - files_by_maint($status_mark, $this_maint); - + $files_by_mark[$status_mark]++; + $files_by_maint[$this_maint][$status_mark]++; + return array( "full_name" => $file, - "short_name" => $trans_name, + "short_name" => basename($trans_file), "revision" => array($en_rev, $trans_rev, $rev_diff), "size" => array($en_size, $trans_size, $size_diff), "date" => array($en_date, $trans_date, $date_diff), @@ -386,10 +274,7 @@ "status" => $this_status, "mark" => $status_mark ); - - - return TRUE; - + } // get_file_status() function end // ========================================================================= @@ -398,7 +283,7 @@ // Check the status of files in a diretory of phpdoc XML files // The English directory is passed to this function to check -function get_dir_status($dir, $DOCDIR, $LANG) +function get_dir_status($dir) { // If this is an old "functions" directory // (not under reference) then do not travers @@ -444,7 +329,7 @@ $dir_status = array(); foreach ($files as $file) { // If the file status is OK, append the status info - if ($file_status = get_file_status("{$dir}{$file}")) { + if ($file_status = get_file_status($dir.$file)) { $dir_status[] = $file_status; } } @@ -454,7 +339,7 @@ foreach ($directories as $file) { $dir_status = array_merge( $dir_status, - get_dir_status("{$dir}{$file}/", $DOCDIR, $LANG) + get_dir_status($dir.$file.'/') ); } @@ -499,9 +384,11 @@ // translation related meta information function parse_translation($DOCDIR, $LANG, $MAINT) { + global $files_by_mark; + // Path to find translation.xml file, set default values, // in case we can't find the translation file - $translation_xml = "{$DOCDIR}{$LANG}/translation.xml"; + $translation_xml = $DOCDIR.$LANG."/translation.xml"; $output_charset = 'iso-8859-1'; $translation = array( "intro" => "", @@ -523,11 +410,11 @@ // Get intro text (different for a persons info and // for a whole group info page) - if (!empty($MAINT)) { - $translation["intro"] = "Personal Statistics for {$MAINT}"; - } else { + if (empty($MAINT)) { preg_match("!<intro>(.+)</intro>!s", $txml, $match); $translation["intro"] = trim($match[1]); + } else { + $translation["intro"] = "Personal Statistics for ".$MAINT; } // Get encoding for the output, from the translation.xml @@ -539,10 +426,10 @@ // Get persons list preg pattern, only check for a specific // maintainer, if the users asked for it - if (!empty($MAINT)) { - $pattern = "!<person([^<]+nick=\"{$MAINT}\".+)/\\s?>!U"; - } else { + if (empty($MAINT)) { $pattern = "!<person(.+)/\\s?>!U"; + } else { + $pattern = "!<person([^<]+nick=\"".$MAINT."\".+)/\\s?>!U"; } // Find all persons matching the pattern @@ -550,10 +437,19 @@ $translation['persons'] = parse_attr_string($matches[1]); // Get list of work in progress files - if (!empty($MAINT)) { + if (empty($MAINT)) { + // Get all wip files + preg_match_all("!<file(.+)/\\s?>!U", $txml, $matches); + $translation['files'] = parse_attr_string($matches[1]); + + // Provide info about number of WIP files + $files_by_mark[REV_WIP] += count($translation['files']); + + } else { + // Only check for a specific maintainer, if we were asked to - preg_match_all("!<file([^<]+person=\"{$MAINT}\".+)/\\s?>!U", $txml, $matches); + preg_match_all("!<file([^<]+person=\"".$MAINT."\".+)/\\s?>!U", $txml, +$matches); $translation['files'] = parse_attr_string($matches[1]); // Other maintainers wip files need to be cleared from @@ -562,16 +458,7 @@ $translation['allfiles'] = parse_attr_string($matches[1]); // Provide info about number of WIP files - files_by_mark(REV_WIP, count($translation['allfiles'])); - - } else { - - // Get all wip files - preg_match_all("!<file(.+)/\\s?>!U", $txml, $matches); - $translation['files'] = parse_attr_string($matches[1]); - - // Provide info about number of WIP files - files_by_mark(REV_WIP, count($translation['files'])); + $files_by_mark[REV_WIP] += count($translation['allfiles']); } @@ -604,22 +491,28 @@ // Parse translation.xml file for more information list($charset, $translation) = parse_translation($DOCDIR, $LANG, $MAINT); -// Add WIP files to maintainers file count +// Add WIP files to maintainers file count and figure out, +// if we need to use optional date and revision columns +$using_date = FALSE; $using_rev = FALSE; foreach ($translation["files"] as $num => $fileinfo) { - files_by_maint(REV_WIP, $fileinfo["person"]); + $files_by_maint[$fileinfo["person"]][REV_WIP]++; + if (isset($fileinfo["date"])) { $using_date = TRUE; } + if (isset($fileinfo["revision"])) { $using_rev = TRUE; } } // Get all files status -$files_status = get_dir_status("{$DOCDIR}en/", $DOCDIR, $LANG); +$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"; -// Get missing files and files with missing -// tags collected in the previous step -$missing_files = missing_file(); -$missing_tags = missing_tag(); - -// Files counted by mark and maintainer -$files_by_mark = files_by_mark(); -$files_by_maint = files_by_maint(); // Figure out generation date $date = date("r"); @@ -647,8 +540,8 @@ .old { background-color:#eee8aa; } .crit { background-color:#ff6347; } .wip { background-color:#dcdcdc; } -.miss { background-color:#dddddd; } .r { text-align:right } +.rb { text-align:right; font-weight:bold; } .c { text-align:center } body { margin:0px 0px 0px 0px; background-color:#F0F0F0; } //--> @@ -688,12 +581,12 @@ print <<<END_OF_MULTILINE <a name="translators"></a> <table width="820" border="0" cellpadding="4" cellspacing="1" align="center"> -<tr> -<th rowspan="2" class="blue">Translator's name</th> -<th rowspan="2" class="blue">Contact email</th> -<th rowspan="2" class="blue">Nick</th> -<th rowspan="2" class="blue">C<br>V<br>S</th> -<th colspan="7" class="blue">Files maintained</th> +<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> @@ -751,17 +644,17 @@ print("<tr class=$col>" . "<td><a name=\"maint$num\">$person[name]</a></td>" . "<td>$person[email]</td>" . - "<td>$person[nick] </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>" . $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> </p>\n"; } @@ -774,13 +667,13 @@ // for only one maintainer (his personal summary is in the table above) if (empty($MAINT)) { -print <<<END_OF_MULTILINE + print <<<END_OF_MULTILINE <a name="filesummary"></a> <table width="450" border="0" cellpadding="4" cellspacing="1" align="center"> -<tr> -<th class="blue">File status type</th> -<th class="blue">Number of files</th> -<th class="blue">Percent of files</th> +<tr class=blue> +<th>File status type</th> +<th>Number of files</th> +<th>Percent of files</th> </tr> END_OF_MULTILINE; @@ -797,31 +690,15 @@ ); foreach ($file_types as $num => $type) { - $type[] = 'class="' . $CSS[$type[0]] . '"'; - $type[] = intval($files_by_mark[$type[0]]); - $type[] = number_format( - $files_by_mark[$type[0]] * 100 / $files_sum, 2 - ); - -print <<<END_OF_MULTILINE -<tr> - <td {$type[2]}>{$type[1]}</td> - <td {$type[2]} align="center">{$type[3]}</td> - <td {$type[2]} align="center">{$type[4]}%</td> -</tr> -END_OF_MULTILINE; - + 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></tr>\n"; } -print <<<END_OF_MULTILINE -<tr> -<th class="blue">Files total</th> -<th class="blue">{$files_sum}</th> -<th class="blue">100%</th> -</tr> -END_OF_MULTILINE; - - print("</table>\n<p> </p>\n"); + print "<tr class=blue><th>Files +total</th><th>$files_sum</th><th>100%</th></tr>\n". + "</table>\n<p> </p>\n"; } @@ -835,38 +712,33 @@ print <<<END_OF_MULTILINE <a name="files"></a> <table width="820" border="0" cellpadding="4" cellspacing="1" align="center"> -<tr> -<th rowspan="2" class="blue">Translated file</th> -<th colspan="3" class="blue">Revision</th> -<th colspan="3" class="blue">Size in kB</th> -<th colspan="3" class="blue">Age in days</th> -<th rowspan="2" class="blue">Maintainer</th> -<th rowspan="2" class="blue">Status</th> +<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> -<th class="blue">en</th> -<th class="blue">$LANG</th> -<th class="blue">diff</th> -<th class="blue">en</th> -<th class="blue">$LANG</th> -<th class="blue">diff</th> -<th class="blue">en</th> -<th class="blue">$LANG</th> -<th class="blue">diff</th> +<tr class=blue> +<th>en</th> +<th>$LANG</th> +<th>diff</th> +<th>en</th> +<th>$LANG</th> +<th>diff</th> +<th>en</th> +<th>$LANG</th> +<th>diff</th> </tr> END_OF_MULTILINE; // This was the previous directory [first] -$prev_dir = $new_dir = "{$DOCDIR}en"; +$prev_dir = $new_dir = $DOCDIR."en"; // Go through all files collected foreach ($files_status as $num => $file) { - // Do not print out actual files - if ($file["mark"] == REV_UPTODATE) { - continue; - } - // 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"]] . @@ -880,23 +752,20 @@ preg_replace( "'^".$DOCDIR."'", "phpdoc/", $file["full_name"]) . "?r1=" . $file["revision"][1] . "&r2=" . $file["revision"][0] . - CVS_OPT . "\">" . basename($file["short_name"]) . "</a>"; - } else { - // Else just shorten the filename (we have directory headers) - $file["short_name"] = basename($file["short_name"]); + CVS_OPT . "\">" . $file["short_name"] . "</a>"; } // Guess the new directory from the full name of the file - $new_dir = substr($file["full_name"], 0, strrpos($file["full_name"], "/")); + $new_dir = dirname($file["full_name"]); // If this is a new directory, put out dir headline if ($new_dir != $prev_dir) { - // Drop out the unneded parts from the dirname... - $display_dir = str_replace("{$DOCDIR}en/", "", dirname($file["full_name"])); + // 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\" height=\"3\">$display_dir</th></tr>\n"; + print "<tr class=blue><th colspan=12>$display_dir</th></tr>\n"; // Store the new actual directory $prev_dir = $new_dir; @@ -906,13 +775,13 @@ print "<tr class={$CSS[$file['mark']]}><td>{$file['short_name']}</td>". "<td> {$file['revision'][0]}</td>" . "<td> {$file['revision'][1]}</td>". - "<td class=r><b>{$file['revision'][2]}</b> </td>". + "<td class=rb>{$file['revision'][2]} </td>". "<td class=r>{$file['size'][0]} </td>". "<td class=r>{$file['size'][1]} </td>". - "<td class=r><b>{$file['size'][2]}</b> </td>". + "<td class=rb>{$file['size'][2]} </td>". "<td class=r>{$file['date'][0]} </td>". "<td class=r>{$file['date'][1]} </td>". - "<td class=r><b>{$file['date'][2]}</b> </td>". + "<td class=rb>{$file['date'][2]} </td>". "<td class=c>{$file['maintainer']}</td>". "<td class=c>".trim($file['status'])."</td></tr>\n"; @@ -928,30 +797,21 @@ // If work-in-progress list is available (valid translation.xml file in lang) if (count($translation["files"]) != 0) { - // Figure out, if we need to use optional date and - // revision columns (if there is no file with that parameter, - // we won't include the table column for that) - $using_date = FALSE; $using_rev = FALSE; - foreach ($translation["files"] as $file) { - if (isset($file["date"])) { $using_date = TRUE; } - if (isset($file["revision"])) { $using_rev = TRUE; } - } - // Print out files table header print "<a name=\"wip\"></a>\n" . "<table width=\"820\" border=\"0\" cellpadding=\"4\" cellspacing=\"1\" align=\"center\">\n" . - "<tr>". - "<th class=\"blue\">Work in progress files</th>". - "<th class=\"blue\">Translator</th>". - "<th class=\"blue\">Type</th>"; + "<tr class=blue>". + "<th>Work in progress files</th>". + "<th>Translator</th>". + "<th>Type</th>"; // Print out date and revision columns if needed if ($using_date) { - print '<th class="blue">Date</th>' . ""; + print '<th>Date</th>'; } if ($using_rev) { - print '<th class="blue">CO-Revision</th>' . - '<th class="blue">EN-Revision</th>'; + print '<th>CO-Revision</th>' . + '<th>EN-Revision</th>'; } print "</tr>\n"; @@ -965,7 +825,7 @@ } // Print out the line with the first columns - print "<tr class=miss><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 @@ -996,7 +856,7 @@ 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><b>Files without Revision-comment ($count files):</b></th>". + "<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) { @@ -1004,22 +864,21 @@ $short_file = basename($val[0]); // Guess the new directory from the full name of the file - $new_dir = substr($val[0], 0, strrpos($val[0], "/")); + $new_dir = dirname($val[0]); // If this is a new directory, put out dir headline if ($new_dir != $prev_dir) { // Print out directory header - print "<tr class=blue><th colspan=4>".dirname($val[0])."</th></tr>\n"; + print "<tr class=blue><th colspan=4>$new_dir</th></tr>\n"; // Store the new actual directory $prev_dir = $new_dir; } - print "<tr class=miss><td>$short_file</td><td class=r>$val[1]</td>". + 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"; } print "</table>\n<p> </p>\n$navbar<p> </p>\n"; - } // Merge all work in progress files collected @@ -1040,26 +899,26 @@ if ($count > 0) { print "<a name=\"missfiles\"></a>" . "<table width=\"400\" border=\"0\" cellpadding=\"3\" cellspacing=\"1\" align=\"center\">\n" . - "<tr><th class=blue><b><a name=\"avail\" class=\"ref\">" . - " Available for translation</a> ($count files):</b></th><th class=blue><b>kB</b></th></tr>\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) $short_file = basename($file); // Guess the new directory from the full name of the file - $new_dir = substr($file, 0, strrpos($file, "/")); + $new_dir = dirname($file); // If this is a new directory, put out dir headline if ($new_dir != $prev_dir) { // Print out directory header if not "." - print "<tr class=blue><th colspan=\"2\">".dirname($file)."</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=miss><td>$short_file</td>" . + print "<tr class=wip><td>$short_file</td>" . "<td class=r>$info[0]</td></tr>\n"; } print "</table>\n<p> </p>\n$navbar<p> </p>\n";
-- PHP Documentation Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php