diff options
-rw-r--r-- | bugzillaBugTriage.js | 78 |
1 files changed, 48 insertions, 30 deletions
diff --git a/bugzillaBugTriage.js b/bugzillaBugTriage.js index 06c8a62..c14e3ec 100644 --- a/bugzillaBugTriage.js +++ b/bugzillaBugTriage.js @@ -144,13 +144,11 @@ XMLRPCMessage.prototype.xml = function() { // do individual parameters for ( var i = 0; i < this.params.length; i++) { var data = this.params[i]; - xml += "<param>\n"; - - xml += "<value>" - + this.getParamXML(this.dataTypeOf(data), - data) + "</value>\n"; - - xml += "</param>\n"; + xml += "<param>\n"; + xml += "<value>" + + this.getParamXML(this.dataTypeOf(data), + data) + "</value>\n"; + xml += "</param>\n"; } xml += "</params>\n"; @@ -267,19 +265,18 @@ XMLRPCMessage.prototype.getParamXML = function(type, data) { return xml; }; -/* - * Create and return an object that has p as its prototype - * - * @param p parent Object - * @return child Object - */ -if (typeof Object.create !== 'function') { - Object.prototype.create = function () { - function F() {} - F.prototype = this; - return new F(); - }; -} +///* +// * Create and return an object that has p as its prototype +// * +// * @param p parent Object +// * @return child Object +// */ +//heir = function (o) { +// function F() {}; +// F.prototype = o; +// delete F.prototype.create; +// return new F(); +//}; // ============================================================== var hlpr = function () { @@ -918,20 +915,35 @@ BZPage.prototype.addNewButton = function(originalLocation, newId, newLabel, } }; +/** + * Get login of the currently logged-in user. + * + * @return String with the login name of the currently logged-in user + */ +BZPage.prototype.getLogin = function () { + var lastLIElement = this.doc.querySelector("#header ul.links li:last-of-type"); + console.log("Testing element:\n"+ lastLIElement); + console.log("Testing element.textContent:\n"+ lastLIElement.textContent); + var loginArr = lastLIElement.textContent.split("\n"); + console.log("loginArr = " + loginArr.toSource()); + var loginStr = loginArr[loginArr.length - 1].trim(); + console.log("loginStr = " + loginStr); + return loginStr; +} // ==================================================================================== // MozillaBugzilla object -function MozillaBugzilla() { +MozillaBugzilla = function () { -} - -MozillaBugzilla.prototype = BZPage.prototype.create(); +}; +MozillaBugzilla.prototype = new BZPage(); +MozillaBugzilla.prototype.constructor = MozillaBugzilla; // ==================================================================================== // RHBugzillaPage object -function RHBugzillaPage(doc) { +RHBugzillaPage = function(doc) { // For identification of graphics card const manuChipStrs = [ [ "ATI Radeon", "ATI", "1002" ], [ "ATI Mobility Radeon", "ATI", "1002" ], @@ -957,10 +969,8 @@ function RHBugzillaPage(doc) { this.doc = doc; var that = this; this.originalButton = this.doc.getElementById("commit"); - - var loginArr = this.doc.querySelector("#header ul.links li:last-of-type").textContent - .split("\n"); - this.login = loginArr[loginArr.length - 1].trim(); + + this.login = this.getLogin(); if (myStorage.BZpassword) { this.password = myStorage.BZpassword; @@ -1183,7 +1193,8 @@ function RHBugzillaPage(doc) { } } // END OF RHBugzillaPage CONSTRUCTOR -RHBugzillaPage.prototype = BZPage.prototype.create(); +RHBugzillaPage.prototype = new BZPage(); +RHBugzillaPage.prototype.constructor = RHBugzillaPage; /* Offline supporting functions */ /** @@ -1938,14 +1949,21 @@ RHBugzillaPage.prototype.fixAttachById = function(id, type, email) { } var msg = new XMLRPCMessage("bugzilla.updateAttachMimeType"); + console.log("XML-RPC before:\n"+msg.xml()) msg.addParameter( { 'attach_id' : id, 'mime_type' : type, 'nomail' : !email }); + console.log("XML-RPC message:\n"+msg.xml()); msg.addParameter(this.login); + console.log("XML-RPC message:\n"+msg.xml()); msg.addParameter(this.password); +<<<<<<< HEAD + console.log("XML-RPC message:\n"+msg.xml()); +======= console.log("XML-RPC message:\n" + msg.xml()); +>>>>>>> 1c5b90c198ffd4c9508ac9ba6c0e67de8e08da37 var req = new XMLHttpRequest(); var that = this; |