aboutsummaryrefslogtreecommitdiffstats
path: root/data/lib
diff options
context:
space:
mode:
Diffstat (limited to 'data/lib')
-rw-r--r--data/lib/otherButtons.js6
-rw-r--r--data/lib/rhbzpage.js4
-rw-r--r--data/lib/xorgBugCategories.js51
3 files changed, 60 insertions, 1 deletions
diff --git a/data/lib/otherButtons.js b/data/lib/otherButtons.js
index 3a1f76a..7a11395 100644
--- a/data/lib/otherButtons.js
+++ b/data/lib/otherButtons.js
@@ -60,7 +60,11 @@ function markBugTriaged() {
// /fedora-meeting.2009-11-24-15.11.log.html
// http://meetbot.fedoraproject.org/fedora-meeting/2009-11-24\
// /fedora-meeting.2009-11-24-15.11.log.html
- addStuffToTextBox("keywords","Triaged");
+ if (!hasXorgBugsCategory()) {
+ alert("This won't do! First set the category!");
+ } else {
+ addStuffToTextBox("keywords","Triaged");
+ }
}
function addingEmbelishments(list) {
diff --git a/data/lib/rhbzpage.js b/data/lib/rhbzpage.js
index 706c8c1..d36f33c 100644
--- a/data/lib/rhbzpage.js
+++ b/data/lib/rhbzpage.js
@@ -466,6 +466,10 @@ function RHBZinit() {
setDefaultAssignee();
}
+ if (constantData.xorgBugsCategories) {
+ makeBugCategoriesList(constantData.xorgBugsCategories);
+ }
+
// Dig out backtrace protection against double-firing?
btSnippet = "";
diff --git a/data/lib/xorgBugCategories.js b/data/lib/xorgBugCategories.js
new file mode 100644
index 0000000..f47ad1d
--- /dev/null
+++ b/data/lib/xorgBugCategories.js
@@ -0,0 +1,51 @@
+// Released under the MIT/X11 license
+// http://www.opensource.org/licenses/mit-license.php
+"use strict";
+
+function hasXorgBugsCategory() {
+ var catRE = /\s*\[cat:.*?\]\s*/; // RE for testing whether
+ // there is already category tag in the Whiteboard
+
+ var whiteboardContent = document.
+ getElementById("status_whiteboard").value;
+ return (catRE.test(whiteboardContent));
+}
+
+/**
+ * Create a category list to the upper toolbar
+ */
+function makeBugCategoriesList(catList) {
+
+ // Create <select> element and add it first blank <option>
+ var targetDiv = document.getElementById("commit_top").parentNode;
+ var categoryList = document.createElement("select");
+ categoryList.setAttribute("id", "xorgBugsCategoriesSelect");
+ categoryList.setAttribute("name", "xorgBugsCategoriesSelect");
+ var optionElement = document.createElement("option");
+ optionElement.value = null;
+ optionElement.setAttribute("id", "catId_blank");
+ optionElement.appendChild(document.createTextNode("---"));
+ categoryList.appendChild(optionElement);
+
+ // Fill-in <select> with <options>s for each category one
+ catList.forEach(function (cat) {
+ optionElement = document.createElement("option");
+ optionElement.value = cat;
+ optionElement.setAttribute("id", "catId_" + cat.replace(" ","").toLowerCase());
+ optionElement.appendChild(document.createTextNode(cat));
+ categoryList.appendChild(optionElement);
+ });
+
+ categoryList.addEventListener("change", function (evt) {
+ var selectedCategory = "[cat:" + this.value + "]";
+ var whiteboardElement = document.getElementById("status_whiteboard");
+
+ if (hasXorgBugsCategory()) {
+ whiteboardElement.value = whiteboardElement.
+ value.replace(catRE, "");
+ }
+ addStuffToTextBox("status_whiteboard", selectedCategory);
+ }, false);
+
+ targetDiv.insertBefore(categoryList, targetDiv.firstChild);
+}