Bug 158497 - Templatise colchange.cgi. Patch by gerv; r=burnus.

This commit is contained in:
gerv%gerv.net 2002-07-26 20:37:06 +00:00
Родитель f1e552a3ff
Коммит 7ef9fc63c9
2 изменённых файлов: 55 добавлений и 49 удалений

Просмотреть файл

@ -19,6 +19,7 @@
# Rights Reserved. # Rights Reserved.
# #
# Contributor(s): Terry Weissman <terry@mozilla.org> # Contributor(s): Terry Weissman <terry@mozilla.org>
# Gervase Markham <gerv@gerv.net>
use diagnostics; use diagnostics;
use strict; use strict;
@ -37,13 +38,10 @@ require "CGI.pl";
ConnectToDatabase(); ConnectToDatabase();
quietly_check_login(); quietly_check_login();
print "Content-type: text/html\n"; GetVersionTable();
# The master list not only says what fields are possible, but what order # The master list not only says what fields are possible, but what order
# they get displayed in. # they get displayed in.
GetVersionTable();
my @masterlist = ("opendate", "changeddate", "severity", "priority", my @masterlist = ("opendate", "changeddate", "severity", "priority",
"platform", "owner", "reporter", "status", "resolution", "platform", "owner", "reporter", "status", "resolution",
"product", "component", "version", "os", "votes"); "product", "component", "version", "os", "votes");
@ -61,10 +59,9 @@ if (@::legal_keywords) {
push(@masterlist, "keywords"); push(@masterlist, "keywords");
} }
push(@masterlist, ("summary", "summaryfull")); push(@masterlist, ("summary", "summaryfull"));
$vars->{masterlist} = \@masterlist; $vars->{'masterlist'} = \@masterlist;
my @collist; my @collist;
if (defined $::FORM{'rememberedquery'}) { if (defined $::FORM{'rememberedquery'}) {
@ -84,14 +81,15 @@ if (defined $::FORM{'rememberedquery'}) {
my $list = join(" ", @collist); my $list = join(" ", @collist);
my $urlbase = Param("urlbase"); my $urlbase = Param("urlbase");
my $cookiepath = Param("cookiepath"); my $cookiepath = Param("cookiepath");
print "Set-Cookie: COLUMNLIST=$list ; path=$cookiepath ; expires=Sun, 30-Jun-2029 00:00:00 GMT\n"; print "Set-Cookie: COLUMNLIST=$list ; path=$cookiepath ; expires=Sun, 30-Jun-2029 00:00:00 GMT\n";
print "Set-Cookie: SPLITHEADER=$::FORM{'splitheader'} ; path=$cookiepath ; expires=Sun, 30-Jun-2029 00:00:00 GMT\n"; print "Set-Cookie: SPLITHEADER=$::FORM{'splitheader'} ; path=$cookiepath ; expires=Sun, 30-Jun-2029 00:00:00 GMT\n";
print "Refresh: 0; URL=buglist.cgi?$::FORM{'rememberedquery'}\n"; print "Refresh: 0; URL=buglist.cgi?$::FORM{'rememberedquery'}\n";
print "\n"; print "Content-type: text/html\n\n";
print "<meta http-equiv=\"Refresh\" content=\"1; URL=$urlbase"."buglist.cgi?$::FORM{'rememberedquery'}\">\n"; $vars->{'message'} = "Resubmitting your query with new columns...";
print "<title>What a hack.</title>\n"; $vars->{'title'} = "Change columns";
PutHeader ("Change columns"); $template->process("global/message.html.tmpl", $vars)
print "Resubmitting your query with new columns...\n"; || ThrowTemplateError($template->error());
exit; exit;
} }
@ -101,26 +99,12 @@ if (defined $::COOKIE{'COLUMNLIST'}) {
@collist = @::default_column_list; @collist = @::default_column_list;
} }
$vars->{collist} = \@collist; $vars->{'collist'} = \@collist;
$vars->{'splitheader'} = $::COOKIE{'SPLITHEADER'} ? 1 : 0;
$vars->{splitheader} = 0; $vars->{'buffer'} = $::buffer;
if ($::COOKIE{'SPLITHEADER'}) {
$vars->{splitheader} = 1;
}
my %desc = ();
foreach my $i (@masterlist) {
$desc{$i} = $i;
}
$desc{'summary'} = "Summary (first 60 characters)";
$desc{'summaryfull'} = "Full Summary";
$vars->{desc} = \%desc;
$vars->{buffer} = $::buffer;
# Generate and return the UI (HTML page) from the appropriate template. # Generate and return the UI (HTML page) from the appropriate template.
print "Content-type: text/html\n\n"; print "Content-type: text/html\n\n";
$template->process("list/change-columns.html.tmpl", $vars) $template->process("list/change-columns.html.tmpl", $vars)
|| ThrowTemplateError($template->error()); || ThrowTemplateError($template->error());

Просмотреть файл

@ -23,29 +23,51 @@
title = "Change Columns" title = "Change Columns"
%] %]
Check which columns you wish to appear on the list, and then click
on submit. (Cookies are required.)
<p> <p>
<form action="colchange.cgi"> Select the columns you wish to appear in your buglists. Note that
<input type="hidden" name="rememberedquery" value="[% buffer %]"> this feature requires cookies to work.
[% FOREACH column = masterlist %]
<input type="checkbox" id="[% column %]" name="column_[% column %]" [% "CHECKED" IF lsearch(collist, column) != -1 %]>
<label for="[% column %]">[% desc.${column} %]</label><br>
[% END %]
</p><p>
<input id="nosplitheader" type="radio" name="splitheader" value="0" [% "CHECKED" IF ! splitheader %]>
<label for="nosplitheader">Normal headers (prettier)</label><br>
<input id="splitheader" type="radio" name="splitheader" value="1" [% "CHECKED" IF splitheader %]>
<label for="splitheader">Stagger headers (often makes list more compact)</label>
</p><p>
<input type="submit" value="Submit">
</form>
<form action="colchange.cgi">
<input type="hidden" name="rememberedquery" value="[% buffer %]">
<input type="hidden" name="resetit" value="1">
<input type="submit" value="Reset to Bugzilla default">
</form>
</p> </p>
[% FOREACH column = masterlist %]
[% desc.${column} = column %]
[% END %]
[% desc.summary = "Summary (first 60 characters)" %]
[% desc.summaryfull = "Full Summary" %]
<form action="colchange.cgi">
<input type="hidden" name="rememberedquery" value="[% buffer %]">
[% FOREACH column = masterlist %]
<input type="checkbox" id="[% column %]" name="column_[% column %]"
[% "checked='checked'" IF lsearch(collist, column) != -1 %]>
<label for="[% column %]">[% desc.${column} %]</label>
<br>
[% END %]
<p>
<input id="nosplitheader" type="radio" name="splitheader" value="0"
[% "checked='checked'" IF NOT splitheader %]>
<label for="nosplitheader">
Normal headers (prettier)
</label>
<br>
<input id="splitheader" type="radio" name="splitheader" value="1"
[% "checked='checked'" IF splitheader %]>
<label for="splitheader">
Stagger headers (often makes list more compact)
</label>
</p>
<p>
<input type="submit" value="Change Columns">
</p>
</form>
<form action="colchange.cgi">
<input type="hidden" name="rememberedquery" value="[% buffer %]">
<input type="hidden" name="resetit" value="1">
<input type="submit" value="Reset to Bugzilla default">
</form>
[% PROCESS global/footer.html.tmpl %] [% PROCESS global/footer.html.tmpl %]