From 5683ca475d5d89dd8eae076ccf680bed256f80ef Mon Sep 17 00:00:00 2001 From: "terry%netscape.com" <> Date: Tue, 19 Jan 1999 08:07:45 +0000 Subject: Majorly changed querying of email addresses. --- CHANGES | 17 ++++++++++++ buglist.cgi | 65 +++++++++++++++++++++++++++++++++++++++++++ helpemailquery.html | 36 ++++++++++++++++++++++++ makecctable.sh | 5 +++- query.cgi | 79 +++++++++++++++++++++++++++++++++++++++++++++++------ 5 files changed, 193 insertions(+), 9 deletions(-) create mode 100644 helpemailquery.html diff --git a/CHANGES b/CHANGES index 66c8437c1..fabe02e1e 100644 --- a/CHANGES +++ b/CHANGES @@ -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 diff --git a/buglist.cgi b/buglist.cgi index 179e2d0dc..cc2c56034 100755 --- a/buglist.cgi +++ b/buglist.cgi @@ -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 $email.\n"; + exit; + } + if ($lead eq " or ") { + $query .= ")\n"; + } +} + + + + + if (defined $::FORM{'changedin'}) { my $c = trim($::FORM{'changedin'}); if ($c ne "") { diff --git a/helpemailquery.html b/helpemailquery.html new file mode 100644 index 000000000..622e3aa45 --- /dev/null +++ b/helpemailquery.html @@ -0,0 +1,36 @@ + +Help on searching by email address. + + + +

Help on searching by email address.

+ +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... + +

+ +To search for bugs associated with an email address: + +

+ +

+ +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. + +

+ +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. + + + + diff --git a/makecctable.sh b/makecctable.sh index 44c50ca92..f0bde191b 100755 --- a/makecctable.sh +++ b/makecctable.sh @@ -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) ); diff --git a/query.cgi b/query.cgi index 170d84b9d..053511d5d 100755 --- a/query.cgi +++ b/query.cgi @@ -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| + +
+ + + + + + + + + + + + +
Email: + matching as + + +Assigned To +
+Reporter +
(Will match any of the selected fields) +CC    +
+
+|; +} + + + + + +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 "

- -
Assigned To:$who +$emailinput1

+$emailinput2

+ + + -

-

Reporter:$reporter -
Changed in the last days. -- cgit v1.2.3-24-g4f1b