diff options
author | Matěj Cepl <mcepl@redhat.com> | 2010-07-16 17:45:14 +0200 |
---|---|---|
committer | Matěj Cepl <mcepl@redhat.com> | 2010-07-16 17:45:14 +0200 |
commit | d53b9140d0768522eeb6a024a17fc41dc73b4966 (patch) | |
tree | b34cd2e97df964d3f7012bb110b70d0cf8025422 /lib/util.js | |
parent | 641d7c3743be440112952140ca799b6748b261c7 (diff) | |
download | bugzilla-triage-d53b9140d0768522eeb6a024a17fc41dc73b4966.tar.gz |
Create a special library prompts, add prompts.prompt, and switch bzpage
and logger to use it.
Diffstat (limited to 'lib/util.js')
-rw-r--r-- | lib/util.js | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/lib/util.js b/lib/util.js index dd4c4f9..e3676ca 100644 --- a/lib/util.js +++ b/lib/util.js @@ -191,55 +191,3 @@ var filterByRegexp = exports.filterByRegexp = return ""; } }; - -/** - * returns password with a special password - * - * @return String with the password - */ -exports.getPassword = function getPassword(prompt) { - if (!prompt) { // either undefined or null - prompt = "Enter password:"; - } - var prompts = Cc["@mozilla.org/embedcomp/prompt-service;1"] - .getService(Ci.nsIPromptService); - var password = { - value : "" - }; // default the password to pass - var check = { - value : true - }; // default the checkbox to true - var result = prompts.promptPassword(null, "Bugzilla Triage Script", prompt, - password, null, check); - // result is true if OK was pressed, false if cancel was pressed. - // password.value is set if OK was pressed. - // The checkbox is not displayed. - if (result) { - return password.value ? password.value : null; - } else { - return undefined; - } -}; - -/** - * YES/NO prompt; returns boolean or null (for Cancel) - * https://developer.mozilla.org/en/XPCOM_Interface_Reference/nsIPromptService - */ -exports.promptOKNoCancel = function promptOKNoCancel(prompt) { - if (!prompt) { // either undefined or null - console.error("Prompt is required!"); - return undefined; - } - var prompts = Cc["@mozilla.org/embedcomp/prompt-service;1"] - .getService(Ci.nsIPromptService); - - var result = prompts.confirmEx(null, "Bugzilla Triage Script", prompt, - prompts.STD_YES_NO_BUTTONS, null, null, null, null, {}); - if (result === 0) { - return true; - } else if (result === 1) { - return false; - } else { - return null; - } -};
\ No newline at end of file |