summaryrefslogtreecommitdiffstats
path: root/buglist.cgi
diff options
context:
space:
mode:
authorgerv%gerv.net <>2002-07-27 05:44:44 +0200
committergerv%gerv.net <>2002-07-27 05:44:44 +0200
commit18b8582df8e89acc8dc7defa7b6848928327e621 (patch)
tree1ef757be1666c550e7ef2a7b3069a5ef22dfdd08 /buglist.cgi
parente7cb77c38201a379f7a781e1acdd1355a472ad4d (diff)
downloadbugzilla-18b8582df8e89acc8dc7defa7b6848928327e621.tar.gz
bugzilla-18b8582df8e89acc8dc7defa7b6848928327e621.tar.xz
Bug 150776 - Remembered query options need regrouping. Patch by gerv; r=jouni, burnus.
Diffstat (limited to 'buglist.cgi')
-rwxr-xr-xbuglist.cgi58
1 files changed, 23 insertions, 35 deletions
diff --git a/buglist.cgi b/buglist.cgi
index 123e3d4b3..e8199b97c 100755
--- a/buglist.cgi
+++ b/buglist.cgi
@@ -1064,18 +1064,22 @@ sub GenerateSQL {
# Command Execution
################################################################################
-# Figure out if the user wanted to do anything besides just running the query
-# they defined on the query page, and take appropriate action.
-CMD: for ($::FORM{'cmdtype'}) {
- /^runnamed$/ && do {
+# Backwards-compatibility - the old interface had cmdtype="runnamed" to run
+# a named command, and we can't break this because it's in bookmarks.
+if ($::FORM{'cmdtype'} eq "runnamed") {
+ $::FORM{'cmdtype'} = "dorem";
+ $::FORM{'remaction'} = "run";
+}
+
+# Take appropriate action based on user's request.
+if ($::FORM{'cmdtype'} eq "dorem") {
+ if ($::FORM{'remaction'} eq "run") {
$::buffer = LookupNamedQuery($::FORM{"namedcmd"});
$vars->{'title'} = "Bug List: $::FORM{'namedcmd'}";
ProcessFormFields($::buffer);
$order = $::FORM{'order'} || $order;
- last CMD;
- };
-
- /^editnamed$/ && do {
+ }
+ elsif ($::FORM{'remaction'} eq "load") {
my $url = "query.cgi?" . LookupNamedQuery($::FORM{"namedcmd"});
print "Refresh: 0; URL=$url\n";
print "Content-Type: text/html\n\n";
@@ -1086,9 +1090,8 @@ CMD: for ($::FORM{'cmdtype'}) {
$template->process("global/message.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
exit;
- };
-
- /^forgetnamed$/ && do {
+ }
+ elsif ($::FORM{'remaction'} eq "forget") {
confirm_login();
my $userid = DBNameToIdAndCheck($::COOKIE{"Bugzilla_login"});
my $qname = SqlQuote($::FORM{'namedcmd'});
@@ -1112,28 +1115,21 @@ CMD: for ($::FORM{'cmdtype'}) {
$template->process("global/message.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
exit;
- };
-
- /^asdefault$/ && do {
+ }
+}
+elsif ($::FORM{'cmdtype'} eq "doit") {
+ if ($::FORM{'remember'} == 1 && $::FORM{'remtype'} eq "asdefault") {
confirm_login();
my $userid = DBNameToIdAndCheck($::COOKIE{"Bugzilla_login"});
my $qname = SqlQuote($::defaultqueryname);
my $qbuffer = SqlQuote($::buffer);
SendSQL("REPLACE INTO namedqueries (userid, name, query)
VALUES ($userid, $qname, $qbuffer)");
- print "Content-Type: text/html\n\n";
# Generate and return the UI (HTML page) from the appropriate template.
- $vars->{'title'} = "OK, default is set";
$vars->{'message'} = "OK, you now have a new default query. You may
also bookmark the result of any individual query.";
- $vars->{'url'} = "query.cgi";
- $vars->{'link'} = "Go back to the query page, using the new default.";
- $template->process("global/message.html.tmpl", $vars)
- || ThrowTemplateError($template->error());
- exit;
- };
-
- /^asnamed$/ && do {
+ }
+ elsif ($::FORM{'remember'} == 1 && $::FORM{'remtype'} eq "asnamed") {
confirm_login();
my $userid = DBNameToIdAndCheck($::COOKIE{"Bugzilla_login"});
@@ -1150,7 +1146,7 @@ CMD: for ($::FORM{'cmdtype'}) {
$::buffer =~ s/[\&\?]cmdtype=[a-z]+//;
my $qbuffer = SqlQuote($::buffer);
- my $tofooter= $::FORM{'tofooter'} ? 1 : 0;
+ my $tofooter = $::FORM{'tofooter'} ? 1 : 0;
SendSQL("SELECT query FROM namedqueries WHERE userid = $userid AND name = $qname");
if (FetchOneColumn()) {
@@ -1172,8 +1168,6 @@ CMD: for ($::FORM{'cmdtype'}) {
}
}
- print "Content-Type: text/html\n\n";
- # Generate and return the UI (HTML page) from the appropriate template.
if ($new_in_footer) {
my %query = (name => $name,
query => $::buffer,
@@ -1181,14 +1175,8 @@ CMD: for ($::FORM{'cmdtype'}) {
push(@{$vars->{'user'}{'queries'}}, \%query);
}
- $vars->{'title'} = "OK, query saved.";
- $vars->{'message'} = "OK, you have a new query named <code>$name</code>";
- $vars->{'url'} = "query.cgi";
- $vars->{'link'} = "Go back to the query page.";
- $template->process("global/message.html.tmpl", $vars)
- || ThrowTemplateError($template->error());
- exit;
- };
+ $vars->{'message'} = "OK, you have a new query named <code>$name</code>.";
+ }
}