From b5369abc094a0879c1b475b1a85e88debf2547ec Mon Sep 17 00:00:00 2001
From: Don Armstrong
Date: Thu, 6 Dec 2012 12:13:28 -0800
Subject: [PATCH 1/1] add templating for pkgindex.cgi
---
cgi/pkgindex.cgi | 58 ++++++++-----------------------
templates/en_US/cgi/pkgindex.tmpl | 32 +++++++++++++++++
2 files changed, 47 insertions(+), 43 deletions(-)
create mode 100644 templates/en_US/cgi/pkgindex.tmpl
diff --git a/cgi/pkgindex.cgi b/cgi/pkgindex.cgi
index 767b572..793cda2 100755
--- a/cgi/pkgindex.cgi
+++ b/cgi/pkgindex.cgi
@@ -85,9 +85,9 @@ if ($indexon eq "pkg") {
foreach my $pkg (keys %count) {
$sortkey{$pkg} = lc $pkg;
$htmldescrip{$pkg} = sprintf('%s (%s)',
- package_links(package => $pkg, links_only=>1),
- html_escape($pkg),
- package_links(maint=>$maintainers{$pkg}//[]));
+ package_links(package => $pkg, links_only=>1),
+ html_escape($pkg),
+ package_links(maint=>$maintainers{$pkg}//['']));
}
} elsif ($indexon eq "src") {
$tag = "source package";
@@ -115,7 +115,7 @@ if ($indexon eq "pkg") {
$htmldescrip{$src} = sprintf('%s (%s)',
package_links(src => $src, links_only=>1),
html_escape($src),
- package_links(maint => $maintainers{$src}//[]));
+ package_links(maint => $maintainers{$src}//['']));
}
} elsif ($indexon eq "maint") {
$tag = "maintainer";
@@ -147,7 +147,7 @@ if ($indexon eq "pkg") {
$note .= "different addresses.
\n";
foreach my $maint (keys %count) {
$sortkey{$maint} = lc $email2maint{$maint} || "(unknown)";
- $htmldescrip{$maint} = package_links(maint => $email2maint{$maint}//[]);
+ $htmldescrip{$maint} = package_links(maint => $email2maint{$maint}//['']);
}
} elsif ($indexon eq "submitter") {
$tag = "submitter";
@@ -226,44 +226,16 @@ $result .= "\n";
print "Content-Type: text/html\n\n";
-print "\n";
-print "\n" .
- "$gProject$Archived $gBug reports by $tag\n" .
- qq() .
- "\n" .
- '' .
- "\n";
-print "" . "$gProject$Archived $gBug report logs by $tag" .
- "
\n";
-
-print $note;
-print <
-
-
-
-
-
-
-END
-if (defined $param{first}) {
- print qq(\n);
-}
-else {
- print q();
- if ($param{skip} > 0) {
- print q();
- }
- if (keys %count > ($param{skip} + $param{max_results})) {
- print q();
- }
- print qq(
\n);
-}
-print $result;
-
-print "
\n";
-print fill_in_template(template=>'html/html_tail',
+print fill_in_template(template=>'cgi/pkgindex.tmpl',
+ variables => {count => \%count,
+ param => \%param,
+ result => $result,
+ html_escape => \&Debbugs::CGI::html_escape,
+ archived => $Archived,
+ note => $note,
+ tag => $tag,
+ },
hole_var => {'&strftime' => \&POSIX::strftime,
},
);
-print "\n";
+
diff --git a/templates/en_US/cgi/pkgindex.tmpl b/templates/en_US/cgi/pkgindex.tmpl
new file mode 100644
index 0000000..3974f22
--- /dev/null
+++ b/templates/en_US/cgi/pkgindex.tmpl
@@ -0,0 +1,32 @@
+{include(q(html/pre_title))}{html_escape($config{project})} {html_escape($config{bug})} report logs by {html_escape($tag)}{include(q(html/post_title.tmpl))}
+
+
+{html_escape($config{project})} {html_escape($config{bug})} report logs by {html_escape($tag)}
+{$note}
+