aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormkanat%bugzilla.org <>2007-03-08 02:37:07 +0000
committermkanat%bugzilla.org <>2007-03-08 02:37:07 +0000
commit558b05ca68f3987fa9020554b2170b6de8ad33f7 (patch)
treeed97b793f2168996447e3d002ae77fd660d72cd7 /colchange.cgi
parentBug 372997 - "JavaScript warnings in attachment.js" (part II) [p=reed r=timel... (diff)
downloadbugzilla-558b05ca68f3987fa9020554b2170b6de8ad33f7.tar.gz
bugzilla-558b05ca68f3987fa9020554b2170b6de8ad33f7.tar.bz2
bugzilla-558b05ca68f3987fa9020554b2170b6de8ad33f7.zip
Bug 345826: Ability to save column list in saved searches
Patch By Ronaldo Maia <romaia@async.com.br> r=LpSolit, a=LpSolit
Diffstat (limited to 'colchange.cgi')
-rwxr-xr-xcolchange.cgi52
1 files changed, 48 insertions, 4 deletions
diff --git a/colchange.cgi b/colchange.cgi
index de834b8bc..b52433924 100755
--- a/colchange.cgi
+++ b/colchange.cgi
@@ -28,6 +28,8 @@ use lib qw(.);
use Bugzilla;
use Bugzilla::Constants;
+use Bugzilla::CGI;
+use Bugzilla::Search::Saved;
use Bugzilla::Error;
use Bugzilla::User;
use Bugzilla::Keyword;
@@ -101,9 +103,13 @@ if (defined $cgi->param('rememberedquery')) {
my $urlbase = Bugzilla->params->{"urlbase"};
if ($list) {
- $cgi->send_cookie(-name => 'COLUMNLIST',
- -value => $list,
- -expires => 'Fri, 01-Jan-2038 00:00:00 GMT');
+ # Only set the cookie if this is not a saved search.
+ # Saved searches have their own column list
+ if (!$cgi->param('save_columns_for_search')) {
+ $cgi->send_cookie(-name => 'COLUMNLIST',
+ -value => $list,
+ -expires => 'Fri, 01-Jan-2038 00:00:00 GMT');
+ }
}
else {
$cgi->remove_cookie('COLUMNLIST');
@@ -118,7 +124,27 @@ if (defined $cgi->param('rememberedquery')) {
}
$vars->{'message'} = "change_columns";
- $vars->{'redirect_url'} = "buglist.cgi?".$cgi->param('rememberedquery');
+
+ my $search;
+ if (defined $cgi->param('saved_search')) {
+ $search = new Bugzilla::Search::Saved($cgi->param('saved_search'));
+ }
+
+ if ($cgi->param('save_columns_for_search')
+ && defined $search && $search->user->id == Bugzilla->user->id)
+ {
+ my $params = new Bugzilla::CGI($search->url);
+ $params->param('columnlist', join(",", @collist));
+ $search->set_url($params->query_string());
+ $search->update();
+ $vars->{'redirect_url'} = "buglist.cgi?".$cgi->param('rememberedquery');
+ }
+ else {
+ my $params = new Bugzilla::CGI($cgi->param('rememberedquery'));
+ $params->param('columnlist', join(",", @collist));
+ $vars->{'redirect_url'} = "buglist.cgi?".$params->query_string();
+ }
+
# If we're running on Microsoft IIS, using cgi->redirect discards
# the Set-Cookie lines -- workaround is to use the old-fashioned
@@ -149,6 +175,24 @@ $vars->{'splitheader'} = $cgi->cookie('SPLITHEADER') ? 1 : 0;
$vars->{'buffer'} = $cgi->query_string();
+my $search;
+if (defined $cgi->param('query_based_on')) {
+ my $searches = Bugzilla->user->queries;
+ my ($search) = grep($_->name eq $cgi->param('query_based_on'), @$searches);
+
+ # Only allow users to edit their own queries.
+ if ($search && $search->user->id == Bugzilla->user->id) {
+ $vars->{'saved_search'} = $search;
+ $vars->{'buffer'} = "cmdtype=runnamed&namedcmd=".$search->name;
+
+ my $params = new Bugzilla::CGI($search->url);
+ if ($params->param('columnlist')) {
+ my @collist = split(',', $params->param('columnlist'));
+ $vars->{'collist'} = \@collist if scalar (@collist);
+ }
+ }
+}
+
# Generate and return the UI (HTML page) from the appropriate template.
print $cgi->header();
$template->process("list/change-columns.html.tmpl", $vars)