aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bzpage.js
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2010-07-14 11:42:00 +0200
committerMatěj Cepl <mcepl@redhat.com>2010-07-14 16:43:59 +0200
commit890a07ac1cfa6b60d450909a0108750db58fbbaa (patch)
treebaccecb1c9818fee453d1812cb88608eb9cc3c69 /lib/bzpage.js
parent610ab1af93076a43a654b29a8ae436b7e4e95404 (diff)
downloadbugzilla-triage-890a07ac1cfa6b60d450909a0108750db58fbbaa.tar.gz
Make configuration of used packages hostname-sensitive and stored in the
JSON file itself. Fixes #18 Also clear out all FIXMEs.
Diffstat (limited to 'lib/bzpage.js')
-rw-r--r--lib/bzpage.js32
1 files changed, 17 insertions, 15 deletions
diff --git a/lib/bzpage.js b/lib/bzpage.js
index f81b3da..997ac5b 100644
--- a/lib/bzpage.js
+++ b/lib/bzpage.js
@@ -90,7 +90,7 @@ var BZPage = function BZPage(win, config) {
this.CCList = this.getCCList();
// Prepare for query buttons
- // FIXME getting null for commentArea sometimes
+ // TODO getting null for commentArea sometimes
var commentArea = this.doc.getElementById("comment_status_commit");
if (commentArea) {
var brElementPlacer = commentArea.getElementsByTagName("br");
@@ -121,18 +121,21 @@ BZPage.prototype.getBugId = function getBugId () {
*/
BZPage.prototype.getInstalledPackages = function getInstalledPackages(cfg) {
var installedPackages = {};
- var prefName = BSTPrefNS+"enabledPacks";
var enabledPackages = [];
+ var hostname = this.win.location.hostname;
+ // Collect enabled packages per hostname (plus default ones)
if (cfg.gJSONData && ("commentPackages" in cfg.gJSONData)) {
- if (preferences.isSet(prefName)) {
- enabledPackages = preferences.get(prefName,"").split(/[, ]/);
+ if ("enabledPackages" in cfg.gJSONData.configData) {
+ var epObject = cfg.gJSONData.configData.enabledPackages;
+ if (hostname in epObject) {
+ enabledPackages = enabledPackages.concat(epObject[hostname].split(/[, ]/));
+ }
+ if ("any" in epObject) {
+ enabledPackages = enabledPackages.concat(epObject["any"].split(/[, ]/));
+ }
} else {
- console.log("Setting default preference " + prefName + " to 'all'.");
- preferences.set(prefName,"all");
- }
-
- if ((enabledPackages.length === 1) && (enabledPackages[0] === "all")) {
+ // Default to collecting all comment packages available
enabledPackages = [];
for (var key in cfg.gJSONData.commentPackages) {
enabledPackages.push(key);
@@ -373,6 +376,9 @@ BZPage.prototype.createNewButton = function createNewButton (location, after, pk
}, false);
var originalLocation = this.doc.getElementById(location);
+ if (!originalLocation) {
+ console.log("location = " + location);
+ }
if (after) {
originalLocation.parentNode.insertBefore(newButton,
@@ -495,10 +501,6 @@ BZPage.prototype.collectComments = function collectComments () {
* @param label
* @return none
*
- * FIXME bugzilla-comments version has this signature:
- * selectOption = function selectOption(select, value) {
- var doc = select[0].ownerDocument;
- select.val(value);
*/
BZPage.prototype.selectOption = function selectOption (id, label) {
var sel = this.doc.getElementById(id);
@@ -691,7 +693,7 @@ BZPage.prototype.setUpLogging = function setUpLogging () {
var that = this;
// logging all submits for timesheet
- // FIXME we should merge in functionality of RHBugzillaPage.submitCallback
+ // TODO we should merge in functionality of RHBugzillaPage.submitCallback
// and actually make it working
// Maybe rewriting whole offline capability into a separate object?
if (!this.submitHandlerInstalled) {
@@ -702,7 +704,7 @@ BZPage.prototype.setUpLogging = function setUpLogging () {
var resp = that.log.addLogRecord(that);
if (resp === null) {
console.log("Avoiding submitting!");
- // FIXME doesn't work ... still submitting'
+ // TODO doesn't work ... still submitting'
evt.stopPropagation();
evt.preventDefault();
}