]> git.donarmstrong.com Git - debbugs.git/commitdiff
add templating for pkgindex.cgi
authorDon Armstrong <don@donarmstrong.com>
Thu, 6 Dec 2012 20:13:28 +0000 (12:13 -0800)
committerDon Armstrong <don@donarmstrong.com>
Thu, 6 Dec 2012 20:13:28 +0000 (12:13 -0800)
cgi/pkgindex.cgi
templates/en_US/cgi/pkgindex.tmpl [new file with mode: 0644]

index 767b5721ca420a7363cf7b008f6be7e1aaaad4b4..793cda252a25627fd6fa5205c27958dd59e2ac91 100755 (executable)
@@ -85,9 +85,9 @@ if ($indexon eq "pkg") {
   foreach my $pkg (keys %count) {
     $sortkey{$pkg} = lc $pkg;
     $htmldescrip{$pkg} = sprintf('<a href="%s">%s</a> (%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('<a href="%s">%s</a> (%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.</p>\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 .= "</ul>\n";
 
 print "Content-Type: text/html\n\n";
 
-print "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n";
-print "<HTML><HEAD>\n" . 
-    "<TITLE>$gProject$Archived $gBug reports by $tag</TITLE>\n" .
-    qq(<LINK REL="stylesheet" HREF="$gWebHostBugDir/css/bugs.css" TYPE="text/css">) .
-    "</HEAD>\n" .
-    '<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000FF" VLINK="#800080">' .
-    "\n";
-print "<H1>" . "$gProject$Archived $gBug report logs by $tag" .
-      "</H1>\n";
-
-print $note;
-print <<END;
-<form>
-<input type="hidden" name="skip" value="$param{skip}">
-<input type="hidden" name="max_results" value="$param{max_results}">
-<input type="hidden" name="indexon" value="$param{indexon}">
-<input type="hidden" name="repeatmerged" value="$param{repeatmerged}">
-<input type="hidden" name="archive" value="$param{archive}">
-<input type="hidden" name="sortby" value="$param{sortby}">
-END
-if (defined $param{first}) {
-     print qq(<input type="hidden" name="first" value="$param{first}">\n);
-}
-else {
-     print q(<p>);
-     if ($param{skip} > 0) {
-         print q(<input type="submit" name="prev" value="Prev">);
-     }
-     if (keys %count > ($param{skip} + $param{max_results})) {
-         print q(<input type="submit" name="next" value="Next">);
-     }
-     print qq(</p>\n);
-}
-print $result;
-
-print "<hr>\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 "</body></html>\n";
+
diff --git a/templates/en_US/cgi/pkgindex.tmpl b/templates/en_US/cgi/pkgindex.tmpl
new file mode 100644 (file)
index 0000000..3974f22
--- /dev/null
@@ -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))}
+</head>
+<body>
+<h1>{html_escape($config{project})} {html_escape($config{bug})} report logs by {html_escape($tag)}</h1> 
+{$note}
+<form>
+<input type="hidden" name="skip" value="$param{skip}">
+<input type="hidden" name="max_results" value="$param{max_results}">
+<input type="hidden" name="indexon" value="$param{indexon}">
+<input type="hidden" name="repeatmerged" value="$param{repeatmerged}">
+<input type="hidden" name="archive" value="$param{archive}">
+<input type="hidden" name="sortby" value="$param{sortby}">
+{ my $output = '';
+if (defined $param{first}) {
+    $output .= qq(<input type="hidden" name="first" value=").html_escape($param{first}).qq(">\n);
+} else {
+    $output .= q(<p>);
+     if ($param{skip}> 0) {
+        $output .= q(<input type="submit" name="prev" value="Prev">);
+     }
+     if (keys %count > ($param{skip} + $param{max_results})) {
+         $output .= q(<input type="submit" name="next" value="Next">);
+     }
+     $output .= qq(</p>\n);
+}
+$output;
+}
+{ $result }
+<hr/>
+{include(q(html/html_tail))}
+</body>
+</html>