Merge query-by-number and multi-field query forms.
This work included: - move a few functions out of query-pr-summary.cgi into a new file - query-pr-lib.pl, which now provides a procedure to display forms - include query-pr-lib.pl in both query-pr.cgi and query-pr-summary.cgi scripts PR: www/35647 Approved by: trhodes (mentor), keramida (mentor) Silence from: www@
This commit is contained in:
parent
420f16be4e
commit
62076a45d1
Notes:
svn2git
2020-12-08 03:00:23 +00:00
svn path=/www/; revision=29359
3 changed files with 168 additions and 162 deletions
162
en/cgi/query-pr-lib.pl
Normal file
162
en/cgi/query-pr-lib.pl
Normal file
|
@ -0,0 +1,162 @@
|
||||||
|
#!/usr/bin/perl -Tw
|
||||||
|
|
||||||
|
sub get_categories {
|
||||||
|
@categories = ();
|
||||||
|
|
||||||
|
open(Q, 'query-pr.web --list-categories 2>/dev/null |') ||
|
||||||
|
die "Cannot get categories\n";
|
||||||
|
|
||||||
|
while(<Q>) {
|
||||||
|
chop;
|
||||||
|
local ($cat, $desc, $responsible, $notify) = split(/:/);
|
||||||
|
push(@categories, $cat);
|
||||||
|
$catdesc{$cat} = $desc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sub get_states {
|
||||||
|
@states = ();
|
||||||
|
|
||||||
|
open(Q, 'query-pr.web --list-states 2>/dev/null |') ||
|
||||||
|
die "Cannot get states\n";
|
||||||
|
|
||||||
|
while(<Q>) {
|
||||||
|
chop;
|
||||||
|
local ($state, $type, $desc) = split(/:/);
|
||||||
|
push(@states, $state);
|
||||||
|
$statedesc{$state} = $desc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sub get_classes {
|
||||||
|
@classes = ();
|
||||||
|
|
||||||
|
open(Q, 'query-pr.web --list-classes 2>/dev/null |') ||
|
||||||
|
die "Cannot get classes\n";
|
||||||
|
|
||||||
|
while(<Q>) {
|
||||||
|
chop;
|
||||||
|
local ($class, $type, $desc) = split(/:/);
|
||||||
|
push(@classes, $class);
|
||||||
|
$classdesc{$class} = $desc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sub displayform {
|
||||||
|
print qq`
|
||||||
|
<p>To query the GNATS Database for specific PR number, please fill in
|
||||||
|
this form:</p>
|
||||||
|
<form action='./query-pr.cgi' method='get'>
|
||||||
|
<table cellspacing='0' cellpadding='3' class='headtable'>
|
||||||
|
<tr><td width='130'><b>PR number:</b></td><td><input type='text'
|
||||||
|
name='pr' maxlength='30' /></td></tr>
|
||||||
|
<tr><td width='130'><b>Category:</b></td><td><input type='text'
|
||||||
|
name='cat' maxlength='30' /> (optional)</td></tr>
|
||||||
|
<tr><td colspan='2'><input type='submit' value='Submit' />
|
||||||
|
<input type='reset' value='Reset Form' /></td></tr>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<p>Alternatively, it is possible to select items you wish to search for.
|
||||||
|
Multiple items are AND'ed together.<br />
|
||||||
|
To generate current list of all open PRs in GNATS database, just press
|
||||||
|
the "Query PRs" button.
|
||||||
|
</p>
|
||||||
|
<form method='get' action='./query-pr-summary.cgi'>
|
||||||
|
|
||||||
|
<table cellspacing="0" cellpadding="3" class="headtable">
|
||||||
|
<tr>
|
||||||
|
<td><b>Category</b>:</td>
|
||||||
|
<td><select name='category'>
|
||||||
|
<option selected='selected' value=''>Any</option>`;
|
||||||
|
|
||||||
|
&get_categories;
|
||||||
|
foreach (sort @categories) {
|
||||||
|
#print "<option value='$_'>$_ ($catdesc{$_})</option>\n";
|
||||||
|
print "<option>$_</option>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
print qq`
|
||||||
|
</select></td>
|
||||||
|
<td><b>Severity</b>:</td>
|
||||||
|
<td><select name='severity'>
|
||||||
|
<option selected='selected' value=''>Any</option>
|
||||||
|
<option>non-critical</option>
|
||||||
|
<option>serious</option>
|
||||||
|
<option>critical</option>
|
||||||
|
</select></td>
|
||||||
|
</tr><tr>
|
||||||
|
<td><b>Priority</b>:</td>
|
||||||
|
<td><select name='priority'>
|
||||||
|
<option selected='selected' value=''>Any</option>
|
||||||
|
<option>low</option>
|
||||||
|
<option>medium</option>
|
||||||
|
<option>high</option>
|
||||||
|
</select></td>
|
||||||
|
<td><b>Class</b>:</td>
|
||||||
|
<td><select name='class'>
|
||||||
|
<option selected='selected' value=''>Any</option>
|
||||||
|
`;
|
||||||
|
|
||||||
|
&get_classes;
|
||||||
|
foreach (@classes) {
|
||||||
|
#print "<option value='$_'>$_ ($classdesc{$_})</option>\n";
|
||||||
|
print "<option>$_</option>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
print qq`</select></td>
|
||||||
|
</tr><tr>
|
||||||
|
<td><b>State</b>:</td>
|
||||||
|
<td><select name='state'>
|
||||||
|
<option selected='selected' value=''>Any</option>
|
||||||
|
`;
|
||||||
|
|
||||||
|
&get_states;
|
||||||
|
foreach (@states) {
|
||||||
|
($us = $_) =~ s/^./\U$&/;
|
||||||
|
print "<option value='$_'>";
|
||||||
|
#print "$us ($statedesc{$_})</option>\n";
|
||||||
|
print "$us</option>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
print qq`</select></td>
|
||||||
|
<td><b>Sort by</b>:</td>
|
||||||
|
<td><select name='sort'>
|
||||||
|
<option value='none'>No Sort</option>
|
||||||
|
<option value='lastmod'>Last-Modified</option>
|
||||||
|
<option value='category'>Category</option>
|
||||||
|
<option value='responsible'>Responsible Party</option>
|
||||||
|
</select></td>
|
||||||
|
</tr><tr>
|
||||||
|
<!-- We don't use submitter Submitter: -->
|
||||||
|
<td><b>Text in single-line fields</b>:</td>
|
||||||
|
<td><input type='text' name='text' /></td>
|
||||||
|
<td><b>Responsible</b>:</td>
|
||||||
|
<td><input type='text' name='responsible' /></td>
|
||||||
|
</tr><tr>
|
||||||
|
<td><b>Text in multi-line fields</b>:</td>
|
||||||
|
<td><input type='text' name='multitext' /></td>
|
||||||
|
<td><b>Originator</b>:</td>
|
||||||
|
<td><input type='text' name='originator' /></td>
|
||||||
|
</tr><tr>
|
||||||
|
<td><b>Closed reports too</b>:</td>
|
||||||
|
<td><input name='closedtoo' value='on' type='checkbox' /></td>
|
||||||
|
<td><b>Release</b>:</td>
|
||||||
|
<td><select name='release'>
|
||||||
|
<option selected='selected' value=''>Any</option>
|
||||||
|
<option value='^FreeBSD [2345]'>Pre-6.X</option>
|
||||||
|
<option value='^FreeBSD 6'>6.X only</option>
|
||||||
|
<option value='^FreeBSD 5'>5.X only</option>
|
||||||
|
<option value='^FreeBSD 4'>4.X only</option>
|
||||||
|
<option value='^FreeBSD 3'>3.X only</option>
|
||||||
|
<option value='^FreeBSD 2'>2.X only</option>
|
||||||
|
</select></td>
|
||||||
|
</tr>
|
||||||
|
<tr><td colspan="2"><input type='submit' value='Query PRs' />
|
||||||
|
<input type='reset' value='Reset Form' /></td></tr>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/perl -T
|
#!/usr/bin/perl -T
|
||||||
# $FreeBSD: www/en/cgi/query-pr-summary.cgi,v 1.56 2006/09/24 13:34:55 danger Exp $
|
# $FreeBSD: www/en/cgi/query-pr-summary.cgi,v 1.57 2006/10/08 17:00:12 ceri Exp $
|
||||||
|
|
||||||
$html_mode = 1 if $ENV{'DOCUMENT_ROOT'};
|
$html_mode = 1 if $ENV{'DOCUMENT_ROOT'};
|
||||||
$self_ref = $ENV{'SCRIPT_NAME'};
|
$self_ref = $ENV{'SCRIPT_NAME'};
|
||||||
|
@ -15,6 +15,7 @@ $closed_too = 0;
|
||||||
|
|
||||||
require './cgi-lib.pl';
|
require './cgi-lib.pl';
|
||||||
require './cgi-style.pl';
|
require './cgi-style.pl';
|
||||||
|
require './query-pr-lib.pl';
|
||||||
require 'getopts.pl';
|
require 'getopts.pl';
|
||||||
|
|
||||||
if (!$ENV{'QUERY_STRING'} or $ENV{'QUERY_STRING'} eq 'query') {
|
if (!$ENV{'QUERY_STRING'} or $ENV{'QUERY_STRING'} eq 'query') {
|
||||||
|
@ -411,48 +412,6 @@ sub severity_summary {
|
||||||
&printcnt(&gnats_summary('$severity eq "non-critical"', $html_mode));
|
&printcnt(&gnats_summary('$severity eq "non-critical"', $html_mode));
|
||||||
}
|
}
|
||||||
|
|
||||||
sub get_categories {
|
|
||||||
@categories = ();
|
|
||||||
|
|
||||||
open(Q, 'query-pr.web --list-categories 2>/dev/null |') ||
|
|
||||||
die "Cannot get categories\n";
|
|
||||||
|
|
||||||
while(<Q>) {
|
|
||||||
chop;
|
|
||||||
local ($cat, $desc, $responsible, $notify) = split(/:/);
|
|
||||||
push(@categories, $cat);
|
|
||||||
$catdesc{$cat} = $desc;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sub get_states {
|
|
||||||
@states = ();
|
|
||||||
|
|
||||||
open(Q, 'query-pr.web --list-states 2>/dev/null |') ||
|
|
||||||
die "Cannot get states\n";
|
|
||||||
|
|
||||||
while(<Q>) {
|
|
||||||
chop;
|
|
||||||
local ($state, $type, $desc) = split(/:/);
|
|
||||||
push(@states, $state);
|
|
||||||
$statedesc{$state} = $desc;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sub get_classes {
|
|
||||||
@classes = ();
|
|
||||||
|
|
||||||
open(Q, 'query-pr.web --list-classes 2>/dev/null |') ||
|
|
||||||
die "Cannot get classes\n";
|
|
||||||
|
|
||||||
while(<Q>) {
|
|
||||||
chop;
|
|
||||||
local ($class, $type, $desc) = split(/:/);
|
|
||||||
push(@classes, $class);
|
|
||||||
$classdesc{$class} = $desc;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sub read_gnats {
|
sub read_gnats {
|
||||||
local($report) = @_[0];
|
local($report) = @_[0];
|
||||||
|
|
||||||
|
@ -586,108 +545,3 @@ sub gnats_summary_line_text {
|
||||||
$resp . (' ' x (10 - length($resp))) .
|
$resp . (' ' x (10 - length($resp))) .
|
||||||
substr($syn,0,39) . "\n";
|
substr($syn,0,39) . "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
sub displayform {
|
|
||||||
print qq`
|
|
||||||
<p>
|
|
||||||
Please select the items you wish to search for. Multiple items are AND'ed
|
|
||||||
together.<br />
|
|
||||||
To generate current list of all open PRs in GNATS database, just press
|
|
||||||
the "Query PRs" button.
|
|
||||||
</p>
|
|
||||||
<form method='get' action='$self_ref'>
|
|
||||||
|
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
<td><b>Category</b>:</td>
|
|
||||||
<td><select name='category'>
|
|
||||||
<option selected='selected' value=''>Any</option>`;
|
|
||||||
|
|
||||||
&get_categories;
|
|
||||||
foreach (sort @categories) {
|
|
||||||
#print "<option value='$_'>$_ ($catdesc{$_})</option>\n";
|
|
||||||
print "<option>$_</option>\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
print qq`
|
|
||||||
</select></td>
|
|
||||||
<td><b>Severity</b>:</td>
|
|
||||||
<td><select name='severity'>
|
|
||||||
<option selected='selected' value=''>Any</option>
|
|
||||||
<option>non-critical</option>
|
|
||||||
<option>serious</option>
|
|
||||||
<option>critical</option>
|
|
||||||
</select></td>
|
|
||||||
</tr><tr>
|
|
||||||
<td><b>Priority</b>:</td>
|
|
||||||
<td><select name='priority'>
|
|
||||||
<option selected='selected' value=''>Any</option>
|
|
||||||
<option>low</option>
|
|
||||||
<option>medium</option>
|
|
||||||
<option>high</option>
|
|
||||||
</select></td>
|
|
||||||
<td><b>Class</b>:</td>
|
|
||||||
<td><select name='class'>
|
|
||||||
<option selected='selected' value=''>Any</option>
|
|
||||||
`;
|
|
||||||
|
|
||||||
&get_classes;
|
|
||||||
foreach (@classes) {
|
|
||||||
#print "<option value='$_'>$_ ($classdesc{$_})</option>\n";
|
|
||||||
print "<option>$_</option>\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
print qq`</select></td>
|
|
||||||
</tr><tr>
|
|
||||||
<td><b>State</b>:</td>
|
|
||||||
<td><select name='state'>
|
|
||||||
<option selected='selected' value=''>Any</option>
|
|
||||||
`;
|
|
||||||
|
|
||||||
&get_states;
|
|
||||||
foreach (@states) {
|
|
||||||
($us = $_) =~ s/^./\U$&/;
|
|
||||||
print "<option value='$_'>";
|
|
||||||
#print "$us ($statedesc{$_})</option>\n";
|
|
||||||
print "$us</option>\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
print qq`</select></td>
|
|
||||||
<td><b>Sort by</b>:</td>
|
|
||||||
<td><select name='sort'>
|
|
||||||
<option value='none'>No Sort</option>
|
|
||||||
<option value='lastmod'>Last-Modified</option>
|
|
||||||
<option value='category'>Category</option>
|
|
||||||
<option value='responsible'>Responsible Party</option>
|
|
||||||
</select></td>
|
|
||||||
</tr><tr>
|
|
||||||
<!-- We don't use submitter Submitter: -->
|
|
||||||
<td><b>Text in single-line fields</b>:</td>
|
|
||||||
<td><input type='text' name='text' /></td>
|
|
||||||
<td><b>Responsible</b>:</td>
|
|
||||||
<td><input type='text' name='responsible' /></td>
|
|
||||||
</tr><tr>
|
|
||||||
<td><b>Text in multi-line fields</b>:</td>
|
|
||||||
<td><input type='text' name='multitext' /></td>
|
|
||||||
<td><b>Originator</b>:</td>
|
|
||||||
<td><input type='text' name='originator' /></td>
|
|
||||||
</tr><tr>
|
|
||||||
<td><b>Closed reports too</b>:</td>
|
|
||||||
<td><input name='closedtoo' value='on' type='checkbox' /></td>
|
|
||||||
<td><b>Release</b>:</td>
|
|
||||||
<td><select name='release'>
|
|
||||||
<option selected='selected' value=''>Any</option>
|
|
||||||
<option value='^FreeBSD [2345]'>Pre-6.X</option>
|
|
||||||
<option value='^FreeBSD 6'>6.X only</option>
|
|
||||||
<option value='^FreeBSD 5'>5.X only</option>
|
|
||||||
<option value='^FreeBSD 4'>4.X only</option>
|
|
||||||
<option value='^FreeBSD 3'>3.X only</option>
|
|
||||||
<option value='^FreeBSD 2'>2.X only</option>
|
|
||||||
</select></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
<input type='submit' value='Query PRs' />
|
|
||||||
<input type='reset' value='Reset Form' />
|
|
||||||
</form>
|
|
||||||
`;
|
|
||||||
}
|
|
||||||
|
|
|
@ -26,17 +26,17 @@
|
||||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
# SUCH DAMAGE.
|
# SUCH DAMAGE.
|
||||||
#
|
#
|
||||||
# $FreeBSD: www/en/cgi/query-pr.cgi,v 1.59 2006/11/27 17:12:50 shaun Exp $
|
# $FreeBSD: www/en/cgi/query-pr.cgi,v 1.60 2006/12/09 15:46:06 shaun Exp $
|
||||||
#
|
#
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
#use warnings;
|
|
||||||
|
|
||||||
use MIME::Base64; # ports/converters/p5-MIME-Base64
|
use MIME::Base64; # ports/converters/p5-MIME-Base64
|
||||||
use MIME::QuotedPrint; #
|
use MIME::QuotedPrint; #
|
||||||
use Convert::UU qw(uudecode uuencode); # ports/converters/p5-Convert-UU
|
use Convert::UU qw(uudecode uuencode); # ports/converters/p5-Convert-UU
|
||||||
|
|
||||||
require './cgi-style.pl';
|
require './cgi-style.pl';
|
||||||
|
require './query-pr-lib.pl';
|
||||||
|
|
||||||
use constant HTTP_HEADER => "Content-type: text/html; charset=UTF-8\r\n\r\n";
|
use constant HTTP_HEADER => "Content-type: text/html; charset=UTF-8\r\n\r\n";
|
||||||
use constant HTTP_HEADER_PATCH => "Content-type: text/plain; charset=UTF-8\r\n\r\n";
|
use constant HTTP_HEADER_PATCH => "Content-type: text/plain; charset=UTF-8\r\n\r\n";
|
||||||
|
@ -213,16 +213,6 @@ $fmt{'html_footerlinks'} = <<EOF;
|
||||||
</div>
|
</div>
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
$fmt{'query_form'} = <<EOF;
|
|
||||||
<form action="${scriptname}" method="get">
|
|
||||||
<table cellspacing="0" cellpadding="3" class="headtable">
|
|
||||||
<tr><td width="130"><b>PR number:</b></td><td><input type="text" name="pr" maxlength="30" value="%%(1)" /></td></tr>
|
|
||||||
<tr><td width="130"><b>Category:</b></td><td><input type="text" name="cat" maxlength="30" value="%%(2)" /> (optional)</td></tr>
|
|
||||||
<tr><td></td><td><input type="submit" value="Submit" /></td></tr>
|
|
||||||
</table>
|
|
||||||
</form>
|
|
||||||
EOF
|
|
||||||
|
|
||||||
$fmt{'trylatermsg'} = <<EOF;
|
$fmt{'trylatermsg'} = <<EOF;
|
||||||
<p>
|
<p>
|
||||||
Please <a href="${scriptname}?${querystring}">try again</a> later.
|
Please <a href="${scriptname}?${querystring}">try again</a> later.
|
||||||
|
@ -272,7 +262,7 @@ $category = undef
|
||||||
|
|
||||||
if ($PR !~ /^$valid_pr$/ || $PR < 0) {
|
if ($PR !~ /^$valid_pr$/ || $PR < 0) {
|
||||||
print html_header("Query PR Database");
|
print html_header("Query PR Database");
|
||||||
sprint('query_form');
|
displayform();
|
||||||
print html_footer();
|
print html_footer();
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
@ -290,7 +280,7 @@ if ($category) {
|
||||||
|
|
||||||
if (!@query or ($query[0] and $query[0] =~ /^query-pr(:?\.(:?real|web))?: /)) {
|
if (!@query or ($query[0] and $query[0] =~ /^query-pr(:?\.(:?real|web))?: /)) {
|
||||||
print html_header("No PRs Matched Query");
|
print html_header("No PRs Matched Query");
|
||||||
sprint('query_form', $PR || "", $category || "");
|
displayform();
|
||||||
print html_footer();
|
print html_footer();
|
||||||
exit;
|
exit;
|
||||||
} elsif ($query[0] =~ /^lockf: /) {
|
} elsif ($query[0] =~ /^lockf: /) {
|
||||||
|
|
Loading…
Reference in a new issue