Bug 25521 - Keyword field in new bug entry. Patch by jeff.hedlund@matrixsi.com; r=gerv.

This commit is contained in:
gerv%gerv.net 2002-09-13 22:21:19 +00:00
parent 196cbe728a
commit 612d0b26ae
2 changed files with 41 additions and 0 deletions

View File

@ -220,6 +220,27 @@ if (defined $::FORM{'cc'}) {
}
}
}
# Check for valid keywords and create list of keywords to be added to db
# (validity routine copied from process_bug.cgi)
my @keywordlist;
my %keywordseen;
if ($::FORM{'keywords'} && UserInGroup("editbugs")) {
foreach my $keyword (split(/[\s,]+/, $::FORM{'keywords'})) {
if ($keyword eq '') {
next;
}
my $i = GetKeywordIdFromName($keyword);
if (!$i) {
$vars->{'keyword'} = $keyword;
ThrowUserError("unknown_keyword");
}
if (!$keywordseen{$i}) {
push(@keywordlist, $i);
$keywordseen{$i} = 1;
}
}
}
# Build up SQL string to add bug.
my $sql = "INSERT INTO bugs " .
@ -281,6 +302,13 @@ foreach my $ccid (keys(%ccids)) {
SendSQL("INSERT INTO cc (bug_id, who) VALUES ($id, $ccid)");
}
if (UserInGroup("editbugs")) {
foreach my $keyword (@keywordlist) {
SendSQL("INSERT INTO keywords (bug_id, keywordid)
VALUES ($id, $keyword)");
}
}
SendSQL("UNLOCK TABLES") if Param("shadowdb");
# Assemble the -force* strings so this counts as "Added to this capacity"

View File

@ -177,6 +177,19 @@
<br>
</td>
</tr>
[% IF UserInGroup('editbugs') %]
<tr>
<td align="right" valign="top">
<strong>
<a href="describekeywords.cgi">Keywords</a>:
</strong>
</td>
<td colspan="3">
<input name="keywords" size="60" value=""> (optional)
</td>
</tr>
[% END %]
<tr>
<td></td>