diff options
author | Matěj Cepl <mcepl@redhat.com> | 2011-02-14 17:51:53 +0100 |
---|---|---|
committer | Matěj Cepl <mcepl@redhat.com> | 2011-02-14 17:57:45 +0100 |
commit | 04657077ba12e8f23feaa0c3787b590c44446056 (patch) | |
tree | ebe206422871e71b142985786a9472ff447be0cd /data/bzpage.js | |
parent | 838c1d4abd72bd87dcc8ee41310ca3a8af498c96 (diff) | |
download | bugzilla-triage-04657077ba12e8f23feaa0c3787b590c44446056.tar.gz |
Basic functionality working. Switching to this bug for my day-to-day work.
Diffstat (limited to 'data/bzpage.js')
-rw-r--r-- | data/bzpage.js | 85 |
1 files changed, 37 insertions, 48 deletions
diff --git a/data/bzpage.js b/data/bzpage.js index b980e96..f99bc21 100644 --- a/data/bzpage.js +++ b/data/bzpage.js @@ -100,9 +100,10 @@ function executeCommand(cmdObj) { * @param cmdParams Object with the appropriate parameters for the command */ function centralCommandDispatch (cmdLabel, cmdParams) { - console.log("centralCommandDispatch : cmdLabel = " + cmdLabel + - ", cmdParams = " + cmdParams); + console.log("centralCommandDispatch : cmdLabel = " + cmdLabel); switch (cmdLabel) { + case "name": + break; case "resolution": case "product": case "component": @@ -231,6 +232,7 @@ function killNodes(doc, target, remove) { * @return none */ function changeAssignee (newAssignee) { + console.log("changeAssignee : newAssignee = " + newAssignee); var defAssigneeButton = null; // Previous assignee should know what's going on in his bug addToCCList(getOwner()); @@ -357,7 +359,13 @@ function createDeadLink (id, text, parent, callback, params, before, covered, ac * @return none */ function createNewButton (location, after, cmdObj) { - var newId = cmdObj.name.toLowerCase().replace(/[^a-z0-9]+/,"","g") + "_btn"; + try { + var newId = cmdObj.name.toLowerCase().replace(/[^a-z0-9]+/,"","g") + "_btn"; + } catch (e) { + console.log("createNewButton : e = " + e); + console.log("createNewButton : cmdObj.toSource() = " + + cmdObj.toSource()); + } // protection against double-firings if (document.getElementById(newId)) { @@ -428,24 +436,34 @@ function generateButtons (pkgs, kNodes) { for (var pkg in pkgs) { for (var cmdIdx in pkgs[pkg]) { var cmdObj = pkgs[pkg][cmdIdx]; - switch (cmdObj.position) { - case "topRow": - createNewButton(topRowPosition, false, cmdObj); - break; - case "bottomRow": - createNewButton(bottomRowPosition, false, cmdObj); - break; - case "dropDown": - addToCommentsDropdown(cmdObj); - break; - default: // [+-]ID - var firstChr = cmdObj.position.charAt(0); - var newId = cmdObj.position.substr(1); - createNewButton(newId, firstChr === "+", cmdObj); - break; + if (cmdObj.position !== undefined) { + switch (cmdObj.position) { + case "topRow": + createNewButton(topRowPosition, false, cmdObj); + break; + case "bottomRow": + createNewButton(bottomRowPosition, false, cmdObj); + break; + case "dropDown": + addToCommentsDropdown(cmdObj); + break; + default: // [+-]ID + var firstChr = cmdObj.position.charAt(0); + var newId = cmdObj.position.substr(1); + createNewButton(newId, firstChr === "+", cmdObj); + break; + } + } else { + console.log("generateButtons : rejected cmdObj = " + + cmdObj.toSource()); } } } + // TODO This is weird in this place, but that's the place where all constantData etc. + // are finally defined and available. + if (RHBZinit) { + RHBZinit(); + } } function setConfigurationButton () { @@ -463,31 +481,6 @@ function setConfigurationButton () { }, false); } -/* - * From <a> element diggs out just plain email address - * Note that bugzilla.gnome.org doesn't have mailto: url but - * https://bugzilla.gnome.org/page.cgi?id=describeuser.html&login=mcepl%40redhat.com - * - * @param aElement Element with href attribute or something else - * @return String with the address or null - * - */ -function parseMailto(aElement) { - var emailStr = "", hrefStr = ""; - // use url utils - if (aElement) { - hrefStr = decodeURIComponent(aElement.getAttribute("href")); - emailStr = hrefStr.split(":"); - // workaround for Gnome bugzilla ... no mailto: here. - if (emailStr.length < 2) { - var params = getParamsFromURL("https://" + window.location.hostname + "/" + hrefStr); - return decodeURI(params.login); - } - return emailStr[1]; - } - return null; -} - /** * Get the current title of the bug * @@ -757,7 +750,7 @@ function parseAttachmentLine(inElem) { var aHref = Array.filter(aHrefsArr, function(x) { return x.textContent.trim() === "Details"; })[0]; - var id = getParamsFromURL(aHref.getAttribute("href")).id; + var id = parseURL(aHref.getAttribute("href")).params.id; // getting MIME type and size var stringArray = inElem.getElementsByClassName("bz_attach_extra_info")[0].textContent. @@ -1017,10 +1010,6 @@ function startup() { location: window.location.href, login: getLogin() })); - - if (RHBZinit) { - RHBZinit(); - } } startup(); |