author | Clipperz <info@clipperz.com> | 2013-01-31 13:42:04 (UTC) |
---|---|---|
committer | Clipperz <info@clipperz.com> | 2013-01-31 13:42:04 (UTC) |
commit | 07d0357beef5d9328a2dd8d07ad7b39c87ac55e4 (patch) (unidiff) | |
tree | f7a4aed8848302db153c2a211f8e58b944eb4c5b /frontend/beta/js/Clipperz/PM/Components/MessageBox.js | |
parent | 767a3dcf48b6ac911c088af5dd7738a728eb6b99 (diff) | |
download | clipperz-07d0357beef5d9328a2dd8d07ad7b39c87ac55e4.zip clipperz-07d0357beef5d9328a2dd8d07ad7b39c87ac55e4.tar.gz clipperz-07d0357beef5d9328a2dd8d07ad7b39c87ac55e4.tar.bz2 |
Updated Copyright claims
- updated reference dates;
- removed reference to Community Edition;
- normalized logging using Clipperz.log[Warn|Error|Debug]
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,214 +1,212 @@ | |||
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() + "]"); |
151 | // }; | 149 | // }; |
152 | 150 | ||
153 | //MochiKit.Logging.logDebug("--- MessageBox.update - step: " + this.step() + " / " + this.steps() + " - " + someValues.text); | 151 | //MochiKit.Logging.logDebug("--- MessageBox.update - step: " + this.step() + " / " + this.steps() + " - " + someValues.text); |
154 | //MochiKit.Logging.logDebug("<<< MessageBox.update"); | 152 | //MochiKit.Logging.logDebug("<<< MessageBox.update"); |
155 | }, | 153 | }, |
156 | 154 | ||
157 | //----------------------------------------------------- | 155 | //----------------------------------------------------- |
158 | 156 | ||
159 | 'hide': function(anAnimationTargetElement) { | 157 | 'hide': function(anAnimationTargetElement) { |
160 | if (anAnimationTargetElement) { | 158 | if (anAnimationTargetElement) { |
161 | Clipperz.YUI.MessageBox.getDialog().animateTarget = anAnimationTargetElement; | 159 | Clipperz.YUI.MessageBox.getDialog().animateTarget = anAnimationTargetElement; |
162 | } | 160 | } |
163 | 161 | ||
164 | Clipperz.YUI.MessageBox.hide(); | 162 | Clipperz.YUI.MessageBox.hide(); |
165 | }, | 163 | }, |
166 | 164 | ||
167 | //----------------------------------------------------- | 165 | //----------------------------------------------------- |
168 | __syntaxFix__: '__syntaxFix__' | 166 | __syntaxFix__: '__syntaxFix__' |
169 | }); | 167 | }); |
170 | 168 | ||
171 | 169 | ||
172 | //########################################################## | 170 | //########################################################## |
173 | 171 | ||
174 | _clipperz_pm_components_messageBox = null; | 172 | _clipperz_pm_components_messageBox = null; |
175 | 173 | ||
176 | Clipperz.PM.Components.MessageBox = function() { | 174 | Clipperz.PM.Components.MessageBox = function() { |
177 | if (_clipperz_pm_components_messageBox == null) { | 175 | if (_clipperz_pm_components_messageBox == null) { |
178 | _clipperz_pm_components_messageBox = new Clipperz.PM.Components.MessageBoxImplementation(); | 176 | _clipperz_pm_components_messageBox = new Clipperz.PM.Components.MessageBoxImplementation(); |
179 | } | 177 | } |
180 | 178 | ||
181 | return _clipperz_pm_components_messageBox; | 179 | return _clipperz_pm_components_messageBox; |
182 | } | 180 | } |
183 | 181 | ||
184 | //--------------------------------------------------------- | 182 | //--------------------------------------------------------- |
185 | 183 | ||
186 | Clipperz.PM.Components.MessageBox.showProgressPanel = function(aCallback, anErrback, anActivationItem) { | 184 | Clipperz.PM.Components.MessageBox.showProgressPanel = function(aCallback, anErrback, anActivationItem) { |
187 | var deferredResult; | 185 | var deferredResult; |
188 | 186 | ||
189 | deferredResult = new MochiKit.Async.Deferred(); | 187 | deferredResult = new MochiKit.Async.Deferred(); |
190 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Clipperz.PM.Components.MessageBox.showProgressPanel - 0: " + res); return res;}); | 188 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Clipperz.PM.Components.MessageBox.showProgressPanel - 0: " + res); return res;}); |
191 | deferredResult.addCallback(MochiKit.Base.method(Clipperz.PM.Components.MessageBox(), 'deferredShow'), | 189 | deferredResult.addCallback(MochiKit.Base.method(Clipperz.PM.Components.MessageBox(), 'deferredShow'), |
192 | { | 190 | { |
193 | title: "", | 191 | title: "", |
194 | text: "", | 192 | text: "", |
195 | width:240, | 193 | width:240, |
196 | showProgressBar:true, | 194 | showProgressBar:true, |
197 | showCloseButton:false, | 195 | showCloseButton:false, |
198 | fn:MochiKit.Base.method(deferredResult, 'cancel'), | 196 | fn:MochiKit.Base.method(deferredResult, 'cancel'), |
199 | scope:this, | 197 | scope:this, |
200 | buttons:{ | 198 | buttons:{ |
201 | //'ok':Clipperz.PM.Strings['loginMessagePanelInitialButtonLabel'] | 199 | //'ok':Clipperz.PM.Strings['loginMessagePanelInitialButtonLabel'] |
202 | } | 200 | } |
203 | }, | 201 | }, |
204 | anActivationItem | 202 | anActivationItem |
205 | ); | 203 | ); |
206 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Clipperz.PM.Components.MessageBox.showProgressPanel - 1: " + res); return res;}); | 204 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Clipperz.PM.Components.MessageBox.showProgressPanel - 1: " + res); return res;}); |
207 | deferredResult.addCallback(aCallback); | 205 | deferredResult.addCallback(aCallback); |
208 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Clipperz.PM.Components.MessageBox.showProgressPanel - 2: " + res); return res;}); | 206 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Clipperz.PM.Components.MessageBox.showProgressPanel - 2: " + res); return res;}); |
209 | deferredResult.addCallback(MochiKit.Async.wait, 0.5); | 207 | deferredResult.addCallback(MochiKit.Async.wait, 0.5); |
210 | deferredResult.addCallback(function(res) { | 208 | deferredResult.addCallback(function(res) { |
211 | Clipperz.PM.Components.MessageBox().hide(YAHOO.ext.Element.get(anActivationItem)); | 209 | Clipperz.PM.Components.MessageBox().hide(YAHOO.ext.Element.get(anActivationItem)); |
212 | return res; | 210 | return res; |
213 | }); | 211 | }); |
214 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Clipperz.PM.Components.MessageBox.showProgressPanel - 3: " + res); return res;}); | 212 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Clipperz.PM.Components.MessageBox.showProgressPanel - 3: " + res); return res;}); |