From: terry%mozilla.org <>
Date: Tue, 25 Jan 2000 15:53:26 +0000 (+0000)
Subject: Reworked preferences UI. Added ability to turn off "My bugs" link at
X-Git-Tag: bugzilla-2.12~419
X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0230a614c04af4633fd9cb3d9216b720d474a4b7;p=thirdparty%2Fbugzilla.git
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.
---
diff --git a/CGI.pl b/CGI.pl
index 66217eb450..770a8d98bd 100644
--- a/CGI.pl
+++ b/CGI.pl
@@ -474,6 +474,25 @@ sub make_popup {
}
+sub BuildPulldown {
+ my ($name, $valuelist, $default) = (@_);
+
+ my $entry = qq{};
+ 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{ | My votes};
}
- my $mybugsurl = PerformSubsts($mybugstemplate, \%substs);
- $html = $html . " | My bugs";
- }
-
- $html = $html . " | New account\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 .= "| Edit prefs";
+ 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 . " | My bugs";
+ }
+ SendSQL("SELECT name,query FROM namedqueries " .
+ "WHERE userid = $userid AND linkinfooter");
+ while (MoreSQLData()) {
+ my ($name, $query) = (FetchSQLData());
+ $html .= qq{ | $name};
+ }
+ $html .= " | Edit prefs";
if (UserInGroup("tweakparams")) {
$html .= ", parameters";
$html .= ", sanity check";
@@ -882,9 +899,12 @@ sub GetCommandMenu {
if (UserInGroup("editkeywords")) {
$html .= ", keywords";
}
- $html = $html . " | Log out $::COOKIE{'Bugzilla_login'}";
+ $html .= " | Log out $::COOKIE{'Bugzilla_login'}";
} else {
- $html = $html . " | Log in";
+ $html .=
+ " | New account\n";
+ $html .=
+ " | Log in";
}
$html .= "";
return $html;
diff --git a/buglist.cgi b/buglist.cgi
index f096bd323d..6427180e91 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 $name
@@ -874,6 +882,7 @@ if ($count == 0) {
print qq{
Query Page\n};
print qq{ Enter New Bug\n};
+ print qq{Edit this query\n};
} elsif ($count == 1) {
print "One bug found.\n";
} else {
diff --git a/changepassword.cgi b/changepassword.cgi
index ca533b1eeb..873ababda9 100755
--- a/changepassword.cgi
+++ b/changepassword.cgi
@@ -20,153 +20,18 @@
#
# Contributor(s): Terry Weissman
-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 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{
-
-";
- if ($::anyvotesallowed) {
- print qq{Review your votes\n};
- }
- PutFooter();
- exit;
-}
-
-if ($::FORM{'pwd1'} ne $::FORM{'pwd2'}) {
- print "
Try again.
-The two passwords you entered did not match. Please click Back and try again.\n";
- PutFooter();
- exit;
+print q{Content-type: text/html
+
+
+
+
+
+
+This URL is obsolete. Forwarding you to the correct one.
+
-Please choose a password that is between 3 and 15 characters long, and that
-contains only numbers, letters, hyphens, or underlines.
-
-Please click Back 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.
-
";
-PutFooter();
-
diff --git a/checksetup.pl b/checksetup.pl
index 699ed8138e..6f7f38559a 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 daa8c1da27..6bd398c735 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 b8f390537b..6e42aa1c19 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 5ec3d5f9c7..68eb58a01f 100644
--- a/index.html
+++ b/index.html
@@ -75,7 +75,7 @@ But it all boils down to a choice of:
diff --git a/processmail b/processmail
index d814107083..f6912c99a6 100755
--- a/processmail
+++ b/processmail
@@ -656,7 +656,7 @@ sub ProcessOneBug {
if (@sentlist) {
print "Email sent to: " . join(", ", @sentlist) . "\n";
if ($didexclude) {
- print "Excluding: $nametoexclude (change your preferences if you wish not to be excluded)\n";
+ print qq{Excluding: $nametoexclude (change your preferences 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 09ec3b7fe9..0b6211bfbe 100755
--- a/query.cgi
+++ b/query.cgi
@@ -225,19 +225,21 @@ sub GenerateEmailInput {
}
- return qq|
+ $default{"emailtype$id"} ||= "substring";
+
+ return qq{
Assigned To
@@ -262,7 +264,7 @@ sub GenerateEmailInput {
-|;
+};
}
@@ -748,7 +750,7 @@ if (UserInGroup("editkeywords")) {
if ($userid) {
print "Log in as someone besides $::COOKIE{'Bugzilla_login'} \n";
}
-print "Change your password or preferences. \n";
+print "Change your password or preferences. \n";
print "Create a new bug. \n";
print "Open a new Bugzilla account \n";
print "Bug reports \n";
diff --git a/userprefs.cgi b/userprefs.cgi
new file mode 100755
index 0000000000..964f867128
--- /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
+
+use diagnostics;
+use strict;
+
+require "CGI.pl";
+
+
+
+my $userid;
+
+
+sub EmitEntry {
+ my ($description, $entry) = (@_);
+ print qq{
+Please hit back 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{});
+ EmitEntry("New password",
+ qq{});
+ EmitEntry("Re-enter new password",
+ qq{});
+ EmitEntry("Your username (optional)",
+ qq{});
+}
+
+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{
+
+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?
+
+};
+ 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{
+
+
New!
+Bugzilla has a new email
+notification scheme. It is experimental and bleeding edge 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.
+
+};
+ EmitEntry("Check here to sign up (and risk any bugs)",
+ qq{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{
+
+If you go create name queries in the query page,
+you can then come to this page and choose to have some of them appear in the
+footer of each Bugzilla page.
+