From 34d9b467395b2e66db5ad960c16810b4541ed20b Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Mon, 17 May 2010 16:47:02 +0200 Subject: Connect back logging and bit of small bits. --- bugzillaBugTriage.js | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/bugzillaBugTriage.js b/bugzillaBugTriage.js index 546be53..ded744d 100644 --- a/bugzillaBugTriage.js +++ b/bugzillaBugTriage.js @@ -265,6 +265,9 @@ hlpr.heir = function(p) { * @return position of the string in the list, or -1 if none found. */ hlpr.isInList = function(mbr, list) { + if (!list) { + return false; + } return (list.indexOf(mbr) !== -1); }; @@ -293,7 +296,7 @@ hlpr.addCSVValue = function addCSVValue(str, value) { if (!hlpr.isInList(parts,value)) { parts = parts.concat(hlpr.valToArray(value)); } - return parts.join(","); + return parts.join(", "); }; /** @@ -313,7 +316,11 @@ hlpr.removeCSVValue = function removeCSVValue(str, value) { return parts.join(","); }; -//Get JSON configuration data +/** + * Load text from URL + * + * @param + */ hlpr.loadText = function(URL, cb_function, what) { if (what === undefined) { // missing optional argument what = this; @@ -602,6 +609,11 @@ function BZPage(doc) { if ("constantData" in config.gJSONData) { this.constantData = config.gJSONData.constantData; } + + if ("submitsLogging" in config.gJSONData.configData && + config.gJSONData.configData.submitsLogging) { + this.setUpLoggingButtons(); + } this.generateButtons(); } @@ -814,16 +826,10 @@ BZPage.prototype.addToCommentsDropdown = function(pkg, cmd) { * Generic function to add new button to the page. Actually copies new button * from the old one (in order to have the same look-and-feel, etc. * - * @param originalLocation Object after which the new button will be added - * @param newId String with the id of the new button; has to be unique in whole - * page - * @param newLabel String with the label which will be shown to user - * @param commentString String with comment to be added to the comment box - * @param nState String with the new state bug should switch to (see - * generalPurposeCureForAllDisease function for details) - * @param secPar String with second parameter for generalPurposeForAllDisease - * @param doSubmit Boolean optional whether the button should submit whole - * page (default true) + * @param location Object around which the new button will be added + * @param after Boolean before or after location ? + * @param pkg String which package to take the command from + * @param id String which command to take * @return none */ BZPage.prototype.createNewButton = function(location, after, pkg, id) { @@ -1200,9 +1206,9 @@ BZPage.prototype.getPassword = function() { * */ BZPage.prototype.setUpLoggingButtons = function() { + console.log("LOgging setUpLoggingButtons"); // For adding additional buttons to the top toolbar - let additionalButtons = this.doc.getElementById("bugzilla-body") - .getElementsByClassName("related_actions")[0]; + let additionalButtons = this.doc.querySelector("#bugzilla-body *.related_actions"); let that = this; // logging all submits for timesheet -- cgit