From 612d0b26aecaf06f6d49d76fa5d2a5363b7a1370 Mon Sep 17 00:00:00 2001 From: "gerv%gerv.net" Date: Fri, 13 Sep 2002 22:21:19 +0000 Subject: [PATCH] Bug 25521 - Keyword field in new bug entry. Patch by jeff.hedlund@matrixsi.com; r=gerv. --- webtools/bugzilla/post_bug.cgi | 28 +++++++++++++++++++ .../en/default/bug/create/create.html.tmpl | 13 +++++++++ 2 files changed, 41 insertions(+) diff --git a/webtools/bugzilla/post_bug.cgi b/webtools/bugzilla/post_bug.cgi index b7fdf66d530b..8d21f15050c5 100755 --- a/webtools/bugzilla/post_bug.cgi +++ b/webtools/bugzilla/post_bug.cgi @@ -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" diff --git a/webtools/bugzilla/template/en/default/bug/create/create.html.tmpl b/webtools/bugzilla/template/en/default/bug/create/create.html.tmpl index 3e776865b909..066c11b63adc 100644 --- a/webtools/bugzilla/template/en/default/bug/create/create.html.tmpl +++ b/webtools/bugzilla/template/en/default/bug/create/create.html.tmpl @@ -177,6 +177,19 @@
+ + [% IF UserInGroup('editbugs') %] + + + + Keywords: + + + + (optional) + + + [% END %]