From 840eaae09a5f1118e290db7c6a38441eabb953dc Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Sat, 30 Dec 2006 04:55:08 +0000 Subject: [PATCH] =?utf8?q?Bug=20365300:=20[mod=5Fperl]=20Editing=20a=20sav?= =?utf8?q?ed=20search=20does=20not=20re-populate=20the=20search=20page=20-?= =?utf8?q?=20Patch=20by=20Fr=C3=83=C2=A9d=C3=83=C2=A9ric=20Buclin=20=20r/a=3Djustdave?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- query.cgi | 39 +++++++---------------- template/en/default/search/knob.html.tmpl | 7 ++-- 2 files changed, 16 insertions(+), 30 deletions(-) diff --git a/query.cgi b/query.cgi index cc2e049036..656fb1f657 100755 --- a/query.cgi +++ b/query.cgi @@ -111,6 +111,7 @@ local our %default; # and ignore any multiple values. sub PrefillForm { my ($buf) = (@_); + $buf = new Bugzilla::CGI($buf); my $foundone = 0; # Nothing must be undef, otherwise the template complains. @@ -132,26 +133,14 @@ sub PrefillForm { "category", "subcategory", "name", "newcategory", "newsubcategory", "public", "frequency") { - # This is a bit of a hack. The default, empty list has - # three entries to accommodate the needs of the email fields - - # we use each position to denote the relevant field. Array - # position 0 is unused for email fields because the form - # parameters historically started at 1. - $default{$name} = ["", "", ""]; + $default{$name} = []; } # Iterate over the URL parameters - foreach my $item (split(/\&/, $buf)) { - my @el = split(/=/, $item); - my $name = $el[0]; - my $value; - if ($#el > 0) { - $value = Bugzilla::Util::url_decode($el[1]); - } else { - $value = ""; - } - + foreach my $name ($buf->param()) { + my @values = $buf->param($name); + # If the name begins with field, type, or value, then it is part of # the boolean charts. Because these are built different than the rest # of the form, we don't need to save a default value. We do, however, @@ -165,22 +154,16 @@ sub PrefillForm { # positions to show the defaults for that number field. elsif ($name =~ m/^(.+)(\d)$/ && defined($default{$1})) { $foundone = 1; - $default{$1}->[$2] = $value; + $default{$1}->[$2] = $values[0]; } - # If there's no default yet, we replace the blank string. - elsif (defined($default{$name}) && $default{$name}->[0] eq "") { + elsif (exists $default{$name}) { $foundone = 1; - $default{$name} = [$value]; - } - # If there's already a default, we push on the new value. - elsif (defined($default{$name})) { - push (@{$default{$name}}, $value); - } - } + push (@{$default{$name}}, @values); + } + } return $foundone; } - if (!PrefillForm($buffer)) { # Ah-hah, there was no form stuff specified. Do it again with the # default query. @@ -335,7 +318,7 @@ if ($cgi->param('order')) { $deforder = $cgi->param('order') } $vars->{'userdefaultquery'} = $userdefaultquery; $vars->{'orders'} = \@orders; -$default{'querytype'} = $deforder || 'Importance'; +$default{'order'} = [$deforder || 'Importance']; if (($cgi->param('query_format') || $cgi->param('format') || "") eq "create-series") { diff --git a/template/en/default/search/knob.html.tmpl b/template/en/default/search/knob.html.tmpl index 4076837474..58c83fdef3 100644 --- a/template/en/default/search/knob.html.tmpl +++ b/template/en/default/search/knob.html.tmpl @@ -57,8 +57,11 @@ [% IF known_name %] - + [%# We store known_name in case the user add a boolean chart. %] + + + [%# The name of the existing query will be passed to buglist.cgi. %] + [% END %]

-- 2.47.2