]> git.donarmstrong.com Git - debbugs.git/commitdiff
add templates for pkgreport.cgi templates
authorDon Armstrong <don@donarmstrong.com>
Sat, 15 Dec 2012 00:56:41 +0000 (16:56 -0800)
committerDon Armstrong <don@donarmstrong.com>
Sat, 15 Dec 2012 00:56:41 +0000 (16:56 -0800)
cgi/pkgreport.cgi
templates/en_US/cgi/pkgreport.tmpl [new file with mode: 0644]

index d29c3abc7ff56943a7a0a2196be16e5560bda857..40982ef74aa4d0fc26a9b3aa863476dc9b38774f 100755 (executable)
@@ -314,6 +314,15 @@ for my $package (# For binary packages, add the binary package
 }
 
 
+my $pkg = $param{package} if defined $param{package};
+my $src = $param{src} if defined $param{src};
+
+# if this is a psuedopackage, then dist makes no sense
+my $pseudodesc = getpseudodesc();
+if (defined $pseudodesc and defined $pkg and exists $pseudodesc->{$pkg}) {
+     delete $param{dist};
+}
+
 # walk through the keys and make the right get_bugs query.
 
 my $form_option_variables = {};
@@ -440,71 +449,50 @@ my $result = pkg_htmlizebugs(bugs => \@bugs,
 
 print "Content-Type: text/html; charset=utf-8\n\n";
 
-print "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n";
-print "<HTML><HEAD>\n" . 
-    "<TITLE>$title -- $gProject$Archived $gBug report logs</TITLE>\n" .
-    qq(<link rel="stylesheet" href="$gWebHostBugDir/css/bugs.css" type="text/css">) .
-    "</HEAD>\n" .
-    '<BODY onload="pagemain();">' .
-    "\n";
-print qq(<DIV id="status_mask"></DIV>\n);
-print "<H1>" . "$gProject$Archived $gBug report logs: $title" .
-      "</H1>\n";
-
-my $showresult = 1;
-
-my $pkg = $param{package} if defined $param{package};
-my $src = $param{src} if defined $param{src};
-
-my $pseudodesc = getpseudodesc();
-if (defined $pseudodesc and defined $pkg and exists $pseudodesc->{$pkg}) {
-     delete $param{dist};
-}
-
 # output information about the packages
 
-for my $package (make_list($param{package}||[])) {
-     print generate_package_info(binary => 1,
-                                package => $package,
-                                options => \%param,
-                                bugs    => \@bugs,
-                               );
-}
-for my $package (make_list($param{src}||[])) {
-     print generate_package_info(binary => 0,
-                                package => $package,
-                                options => \%param,
-                                bugs    => \@bugs,
-                               );
-}
+
+my %variables;
 
 if (exists $param{maint} or exists $param{maintenc}) {
-    print "<p>Note that maintainers may use different Maintainer fields for\n";
-    print "different packages, so there may be other reports filed under\n";
-    print "different addresses.\n";
+    $variables{maint_note} = 1;
 }
 if (exists $param{submitter}) {
-    print "<p>Note that people may use different email accounts for\n";
-    print "different bugs, so there may be other reports filed under\n";
-    print "different addresses.\n";
+    $variables{submitter_note} = 1;
 }
+$variables{result} = $result;
+$variables{option_form} = 
+    option_form(template => 'cgi/pkgreport_options',
+               param    => \%param,
+               form_options => $form_options,
+               variables => $form_option_variables,
+              );
 
-print $result;
-
-print fill_in_template(template=>'cgi/pkgreport_javascript');
+$variables{package_info} = '';
 
-print qq(<h2 class="outstanding"><!--<a class="options" href="javascript:toggle(1)">-->Options<!--</a>--></h2>\n);
+for my $package (make_list($param{package}||[])) {
+    $variables{package_info} .=
+       generate_package_info(binary => 1,
+                             package => $package,
+                             options => \%param,
+                             bugs    => \@bugs,
+                            );
+}
 
-print option_form(template => 'cgi/pkgreport_options',
-                 param    => \%param,
-                 form_options => $form_options,
-                 variables => $form_option_variables,
-                );
+for my $package (make_list($param{src}||[])) {
+    $variables{package_info} .=
+       generate_package_info(binary => 0,
+                             package => $package,
+                             options => \%param,
+                             bugs    => \@bugs,
+                            );
+}
 
-print "<hr>\n";
-print fill_in_template(template=>'html/html_tail',
+print fill_in_template(template=>'cgi/pkgreport',
+                      variables => {%variables,
+                                    param => \%param,
+                                    html_escape => \&Debbugs::CGI::html_escape,
+                                   },
                       hole_var => {'&strftime' => \&POSIX::strftime,
                                   },
                      );
-print "</body></html>\n";
-
diff --git a/templates/en_US/cgi/pkgreport.tmpl b/templates/en_US/cgi/pkgreport.tmpl
new file mode 100644 (file)
index 0000000..dc901d9
--- /dev/null
@@ -0,0 +1,31 @@
+{include(q(html/pre_title))}{$title} -- {html_escape($config{project})} {html_escape($config{bug})} report logs{include(q(html/post_title.tmpl))}
+</head>
+<body onload="pagemain();">
+<div id="status_mask"></div>
+<h1>{$title} -- {html_escape($config{project})} {html_escape($config{bug})} report logs</h1> 
+{ $package_info }
+{ my $output = '';
+if ($maint_note) {
+   $output .= <<END;
+<p>Note that maintainers may use different Maintainer fields for
+different packages, so there may be other reports filed under
+different addresses.</p>
+END
+}
+if ($submitter_note) {
+   $output .= <<END;
+<p>Note that people may use different email accounts for
+different bugs, so there may be other reports filed under
+different addresses.</p>
+END
+}
+$output;
+}
+{ $result }
+{include(q(cgi/pkgreport_javascript))}
+<h2 class="outstanding">Options</h2>
+{ $option_form }
+<hr/>
+{include(q(html/html_tail))}
+</body>
+</html>