1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
|
#!/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 <terry@mozilla.org>
# David Gardiner <david.gardiner@unisa.edu.au>
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 @::legal_resolution,
@::legal_product,
@::legal_bug_status,
@::legal_priority,
@::legal_opsys,
@::legal_platform,
@::legal_components,
@::legal_versions,
@::legal_severity,
@::legal_target_milestone,
@::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();
}
if (!defined $::COOKIE{"DEFAULTQUERY"}) {
$::COOKIE{"DEFAULTQUERY"} = Param("defaultquery");
}
if (!defined $::buffer || $::buffer eq "") {
$::buffer = $::COOKIE{"DEFAULTQUERY"};
}
use vars qw(%default);
my %type;
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",
"email2", "emailtype2", "emailreporter2",
"emailassigned_to2", "emailcc2", "emailqa_contact2",
"changedin", "votes", "short_desc", "short_desc_type",
"long_desc", "long_desc_type", "bug_file_loc",
"bug_file_loc_type", "status_whiteboard",
"status_whiteboard_type", "keywords") {
$default{$name} = "";
$type{$name} = 0;
}
foreach my $item (split(/\&/, $::buffer)) {
my @el = split(/=/, $item);
my $name = $el[0];
my $value;
if ($#el > 0) {
$value = url_decode($el[1]);
} else {
$value = "";
}
if (defined $default{$name}) {
if ($default{$name} ne "") {
$default{$name} .= "|$value";
$type{$name} = 1;
} else {
$default{$name} = $value;
}
}
}
if ($default{'chfieldto'} eq "") {
$default{'chfieldto'} = "Now";
}
my $namelist = "";
foreach my $i (sort (keys %::COOKIE)) {
if ($i =~ /^QUERY_/) {
if ($::COOKIE{$i} ne "") {
my $name = substr($i, 6);
$namelist .= "<OPTION>$name";
}
}
}
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" : "";
if ($assignedto eq "" && $reporter eq "" && $cc eq "") {
if ($id eq "1") {
$assignedto = "checked";
} else {
$reporter = "checked";
}
}
my $qapart = "";
if (Param("useqacontact")) {
my $qacontact =
($default{"emailqa_contact$id"} eq "1") ? "checked" : "";
$qapart = qq|
<tr>
<td></td>
<td>
<input type="checkbox" name="emailqa_contact$id" value=1 $qacontact>QA Contact
</td>
</tr>
|;
}
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="$defstr"> matching as
<SELECT NAME=emailtype$id>
<OPTION VALUE="regexp">regexp
<OPTION VALUE="notregexp">not 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>$qapart
<tr>
<td align=right>(Will match any of the selected fields)</td>
<td>
<input type="checkbox" name="emailcc$id" value=1 $cc>CC
</td>
</tr>
</table>
</table>
|;
}
my $emailinput1 = GenerateEmailInput(1);
my $emailinput2 = GenerateEmailInput(2);
# javascript
my $jscript = << 'ENDSCRIPT';
<script language="Javascript1.2" type="text/javascript">
<!--
function array_push(str)
{
this[this.length] = str;
return this;
}
Array.prototype.push = array_push;
var cpts = new Array();
var vers = new Array();
var agt=navigator.userAgent.toLowerCase();
ENDSCRIPT
my $p;
my $v;
my $c;
my $i = 0;
my $j = 0;
foreach $c (@::legal_components) {
$jscript .= "cpts['$c'] = new Array();\n";
}
foreach $v (@::legal_versions) {
$jscript .= "vers['$v'] = new Array();\n";
}
for $p (@::legal_product) {
if ($::components{$p}) {
foreach $c (@{$::components{$p}}) {
$jscript .= "cpts['$c'].push('$p');\n";
}
}
if ($::versions{$p}) {
foreach $v (@{$::versions{$p}}) {
$jscript .= "vers['$v'].push('$p');\n";
}
}
}
$i = 0;
$jscript .= q{
// Only display versions/components valid for selected product(s)
function selectProduct(f) {
var agt=navigator.userAgent.toLowerCase();
// Netscape 4.04 and 4.05 also choke with an "undefined"
// error. if someone can figure out how to "define" the
// whatever, we'll remove this hack. in the mean time, we'll
// assume that v4.00-4.03 also die, so we'll disable the neat
// javascript stuff for Netscape 4.05 and earlier.
var agtver = parseFloat(navigator.appVersion);
if (agtver <= 4.05 ) return;
var cnt = 0;
var i;
var j;
for (i=0 ; i<f.product.length ; i++) {
if (f.product[i].selected) {
cnt++;
}
}
var doall = (cnt == f.product.length || cnt == 0);
var csel = new Array();
for (i=0 ; i<f.component.length ; i++) {
if (f.component[i].selected) {
csel[f.component[i].value] = 1;
}
}
f.component.options.length = 0;
for (c in cpts) {
var doit = doall;
for (i=0 ; !doit && i<f.product.length ; i++) {
if (f.product[i].selected) {
var p = f.product[i].value;
for (j in cpts[c]) {
var p2 = cpts[c][j];
if (p2 == p) {
doit = true;
break;
}
}
}
}
if (doit) {
var l = f.component.length;
f.component[l] = new Option(c, c);
if (csel[c]) {
f.component[l].selected = true;
}
}
}
var vsel = new Array();
for (i=0 ; i<f.version.length ; i++) {
if (f.version[i].selected) {
vsel[f.version[i].value] = 1;
}
}
f.version.options.length = 0;
for (v in vers) {
var doit = doall;
for (i=0 ; !doit && i<f.product.length ; i++) {
if (f.product[i].selected) {
var p = f.product[i].value;
for (j in vers[v]) {
var p2 = vers[v][j];
if (p2 == p) {
doit = true;
break;
}
}
}
}
if (doit) {
var l = f.version.length;
f.version[l] = new Option(v, v);
if (vsel[v]) {
f.version[l].selected = true;
}
}
}
}
// -->
</script>
};
# 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 Page", "",
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{
<FORM METHOD=GET ACTION="buglist.cgi">
<table>
<tr>
<th align=left><A HREF="bug_status.html">Status</a>:</th>
<th align=left><A HREF="bug_status.html">Resolution</a>:</th>
<th align=left><A HREF="bug_status.html#rep_platform">Platform</a>:</th>
<th align=left><A HREF="bug_status.html#op_sys">OpSys</a>:</th>
<th align=left><A HREF="bug_status.html#priority">Priority</a>:</th>
<th align=left><A HREF="bug_status.html#severity">Severity</a>:</th>
};
print "
</tr>
<tr>
<td align=left valign=top>
<SELECT NAME=\"bug_status\" MULTIPLE SIZE=7>
@{[make_options(\@::legal_bug_status, $default{'bug_status'}, $type{'bug_status'})]}
</SELECT>
</td>
<td align=left valign=top>
<SELECT NAME=\"resolution\" MULTIPLE SIZE=7>
@{[make_options(\@::legal_resolution, $default{'resolution'}, $type{'resolution'})]}
</SELECT>
</td>
<td align=left valign=top>
<SELECT NAME=\"rep_platform\" MULTIPLE SIZE=7>
@{[make_options(\@::legal_platform, $default{'rep_platform'}, $type{'rep_platform'})]}
</SELECT>
</td>
<td align=left valign=top>
<SELECT NAME=\"op_sys\" MULTIPLE SIZE=7>
@{[make_options(\@::legal_opsys, $default{'op_sys'}, $type{'op_sys'})]}
</SELECT>
</td>
<td align=left valign=top>
<SELECT NAME=\"priority\" MULTIPLE SIZE=7>
@{[make_options(\@::legal_priority, $default{'priority'}, $type{'priority'})]}
</SELECT>
</td>
<td align=left valign=top>
<SELECT NAME=\"bug_severity\" MULTIPLE SIZE=7>
@{[make_options(\@::legal_severity, $default{'bug_severity'}, $type{'bug_severity'})]}
</SELECT>
</tr>
</table>
<p>
<table>
<tr><td colspan=2>
$emailinput1<p>
</td></tr><tr><td colspan=2>
$emailinput2<p>
</td></tr>
<tr>
<td>
Changed in the <NOBR>last <INPUT NAME=changedin SIZE=2 VALUE=\"$default{'changedin'}\"> days.</NOBR>
</td>
<td align=right>
At <NOBR>least <INPUT NAME=votes SIZE=3 VALUE=\"$default{'votes'}\"> votes.</NOBR>
</tr>
</table>
<table>
<tr>
<td rowspan=2 align=right>Where the field(s)
</td><td rowspan=2>
<SELECT NAME=\"chfield\" MULTIPLE SIZE=4>
@{[make_options(\@logfields, $default{'chfield'}, $type{'chfield'})]}
</SELECT>
</td><td rowspan=2>
changed.
</td><td>
<nobr>dates <INPUT NAME=chfieldfrom SIZE=10 VALUE=\"$default{'chfieldfrom'}\"></nobr>
<nobr>to <INPUT NAME=chfieldto SIZE=10 VALUE=\"$default{'chfieldto'}\"></nobr>
</td>
</tr>
<tr>
<td>changed to value <nobr><INPUT NAME=chfieldvalue SIZE=10> (optional)</nobr>
</td>
</table>
<P>
<table>
<tr>
<TH ALIGN=LEFT VALIGN=BOTTOM>Program:</th>
<TH ALIGN=LEFT VALIGN=BOTTOM>Version:</th>
<TH ALIGN=LEFT VALIGN=BOTTOM><A HREF=describecomponents.cgi>Component:</a></th>
";
if (Param("usetargetmilestone")) {
print "<TH ALIGN=LEFT VALIGN=BOTTOM>Target Milestone:</th>";
}
print "
</tr>
<tr>
<td align=left valign=top>
<SELECT NAME=\"product\" MULTIPLE SIZE=5 onChange=\"selectProduct(this.form);\">
@{[make_options(\@::legal_product, $default{'product'}, $type{'product'})]}
</SELECT>
</td>
<td align=left valign=top>
<SELECT NAME=\"version\" MULTIPLE SIZE=5>
@{[make_options(\@::legal_versions, $default{'version'}, $type{'version'})]}
</SELECT>
</td>
<td align=left valign=top>
<SELECT NAME=\"component\" MULTIPLE SIZE=5>
@{[make_options(\@::legal_components, $default{'component'}, $type{'component'})]}
</SELECT>
</td>";
if (Param("usetargetmilestone")) {
print "
<td align=left valign=top>
<SELECT NAME=\"target_milestone\" MULTIPLE SIZE=5>
@{[make_options(\@::legal_target_milestone, $default{'component'}, $type{'component'})]}
</SELECT>
</td>";
}
sub StringSearch {
my ($desc, $name) = (@_);
my $type = $name . "_type";
my $def = value_quote($default{$name});
print qq{<tr>
<td align=right>$desc:</td>
<td><input name=$name size=30 value="$def"></td>
<td><SELECT NAME=$type>
};
if ($default{$type} eq "") {
$default{$type} = "substring";
}
foreach my $i (["substring", "case-insensitive substring"],
["casesubstring", "case-sensitive substring"],
["regexp", "regular expression"],
["notregexp", "not ( regular expression )"]) {
my ($n, $d) = (@$i);
my $sel = "";
if ($default{$type} eq $n) {
$sel = " SELECTED";
}
print qq{<OPTION VALUE="$n"$sel>$d\n};
}
print "</SELECT></TD>
</tr>
";
}
print "
</tr>
</table>
<table border=0>
";
StringSearch("Summary", "short_desc");
StringSearch("Description", "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{
<TR>
<TD ALIGN="right"><A HREF="describekeywords.cgi">Keywords</A>:</TD>
<TD><INPUT NAME="keywords" SIZE=30 VALUE=$def></TD>
<TD><SELECT NAME=keywords_type>
};
foreach my $i (["or", "Any of the listed keywords set"]) {
my ($n, $d) = (@$i);
my $sel = "";
if ($default{"keywords"} eq $n) {
$sel = " SELECTED";
}
print qq{<OPTION VALUE="$n"$sel>$d\n};
}
print qq{</SELECT></TD></TR>};
}
print "
</table>
<p>
<BR>
<INPUT TYPE=radio NAME=cmdtype VALUE=doit CHECKED> Run this query
<BR>
";
if ($namelist ne "") {
print "
<table cellspacing=0 cellpadding=0><tr>
<td><INPUT TYPE=radio NAME=cmdtype VALUE=editnamed> Load the remembered query:</td>
<td rowspan=3><select name=namedcmd>$namelist</select>
</tr><tr>
<td><INPUT TYPE=radio NAME=cmdtype VALUE=runnamed> Run the remembered query:</td>
</tr><tr>
<td><INPUT TYPE=radio NAME=cmdtype VALUE=forgetnamed> Forget the remembered query:</td>
</tr></table>"
}
print "
<INPUT TYPE=radio NAME=cmdtype VALUE=asdefault> Remember this as the default query
<BR>
<INPUT TYPE=radio NAME=cmdtype VALUE=asnamed> Remember this query, and name it:
<INPUT TYPE=text NAME=newqueryname>
<BR>
<NOBR><B>Sort By:</B>
<SELECT NAME=\"order\">
<OPTION>Bug Number
<OPTION SELECTED>\"Importance\"
<OPTION>Assignee
</SELECT></NOBR>
<INPUT TYPE=\"submit\" VALUE=\"Submit query\">
<INPUT TYPE=\"reset\" VALUE=\"Reset back to the default query\">
<INPUT TYPE=hidden name=form_name VALUE=query>
<BR>Give me a <A HREF=\"help.html\">clue</A> about how to use this form.
</FORM>
";
quietly_check_login();
if (UserInGroup("tweakparams")) {
print "<a href=editparams.cgi>Edit Bugzilla operating parameters</a><br>\n";
}
if (UserInGroup("editcomponents")) {
print "<a href=editproducts.cgi>Edit Bugzilla products and components</a><br>\n";
}
if (UserInGroup("editkeywords")) {
print "<a href=editkeywords.cgi>Edit Bugzilla keywords</a><br>\n";
}
if (defined $::COOKIE{"Bugzilla_login"}) {
print "<a href=relogin.cgi>Log in as someone besides <b>$::COOKIE{'Bugzilla_login'}</b></a><br>\n";
}
print "<a href=changepassword.cgi>Change your password or preferences.</a><br>\n";
print "<a href=\"enter_bug.cgi\">Create a new bug.</a><br>\n";
print "<a href=\"createaccount.cgi\">Open a new Bugzilla account</a><br>\n";
print "<a href=\"reports.cgi\">Bug reports</a><br>\n";
|