Diffstat (limited to 'frontend/beta/js/Clipperz/YUI/MessageBox.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/beta/js/Clipperz/YUI/MessageBox.js | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/frontend/beta/js/Clipperz/YUI/MessageBox.js b/frontend/beta/js/Clipperz/YUI/MessageBox.js index ec33d7d..c7b4702 100644 --- a/frontend/beta/js/Clipperz/YUI/MessageBox.js +++ b/frontend/beta/js/Clipperz/YUI/MessageBox.js | |||
@@ -1,120 +1,117 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2011 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz's Javascript Crypto Library. | 5 | This file is part of Clipperz Community Edition. |
6 | Javascript Crypto Library provides web developers with an extensive | 6 | Clipperz Community Edition is an online password manager. |
7 | and efficient set of cryptographic functions. The library aims to | ||
8 | obtain maximum execution speed while preserving modularity and | ||
9 | reusability. | ||
10 | For further information about its features and functionalities please | 7 | For further information about its features and functionalities please |
11 | refer to http://www.clipperz.com | 8 | refer to http://www.clipperz.com. |
12 | 9 | ||
13 | * Javascript Crypto Library is free software: you can redistribute | 10 | * Clipperz Community Edition is free software: you can redistribute |
14 | it and/or modify it under the terms of the GNU Affero General Public | 11 | it and/or modify it under the terms of the GNU Affero General Public |
15 | License as published by the Free Software Foundation, either version | 12 | License as published by the Free Software Foundation, either version |
16 | 3 of the License, or (at your option) any later version. | 13 | 3 of the License, or (at your option) any later version. |
17 | 14 | ||
18 | * Javascript Crypto Library is distributed in the hope that it will | 15 | * Clipperz Community Edition is distributed in the hope that it will |
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 16 | be useful, but WITHOUT ANY WARRANTY; without even the implied |
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
21 | See the GNU Affero General Public License for more details. | 18 | See the GNU Affero General Public License for more details. |
22 | 19 | ||
23 | * You should have received a copy of the GNU Affero General Public | 20 | * You should have received a copy of the GNU Affero General Public |
24 | License along with Javascript Crypto Library. If not, see | 21 | License along with Clipperz Community Edition. If not, see |
25 | <http://www.gnu.org/licenses/>. | 22 | <http://www.gnu.org/licenses/>. |
26 | 23 | ||
27 | */ | 24 | */ |
28 | 25 | ||
29 | Clipperz.YUI.MessageBox = function(){ | 26 | Clipperz.YUI.MessageBox = function(){ |
30 | var dlg, opt, mask; | 27 | var dlg, opt, mask; |
31 | var bodyEl, msgEl, textboxEl, textareaEl, progressEl, pp; | 28 | var bodyEl, msgEl, textboxEl, textareaEl, progressEl, pp; |
32 | var buttons, activeTextEl, bwidth; | 29 | var buttons, activeTextEl, bwidth; |
33 | 30 | ||
34 | var handleButton = function(button){ | 31 | var handleButton = function(button){ |
35 | if(typeof opt.fn == 'function'){ | 32 | if(typeof opt.fn == 'function'){ |
36 | if(opt.fn.call(opt.scope||window, button, activeTextEl.dom.value) !== false){ | 33 | if(opt.fn.call(opt.scope||window, button, activeTextEl.dom.value) !== false){ |
37 | dlg.hide(); | 34 | dlg.hide(); |
38 | } | 35 | } |
39 | }else{ | 36 | }else{ |
40 | dlg.hide(); | 37 | dlg.hide(); |
41 | } | 38 | } |
42 | }; | 39 | }; |
43 | 40 | ||
44 | return { | 41 | return { |
45 | updateButtons: function(b){ | 42 | updateButtons: function(b){ |
46 | var width = 0; | 43 | var width = 0; |
47 | if(!b){ | 44 | if(!b){ |
48 | buttons['ok'].hide(); | 45 | buttons['ok'].hide(); |
49 | buttons['cancel'].hide(); | 46 | buttons['cancel'].hide(); |
50 | buttons['yes'].hide(); | 47 | buttons['yes'].hide(); |
51 | buttons['no'].hide(); | 48 | buttons['no'].hide(); |
52 | return width; | 49 | return width; |
53 | } | 50 | } |
54 | for(var k in buttons){ | 51 | for(var k in buttons){ |
55 | if(typeof buttons[k] != 'function'){ | 52 | if(typeof buttons[k] != 'function'){ |
56 | if(b[k]){ | 53 | if(b[k]){ |
57 | buttons[k].show(); | 54 | buttons[k].show(); |
58 | buttons[k].setText(typeof b[k] == 'string' ? b[k] : YAHOO.ext.MessageBox.buttonText[k]); | 55 | buttons[k].setText(typeof b[k] == 'string' ? b[k] : YAHOO.ext.MessageBox.buttonText[k]); |
59 | width += buttons[k].el.getWidth()+15; | 56 | width += buttons[k].el.getWidth()+15; |
60 | }else{ | 57 | }else{ |
61 | buttons[k].hide(); | 58 | buttons[k].hide(); |
62 | } | 59 | } |
63 | } | 60 | } |
64 | } | 61 | } |
65 | return width; | 62 | return width; |
66 | }, | 63 | }, |
67 | 64 | ||
68 | getDialog : function(){ | 65 | getDialog : function(){ |
69 | if(!dlg){ | 66 | if(!dlg){ |
70 | dlg = new YAHOO.ext.BasicDialog('mb-dlg', { | 67 | dlg = new YAHOO.ext.BasicDialog('mb-dlg', { |
71 | autoCreate:true, | 68 | autoCreate:true, |
72 | shadow:true, | 69 | shadow:true, |
73 | draggable:true, | 70 | draggable:true, |
74 | resizable:false, | 71 | resizable:false, |
75 | constraintoviewport:true, | 72 | constraintoviewport:true, |
76 | fixedcenter:true, | 73 | fixedcenter:true, |
77 | shim:true, | 74 | shim:true, |
78 | modal:true, | 75 | modal:true, |
79 | width:400, height:100, | 76 | width:400, height:100, |
80 | buttonAlign:'center', | 77 | buttonAlign:'center', |
81 | closeClick : function(){ | 78 | closeClick : function(){ |
82 | if(opt && opt.buttons && opt.buttons.no && !opt.buttons.cancel){ | 79 | if(opt && opt.buttons && opt.buttons.no && !opt.buttons.cancel){ |
83 | handleButton('no'); | 80 | handleButton('no'); |
84 | }else{ | 81 | }else{ |
85 | handleButton('cancel'); | 82 | handleButton('cancel'); |
86 | } | 83 | } |
87 | } | 84 | } |
88 | }); | 85 | }); |
89 | dlg.closeClick = function(){ | 86 | dlg.closeClick = function(){ |
90 | alert('wtf'); | 87 | alert('wtf'); |
91 | }; | 88 | }; |
92 | mask = dlg.mask; | 89 | mask = dlg.mask; |
93 | dlg.addKeyListener(27, dlg.hide, dlg); | 90 | dlg.addKeyListener(27, dlg.hide, dlg); |
94 | buttons = {}; | 91 | buttons = {}; |
95 | buttons['ok'] = dlg.addButton(this.buttonText['ok'], handleButton.createCallback('ok')); | 92 | buttons['ok'] = dlg.addButton(this.buttonText['ok'], handleButton.createCallback('ok')); |
96 | buttons['yes'] = dlg.addButton(this.buttonText['yes'], handleButton.createCallback('yes')); | 93 | buttons['yes'] = dlg.addButton(this.buttonText['yes'], handleButton.createCallback('yes')); |
97 | buttons['no'] = dlg.addButton(this.buttonText['no'], handleButton.createCallback('no')); | 94 | buttons['no'] = dlg.addButton(this.buttonText['no'], handleButton.createCallback('no')); |
98 | buttons['cancel'] = dlg.addButton(this.buttonText['cancel'], handleButton.createCallback('cancel')); | 95 | buttons['cancel'] = dlg.addButton(this.buttonText['cancel'], handleButton.createCallback('cancel')); |
99 | bodyEl = dlg.body.createChild({ | 96 | bodyEl = dlg.body.createChild({ |
100 | tag:'div', | 97 | tag:'div', |
101 | html:'<span class="ext-mb-text"></span><br /><input type="text" class="ext-mb-input"><textarea class="ext-mb-textarea"></textarea><div class="ext-mb-progress-wrap"><div class="ext-mb-progress"><div class="ext-mb-progress-bar"> </div></div></div>' | 98 | html:'<span class="ext-mb-text"></span><br /><input type="text" class="ext-mb-input"><textarea class="ext-mb-textarea"></textarea><div class="ext-mb-progress-wrap"><div class="ext-mb-progress"><div class="ext-mb-progress-bar"> </div></div></div>' |
102 | }); | 99 | }); |
103 | msgEl = bodyEl.dom.firstChild; | 100 | msgEl = bodyEl.dom.firstChild; |
104 | textboxEl = getEl(bodyEl.dom.childNodes[2]); | 101 | textboxEl = getEl(bodyEl.dom.childNodes[2]); |
105 | textboxEl.enableDisplayMode(); | 102 | textboxEl.enableDisplayMode(); |
106 | textboxEl.addKeyListener([10,13], function(){ | 103 | textboxEl.addKeyListener([10,13], function(){ |
107 | if(dlg.isVisible() && opt && opt.buttons){ | 104 | if(dlg.isVisible() && opt && opt.buttons){ |
108 | if(opt.buttons.ok){ | 105 | if(opt.buttons.ok){ |
109 | handleButton('ok'); | 106 | handleButton('ok'); |
110 | }else if(opt.buttons.yes){ | 107 | }else if(opt.buttons.yes){ |
111 | handleButton('yes'); | 108 | handleButton('yes'); |
112 | } | 109 | } |
113 | } | 110 | } |
114 | }); | 111 | }); |
115 | textareaEl = getEl(bodyEl.dom.childNodes[3]); | 112 | textareaEl = getEl(bodyEl.dom.childNodes[3]); |
116 | textareaEl.enableDisplayMode(); | 113 | textareaEl.enableDisplayMode(); |
117 | progressEl = getEl(bodyEl.dom.childNodes[4]); | 114 | progressEl = getEl(bodyEl.dom.childNodes[4]); |
118 | progressEl.enableDisplayMode(); | 115 | progressEl.enableDisplayMode(); |
119 | pp = getEl(progressEl.dom.firstChild.firstChild); | 116 | pp = getEl(progressEl.dom.firstChild.firstChild); |
120 | } | 117 | } |