Diffstat (limited to 'frontend/beta/js/Clipperz/PM/Components/MessageBox.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/beta/js/Clipperz/PM/Components/MessageBox.js | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/frontend/beta/js/Clipperz/PM/Components/MessageBox.js b/frontend/beta/js/Clipperz/PM/Components/MessageBox.js index cf9ec86..f9b845e 100644 --- a/frontend/beta/js/Clipperz/PM/Components/MessageBox.js +++ b/frontend/beta/js/Clipperz/PM/Components/MessageBox.js | |||
@@ -1,150 +1,148 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
28 | if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; } | 26 | if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; } |
29 | 27 | ||
30 | 28 | ||
31 | 29 | ||
32 | Clipperz.PM.Components.MessageBoxImplementation = function() { | 30 | Clipperz.PM.Components.MessageBoxImplementation = function() { |
33 | this._step = 0; | 31 | this._step = 0; |
34 | this._steps = 0; | 32 | this._steps = 0; |
35 | 33 | ||
36 | return this; | 34 | return this; |
37 | }; | 35 | }; |
38 | 36 | ||
39 | //YAHOO.extendX(Clipperz.PM.Components.MessageBoxImplementation, Clipperz.PM.Components.BaseComponent, { | 37 | //YAHOO.extendX(Clipperz.PM.Components.MessageBoxImplementation, Clipperz.PM.Components.BaseComponent, { |
40 | Clipperz.PM.Components.MessageBoxImplementation.prototype = MochiKit.Base.update(null, { | 38 | Clipperz.PM.Components.MessageBoxImplementation.prototype = MochiKit.Base.update(null, { |
41 | 39 | ||
42 | 'toString': function() { | 40 | 'toString': function() { |
43 | return "Clipperz.PM.Components.MessageBox"; | 41 | return "Clipperz.PM.Components.MessageBox"; |
44 | }, | 42 | }, |
45 | 43 | ||
46 | //----------------------------------------------------- | 44 | //----------------------------------------------------- |
47 | 45 | ||
48 | 'step': function() { | 46 | 'step': function() { |
49 | return this._step; | 47 | return this._step; |
50 | }, | 48 | }, |
51 | 49 | ||
52 | 'setStep': function(aValue) { | 50 | 'setStep': function(aValue) { |
53 | if (aValue == 'next') { | 51 | if (aValue == 'next') { |
54 | this._step = this._step + 1; | 52 | this._step = this._step + 1; |
55 | } else { | 53 | } else { |
56 | this._step = aValue; | 54 | this._step = aValue; |
57 | } | 55 | } |
58 | 56 | ||
59 | if (this._step > this.steps()) { | 57 | if (this._step > this.steps()) { |
60 | //MochiKit.Logging.logDebug("overstepping: " + this._step + " (" + this.steps() + ")"); | 58 | //MochiKit.Logging.logDebug("overstepping: " + this._step + " (" + this.steps() + ")"); |
61 | this._step = this.steps(); | 59 | this._step = this.steps(); |
62 | } | 60 | } |
63 | }, | 61 | }, |
64 | 62 | ||
65 | //----------------------------------------------------- | 63 | //----------------------------------------------------- |
66 | 64 | ||
67 | 'steps': function() { | 65 | 'steps': function() { |
68 | return this._steps; | 66 | return this._steps; |
69 | }, | 67 | }, |
70 | 68 | ||
71 | 'setSteps': function(aValue) { | 69 | 'setSteps': function(aValue) { |
72 | if (aValue.constructor == String) { | 70 | if (aValue.constructor == String) { |
73 | if (aValue.charAt(0) == '+') { | 71 | if (aValue.charAt(0) == '+') { |
74 | this._steps += aValue.substring(1)*1; | 72 | this._steps += aValue.substring(1)*1; |
75 | } else if (aValue.charAt(0) == '-') { | 73 | } else if (aValue.charAt(0) == '-') { |
76 | this._steps -= aValue.substring(1)*1; | 74 | this._steps -= aValue.substring(1)*1; |
77 | } else { | 75 | } else { |
78 | this._steps = aValue.substring(1)*1; | 76 | this._steps = aValue.substring(1)*1; |
79 | } | 77 | } |
80 | } else { | 78 | } else { |
81 | this._steps = aValue; | 79 | this._steps = aValue; |
82 | } | 80 | } |
83 | }, | 81 | }, |
84 | 82 | ||
85 | //----------------------------------------------------- | 83 | //----------------------------------------------------- |
86 | 84 | ||
87 | 'deferredShow': function(aConfiguration, anAnimationTargetElement, aValue) { | 85 | 'deferredShow': function(aConfiguration, anAnimationTargetElement, aValue) { |
88 | this.show(aConfiguration, anAnimationTargetElement); | 86 | this.show(aConfiguration, anAnimationTargetElement); |
89 | 87 | ||
90 | return aValue; | 88 | return aValue; |
91 | }, | 89 | }, |
92 | 90 | ||
93 | 'show': function(aConfiguration, anAnimationTargetElement) { | 91 | 'show': function(aConfiguration, anAnimationTargetElement) { |
94 | varmessageBoxConfiguration; | 92 | varmessageBoxConfiguration; |
95 | 93 | ||
96 | messageBoxConfiguration = MochiKit.Base.clone(aConfiguration); | 94 | messageBoxConfiguration = MochiKit.Base.clone(aConfiguration); |
97 | messageBoxConfiguration.msg = messageBoxConfiguration.text; | 95 | messageBoxConfiguration.msg = messageBoxConfiguration.text; |
98 | messageBoxConfiguration.animEl = anAnimationTargetElement; | 96 | messageBoxConfiguration.animEl = anAnimationTargetElement; |
99 | messageBoxConfiguration.progress = messageBoxConfiguration.showProgressBar; | 97 | messageBoxConfiguration.progress = messageBoxConfiguration.showProgressBar; |
100 | messageBoxConfiguration.closable = messageBoxConfiguration.showCloseButton; | 98 | messageBoxConfiguration.closable = messageBoxConfiguration.showCloseButton; |
101 | this.setSteps(aConfiguration.steps || 0); | 99 | this.setSteps(aConfiguration.steps || 0); |
102 | this.setStep(aConfiguration.step || 0); | 100 | this.setStep(aConfiguration.step || 0); |
103 | delete messageBoxConfiguration.buttons; | 101 | delete messageBoxConfiguration.buttons; |
104 | 102 | ||
105 | Clipperz.YUI.MessageBox.show(messageBoxConfiguration); | 103 | Clipperz.YUI.MessageBox.show(messageBoxConfiguration); |
106 | }, | 104 | }, |
107 | 105 | ||
108 | //----------------------------------------------------- | 106 | //----------------------------------------------------- |
109 | 107 | ||
110 | 'update': function(someValues) { | 108 | 'update': function(someValues) { |
111 | //MochiKit.Logging.logDebug(">>> MessageBox.update"); | 109 | //MochiKit.Logging.logDebug(">>> MessageBox.update"); |
112 | if (someValues.title) { | 110 | if (someValues.title) { |
113 | Clipperz.YUI.MessageBox.getDialog().setTitle(someValues.title); | 111 | Clipperz.YUI.MessageBox.getDialog().setTitle(someValues.title); |
114 | }; | 112 | }; |
115 | 113 | ||
116 | if (someValues.text) { | 114 | if (someValues.text) { |
117 | Clipperz.YUI.MessageBox.updateText(someValues.text); | 115 | Clipperz.YUI.MessageBox.updateText(someValues.text); |
118 | }; | 116 | }; |
119 | 117 | ||
120 | if (typeof(someValues.showProgressBar) != 'undefined') { | 118 | if (typeof(someValues.showProgressBar) != 'undefined') { |
121 | Clipperz.YUI.MessageBox.progressElement().setDisplayed(someValues.showProgressBar); | 119 | Clipperz.YUI.MessageBox.progressElement().setDisplayed(someValues.showProgressBar); |
122 | Clipperz.YUI.MessageBox.updateProgress(0); | 120 | Clipperz.YUI.MessageBox.updateProgress(0); |
123 | }; | 121 | }; |
124 | 122 | ||
125 | if (typeof(someValues.steps) != 'undefined') { | 123 | if (typeof(someValues.steps) != 'undefined') { |
126 | this.setSteps(someValues.steps); | 124 | this.setSteps(someValues.steps); |
127 | }; | 125 | }; |
128 | 126 | ||
129 | if (typeof(someValues.step) != 'undefined') { | 127 | if (typeof(someValues.step) != 'undefined') { |
130 | this.setStep(someValues.step); | 128 | this.setStep(someValues.step); |
131 | } else { | 129 | } else { |
132 | this.setStep('next'); | 130 | this.setStep('next'); |
133 | } | 131 | } |
134 | Clipperz.YUI.MessageBox.updateProgress(this.step() / this.steps()); | 132 | Clipperz.YUI.MessageBox.updateProgress(this.step() / this.steps()); |
135 | 133 | ||
136 | 134 | ||
137 | if (typeof(someValues.fn) != 'undefined') { | 135 | if (typeof(someValues.fn) != 'undefined') { |
138 | Clipperz.YUI.MessageBox.opt().fn = someValues.fn; | 136 | Clipperz.YUI.MessageBox.opt().fn = someValues.fn; |
139 | }; | 137 | }; |
140 | 138 | ||
141 | if (typeof(someValues.scope) != 'undefined') { | 139 | if (typeof(someValues.scope) != 'undefined') { |
142 | Clipperz.YUI.MessageBox.opt().scope = someValues.scope; | 140 | Clipperz.YUI.MessageBox.opt().scope = someValues.scope; |
143 | }; | 141 | }; |
144 | 142 | ||
145 | if (someValues.buttons) { | 143 | if (someValues.buttons) { |
146 | Clipperz.YUI.MessageBox.updateButtons(someValues.buttons); | 144 | Clipperz.YUI.MessageBox.updateButtons(someValues.buttons); |
147 | }; | 145 | }; |
148 | 146 | ||
149 | // if (someValues.title) { | 147 | // if (someValues.title) { |
150 | // Clipperz.YUI.MessageBox.getDialog().setTitle(someValues.title + " [" + this.step() + " / " + this.steps() + "]"); | 148 | // Clipperz.YUI.MessageBox.getDialog().setTitle(someValues.title + " [" + this.step() + " / " + this.steps() + "]"); |