diff options
author | gerv%gerv.net <> | 2003-02-07 17:07:40 +0100 |
---|---|---|
committer | gerv%gerv.net <> | 2003-02-07 17:07:40 +0100 |
commit | 54fc8285e5889841f6fbe274fddc4e0c03da8455 (patch) | |
tree | 5d4e922881e38dcd3aaa6533d6af2a3234856a47 /buglist.cgi | |
parent | 85bb266ec52df7baa3da77cab961eb7fcc18d330 (diff) | |
download | bugzilla-54fc8285e5889841f6fbe274fddc4e0c03da8455.tar.gz bugzilla-54fc8285e5889841f6fbe274fddc4e0c03da8455.tar.xz |
Bug 191020 - buglist.cgi doesn't always get query names right for filename to save. Patch by gerv; r=bbaetz, a=justdave.
Diffstat (limited to 'buglist.cgi')
-rwxr-xr-x | buglist.cgi | 52 |
1 files changed, 36 insertions, 16 deletions
diff --git a/buglist.cgi b/buglist.cgi index e8a21d76e..0ce292337 100755 --- a/buglist.cgi +++ b/buglist.cgi @@ -141,22 +141,6 @@ if ($::buffer =~ /&cmd-/) { exit; } -# Generate a reasonable filename for the user agent to suggest to the user -# when the user saves the bug list. Uses the name of the remembered query -# if available. We have to do this now, even though we return HTTP headers -# at the end, because the fact that there is a remembered query gets -# forgotten in the process of retrieving it. -my @time = localtime(time()); -my $date = sprintf "%04d-%02d-%02d", 1900+$time[5],$time[4]+1,$time[3]; -my $filename = "bugs-$date.$format->{extension}"; -$::FORM{'cmdtype'} ||= ""; -if ($::FORM{'cmdtype'} eq 'runnamed') { - $filename = "$::FORM{'namedcmd'}-$date.$format->{extension}"; - # Remove white-space from the filename so the user cannot tamper - # with the HTTP headers. - $filename =~ s/\s//; -} - ################################################################################ # Utilities ################################################################################ @@ -188,6 +172,18 @@ sub LookupNamedQuery { return $result; } +sub LookupSeries { + my ($series_id) = @_; + detaint_natural($series_id) || ThrowCodeError("invalid_series_id"); + + my $dbh = Bugzilla->instance->dbh; + my $result = $dbh->selectrow_array("SELECT query FROM series " . + "WHERE series_id = $series_id"); + $result + || ThrowCodeError("invalid_series_id", {'series_id' => $series_id}); + return $result; +} + sub GetQuip { my $quip; @@ -231,6 +227,9 @@ sub GetGroupsByUserId { # Command Execution ################################################################################ +$::FORM{'cmdtype'} ||= ""; +$::FORM{'remaction'} ||= ""; + # 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") { @@ -245,6 +244,21 @@ if ($::FORM{'cmdtype'} eq "runnamed") { # This will be modified, so make a copy. $params ||= new Bugzilla::CGI($cgi); +# Generate a reasonable filename for the user agent to suggest to the user +# when the user saves the bug list. Uses the name of the remembered query +# if available. We have to do this now, even though we return HTTP headers +# at the end, because the fact that there is a remembered query gets +# forgotten in the process of retrieving it. +my @time = localtime(time()); +my $date = sprintf "%04d-%02d-%02d", 1900+$time[5],$time[4]+1,$time[3]; +my $filename = "bugs-$date.$format->{extension}"; +if ($::FORM{'cmdtype'} eq "dorem" && $::FORM{'remaction'} =~ /^run/) { + $filename = "$::FORM{'namedcmd'}-$date.$format->{extension}"; + # Remove white-space from the filename so the user cannot tamper + # with the HTTP headers. + $filename =~ s/\s/_/g; +} + # Take appropriate action based on user's request. if ($::FORM{'cmdtype'} eq "dorem") { if ($::FORM{'remaction'} eq "run") { @@ -253,6 +267,12 @@ if ($::FORM{'cmdtype'} eq "dorem") { $params = new Bugzilla::CGI($::buffer); $order = $params->param('order') || $order; } + elsif ($::FORM{'remaction'} eq "runseries") { + $::buffer = LookupSeries($::FORM{"series_id"}); + $vars->{'title'} = "Bug List: $::FORM{'namedcmd'}"; + $params = new Bugzilla::CGI($::buffer); + $order = $params->param('order') || $order; + } elsif ($::FORM{'remaction'} eq "load") { my $url = "query.cgi?" . LookupNamedQuery($::FORM{"namedcmd"}); print "Refresh: 0; URL=$url\n"; |