summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorterry%mozilla.org <>2000-01-25 16:53:26 +0100
committerterry%mozilla.org <>2000-01-25 16:53:26 +0100
commit0230a614c04af4633fd9cb3d9216b720d474a4b7 (patch)
tree69468f51e04ac6caccd0d1a19229d6bea1abb65b
parent5fc31978bdcfe2790ee48d930d1c2adafe66b204 (diff)
downloadbugzilla-0230a614c04af4633fd9cb3d9216b720d474a4b7.tar.gz
bugzilla-0230a614c04af4633fd9cb3d9216b720d474a4b7.tar.xz
Reworked preferences UI. Added ability to turn off "My bugs" link at
bottom. Made "My bugs" show bugs you own AND bugs you submitted. Added ability to display your named queries in the footer. Many random bugfixes.
-rw-r--r--CGI.pl60
-rwxr-xr-xbuglist.cgi15
-rwxr-xr-xchangepassword.cgi163
-rwxr-xr-xchecksetup.pl9
-rw-r--r--defparams.pl4
-rw-r--r--globals.pl2
-rw-r--r--index.html2
-rwxr-xr-xprocessmail2
-rwxr-xr-xquery.cgi20
-rwxr-xr-xuserprefs.cgi298
10 files changed, 390 insertions, 185 deletions
diff --git a/CGI.pl b/CGI.pl
index 66217eb45..770a8d98b 100644
--- a/CGI.pl
+++ b/CGI.pl
@@ -474,6 +474,25 @@ sub make_popup {
}
+sub BuildPulldown {
+ my ($name, $valuelist, $default) = (@_);
+
+ my $entry = qq{<SELECT NAME="$name">};
+ foreach my $i (@$valuelist) {
+ my ($tag, $desc) = (@$i);
+ my $selectpart = "";
+ if ($tag eq $default) {
+ $selectpart = " SELECTED";
+ }
+ $entry .= qq{<OPTION$selectpart VALUE="$tag">$desc\n};
+ }
+ $entry .= qq{</SELECT>};
+ return $entry;
+}
+
+
+
+
sub PasswordForLogin {
my ($login) = (@_);
SendSQL("select cryptpassword from profiles where login_name = " .
@@ -563,7 +582,7 @@ To use the wonders of bugzilla, you can use the following:
Password: %s
To change your password, go to:
- ${urlbase}changepassword.cgi
+ ${urlbase}userprefs.cgi
(Your bugzilla and CVS password, if any, are not currently synchronized.
Top hackers are working around the clock to fix this, as you read this.)
@@ -846,29 +865,27 @@ sub GetCommandMenu {
if ($loggedin) {
my $mybugstemplate = Param("mybugstemplate");
my %substs;
- $substs{'userid'} = $::COOKIE{"Bugzilla_login"};
+ $substs{'userid'} = url_quote($::COOKIE{"Bugzilla_login"});
if (!defined $::anyvotesallowed) {
GetVersionTable();
}
if ($::anyvotesallowed) {
$html .= qq{ | <A HREF="showvotes.cgi"><NOBR>My votes</NOBR></A>};
}
- my $mybugsurl = PerformSubsts($mybugstemplate, \%substs);
- $html = $html . " | <A HREF='$mybugsurl'><NOBR>My bugs</NOBR></A>";
- }
-
- $html = $html . " | <a href=\"createaccount.cgi\"><NOBR>New account</NOBR></a>\n";
-
- my $onLogPage = 0;
- if (defined $ENV{"HTTP_REFERER"}) {
- #my $referrer = $ENV{"HTTP_REFERER"};
- #my @parts = split("/",$referrer);
- #my $called_from = $parts[@parts-1];
- #confirm_login($called_from);
- }
-
- if ($loggedin) {
- $html .= "| <NOBR>Edit <a href='changepassword.cgi'>prefs</a></NOBR>";
+ SendSQL("SELECT mybugslink, userid FROM profiles WHERE login_name = " .
+ SqlQuote($::COOKIE{'Bugzilla_login'}));
+ my ($mybugslink, $userid) = (FetchSQLData());
+ if ($mybugslink) {
+ my $mybugsurl = PerformSubsts($mybugstemplate, \%substs);
+ $html = $html . " | <A HREF='$mybugsurl'><NOBR>My bugs</NOBR></A>";
+ }
+ SendSQL("SELECT name,query FROM namedqueries " .
+ "WHERE userid = $userid AND linkinfooter");
+ while (MoreSQLData()) {
+ my ($name, $query) = (FetchSQLData());
+ $html .= qq{ | <A HREF="buglist.cgi?$query"><NOBR>$name</A>};
+ }
+ $html .= " | <NOBR>Edit <a href='userprefs.cgi'>prefs</a></NOBR>";
if (UserInGroup("tweakparams")) {
$html .= ", <a href=editparams.cgi>parameters</a>";
$html .= ", <a href=sanitycheck.cgi><NOBR>sanity check</NOBR></a>";
@@ -882,9 +899,12 @@ sub GetCommandMenu {
if (UserInGroup("editkeywords")) {
$html .= ", <a href=editkeywords.cgi>keywords</a>";
}
- $html = $html . " | <NOBR><a href=relogin.cgi>Log out</a> $::COOKIE{'Bugzilla_login'}</NOBR>";
+ $html .= " | <NOBR><a href=relogin.cgi>Log out</a> $::COOKIE{'Bugzilla_login'}</NOBR>";
} else {
- $html = $html . " | <NOBR><a href=query.cgi?GoAheadAndLogIn=1>Log in</a></NOBR>";
+ $html .=
+ " | <a href=\"createaccount.cgi\"><NOBR>New account</NOBR></a>\n";
+ $html .=
+ " | <NOBR><a href=query.cgi?GoAheadAndLogIn=1>Log in</a></NOBR>";
}
$html .= "</FORM>";
return $html;
diff --git a/buglist.cgi b/buglist.cgi
index f096bd323..6427180e9 100755
--- a/buglist.cgi
+++ b/buglist.cgi
@@ -141,9 +141,17 @@ individual query.
PutFooter();
exit();
}
- SendSQL("REPLACE INTO namedqueries (userid, name, query) VALUES " .
- "($userid, " . SqlQuote($name) .
- ", " . SqlQuote($::buffer) . ")");
+ $::buffer =~ s/[\&\?]cmdtype=[a-z]+//;
+ my $qname = SqlQuote($name);
+ SendSQL("SELECT query FROM namedqueries " .
+ "WHERE userid = $userid AND name = $qname");
+ if (!FetchOneColumn()) {
+ SendSQL("REPLACE INTO namedqueries (userid, name, query) " .
+ "VALUES ($userid, $qname, " . SqlQuote($::buffer) . ")");
+ } else {
+ SendSQL("UPDATE namedqueries SET query = " . SqlQuote($::buffer) .
+ " WHERE userid = $userid AND name = $qname");
+ }
PutHeader("OK, query saved.");
print qq{
OK, you have a new query named <code>$name</code>
@@ -874,6 +882,7 @@ if ($count == 0) {
print qq{<p><A HREF="query.cgi">Query Page</A>\n};
print qq{&nbsp;&nbsp;<A HREF="enter_bug.cgi">Enter New Bug</A>\n};
+ print qq{<NOBR><A HREF="query.cgi?$::buffer">Edit this query</A></NOBR>\n};
} elsif ($count == 1) {
print "One bug found.\n";
} else {
diff --git a/changepassword.cgi b/changepassword.cgi
index ca533b1ee..873ababda 100755
--- a/changepassword.cgi
+++ b/changepassword.cgi
@@ -20,153 +20,18 @@
#
# Contributor(s): Terry Weissman <terry@mozilla.org>
-require "CGI.pl";
-
-
-sub sillyness {
- my $zz;
- $zz = $::anyvotesallowed;
-}
-
-confirm_login();
-
-print "Content-type: text/html\n\n";
-
-GetVersionTable();
-
-if (! defined $::FORM{'pwd1'}) {
- PutHeader("Preferences", "Change your password and<br>other preferences",
- $::COOKIE{'Bugzilla_login'});
-
- my $qacontactpart = "";
- if (Param('useqacontact')) {
- $qacontactpart = ", the current QA Contact";
- }
- my $loginname = SqlQuote($::COOKIE{'Bugzilla_login'});
- SendSQL("select emailnotification,realname,newemailtech from profiles where login_name = " .
- $loginname);
- my ($emailnotification, $realname, $newemailtech) = (FetchSQLData());
- $realname = value_quote($realname);
- print qq{
-<form method=post>
-<hr>
-<table>
-<tr>
-<td align=right>Please enter the new password for <b>$::COOKIE{'Bugzilla_login'}</b>:</td>
-<td><input type=password name="pwd1"></td>
-</tr>
-<tr>
-<td align=right>Re-enter your new password:</td>
-<td><input type=password name="pwd2"></td>
-</tr>
-<tr>
-<td align=right>Your real name (optional):</td>
-<td><input size=35 name=realname value="$realname"></td>
-</tr>
-</table>
-<hr>
-<table>
-<tr>
-<td align=right>Bugzilla will send out email notification of changed bugs to
-the current owner, the submitter of the bug$qacontactpart, and anyone on the
-CC list. However, you can suppress some of those email notifications.
-On which of these bugs would you like email notification of changes?</td>
-<td><SELECT NAME="emailnotification">
-};
- foreach my $i (["ExcludeSelfChanges", "All qualifying bugs except those which I change"],
- ["CConly", "Only those bugs which I am listed on the CC line"],
- ["All", "All qualifying bugs"]) {
- my ($tag, $desc) = (@$i);
- my $selectpart = "";
- if ($tag eq $emailnotification) {
- $selectpart = " SELECTED";
- }
- print qq{<OPTION$selectpart VALUE="$tag">$desc\n};
- }
- print "
-</SELECT>
-</td>
-</tr>
-";
- if (Param("newemailtech")) {
- my $checkedpart = $newemailtech ? "CHECKED" : "";
- print qq{
-<tr><td colspan=2><hr></td></tr>
-<tr><td align=right><font color="red">New!</font> Bugzilla has a new email
-notification scheme. It is <b>experimental and bleeding edge</b> and will
-hopefully evolve into a brave new happy world where all the spam and ugliness
-of the old notifications will go away. If you wish to sign up for this (and
-risk any bugs), check here.</td>
-<td><input type="checkbox" name="newemailtech" $checkedpart>New email tech</td>
-</tr>
-};
- }
- print "
-</table>
-<hr>
-<input type=submit value=Submit>
-</form>
-<hr>";
- if ($::anyvotesallowed) {
- print qq{<a href="showvotes.cgi">Review your votes</a><hr>\n};
- }
- PutFooter();
- exit;
-}
-
-if ($::FORM{'pwd1'} ne $::FORM{'pwd2'}) {
- print "<H1>Try again.</H1>
-The two passwords you entered did not match. Please click <b>Back</b> and try again.\n";
- PutFooter();
- exit;
+print q{Content-type: text/html
+
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Refresh"
+ CONTENT="0; URL=userprefs.cgi">
+</HEAD>
+<BODY>
+This URL is obsolete. Forwarding you to the correct one.
+<P>
+Going to <A HREF="userprefs.cgi">userprefs.cgi</A>
+<BR>
+</BODY>
+</HTML>
}
-
-
-my $pwd = $::FORM{'pwd1'};
-
-
-if ($pwd ne "") {
- if ($pwd !~ /^[a-zA-Z0-9-_]*$/ || length($pwd) < 3 || length($pwd) > 15) {
- print "<H1>Sorry; we're picky.</H1>
-Please choose a password that is between 3 and 15 characters long, and that
-contains only numbers, letters, hyphens, or underlines.
-<p>
-Please click <b>Back</b> and try again.\n";
- PutFooter();
- exit;
- }
-
-
- my $qpwd = SqlQuote($pwd);
- SendSQL("UPDATE profiles SET password=$qpwd,cryptpassword=encrypt($qpwd)
- WHERE login_name = " .
- SqlQuote($::COOKIE{'Bugzilla_login'}));
- SendSQL("SELECT cryptpassword FROM profiles WHERE login_name = " .
- SqlQuote($::COOKIE{'Bugzilla_login'}));
- my $encrypted = FetchOneColumn();
-
- SendSQL("update logincookies set cryptpassword = '$encrypted' where cookie = $::COOKIE{'Bugzilla_logincookie'}");
-}
-
-
-my $newemailtech = exists $::FORM{'newemailtech'};
-
-SendSQL("UPDATE profiles " .
- "SET emailnotification='$::FORM{'emailnotification'}', " .
- " newemailtech = '$newemailtech' " .
- "WHERE login_name = " . SqlQuote($::COOKIE{'Bugzilla_login'}));
-
-my $newrealname = $::FORM{'realname'};
-
-if ($newrealname ne "") {
- $newrealname = SqlQuote($newrealname);
- SendSQL("update profiles set realname=$newrealname where login_name = " .
- SqlQuote($::COOKIE{'Bugzilla_login'}));
-}
-
-PutHeader("Preferences updated.");
-print "
-Your preferences have been updated.
-<p>";
-PutFooter();
-
diff --git a/checksetup.pl b/checksetup.pl
index 699ed8138..6f7f38559 100755
--- a/checksetup.pl
+++ b/checksetup.pl
@@ -669,6 +669,7 @@ $table{profiles} =
emailnotification enum("ExcludeSelfChanges", "CConly", "All") not null default "ExcludeSelfChanges",
disabledtext mediumtext not null,
newemailtech tinyint not null,
+ mybugslink tinyint not null default 1,
unique(login_name)';
@@ -677,6 +678,7 @@ $table{namedqueries} =
'userid mediumint not null,
name varchar(64) not null,
watchfordiffs tinyint not null,
+ linkinfooter tinyint not null,
query mediumtext not null,
unique(userid, name),
@@ -1402,6 +1404,13 @@ if (GetIndexDef('profiles', 'login_name')->[1]) {
}
+# 2000-01-24 Added a new field to let people control whether the "My
+# bugs" link appears at the bottom of each page. Also can control
+# whether each named query should show up there.
+
+AddField('profiles', 'mybugslink', 'tinyint not null default 1');
+AddField('namedqueries', 'linkinfooter', 'tinyint not null');
+
#
# If you had to change the --TABLE-- definition in any way, then add your
diff --git a/defparams.pl b/defparams.pl
index daa8c1da2..6bd398c73 100644
--- a/defparams.pl
+++ b/defparams.pl
@@ -205,8 +205,10 @@ information about what Bugzilla is and what it can do, see
DefParam("mybugstemplate",
"This is the URL to use to bring up a simple 'all of my bugs' list for a user. %userid% will get replaced with the login name of a user.",
"t",
- "buglist.cgi?bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&assigned_to=%userid%");
+ "buglist.cgi?bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&email1=%userid%&emailtype1=exact&emailassigned_to1=1&emailreporter1=1");
+
+
DefParam("shutdownhtml",
"If this field is non-empty, then Bugzilla will be completely disabled and this text will be displayed instead of all the Bugzilla pages.",
"l",
diff --git a/globals.pl b/globals.pl
index b8f390537..6e42aa1c1 100644
--- a/globals.pl
+++ b/globals.pl
@@ -59,7 +59,7 @@ $::param{'version'} = '2.9';
$::dontchange = "--do_not_change--";
$::chooseone = "--Choose_one:--";
-$::defaultqueryname = "(Default query) ";
+$::defaultqueryname = "(Default query)";
sub ConnectToDatabase {
if (!defined $::db) {
diff --git a/index.html b/index.html
index 5ec3d5f9c..68eb58a01 100644
--- a/index.html
+++ b/index.html
@@ -75,7 +75,7 @@ But it all boils down to a choice of:
<p>
<a href="createaccount.cgi">Open a new Bugzilla account</a><br>
<a href="relogin.cgi">Forget the currently stored login</a><br>
-<a href="changepassword.cgi">Change password or user preferences</a><br>
+<a href="userprefs.cgi">Change password or user preferences</a><br>
<FORM METHOD=GET ACTION="show_bug.cgi">
<INPUT TYPE=SUBMIT VALUE="Find"> bug # <INPUT NAME=id SIZE=6></FORM>
diff --git a/processmail b/processmail
index d81410708..f6912c99a 100755
--- a/processmail
+++ b/processmail
@@ -656,7 +656,7 @@ sub ProcessOneBug {
if (@sentlist) {
print "<B>Email sent to:</B> " . join(", ", @sentlist) . "\n";
if ($didexclude) {
- print "<B>Excluding:</B> $nametoexclude (<a href=changepassword.cgi>change your preferences</a> if you wish not to be excluded)\n";
+ print qq{<B>Excluding:</B> $nametoexclude (<a href="userprefs.cgi?bank=diffs">change your preferences</a> if you wish not to be excluded)\n};
}
}
rename($new, $old) || die "Can't rename $new to $old";
diff --git a/query.cgi b/query.cgi
index 09ec3b7fe..0b6211bfb 100755
--- a/query.cgi
+++ b/query.cgi
@@ -225,19 +225,21 @@ sub GenerateEmailInput {
}
- return qq|
+ $default{"emailtype$id"} ||= "substring";
+
+ return qq{
<table border=1 cellspacing=0 cellpadding=0>
<tr><td>
<table cellspacing=0 cellpadding=0>
<tr>
<td rowspan=2 valign=top><a href="helpemailquery.html">Email:</a>
<input name="email$id" size="30" value="$defstr">&nbsp;matching as
-<SELECT NAME=emailtype$id>
-<OPTION VALUE="regexp">regexp
-<OPTION VALUE="notregexp">not regexp
-<OPTION SELECTED VALUE="substring">substring
-<OPTION VALUE="exact">exact
-</SELECT>
+} . BuildPulldown("emailtype$id",
+ [["regexp", "regexp"],
+ ["notregexp", "not regexp"],
+ ["substring", "substring"],
+ ["exact", "exact"]],
+ $default{"emailtype$id"}) . qq{
</td>
<td>
<input type="checkbox" name="emailassigned_to$id" value=1 $assignedto>Assigned To
@@ -262,7 +264,7 @@ sub GenerateEmailInput {
</tr>
</table>
</table>
-|;
+};
}
@@ -748,7 +750,7 @@ if (UserInGroup("editkeywords")) {
if ($userid) {
print "<a href=relogin.cgi>Log in as someone besides <b>$::COOKIE{'Bugzilla_login'}</b></a><br>\n";
}
-print "<a href=changepassword.cgi>Change your password or preferences.</a><br>\n";
+print "<a href=userprefs.cgi>Change your password or preferences.</a><br>\n";
print "<a href=\"enter_bug.cgi\">Create a new bug.</a><br>\n";
print "<a href=\"createaccount.cgi\">Open a new Bugzilla account</a><br>\n";
print "<a href=\"reports.cgi\">Bug reports</a><br>\n";
diff --git a/userprefs.cgi b/userprefs.cgi
new file mode 100755
index 000000000..964f86712
--- /dev/null
+++ b/userprefs.cgi
@@ -0,0 +1,298 @@
+#!/usr/bonsaitools/bin/perl -w
+# -*- Mode: perl; indent-tabs-mode: nil -*-
+#
+# The contents of this file are subject to the Mozilla Public
+# License Version 1.1 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS
+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# rights and limitations under the License.
+#
+# The Original Code is the Bugzilla Bug Tracking System.
+#
+# Contributor(s): Terry Weissman <terry@mozilla.org>
+
+use diagnostics;
+use strict;
+
+require "CGI.pl";
+
+
+
+my $userid;
+
+
+sub EmitEntry {
+ my ($description, $entry) = (@_);
+ print qq{<TR><TH ALIGN="right">$description:</TH><TD>$entry</TD></TR>\n};
+}
+
+sub Error {
+ my ($msg) = (@_);
+ print qq{
+$msg
+<P>
+Please hit <B>back</B> and try again.
+};
+ PutFooter();
+ exit();
+}
+
+
+sub ShowAccount {
+ SendSQL("SELECT realname FROM profiles WHERE userid = $userid");
+ my ($realname) = (FetchSQLData());
+
+ $realname = value_quote($realname);
+
+ EmitEntry("Old password",
+ qq{<input type=password name="oldpwd">});
+ EmitEntry("New password",
+ qq{<input type=password name="pwd1">});
+ EmitEntry("Re-enter new password",
+ qq{<input type=password name="pwd2">});
+ EmitEntry("Your username (optional)",
+ qq{<INPUT SIZE=35 NAME="realname" VALUE="$realname">});
+}
+
+sub SaveAccount {
+ if ($::FORM{'oldpwd'} ne ""
+ || $::FORM{'pwd1'} ne "" || $::FORM{'pwd2'} ne "") {
+ my $old = SqlQuote($::FORM{'oldpwd'});
+ my $pwd1 = SqlQuote($::FORM{'pwd1'});
+ my $pwd2 = SqlQuote($::FORM{'pwd2'});
+ SendSQL("SELECT cryptpassword = ENCRYPT($old, LEFT(cryptpassword, 2)) " .
+ "FROM profiles WHERE userid = $userid");
+ if (!FetchOneColumn()) {
+ Error("You did not enter your old password correctly.");
+ }
+ if ($pwd1 ne $pwd2) {
+ Error("The two passwords you entered did not match.");
+ }
+ if ($::FORM{'pwd1'} eq '') {
+ Error("You must enter a new password.");
+ }
+ SendSQL("UPDATE profiles SET password = $pwd1, " .
+ "cryptpassword = ENCRYPT($pwd1) " .
+ "WHERE userid = $userid");
+ }
+ SendSQL("UPDATE profiles SET " .
+ "realname = " . SqlQuote($::FORM{'realname'}) .
+ " WHERE userid = $userid");
+}
+
+
+
+sub ShowDiffs {
+ SendSQL("SELECT emailnotification, newemailtech FROM profiles " .
+ "WHERE userid = $userid");
+ my ($emailnotification, $newemailtech) = (FetchSQLData());
+ my $qacontactpart = "";
+ if (Param('useqacontact')) {
+ $qacontactpart = ", the current QA Contact";
+ }
+ print qq{
+<TR><TD COLSPAN="2">
+Bugzilla will send out email notification of changed bugs to
+the current owner, the submitter of the bug$qacontactpart, and anyone on the
+CC list. However, you can suppress some of those email notifications.
+On which of these bugs would you like email notification of changes?
+</TD></TR>
+};
+ my $entry =
+ BuildPulldown("emailnotification",
+ [["ExcludeSelfChanges",
+ "All qualifying bugs except those which I change"],
+ ["CConly",
+ "Only those bugs which I am listed on the CC line"],
+ ["All",
+ "All qualifying bugs"]],
+ $emailnotification);
+ EmitEntry("Notify me of changes to", $entry);
+
+ if (Param("newemailtech")) {
+ my $checkedpart = $newemailtech ? "CHECKED" : "";
+ print qq{
+<TR><TD COLSPAN="2"><HR></TD></TR>
+<TR><TD COLSPAN="2"><FONT COLOR="red">New!</FONT>
+Bugzilla has a new email
+notification scheme. It is <b>experimental and bleeding edge</b> and will
+hopefully evolve into a brave new happy world where all the spam and ugliness
+of the old notifications will go away. If you wish to sign up for this (and
+risk any bugs), check here.
+</TD></TR>
+};
+ EmitEntry("Check here to sign up (and risk any bugs)",
+ qq{<INPUT TYPE="checkbox" NAME="newemailtech" $checkedpart>New email tech});
+ }
+}
+
+sub SaveDiffs {
+ my $newemailtech = 0;
+ if (exists $::FORM{'newemailtech'}) {
+ $newemailtech = 1;
+ }
+ SendSQL("UPDATE profiles " .
+ "SET emailnotification = " . SqlQuote($::FORM{'emailnotification'})
+ . ", newemailtech = $newemailtech WHERE userid = $userid");
+}
+
+
+
+sub ShowFooter {
+ SendSQL("SELECT mybugslink FROM profiles " .
+ "WHERE userid = $userid");
+ my ($mybugslink) = (FetchSQLData());
+ my $entry =
+ BuildPulldown("mybugslink",
+ [["1", "should appear"],
+ ["0", "should not be displayed"]],
+ $mybugslink);
+ EmitEntry("The 'My bugs' link at the footer of each page", $entry);
+ SendSQL("SELECT name, linkinfooter FROM namedqueries " .
+ "WHERE userid = $userid");
+ my $found = 0;
+ while (MoreSQLData()) {
+ my ($name, $linkinfooter) = (FetchSQLData());
+ if ($name eq $::defaultqueryname) {
+ next;
+ }
+ $found = 1;
+ my $entry =
+ BuildPulldown("query-" . value_quote($name),
+ [["0", "should only appear in the query page"],
+ ["1", "should appear on the footer of every page"]],
+ $linkinfooter);
+ EmitEntry("Your query named '$name'", $entry);
+ }
+ if (!$found) {
+ print qq{
+<TR><TD COLSPAN="2">
+If you go create name queries in the <A HREF="query.cgi">query page</A>,
+you can then come to this page and choose to have some of them appear in the
+footer of each Bugzilla page.
+</TD></TR>};
+ }
+}
+
+
+sub SaveFooter {
+ my %old;
+ SendSQL("SELECT name, linkinfooter FROM namedqueries " .
+ "WHERE userid = $userid");
+ while (MoreSQLData()) {
+ my ($name, $linkinfooter) = (FetchSQLData());
+ $old{$name} = $linkinfooter;
+ }
+ foreach my $name (keys %old) {
+ if (exists $::FORM{"query-$name"}) {
+ my $new = $::FORM{"query-$name"};
+ if ($new ne $old{$name}) {
+ SendSQL("UPDATE namedqueries SET linkinfooter = $new " .
+ "WHERE userid = $userid " .
+ "AND name = " . SqlQuote($name));
+ }
+ }
+ }
+ SendSQL("UPDATE profiles SET mybugslink = '" . $::FORM{'mybugslink'} .
+ "' WHERE userid = $userid");
+}
+
+
+
+######################################################################
+################# Live code (not sub defs) starts here ###############
+
+
+confirm_login();
+
+print "Content-type: text/html\n\n";
+
+GetVersionTable();
+
+PutHeader("Preferences", "Preferences", $::COOKIE{'Bugzilla_login'});
+
+my $bank = $::FORM{'bank'} || "account";
+
+my @banklist = (
+ ["account", "Account settings",
+ \&ShowAccount, \&SaveAccount],
+ ["diffs", "Email settings",
+ \&ShowDiffs, \&SaveDiffs],
+ ["footer", "Page footer",
+ \&ShowFooter, \&SaveFooter]
+ );
+
+
+my $numbanks = @banklist;
+my $numcols = $numbanks + 2;
+
+my $headcol = '"lightblue"';
+
+print qq{
+<CENTER>
+<TABLE CELLSPACING="0" CELLPADDING="10" BORDER=0 WIDTH="100%">
+<TR>
+<TH COLSPAN="$numcols" BGCOLOR="lightblue">User preferences</TH>
+</TR>
+<TR><TD BGCOLOR=$headcol>&nbsp;</TD>
+};
+
+
+my $bankdescription;
+my $showfunc;
+my $savefunc;
+
+foreach my $i (@banklist) {
+ my ($name, $description) = (@$i);
+ my $color = "";
+ if ($name eq $bank) {
+ print qq{<TD ALIGN="center">$description</TD>};
+ my $zz;
+ ($zz, $bankdescription, $showfunc, $savefunc) = (@$i);
+ } else {
+ print qq{<TD ALIGN="center" BGCOLOR="lightblue"><A HREF="userprefs.cgi?bank=$name">$description</A></TD>};
+ }
+}
+print qq{
+<TD BGCOLOR=$headcol>&nbsp;</TD></TR>
+</TABLE>
+</CENTER>
+<P>
+};
+
+
+
+
+if (defined $bankdescription) {
+ $userid = DBNameToIdAndCheck($::COOKIE{'Bugzilla_login'});
+
+ if ($::FORM{'dosave'}) {
+ &$savefunc;
+ print "Your changes have been saved.";
+ }
+ print qq{
+<H3>$bankdescription</H3>
+<FORM METHOD="POST">
+<TABLE>
+};
+ &$showfunc;
+ print qq{
+</TABLE>
+<INPUT TYPE="hidden" NAME="dosave" VALUE="1">
+<INPUT TYPE="hidden" NAME="bank" VALUE="$bank">
+<INPUT TYPE="submit" VALUE="Submit">
+</FORM>
+};
+} else {
+ print "<P>Please choose from the above links which settings you wish to change.</P>";
+}
+
+
+print "<P>";
+
+
+PutFooter();