diff options
Diffstat (limited to 'buglist.cgi')
-rwxr-xr-x | buglist.cgi | 58 |
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>."; + } } |