summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgerv%gerv.net <>2002-07-27 05:37:03 +0200
committergerv%gerv.net <>2002-07-27 05:37:03 +0200
commitb9469415fc8d9fe25b153fcd48b0b4165e369809 (patch)
tree198b56543700fd9244e8e350c073d7c389d5fa13
parent177911333aaf0db3860f962d57fe18d6db1fa001 (diff)
downloadbugzilla-b9469415fc8d9fe25b153fcd48b0b4165e369809.tar.gz
bugzilla-b9469415fc8d9fe25b153fcd48b0b4165e369809.tar.xz
Bug 158497 - Templatise colchange.cgi. Patch by gerv; r=burnus.
-rwxr-xr-xcolchange.cgi40
-rw-r--r--template/en/default/list/change-columns.html.tmpl56
2 files changed, 51 insertions, 45 deletions
diff --git a/colchange.cgi b/colchange.cgi
index 727ad2c90..ef650a4d2 100755
--- a/colchange.cgi
+++ b/colchange.cgi
@@ -19,6 +19,7 @@
# Rights Reserved.
#
# Contributor(s): Terry Weissman <terry@mozilla.org>
+# Gervase Markham <gerv@gerv.net>
use diagnostics;
use strict;
@@ -37,13 +38,10 @@ require "CGI.pl";
ConnectToDatabase();
quietly_check_login();
-print "Content-type: text/html\n";
+GetVersionTable();
# The master list not only says what fields are possible, but what order
# they get displayed in.
-
-GetVersionTable();
-
my @masterlist = ("opendate", "changeddate", "severity", "priority",
"platform", "owner", "reporter", "status", "resolution",
"product", "component", "version", "os", "votes");
@@ -61,10 +59,9 @@ if (@::legal_keywords) {
push(@masterlist, "keywords");
}
-
push(@masterlist, ("summary", "summaryfull"));
-$vars->{masterlist} = \@masterlist;
+$vars->{'masterlist'} = \@masterlist;
my @collist;
if (defined $::FORM{'rememberedquery'}) {
@@ -84,14 +81,15 @@ if (defined $::FORM{'rememberedquery'}) {
my $list = join(" ", @collist);
my $urlbase = Param("urlbase");
my $cookiepath = Param("cookiepath");
+
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 "Refresh: 0; URL=buglist.cgi?$::FORM{'rememberedquery'}\n";
- print "\n";
- print "<meta http-equiv=\"Refresh\" content=\"1; URL=$urlbase"."buglist.cgi?$::FORM{'rememberedquery'}\">\n";
- print "<title>What a hack.</title>\n";
- PutHeader ("Change columns");
- print "Resubmitting your query with new columns...\n";
+ print "Content-type: text/html\n\n";
+ $vars->{'message'} = "Resubmitting your query with new columns...";
+ $vars->{'title'} = "Change columns";
+ $template->process("global/message.html.tmpl", $vars)
+ || ThrowTemplateError($template->error());
exit;
}
@@ -101,26 +99,12 @@ if (defined $::COOKIE{'COLUMNLIST'}) {
@collist = @::default_column_list;
}
-$vars->{collist} = \@collist;
+$vars->{'collist'} = \@collist;
+$vars->{'splitheader'} = $::COOKIE{'SPLITHEADER'} ? 1 : 0;
-$vars->{splitheader} = 0;
-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;
+$vars->{'buffer'} = $::buffer;
# Generate and return the UI (HTML page) from the appropriate template.
print "Content-type: text/html\n\n";
$template->process("list/change-columns.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
-
diff --git a/template/en/default/list/change-columns.html.tmpl b/template/en/default/list/change-columns.html.tmpl
index 96e56e8eb..3f2122b38 100644
--- a/template/en/default/list/change-columns.html.tmpl
+++ b/template/en/default/list/change-columns.html.tmpl
@@ -23,29 +23,51 @@
title = "Change Columns"
%]
-Check which columns you wish to appear on the list, and then click
-on submit. (Cookies are required.)
<p>
-<form action="colchange.cgi">
-<input type="hidden" name="rememberedquery" value="[% buffer %]">
+ Select the columns you wish to appear in your buglists. Note that
+ this feature requires cookies to work.
+</p>
+
[% FOREACH column = masterlist %]
- <input type="checkbox" id="[% column %]" name="column_[% column %]" [% "CHECKED" IF lsearch(collist, column) != -1 %]>
- <label for="[% column %]">[% desc.${column} %]</label><br>
+ [% desc.${column} = column %]
[% 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">
+[% 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">
+ <input type="hidden" name="rememberedquery" value="[% buffer %]">
+ <input type="hidden" name="resetit" value="1">
+ <input type="submit" value="Reset to Bugzilla default">
</form>
-</p>
[% PROCESS global/footer.html.tmpl %]