From: phasefx Date: Tue, 19 Jul 2005 18:03:27 +0000 (+0000) Subject: alert windows X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=70955cdce7c558cf7fff626993b01b3d053bba3c;p=Evergreen.git alert windows git-svn-id: svn://svn.open-ils.org/ILS/trunk@1281 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Evergreen/staff_client/chrome/content/evergreen/util/win.js b/Evergreen/staff_client/chrome/content/evergreen/util/win.js index 1d8e1335b7..c4798388dd 100644 --- a/Evergreen/staff_client/chrome/content/evergreen/util/win.js +++ b/Evergreen/staff_client/chrome/content/evergreen/util/win.js @@ -21,7 +21,7 @@ function s_alert(s) { // particular button. The last two arguments are for an optional check box. var check = {}; sdump('D_WIN','s_alert: ' + s); - promptService.confirmEx(window,"ALERT", + var rv = promptService.confirmEx(window,"ALERT", s, flags, "Enter", null, null, @@ -30,8 +30,50 @@ function s_alert(s) { ); if (!check.value) { snd_bad(); - s_alert(s); + return s_alert(s); } + return rv; +} + +function yns_alert(s,a,b,c) { + // alert() replacement, intended to stop barcode scanners from "scanning through" the dialog + + if (!a) a = "Yes"; + if (!b) b = "No"; + if (!c) c = "Maybe"; + + // get a reference to the prompt service component. + var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] + .getService(Components.interfaces.nsIPromptService); + + // set the buttons that will appear on the dialog. It should be + // a set of constants multiplied by button position constants. In this case, + // three buttons appear, Save, Cancel and a custom button. + //var flags=promptService.BUTTON_TITLE_OK * promptService.BUTTON_POS_0 + + // promptService.BUTTON_TITLE_CANCEL * promptService.BUTTON_POS_1 + + // promptService.BUTTON_TITLE_IS_STRING * promptService.BUTTON_POS_2; + var flags = promptService.BUTTON_TITLE_IS_STRING * promptService.BUTTON_POS_0 + + promptService.BUTTON_TITLE_CANCEL * promptService.BUTTON_POS_1 + + promptService.BUTTON_TITLE_IS_STRING * promptService.BUTTON_POS_2; + + // display the dialog box. The flags set above are passed + // as the fourth argument. The next three arguments are custom labels used for + // the buttons, which are used if BUTTON_TITLE_IS_STRING is assigned to a + // particular button. The last two arguments are for an optional check box. + var check = {}; + sdump('D_WIN','yns_alert: ' + s); + var rv = promptService.confirmEx(window,"ALERT", + s, + flags, + a, b, c, + "Check this box to confirm this message", + check + ); + if (!check.value) { + snd_bad(); + return yns_alert(s,a,b,c); + } + return rv; } function new_window(chrome,params) {