#!/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. # # The Initial Developer of the Original Code is Netscape Communications # Corporation. Portions created by Netscape are # Copyright (C) 1998 Netscape Communications Corporation. All # Rights Reserved. # # Contributor(s): Terry Weissman # David Gardiner use diagnostics; use strict; require "CGI.pl"; $::CheckOptionValues = 0; # It's OK if we have some bogus things in the # pop-up lists here, from a remembered query # that is no longer quite valid. We don't # want to crap out in the query page. # Shut up misguided -w warnings about "used only once": use vars @::CheckOptionValues, @::legal_resolution, @::legal_bug_status, @::legal_components, @::legal_keywords, @::legal_opsys, @::legal_platform, @::legal_priority, @::legal_product, @::legal_severity, @::legal_target_milestone, @::legal_versions, @::log_columns, %::versions, %::components, %::FORM; if (defined $::FORM{"GoAheadAndLogIn"}) { # We got here from a login page, probably from relogin.cgi. We better # make sure the password is legit. confirm_login(); } else { quietly_check_login(); } my $userid = 0; if (defined $::COOKIE{"Bugzilla_login"}) { $userid = DBNameToIdAndCheck($::COOKIE{"Bugzilla_login"}); } # Backwards compatability hack -- if there are any of the old QUERY_* # cookies around, and we are logged in, then move them into the database # and nuke the cookie. if ($userid) { my @oldquerycookies; foreach my $i (keys %::COOKIE) { if ($i =~ /^QUERY_(.*)$/) { push(@oldquerycookies, [$1, $i, $::COOKIE{$i}]); } } if (defined $::COOKIE{'DEFAULTQUERY'}) { push(@oldquerycookies, [$::defaultqueryname, 'DEFAULTQUERY', $::COOKIE{'DEFAULTQUERY'}]); } if (@oldquerycookies) { foreach my $ref (@oldquerycookies) { my ($name, $cookiename, $value) = (@$ref); if ($value) { my $qname = SqlQuote($name); SendSQL("SELECT query FROM namedqueries " . "WHERE userid = $userid AND name = $qname"); my $query = FetchOneColumn(); if (!$query) { SendSQL("REPLACE INTO namedqueries " . "(userid, name, query) VALUES " . "($userid, $qname, " . SqlQuote($value) . ")"); } } print "Set-Cookie: $cookiename= ; path=/ ; expires=Sun, 30-Jun-1980 00:00:00 GMT\n"; } } } if ($::FORM{'nukedefaultquery'}) { if ($userid) { SendSQL("DELETE FROM namedqueries " . "WHERE userid = $userid AND name = '$::defaultqueryname'"); } $::buffer = ""; } my $userdefaultquery; if ($userid) { SendSQL("SELECT query FROM namedqueries " . "WHERE userid = $userid AND name = '$::defaultqueryname'"); $userdefaultquery = FetchOneColumn(); } my %default; my %type; sub ProcessFormStuff { my ($buf) = (@_); my $foundone = 0; foreach my $name ("bug_status", "resolution", "assigned_to", "rep_platform", "priority", "bug_severity", "product", "reporter", "op_sys", "component", "version", "chfield", "chfieldfrom", "chfieldto", "chfieldvalue", "email1", "emailtype1", "emailreporter1", "emailassigned_to1", "emailcc1", "emailqa_contact1", "emaillongdesc1", "email2", "emailtype2", "emailreporter2", "emailassigned_to2", "emailcc2", "emailqa_contact2", "emaillongdesc2", "changedin", "votes", "short_desc", "short_desc_type", "long_desc", "long_desc_type", "bug_file_loc", "bug_file_loc_type", "status_whiteboard", "status_whiteboard_type", "bug_id", "bugidtype", "keywords", "keywords_type") { $default{$name} = ""; $type{$name} = 0; } foreach my $item (split(/\&/, $buf)) { my @el = split(/=/, $item); my $name = $el[0]; my $value; if ($#el > 0) { $value = url_decode($el[1]); } else { $value = ""; } if (defined $default{$name}) { $foundone = 1; if ($default{$name} ne "") { $default{$name} .= "|$value"; $type{$name} = 1; } else { $default{$name} = $value; } } } return $foundone; } if (!ProcessFormStuff($::buffer)) { # Ah-hah, there was no form stuff specified. Do it again with the # default query. if ($userdefaultquery) { ProcessFormStuff($userdefaultquery); } else { ProcessFormStuff(Param("defaultquery")); } } if ($default{'chfieldto'} eq "") { $default{'chfieldto'} = "Now"; } print "Set-Cookie: BUGLIST= Content-type: text/html\n\n"; GetVersionTable(); 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" : ""; my $longdesc = ($default{"emaillongdesc$id"} eq "1") ? "checked" : ""; my $qapart = ""; my $qacontact = ""; if (Param("useqacontact")) { $qacontact = ($default{"emailqa_contact$id"} eq "1") ? "checked" : ""; $qapart = qq| QA Contact |; } if ($assignedto eq "" && $reporter eq "" && $cc eq "" && $qacontact eq "") { if ($id eq "1") { $assignedto = "checked"; } else { $reporter = "checked"; } } $default{"emailtype$id"} ||= "substring"; return qq{
$qapart
Email:  matching as } . BuildPulldown("emailtype$id", [["regexp", "regexp"], ["notregexp", "not regexp"], ["substring", "substring"], ["exact", "exact"]], $default{"emailtype$id"}) . qq{ Assigned To
Reporter
(Will match any of the selected fields) CC
Added comment
}; } my $emailinput1 = GenerateEmailInput(1); my $emailinput2 = GenerateEmailInput(2); # javascript my $jscript = << 'ENDSCRIPT'; }; # Muck the "legal product" list so that the default one is always first (and # is therefore visibly selected. # Commented out, until we actually have enough products for this to matter. # set w [lsearch $legal_product $default{"product"}] # if {$w >= 0} { # set legal_product [concat $default{"product"} [lreplace $legal_product $w $w]] # } PutHeader("Bugzilla Query Page", "Query", "This page lets you search the database for recorded bugs.", q{onLoad="selectProduct(document.forms[0]);"}); push @::legal_resolution, "---"; # Oy, what a hack. push @::legal_target_milestone, "---"; # Oy, what a hack. print $jscript; my @logfields = ("[Bug creation]", @::log_columns); print qq{
}; print "
Status: Resolution: Platform: OpSys: Priority: Severity:
@{[make_selection_widget(\"bug_status\",\@::legal_bug_status,$default{'bug_status'}, $type{'bug_status'}, 1)]} @{[make_selection_widget(\"resolution\",\@::legal_resolution,$default{'resolution'}, $type{'resolution'}, 1)]} @{[make_selection_widget(\"platform\",\@::legal_platform,$default{'platform'}, $type{'platform'}, 1)]} @{[make_selection_widget(\"op_sys\",\@::legal_opsys,$default{'op_sys'}, $type{'op_sys'}, 1)]} @{[make_selection_widget(\"priority\",\@::legal_priority,$default{'priority'}, $type{'priority'}, 1)]} @{[make_selection_widget(\"bug_severity\",\@::legal_severity,$default{'bug_severity'}, $type{'bug_severity'}, 1)]}

"; my $inclselected = "SELECTED"; my $exclselected = ""; if ($default{'bugidtype'} eq "exclude") { $inclselected = ""; $exclselected = "SELECTED"; } my $bug_id = value_quote($default{'bug_id'}); print qq{ }; print "
$emailinput1

$emailinput2

bugs numbered:
Changed in the last days. At least votes.
Where the field(s) changed. dates to
changed to value (optional)

"; if (Param("usetargetmilestone")) { print ""; } print " "; if (Param("usetargetmilestone")) { print " "; } sub StringSearch { my ($desc, $name) = (@_); my $type = $name . "_type"; my $def = value_quote($default{$name}); print qq{ "; } print "
Program: Version: Component:Target Milestone:
$desc:
"; StringSearch("Summary", "short_desc"); StringSearch("A description entry", "long_desc"); StringSearch("URL", "bug_file_loc"); if (Param("usestatuswhiteboard")) { StringSearch("Status whiteboard", "status_whiteboard"); } if (@::legal_keywords) { my $def = value_quote($default{'keywords'}); print qq{ }; } print "
Keywords: }; my $type = $default{"keywords_type"}; if ($type eq "or") { # Backward compatability hack. $type = "anywords"; } print BuildPulldown("keywords_type", [["anywords", "Any of the listed keywords set"], ["allwords", "All of the listed keywords set"], ["nowords", "None of the listed keywords set"]], $type); print qq{

"; if (!$userid) { print qq{}; } else { print "
Run this query
"; my @namedqueries; if ($userid) { SendSQL("SELECT name FROM namedqueries " . "WHERE userid = $userid AND name != '$::defaultqueryname' " . "ORDER BY name"); while (MoreSQLData()) { push(@namedqueries, FetchOneColumn()); } } if (@namedqueries) { my $namelist = make_options(\@namedqueries); print qq{
Load the remembered query:
Run the remembered query:
Forget the remembered query:
}; } print " Remember this as the default query
Remember this query, and name it:
" } print " Sort By: "; if ($userdefaultquery) { print qq{
Set my default query back to the system default}; } print "

Give me a clue about how to use this form.

"; if (UserInGroup("tweakparams")) { print "Edit Bugzilla operating parameters
\n"; } if (UserInGroup("editcomponents")) { print "Edit Bugzilla products and components
\n"; } if (UserInGroup("editkeywords")) { print "Edit Bugzilla keywords
\n"; } if ($userid) { print "Log in as someone besides $::COOKIE{'Bugzilla_login'}
\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"; PutFooter();