From: Don Armstrong Date: Fri, 20 Sep 2013 16:56:42 +0000 (-0700) Subject: use templates for pkgreport X-Git-Url: https://git.donarmstrong.com/?p=debbugs.git;a=commitdiff_plain;h=refs%2Fheads%2Fdon%2Fpkgreport-rework use templates for pkgreport --- diff --git a/cgi/pkgreport.cgi b/cgi/pkgreport.cgi index 859c8ed..0e08834 100755 --- a/cgi/pkgreport.cgi +++ b/cgi/pkgreport.cgi @@ -438,18 +438,6 @@ my $result = pkg_htmlizebugs(bugs => \@bugs, (exists $param{dist})?(dist => $param{dist}):(), ); -print "Content-Type: text/html; charset=utf-8\n\n"; - -print "\n"; -print "\n" . - "$title -- $gProject$Archived $gBug report logs\n" . - qq() . - "\n" . - '' . - "\n"; -print qq(
\n); -print "

" . "$gProject$Archived $gBug report logs: $title" . - "

\n"; my $showresult = 1; @@ -463,48 +451,56 @@ if (defined $pseudodesc and defined $pkg and exists $pseudodesc->{$pkg}) { # output information about the packages +my $package_info = ''; for my $package (make_list($param{package}||[])) { - print generate_package_info(binary => 1, - package => $package, - options => \%param, - bugs => \@bugs, - ); + $package_info .= + 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, - ); + $package_info .= + generate_package_info(binary => 0, + package => $package, + options => \%param, + bugs => \@bugs, + ); } +my $maint = 0; if (exists $param{maint} or exists $param{maintenc}) { - print "

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"; + $maint = 1; } +my $submitter = 0; if (exists $param{submitter}) { - print "

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"; + $submitter = 1; } -print $result; - -print fill_in_template(template=>'cgi/pkgreport_javascript'); - -print qq(

Options

\n); +my $option_form = + option_form(template => 'cgi/pkgreport_options', + param => \%param, + form_options => $form_options, + variables => $form_option_variables, + ); -print option_form(template => 'cgi/pkgreport_options', - param => \%param, - form_options => $form_options, - variables => $form_option_variables, - ); - -print "
\n"; -print fill_in_template(template=>'html/html_tail', - hole_var => {'&strftime' => \&POSIX::strftime, - }, - ); -print "\n"; +print "Content-Type: text/html; charset=utf-8\n\n"; +fill_in_template(template=>'cgi/pkgreport', + variables => { + result => $result, + submitter => $submitter, + maint => $maint, + option_form => $option_form, + title => $title, + }, + hole_var => {'&package_links' => \&Debbugs::CGI::package_links, + '&bug_links' => \&Debbugs::CGI::bug_links, + '&version_url' => \&Debbugs::CGI::version_url, + '&bug_url' => \&Debbugs::CGI::bug_url, + '&strftime' => \&POSIX::strftime, + '&maybelink' => \&Debbugs::CGI::maybelink, + }, + output => \*STDOUT, + ); diff --git a/templates/en_US/cgi/pkgreport.tmpl b/templates/en_US/cgi/pkgreport.tmpl new file mode 100644 index 0000000..87cd6e5 --- /dev/null +++ b/templates/en_US/cgi/pkgreport.tmpl @@ -0,0 +1,29 @@ +{include(q(html/pre_title))}{$title} -- {html_escape($config{project})}{$Archived} {$config{bug}} report logs{include(q(html/post_title.tmpl))} + + +
+

{html_escape($config{project})}{$Archived} {$config{bug}} report logs: {$title}

+{$package_info} +{ $OUT =''; +if ($maint) { + $OUT .= <Note that maintainers may use different Maintainer fields for +different packages, so there may be other reports filed under +different addresses. +END +}} +{ $OUT =''; +if ($submitter) { + $OUT .= <Note that people may use different email accounts for +different bugs, so there may be other reports filed under +different addresses. +END +}} +{$result} +{include(q(cgi/pkgreport_javascript))} +{$option_form} +
+{include(q(html/html_tail))} + +