From 397beebc19dfac0417a64fdbcfb4e6657f6ad9f5 Mon Sep 17 00:00:00 2001
From: "terry%mozilla.org" <>
Date: Fri, 7 Jan 2000 05:16:13 +0000
Subject: Add support for a new "keywords" feature. This lets some central
authority maintain a list of keywords, and users can associate any keyword
with any bug.
The new functionality won't appear until at least one keyword is
defined.
Note that you *must* run the "checksetup.pl" script after updating
this change, in order to create the new required tables "keywords" and
"keyworddefs".
---
bug_form.pl | 19 +++
buglist.cgi | 42 +++++-
checksetup.pl | 13 ++
describekeywords.cgi | 74 ++++++++++
editkeywords.cgi | 379 +++++++++++++++++++++++++++++++++++++++++++++++++++
globals.pl | 12 ++
process_bug.cgi | 80 ++++++++++-
query.cgi | 43 ++++--
8 files changed, 646 insertions(+), 16 deletions(-)
create mode 100755 describekeywords.cgi
create mode 100755 editkeywords.cgi
diff --git a/bug_form.pl b/bug_form.pl
index 3d7179d78..63db92d02 100644
--- a/bug_form.pl
+++ b/bug_form.pl
@@ -37,6 +37,7 @@ sub bug_form_pl_sillyness {
$zz = @::legal_priority;
$zz = @::legal_resolution_no_dup;
$zz = @::legal_severity;
+ $zz = @::keywordsbyname;
}
my %knownattachments;
@@ -329,6 +330,24 @@ if (Param("usestatuswhiteboard")) {
";
}
+if (@::legal_keywords) {
+ SendSQL("SELECT keyworddefs.name
+ FROM keyworddefs, keywords
+ WHERE keywords.bug_id = $id AND keyworddefs.id = keywords.keywordid
+ ORDER BY keyworddefs.name");
+ my @list;
+ while (MoreSQLData()) {
+ push(@list, FetchOneColumn());
+ }
+ my $value = value_quote(join(',', @list));
+ print qq{
+
+};
+ }
+
+
+ print "
diff --git a/checksetup.pl b/checksetup.pl
index 7b02ec0d5..cf7a83978 100755
--- a/checksetup.pl
+++ b/checksetup.pl
@@ -637,7 +637,19 @@ $table{votes} =
index(who),
index(bug_id)';
+$table{keywords} =
+ 'bug_id mediumint not null,
+ keywordid smallint not null,
+ index(bug_id),
+ index(keywordid)';
+
+$table{keyworddefs} =
+ 'id smallint not null primary key,
+ name varchar(64) not null,
+ description mediumtext,
+
+ unique(name)';
@@ -727,6 +739,7 @@ AddGroup 'tweakparams', 'Can tweak operating parameters';
AddGroup 'editgroupmembers', 'Can put people in and out of groups that they are members of.';
AddGroup 'creategroups', 'Can create and destroy groups.';
AddGroup 'editcomponents', 'Can create, destroy, and edit components.';
+AddGroup 'editkeywords', 'Can create, destroy, and edit keywords.';
diff --git a/describekeywords.cgi b/describekeywords.cgi
new file mode 100755
index 000000000..4da535c7c
--- /dev/null
+++ b/describekeywords.cgi
@@ -0,0 +1,74 @@
+#!/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 Terry Weissman.
+# Portions created by Terry Weissman are
+# Copyright (C) 2000 Terry Weissman. All
+# Rights Reserved.
+#
+# Contributor(s): Terry Weissman
+
+use diagnostics;
+use strict;
+
+require "CGI.pl";
+
+ConnectToDatabase();
+
+print "Content-type: text/html\n\n";
+
+PutHeader("Bugzilla keyword description");
+
+print qq{
+
+
+
Name
+
Description
+
Bugs
+
+};
+
+SendSQL("SELECT keyworddefs.name, keyworddefs.description,
+ COUNT(keywords.bug_id)
+ FROM keyworddefs LEFT JOIN keywords ON keyworddefs.id=keywords.keywordid
+ GROUP BY keyworddefs.id
+ ORDER BY keyworddefs.name");
+
+while (MoreSQLData()) {
+ my ($name, $description, $bugs) = FetchSQLData();
+ if ($bugs) {
+ my $q = url_quote($name);
+ $bugs = qq{$bugs};
+ } else {
+ $bugs = "none";
+ }
+ print qq{
+
\n";
+}
+
+navigation_header();
diff --git a/editkeywords.cgi b/editkeywords.cgi
new file mode 100755
index 000000000..03525f725
--- /dev/null
+++ b/editkeywords.cgi
@@ -0,0 +1,379 @@
+#!/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 Terry Weissman.
+# Portions created by Terry Weissman are
+# Copyright (C) 2000 Terry Weissman. All
+# Rights Reserved.
+#
+# Contributor(s): Terry Weissman
+
+use diagnostics;
+use strict;
+
+require "CGI.pl";
+
+my $localtrailer = "edit more keywords";
+
+
+#
+# Displays a text like "a.", "a or b.", "a, b or c.", "a, b, c or d."
+#
+
+sub PutTrailer (@)
+{
+ my (@links) = ("Back to the query page", @_);
+
+ my $count = $#links;
+ my $num = 0;
+ print "