Commit 5683ca47 authored by terry%netscape.com's avatar terry%netscape.com

Majorly changed querying of email addresses.

parent ccb7eb4d
......@@ -11,6 +11,12 @@ will tell you what has been changed in the last week.
1/18/99 You can now query by CC. To make this perform reasonably, the CC table
needs some indices. The following MySQL does the necessary stuff:
alter table cc add index (bug_id), add index (who);
1/15/99 The op_sys field can now be queried by (and more easily tweaked).
To make this perform reasonably, it needs an index. The following MySQL
command will create the necessary index:
......@@ -63,6 +69,17 @@ entries:
alter table bugs change column op_sys op_sys enum("All", "Windows 3.1", "Windows 95", "Windows 98", "Windows NT", "Mac System 7", "Mac System 7.5", "Mac System 7.1.6", "Mac System 8.0", "AIX", "BSDI", "HP-UX", "IRIX", "Linux", "OSF/1", "Solaris", "SunOS", "other") not null, change column rep_platform rep_platform enum("All", "DEC", "HP", "Macintosh", "PC", "SGI", "Sun", "Other");
11/20/98 Added searching of CC field. To better support this, added
some indexes to the CC table. You probably want to execute the following
mysql commands:
alter table cc add index (bug_id);
alter table cc add index (who);
10/27/98 security check for legal products in place. bug charts are not
available as an option if collectstats.pl has never been run. all products
get daily stats collected now. README updated: Chart::Base is listed as
......
......@@ -195,6 +195,7 @@ bugs.product,
bugs.bug_status";
}
$query .= "
from bugs,
profiles assign,
......@@ -206,6 +207,15 @@ and bugs.product = projector.program
and bugs.version = projector.value
";
if ((defined $::FORM{'emailcc1'} && $::FORM{'emailcc1'}) ||
(defined $::FORM{'emailcc2'} && $::FORM{'emailcc2'})) {
# We need to poke into the CC table. Do weird SQL left join stuff so that
# we can look in the CC table, but won't reject any bugs that don't have
# any CC fields.
$query =~ s/bugs,/bugs left join cc using (bug_id) left join profiles ccname on cc.who = ccname.userid,/;
}
if (defined $::FORM{'sql'}) {
$query .= "and (\n$::FORM('sql')\n)"
} else {
......@@ -244,6 +254,61 @@ if (defined $::FORM{'sql'}) {
}
}
foreach my $id ("1", "2") {
my $email = trim($::FORM{"email$id"});
if ($email eq "") {
next;
}
my $qemail = SqlQuote($email);
my $type = $::FORM{"emailtype$id"};
my $emailid;
if ($type eq "exact") {
$emailid = DBNameToIdAndCheck($email);
}
my $foundone = 0;
my $lead= "and (\n";
foreach my $field ("assigned_to", "reporter", "cc") {
my $doit = $::FORM{"email$field$id"};
if (!$doit) {
next;
}
$foundone = 1;
my $table;
if ($field eq "assigned_to") {
$table = "assign";
} elsif ($field eq "reporter") {
$table = "report";
} else {
$table = "ccname";
}
if ($type eq "exact") {
if ($field eq "cc") {
$query .= "\t$lead cc.who = $emailid\n";
} else {
$query .= "\t$lead $field = $emailid\n";
}
} elsif ($type eq "regexp") {
$query .= "\t$lead $table.login_name regexp $qemail\n";
} else {
$query .= "\t$lead instr($table.login_name, $qemail)\n";
}
$lead = " or ";
}
if (!$foundone) {
print "You must specify one or more fields in which to search for <tt>$email</tt>.\n";
exit;
}
if ($lead eq " or ") {
$query .= ")\n";
}
}
if (defined $::FORM{'changedin'}) {
my $c = trim($::FORM{'changedin'});
if ($c ne "") {
......
<html> <head>
<title>Help on searching by email address.</title>
</head>
<body>
<h1>Help on searching by email address.</h1>
This used to be simpler, but not very powerful. Now it's really
powerful and useful, but it may not be obvious how to use it...
<p>
To search for bugs associated with an email address:
<ul>
<li> Type a portion of an email address into the text field.
<li> Select which fields of the bug you expect that address to be in
the bugs you're looking for.
</ul>
<p>
You can look for up to two different email addresses; if you specify
both, then only bugs which match both will show up. This is useful to
find bugs that were, for example, created by Ralph and assigned to
Fred.
<p>
You can also use the drop down menus to specify whether you want to
match addresses by doing a substring match, by using regular
expressions, or by exactly matching a fully specified email address.
</body> </html>
......@@ -29,7 +29,10 @@ mysql << OK_ALL_DONE
use bugs;
create table cc (
bug_id mediumint not null,
who mediumint not null
who mediumint not null,
index(bug_id),
index(who)
);
......
......@@ -58,7 +58,11 @@ my %type;
foreach my $name ("bug_status", "resolution", "assigned_to", "rep_platform",
"priority", "bug_severity", "product", "reporter", "op_sys",
"component", "version") {
"component", "version",
"email1", "emailtype1", "emailreporter1",
"emailassigned_to1", "emailcc1",
"email2", "emailtype2", "emailreporter2",
"emailassigned_to2", "emailcc2") {
$default{$name} = "";
$type{$name} = 0;
}
......@@ -100,8 +104,67 @@ print "Set-Cookie: BUGLIST=
Content-type: text/html\n\n";
GetVersionTable();
my $who = GeneratePeopleInput("assigned_to", $default{"assigned_to"});
my $reporter = GeneratePeopleInput("reporter", $default{"reporter"});
sub GenerateEmailInput {
my ($id) = (@_);
my $defstr = value_quote($default{"email$id"});
my $deftype = $default{"emailtype$id"};
if ($deftype eq "") {
$deftype = "substring";
}
my $assignedto = ($default{"emailassigned_to$id"} eq "1") ? "checked" : "";
my $reporter = ($default{"emailreporter$id"} eq "1") ? "checked" : "";
my $cc = ($default{"emailcc$id"} eq "1") ? "checked" : "";
if ($assignedto eq "" && $reporter eq "" && $cc eq "") {
if ($id eq "1") {
$assignedto = "checked";
} else {
$reporter = "checked";
}
}
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="">&nbsp;matching as
<SELECT NAME=emailtype$id>
<OPTION VALUE="regexp">regexp
<OPTION SELECTED VALUE="substring">substring
<OPTION VALUE="exact">exact
</SELECT>
</td>
<td>
<input type="checkbox" name="emailassigned_to$id" value=1 $assignedto>Assigned To
</td>
</tr>
<tr>
<td>
<input type="checkbox" name="emailreporter$id" value=1 $reporter>Reporter
</td>
</tr>
<tr>
<td align=right>(Will match any of the selected fields)</td>
<td>
<input type="checkbox" name="emailcc$id" value=1 $cc>CC &nbsp;&nbsp;
</td>
</tr>
</table>
</table>
|;
}
my $emailinput1 = GenerateEmailInput(1);
my $emailinput2 = GenerateEmailInput(2);
# Muck the "legal product" list so that the default one is always first (and
......@@ -164,12 +227,12 @@ print "
</table>
<p>
<TABLE>
<TR><TD ALIGN=RIGHT><B><A HREF=\"bug_status.html#assigned_to\">Assigned To:</a></B><TD>$who
$emailinput1<p>
$emailinput2<p>
<p>
<TR><TD ALIGN=RIGHT><B>Reporter:</B><TD>$reporter
</TABLE>
<NOBR>Changed in the last <INPUT NAME=changedin SIZE=2> days.</NOBR>
......
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