Commit 88458a65 authored by dmose%mozilla.org's avatar dmose%mozilla.org

patch from bug 17464 to give user some control over what sorts of bug mail get…

patch from bug 17464 to give user some control over what sorts of bug mail get sent to an account. Original patch by al_raetz@yahoo.com and lots of additional hacking by me; r=donm@bluemartini.com
parent 63ececeb
......@@ -748,6 +748,7 @@ $table{profiles} =
newemailtech tinyint not null,
mybugslink tinyint not null default 1,
blessgroupset bigint not null,
emailflags mediumtext,
unique(login_name)';
......@@ -1868,6 +1869,13 @@ unless (-d 'graphs') {
}
}
#
# 2000-12-18. Added an 'emailflags' field for storing preferences about
# when email gets sent on a per-user basis.
#
if (!GetFieldDef('profiles', 'emailflags')) {
AddField('profiles', 'emailflags', 'mediumtext');
}
#
# If you had to change the --TABLE-- definition in any way, then add your
......
......@@ -21,6 +21,7 @@
# Contributor(s): Holger Schurig <holgerschurig@nikocity.de>
# Dave Miller <dave@intrec.com>
# Joe Robins <jmrobins@tgix.com>
# Dan Mosedale <dmose@mozilla.org>
#
# Direct any questions on this source code to
#
......@@ -38,6 +39,7 @@ require "globals.pl";
sub sillyness {
my $zz;
$zz = $::userid;
$zz = $::superusergroupset;
}
my $editall;
......@@ -95,10 +97,10 @@ sub EmitElement ($$)
# Displays the form to edit a user parameters
#
sub EmitFormElements ($$$$$$$)
sub EmitFormElements ($$$$$$$$)
{
my ($user, $password, $realname, $groupset, $blessgroupset,
$emailnotification, $disabledtext) = @_;
$emailnotification, $disabledtext, $newemailtech) = @_;
print " <TH ALIGN=\"right\">Login name:</TH>\n";
EmitElement("user", $user);
......@@ -116,20 +118,26 @@ sub EmitFormElements ($$$$$$$)
print " <TD><INPUT TYPE=\"PASSWORD\" SIZE=16 MAXLENGTH=16 NAME=\"password\" VALUE=\"$password\"></TD>\n";
}
print "</TR><TR>\n";
print " <TH ALIGN=\"right\">Email notification:</TH>\n";
print qq{<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";
if (!$newemailtech) {
print " <TH ALIGN=\"right\">Email notification:</TH>\n";
print qq{<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 qq{<OPTION$selectpart VALUE="$tag">$desc\n};
print "</SELECT></TD>\n";
print "</TR><TR>\n";
}
print "</SELECT></TD>\n";
print "</TR><TR>\n";
print " <TH ALIGN=\"right\">Disable text:</TH>\n";
print " <TD ROWSPAN=2><TEXTAREA NAME=\"disabledtext\" ROWS=10 COLS=60>" .
value_quote($disabledtext) . "</TEXTAREA>\n";
......@@ -389,7 +397,7 @@ if ($action eq 'add') {
print "<FORM METHOD=POST ACTION=editusers.cgi>\n";
print "<TABLE BORDER=0 CELLPADDING=4 CELLSPACING=0><TR>\n";
EmitFormElements('', '', '', 0, 0, 'ExcludeSelfChanges', '');
EmitFormElements('', '', '', 0, 0, 'ExcludeSelfChanges', '', 1);
print "</TR></TABLE>\n<HR>\n";
print "<INPUT TYPE=SUBMIT VALUE=\"Add\">\n";
......@@ -507,10 +515,11 @@ if ($action eq 'del') {
CheckUser($user);
# display some data about the user
SendSQL("SELECT realname, groupset, emailnotification
SendSQL("SELECT realname, groupset, emailnotification, newemailtech
FROM profiles
WHERE login_name=" . SqlQuote($user));
my ($realname, $groupset, $emailnotification) = FetchSQLData();
my ($realname, $groupset, $emailnotification, $newemailtech) =
FetchSQLData();
$realname ||= "<FONT COLOR=\"red\">missing</FONT>";
print "<TABLE BORDER=1 CELLPADDING=4 CELLSPACING=0>\n";
......@@ -526,9 +535,11 @@ if ($action eq 'del') {
print " <TD VALIGN=\"top\">Real name:</TD>\n";
print " <TD VALIGN=\"top\">$realname</TD>\n";
print "</TR><TR>\n";
print " <TD VALIGN=\"top\">E-Mail notification:</TD>\n";
print " <TD VALIGN=\"top\">$emailnotification</TD>\n";
if ( !$newemailtech ) {
print "</TR><TR>\n";
print " <TD VALIGN=\"top\">E-Mail notification:</TD>\n";
print " <TD VALIGN=\"top\">$emailnotification</TD>\n";
}
print "</TR><TR>\n";
print " <TD VALIGN=\"top\">Group set:</TD>\n";
......@@ -670,17 +681,17 @@ if ($action eq 'edit') {
# get data of user
SendSQL("SELECT password, realname, groupset, blessgroupset,
emailnotification, disabledtext
emailnotification, disabledtext, newemailtech
FROM profiles
WHERE login_name=" . SqlQuote($user));
my ($password, $realname, $groupset, $blessgroupset, $emailnotification,
$disabledtext) = FetchSQLData();
$disabledtext, $newemailtech) = FetchSQLData();
print "<FORM METHOD=POST ACTION=editusers.cgi>\n";
print "<TABLE BORDER=0 CELLPADDING=4 CELLSPACING=0><TR>\n";
EmitFormElements($user, $password, $realname, $groupset, $blessgroupset,
$emailnotification, $disabledtext);
$emailnotification, $disabledtext, $newemailtech);
print "</TR></TABLE>\n";
......@@ -691,7 +702,10 @@ if ($action eq 'edit') {
print "<INPUT TYPE=HIDDEN NAME=\"realnameold\" VALUE=\"$realname\">\n";
print "<INPUT TYPE=HIDDEN NAME=\"groupsetold\" VALUE=\"$groupset\">\n";
print "<INPUT TYPE=HIDDEN NAME=\"blessgroupsetold\" VALUE=\"$blessgroupset\">\n";
print "<INPUT TYPE=HIDDEN NAME=\"emailnotificationold\" VALUE=\"$emailnotification\">\n";
if (!$newemailtech) {
print "<INPUT TYPE=HIDDEN NAME=\"emailnotificationold\" " .
"VALUE=\"$emailnotification\">\n";
}
print "<INPUT TYPE=HIDDEN NAME=\"disabledtextold\" VALUE=\"" .
value_quote($disabledtext) . "\">\n";
print "<INPUT TYPE=HIDDEN NAME=\"action\" VALUE=\"update\">\n";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment