Put on my chain mail suit and change the output format of the PR
database queries once again, because I've received complaints that the HTML output mode of the PR query scripts outputs huge, bloated tables after the style changes I made to beautify HTML output. This moves all the visual tweaks of the output in a CSS stylesheet and add a $t_style option to the common cgi-style.pl script. If not set, the style defaults to empty, but users of cgi-style.pl can set this to a local CSS style like this: $t_style="<style type=\"text/css\">...</style>"; or use it to refer from the header of the HTML output to an external CSS stylesheet. The HTML output size is substantially reduced now (at least 50% of the size was caused by many repetitions of style="" attributes), but it's still larger than the preformatted <pre> output because of all the <tr> and <td> tags.
This commit is contained in:
parent
53d7016417
commit
2152ca53a4
Notes:
svn2git
2020-12-08 03:00:23 +00:00
svn path=/www/; revision=22600
2 changed files with 30 additions and 19 deletions
|
@ -1,4 +1,4 @@
|
|||
# $FreeBSD: www/en/cgi/cgi-style.pl,v 1.16 2000/12/18 04:44:38 knu Exp $
|
||||
# $FreeBSD: www/en/cgi/cgi-style.pl,v 1.17 2000/12/29 09:24:40 knu Exp $
|
||||
#
|
||||
# Perl routines to encapsulate various elements of HTML page style.
|
||||
|
||||
|
@ -11,6 +11,11 @@ $timestamp = "$mo-$md-$yr";
|
|||
# Colors for the body
|
||||
$t_body = "<body text=\"#000000\" bgcolor=\"#ffffff\">";
|
||||
|
||||
# This can be set to either a string containing an inline CSS stylesheet
|
||||
# or to a <link> element that references an external CSS stylesheet, to
|
||||
# make local modifications to the style of a CGI script's output.
|
||||
$t_style = "";
|
||||
|
||||
if (!defined($hsty_base)) {
|
||||
$hsty_base = "..";
|
||||
}
|
||||
|
@ -48,7 +53,7 @@ sub html_header {
|
|||
|
||||
return "Content-type: text/html\n\n" .
|
||||
"<html>\n<head><title>$title</title>\n" .
|
||||
"<meta name=\"robots\" content=\"nofollow\">\n</head>\n$t_body\n" .
|
||||
"<meta name=\"robots\" content=\"nofollow\">\n$t_style\n</head>\n$t_body\n" .
|
||||
"$i_topbar <h1><font color=\"#660000\">$title</font></h1>\n";
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/perl -T
|
||||
# $FreeBSD: www/en/cgi/query-pr-summary.cgi,v 1.45 2004/07/25 00:30:35 keramida Exp $
|
||||
# $FreeBSD: www/en/cgi/query-pr-summary.cgi,v 1.46 2004/08/19 12:43:25 ceri Exp $
|
||||
|
||||
sub escape($) { $_ = $_[0]; s/&/&/g; s/</</g; s/>/>/g; $_; }
|
||||
|
||||
|
@ -75,11 +75,18 @@ if ($html_mode) {
|
|||
$dd = "<dd>"; $dd_x = "";
|
||||
$hr = "<hr>";
|
||||
|
||||
$table = "<table style=\"border-width: 0; background-color: #cccccc\" " .
|
||||
" width=\"100%\" cellspacing=1 cellpadding=2>";
|
||||
$table = "<table width=\"100%\" border=0 cellspacing=1 cellpadding=0>";
|
||||
$table_e = "</table>";
|
||||
|
||||
# print "Content-type: text/html\n";
|
||||
# Customizations for the look and feel of the summary tables.
|
||||
$t_style = "<style type=\"text/css\"><!--\n" .
|
||||
"table { background: #ccc; color: #000; }\n" .
|
||||
"tr { padding: 0; }\n" .
|
||||
"th { background: #ffc; color: #000; padding: 2px;\n" .
|
||||
" text-align: left; font-weight: normal; font-style: italic; }\n" .
|
||||
"td { background: #fff; color: #000; padding: 2px; }\n" .
|
||||
"td a { text-decoration: none; }\n" .
|
||||
"--></style>";
|
||||
|
||||
} else {
|
||||
|
||||
|
@ -487,9 +494,8 @@ sub gnats_summary {
|
|||
next if (($report ne '') && (eval($report) == 0));
|
||||
|
||||
if ($htmlmode) {
|
||||
$title = '<a ' . 'style="text-decoration: none;" ' .
|
||||
'href="' . $query_pr_ref . '?pr=' . $cat . '/' . $number . '">' .
|
||||
$_ . '</a> ';
|
||||
$title = '<a href="' . $query_pr_ref .
|
||||
'?pr=' . $cat . '/' . $number . '">' . $_ . '</a> ';
|
||||
$syn = &html_fixline($syn);
|
||||
gnats_summary_line_html($counter, $state, $date, $title, $resp, $syn);
|
||||
} else {
|
||||
|
@ -519,20 +525,20 @@ sub gnats_summary_line_html {
|
|||
|
||||
print "${table}\n" .
|
||||
" <tr valign=\"center\">\n" .
|
||||
" <td style=\"text-align: left; background-color: #ffffcc\">S</td>\n" .
|
||||
" <td style=\"text-align: left; background-color: #ffffcc\">Submitted</td>\n" .
|
||||
" <td style=\"text-align: left; background-color: #ffffcc\">Tracker</td>\n" .
|
||||
" <td style=\"text-align: left; background-color: #ffffcc\">Resp.</td>\n" .
|
||||
" <td style=\"text-align: left; background-color: #ffffcc\">Description</td>\n" .
|
||||
" <th>S</th>\n" .
|
||||
" <th>Submitted</th>\n" .
|
||||
" <th>Tracker</th>\n" .
|
||||
" <th>Resp.</th>\n" .
|
||||
" <th>Description</th>\n" .
|
||||
" </tr>\n"
|
||||
if ($counter == 0);
|
||||
|
||||
print " <tr valign=\"center\">\n" .
|
||||
" <td style=\"background-color: #ffffff\">$state</td>\n" .
|
||||
" <td style=\"background-color: #ffffff\">$date</td>\n" .
|
||||
" <td style=\"background-color: #ffffff\">$title</td>\n" .
|
||||
" <td style=\"background-color: #ffffff\">$resp</td>\n" .
|
||||
" <td style=\"background-color: #ffffff\">$syn</td>\n" .
|
||||
" <td>$state</td>\n" .
|
||||
" <td>$date</td>\n" .
|
||||
" <td>$title</td>\n" .
|
||||
" <td>$resp</td>\n" .
|
||||
" <td>$syn</td>\n" .
|
||||
" </tr>\n";
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue