From cd9f027a36df31d7fb946ec13cd85b6a8d2a51d6 Mon Sep 17 00:00:00 2001 From: "terry%mozilla.org" Date: Sat, 5 Feb 2000 00:38:15 +0000 Subject: [PATCH] The "put this named query in the footer" feature was choking if the name of the query had a space in it. git-svn-id: svn://10.0.0.236/trunk@59813 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/webtools/bugzilla/userprefs.cgi | 32 ++++++++++++++++++------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/mozilla/webtools/bugzilla/userprefs.cgi b/mozilla/webtools/bugzilla/userprefs.cgi index 3a25755932f..0ee7d576f31 100755 --- a/mozilla/webtools/bugzilla/userprefs.cgi +++ b/mozilla/webtools/bugzilla/userprefs.cgi @@ -20,7 +20,12 @@ use strict; require "CGI.pl"; - +# Shut up misguided -w warnings about "used only once". "use vars" just +# doesn't work for me. +sub sillyness { + my $zz; + $zz = $::defaultqueryname; +} my $userid; @@ -154,21 +159,24 @@ sub ShowFooter { EmitEntry("The 'My bugs' link at the footer of each page", $entry); SendSQL("SELECT name, linkinfooter FROM namedqueries " . "WHERE userid = $userid"); - my $found = 0; + my $count = 0; while (MoreSQLData()) { my ($name, $linkinfooter) = (FetchSQLData()); if ($name eq $::defaultqueryname) { next; } - $found = 1; my $entry = - BuildPulldown("query-" . value_quote($name), + BuildPulldown("query-$count", [["0", "should only appear in the query page"], ["1", "should appear on the footer of every page"]], $linkinfooter); EmitEntry("Your query named '$name'", $entry); + my $q = value_quote($name); + print qq{\n}; + $count++; } - if (!$found) { + print qq{\n}; + if (!$count) { print qq{ If you go create remembered queries in the query page, @@ -187,14 +195,18 @@ sub SaveFooter { my ($name, $linkinfooter) = (FetchSQLData()); $old{$name} = $linkinfooter; } - foreach my $name (keys %old) { - if (exists $::FORM{"query-$name"}) { - my $new = $::FORM{"query-$name"}; + + for (my $c=0 ; $c<$::FORM{'numqueries'} ; $c++) { + my $name = $::FORM{"name-$c"}; + if (exists $old{$name}) { + my $new = $::FORM{"query-$c"}; if ($new ne $old{$name}) { SendSQL("UPDATE namedqueries SET linkinfooter = $new " . "WHERE userid = $userid " . "AND name = " . SqlQuote($name)); } + } else { + Error("Hmm, the $name query seems to have gone away."); } } SendSQL("UPDATE profiles SET mybugslink = '" . $::FORM{'mybugslink'} . @@ -215,6 +227,10 @@ GetVersionTable(); PutHeader("Preferences", "Preferences", $::COOKIE{'Bugzilla_login'}); +# foreach my $k (sort(keys(%::FORM))) { +# print "
" . value_quote($k) . ": " . value_quote($::FORM{$k}) . "\n
"; +# } + my $bank = $::FORM{'bank'} || "account"; my @banklist = (