Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/UI/Common/Components') (more/less context) (ignore whitespace changes)
11 files changed, 111 insertions, 169 deletions
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/BaseComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/BaseComponent.js index b9d7adf..58b7593 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/BaseComponent.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/BaseComponent.js | |||
@@ -1,416 +1,410 @@ | |||
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 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); |
27 | 25 | ||
28 | //############################################################################# | 26 | //############################################################################# |
29 | 27 | ||
30 | var _Clipperz_PM_Components_base_id_ = 0; | 28 | var _Clipperz_PM_Components_base_id_ = 0; |
31 | 29 | ||
32 | //############################################################################# | 30 | //############################################################################# |
33 | 31 | ||
34 | Clipperz.PM.UI.Common.Components.BaseComponent = function(args) { | 32 | Clipperz.PM.UI.Common.Components.BaseComponent = function(args) { |
35 | args = args || {}; | 33 | args = args || {}; |
36 | Clipperz.PM.UI.Common.Components.BaseComponent.superclass.constructor.call(this, args); | 34 | Clipperz.PM.UI.Common.Components.BaseComponent.superclass.constructor.call(this, args); |
37 | 35 | ||
38 | this._element = args.element || null; | 36 | this._element = args.element || null; |
39 | this._ids = {}; | 37 | this._ids = {}; |
40 | 38 | ||
41 | this._slots = {}; | 39 | this._slots = {}; |
42 | this._slotComponents = {}; | 40 | this._slotComponents = {}; |
43 | 41 | ||
44 | this._components = {}; | 42 | this._components = {}; |
45 | 43 | ||
46 | this._cachedSlots = {}; | 44 | this._cachedSlots = {}; |
47 | 45 | ||
48 | this._isModal = false; | 46 | this._isModal = false; |
49 | 47 | ||
50 | this._isActive = false; | 48 | this._isActive = false; |
51 | this._elementUsedToEnterModalState; | 49 | this._elementUsedToEnterModalState; |
52 | 50 | ||
53 | this._isFullyRendered = false; | 51 | this._isFullyRendered = false; |
54 | this._renderingWaitingQueue = []; | 52 | this._renderingWaitingQueue = []; |
55 | 53 | ||
56 | //this._slots = { | 54 | //this._slots = { |
57 | // 'header':'header', | 55 | // 'header':'header', |
58 | // 'body': 'body', | 56 | // 'body': 'body', |
59 | // 'footer':'footer' | 57 | // 'footer':'footer' |
60 | //}; | 58 | //}; |
61 | 59 | ||
62 | return this; | 60 | return this; |
63 | } | 61 | } |
64 | 62 | ||
65 | //============================================================================= | 63 | //============================================================================= |
66 | 64 | ||
67 | //TODO get back to MochiKit.Base.update as we are not extending anything | 65 | //TODO get back to MochiKit.Base.update as we are not extending anything |
68 | //MochiKit.Base.update(Clipperz.PM.UI.Common.Components.BaseComponent.prototype, { | 66 | //MochiKit.Base.update(Clipperz.PM.UI.Common.Components.BaseComponent.prototype, { |
69 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.BaseComponent, /*Ext.Component*/ Object, { | 67 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.BaseComponent, /*Ext.Component*/ Object, { |
70 | 68 | ||
71 | 'isClipperzPMComponent': true, | 69 | 'isClipperzPMComponent': true, |
72 | 70 | ||
73 | //------------------------------------------------------------------------- | 71 | //------------------------------------------------------------------------- |
74 | 72 | ||
75 | 'toString': function () { | 73 | 'toString': function () { |
76 | return "Clipperz.PM.UI.Common.Components.BaseComponent component"; | 74 | return "Clipperz.PM.UI.Common.Components.BaseComponent component"; |
77 | }, | 75 | }, |
78 | 76 | ||
79 | 'componentId': function () { | 77 | 'componentId': function () { |
80 | return this.getId('_id_'); | 78 | return this.getId('_id_'); |
81 | }, | 79 | }, |
82 | 80 | ||
83 | //------------------------------------------------------------------------- | 81 | //------------------------------------------------------------------------- |
84 | /* | 82 | /* |
85 | 'slots': function() { | 83 | 'slots': function() { |
86 | return this._slots; | 84 | return this._slots; |
87 | }, | 85 | }, |
88 | */ | 86 | */ |
89 | 'slotComponents': function() { | 87 | 'slotComponents': function() { |
90 | return this._slotComponents; | 88 | return this._slotComponents; |
91 | }, | 89 | }, |
92 | 90 | ||
93 | //------------------------------------------------------------------------- | 91 | //------------------------------------------------------------------------- |
94 | 92 | ||
95 | 'components': function () { | 93 | 'components': function () { |
96 | return this._components; | 94 | return this._components; |
97 | }, | 95 | }, |
98 | 96 | ||
99 | 'addComponent': function (aComponent) { | 97 | 'addComponent': function (aComponent) { |
100 | this.components()[aComponent.componentId()] = aComponent; | 98 | this.components()[aComponent.componentId()] = aComponent; |
101 | }, | 99 | }, |
102 | 100 | ||
103 | 'removeComponent': function (aComponent) { | 101 | 'removeComponent': function (aComponent) { |
104 | var componentId; | 102 | var componentId; |
105 | 103 | ||
106 | componentId = aComponent.componentId(); | 104 | componentId = aComponent.componentId(); |
107 | this.components()[componentId].remove(); | 105 | this.components()[componentId].remove(); |
108 | delete this.components()[componentId]; | 106 | delete this.components()[componentId]; |
109 | }, | 107 | }, |
110 | 108 | ||
111 | //------------------------------------------------------------------------- | 109 | //------------------------------------------------------------------------- |
112 | /* | 110 | /* |
113 | 'domHelper': function() { | 111 | 'domHelper': function() { |
114 | return Clipperz.YUI.DomHelper; | 112 | return Clipperz.YUI.DomHelper; |
115 | }, | 113 | }, |
116 | */ | 114 | */ |
117 | //------------------------------------------------------------------------- | 115 | //------------------------------------------------------------------------- |
118 | /* | 116 | /* |
119 | 'domHelperAppend': function(aValue) { | 117 | 'domHelperAppend': function(aValue) { |
120 | Clipperz.YUI.DomHelper.append(this.element().dom, aValue); | 118 | Clipperz.YUI.DomHelper.append(this.element().dom, aValue); |
121 | }, | 119 | }, |
122 | */ | 120 | */ |
123 | //------------------------------------------------------------------------- | 121 | //------------------------------------------------------------------------- |
124 | 122 | ||
125 | 'element': function() { | 123 | 'element': function() { |
126 | //MochiKit.Logging.logDebug(">>> BaseComponent.element"); | ||
127 | return MochiKit.DOM.getElement(this._element); | 124 | return MochiKit.DOM.getElement(this._element); |
128 | }, | 125 | }, |
129 | 126 | ||
130 | 'setElement': function(aNode) { | 127 | 'setElement': function(aNode) { |
131 | this._element = aNode; | 128 | this._element = aNode; |
132 | }, | 129 | }, |
133 | 130 | ||
134 | //----------------------------------------------------- | 131 | //----------------------------------------------------- |
135 | 132 | ||
136 | 'displayElement': function() { | 133 | 'displayElement': function() { |
137 | return this.element(); | 134 | return this.element(); |
138 | }, | 135 | }, |
139 | 136 | ||
140 | //------------------------------------------------------------------------- | 137 | //------------------------------------------------------------------------- |
141 | 138 | ||
142 | 'renderInNode': function(aDomNode) { | 139 | 'renderInNode': function(aDomNode) { |
143 | this.setElement(aDomNode); | 140 | this.setElement(aDomNode); |
144 | this.render(); | 141 | this.render(); |
145 | }, | 142 | }, |
146 | 143 | ||
147 | 'render': function() { | 144 | 'render': function() { |
148 | this.clear(); | 145 | this.clear(); |
149 | this.renderSelf(); | 146 | this.renderSelf(); |
150 | this.renderComponents(); | 147 | this.renderComponents(); |
151 | if (this.shouldShowTranslationHints()) { | 148 | if (this.shouldShowTranslationHints()) { |
152 | this.renderTranslationHints(); | 149 | this.renderTranslationHints(); |
153 | } | 150 | } |
154 | if (this.shouldShowElementWhileRendering()) { | 151 | if (this.shouldShowElementWhileRendering()) { |
155 | MochiKit.Style.showElement(this.displayElement()); | 152 | MochiKit.Style.showElement(this.displayElement()); |
156 | }; | 153 | }; |
157 | 154 | ||
158 | this._isFullyRendered = true; | 155 | this._isFullyRendered = true; |
159 | 156 | ||
160 | MochiKit.Iter.forEach(this.renderingWaitingQueue(), MochiKit.Base.methodcaller('callback')); | 157 | MochiKit.Iter.forEach(this.renderingWaitingQueue(), MochiKit.Base.methodcaller('callback')); |
161 | this.resetRenderingWaitingQueue(); | 158 | this.resetRenderingWaitingQueue(); |
162 | }, | 159 | }, |
163 | 160 | ||
164 | 'renderSelf': function() { | 161 | 'renderSelf': function() { |
165 | throw Clipperz.Base.exception.AbstractMethod; | 162 | throw Clipperz.Base.exception.AbstractMethod; |
166 | }, | 163 | }, |
167 | 164 | ||
168 | 'renderComponents': function() { | 165 | 'renderComponents': function() { |
169 | varslotName; | 166 | varslotName; |
170 | 167 | ||
171 | for (slotName in this.slotComponents()) { | 168 | for (slotName in this.slotComponents()) { |
172 | this.slotComponents()[slotName].renderInNode(this.elementForSlotNamed(slotName)); | 169 | this.slotComponents()[slotName].renderInNode(this.elementForSlotNamed(slotName)); |
173 | } | 170 | } |
174 | }, | 171 | }, |
175 | 172 | ||
176 | //......................................................................... | 173 | //......................................................................... |
177 | 174 | ||
178 | 'isFullyRendered': function () { | 175 | 'isFullyRendered': function () { |
179 | return this._isFullyRendered; | 176 | return this._isFullyRendered; |
180 | }, | 177 | }, |
181 | 178 | ||
182 | //......................................................................... | 179 | //......................................................................... |
183 | 180 | ||
184 | 'renderingWaitingQueue': function () { | 181 | 'renderingWaitingQueue': function () { |
185 | return this._renderingWaitingQueue; | 182 | return this._renderingWaitingQueue; |
186 | }, | 183 | }, |
187 | 184 | ||
188 | 'resetRenderingWaitingQueue': function () { | 185 | 'resetRenderingWaitingQueue': function () { |
189 | this._renderingWaitingQueue = []; | 186 | this._renderingWaitingQueue = []; |
190 | }, | 187 | }, |
191 | 188 | ||
192 | //......................................................................... | 189 | //......................................................................... |
193 | 190 | ||
194 | 'waitUntilFullyRendered': function () { | 191 | 'waitUntilFullyRendered': function () { |
195 | var deferredResult; | 192 | var deferredResult; |
196 | 193 | ||
197 | if (this.isFullyRendered() == true) { | 194 | if (this.isFullyRendered() == true) { |
198 | deferredResult = MochiKit.Async.succeed | 195 | deferredResult = MochiKit.Async.succeed |
199 | } else { | 196 | } else { |
200 | deferredResult = new Clipperz.Async.Deferred("BaseComponent.waitUntilFullyRendered", {trace:false}); | 197 | deferredResult = new Clipperz.Async.Deferred("BaseComponent.waitUntilFullyRendered", {trace:false}); |
201 | this.renderingWaitingQueue().push(deferredResult); | 198 | this.renderingWaitingQueue().push(deferredResult); |
202 | } | 199 | } |
203 | 200 | ||
204 | return deferredResult; | 201 | return deferredResult; |
205 | }, | 202 | }, |
206 | 203 | ||
207 | //----------------------------------------------------- | 204 | //----------------------------------------------------- |
208 | 205 | ||
209 | 'renderTranslationHints': function () { | 206 | 'renderTranslationHints': function () { |
210 | vartranslatableItems; | 207 | vartranslatableItems; |
211 | 208 | ||
212 | translatableItems = MochiKit.Selector.findChildElements(this.displayElement(), ['[stringID]']); | 209 | translatableItems = MochiKit.Selector.findChildElements(this.displayElement(), ['[stringID]']); |
213 | MochiKit.Iter.forEach(translatableItems, MochiKit.Base.method(this, 'enhanceTranslatableElement')) | 210 | MochiKit.Iter.forEach(translatableItems, MochiKit.Base.method(this, 'enhanceTranslatableElement')) |
214 | }, | 211 | }, |
215 | 212 | ||
216 | 'enhanceTranslatableElement': function (anElement) { | 213 | 'enhanceTranslatableElement': function (anElement) { |
217 | //Clipperz.log(">>> enhanceTranslatableElement", anElement); | 214 | //Clipperz.log(">>> enhanceTranslatableElement", anElement); |
218 | // new Clipperz.PM.UI.Common.Components.TranslatorWidget({ | 215 | // new Clipperz.PM.UI.Common.Components.TranslatorWidget({ |
219 | // 'element':anElement | 216 | // 'element':anElement |
220 | // }); | 217 | // }); |
221 | 218 | ||
222 | MochiKit.Signal.connect(anElement, 'onmouseenter', MochiKit.Base.partial(Clipperz.PM.UI.Common.Components.TranslatorWidget.show, anElement, MochiKit.DOM.getNodeAttribute(anElement, 'stringID'))); | 219 | MochiKit.Signal.connect(anElement, 'onmouseenter', MochiKit.Base.partial(Clipperz.PM.UI.Common.Components.TranslatorWidget.show, anElement, MochiKit.DOM.getNodeAttribute(anElement, 'stringID'))); |
223 | MochiKit.Signal.connect(anElement, 'onmouseleave', Clipperz.PM.UI.Common.Components.TranslatorWidget.hide); | 220 | MochiKit.Signal.connect(anElement, 'onmouseleave', Clipperz.PM.UI.Common.Components.TranslatorWidget.hide); |
224 | //Clipperz.log("<<< enhanceTranslatableElement"); | 221 | //Clipperz.log("<<< enhanceTranslatableElement"); |
225 | }, | 222 | }, |
226 | 223 | ||
227 | //----------------------------------------------------- | 224 | //----------------------------------------------------- |
228 | 225 | ||
229 | 'update': function(args) { | 226 | 'update': function(args) { |
230 | throw Clipperz.Base.exception.AbstractMethod; | 227 | throw Clipperz.Base.exception.AbstractMethod; |
231 | }, | 228 | }, |
232 | 229 | ||
233 | 'updateSelf': function(args) { | 230 | 'updateSelf': function(args) { |
234 | throw Clipperz.Base.exception.AbstractMethod; | 231 | throw Clipperz.Base.exception.AbstractMethod; |
235 | }, | 232 | }, |
236 | 233 | ||
237 | 'updateComponents': function(args) { | 234 | 'updateComponents': function(args) { |
238 | throw Clipperz.Base.exception.AbstractMethod; | 235 | throw Clipperz.Base.exception.AbstractMethod; |
239 | }, | 236 | }, |
240 | 237 | ||
241 | //----------------------------------------------------- | 238 | //----------------------------------------------------- |
242 | 239 | ||
243 | 'refresh': function() { | 240 | 'refresh': function() { |
244 | throw Clipperz.Base.exception.AbstractMethod; | 241 | throw Clipperz.Base.exception.AbstractMethod; |
245 | }, | 242 | }, |
246 | 243 | ||
247 | 'refreshSelf': function() { | 244 | 'refreshSelf': function() { |
248 | throw Clipperz.Base.exception.AbstractMethod; | 245 | throw Clipperz.Base.exception.AbstractMethod; |
249 | }, | 246 | }, |
250 | 247 | ||
251 | 'refreshComponents': function(args) { | 248 | 'refreshComponents': function(args) { |
252 | throw Clipperz.Base.exception.AbstractMethod; | 249 | throw Clipperz.Base.exception.AbstractMethod; |
253 | }, | 250 | }, |
254 | 251 | ||
255 | //----------------------------------------------------- | 252 | //----------------------------------------------------- |
256 | 253 | ||
257 | 'checkSlotNamed': function(aSlotName) { | 254 | 'checkSlotNamed': function(aSlotName) { |
258 | if (typeof(this._slots[aSlotName]) == 'undefined') { | 255 | if (typeof(this._slots[aSlotName]) == 'undefined') { |
259 | throw new Error("undefined slot"); | 256 | throw new Error("undefined slot"); |
260 | }; | 257 | }; |
261 | }, | 258 | }, |
262 | 259 | ||
263 | //----------------------------------------------------- | 260 | //----------------------------------------------------- |
264 | 261 | ||
265 | 'cachedSlots': function() { | 262 | 'cachedSlots': function() { |
266 | return this._cachedSlots; | 263 | return this._cachedSlots; |
267 | }, | 264 | }, |
268 | 265 | ||
269 | 'slotNamed': function(aSlotName) { | 266 | 'slotNamed': function(aSlotName) { |
270 | var result; | 267 | var result; |
271 | 268 | ||
272 | this.checkSlotNamed(aSlotName); | 269 | this.checkSlotNamed(aSlotName); |
273 | if (typeof(this.cachedSlots()[aSlotName]) == 'undefined') { | 270 | if (typeof(this.cachedSlots()[aSlotName]) == 'undefined') { |
274 | this.cachedSlots()[aSlotName] = new Clipperz.PM.UI.Common.Components.ComponentSlot(this,aSlotName); | 271 | this.cachedSlots()[aSlotName] = new Clipperz.PM.UI.Common.Components.ComponentSlot(this,aSlotName); |
275 | } | 272 | } |
276 | 273 | ||
277 | result = this.cachedSlots()[aSlotName]; | 274 | result = this.cachedSlots()[aSlotName]; |
278 | 275 | ||
279 | return result; | 276 | return result; |
280 | }, | 277 | }, |
281 | 278 | ||
282 | //----------------------------------------------------- | 279 | //----------------------------------------------------- |
283 | 280 | ||
284 | 'elementForSlotNamed': function(aSlotName) { | 281 | 'elementForSlotNamed': function(aSlotName) { |
285 | return MochiKit.DOM.getElement(this._slots[aSlotName]); | 282 | return MochiKit.DOM.getElement(this._slots[aSlotName]); |
286 | }, | 283 | }, |
287 | 284 | ||
288 | //----------------------------------------------------- | 285 | //----------------------------------------------------- |
289 | 286 | ||
290 | 'componentForSlotNamed': function(aSlotName) { | 287 | 'componentForSlotNamed': function(aSlotName) { |
291 | return this.slotComponents()[aSlotName]; | 288 | return this.slotComponents()[aSlotName]; |
292 | }, | 289 | }, |
293 | 290 | ||
294 | 'setComponentForSlotNamed': function(aComponent, aSlotName) { | 291 | 'setComponentForSlotNamed': function(aComponent, aSlotName) { |
295 | var domNode; | 292 | var domNode; |
296 | 293 | ||
297 | this.checkSlotNamed(aSlotName); | 294 | this.checkSlotNamed(aSlotName); |
298 | 295 | ||
299 | if (this.slotComponents()[aSlotName] != null) { | 296 | if (this.slotComponents()[aSlotName] != null) { |
300 | this.slotComponents()[aSlotName].remove(); | 297 | this.slotComponents()[aSlotName].remove(); |
301 | } | 298 | } |
302 | 299 | ||
303 | this.slotComponents()[aSlotName] = aComponent; | 300 | this.slotComponents()[aSlotName] = aComponent; |
304 | 301 | ||
305 | // domNode = MochiKit.DOM.getElement(this.slotNamed(aSlotName)); | 302 | // domNode = MochiKit.DOM.getElement(this.slotNamed(aSlotName)); |
306 | domNode = this.elementForSlotNamed(aSlotName); | 303 | domNode = this.elementForSlotNamed(aSlotName); |
307 | 304 | ||
308 | if (domNode != null) { | 305 | if (domNode != null) { |
309 | aComponent.renderInNode(domNode); | 306 | aComponent.renderInNode(domNode); |
310 | } | 307 | } |
311 | }, | 308 | }, |
312 | 309 | ||
313 | //----------------------------------------------------- | 310 | //----------------------------------------------------- |
314 | /* | 311 | /* |
315 | 'purgeListeners': function() { | 312 | 'purgeListeners': function() { |
316 | //MochiKit.Logging.logDebug(">>> Clipperz.PM.UI.Common.Components.BaseComponent.purgeListeners [" + this + "]"); | ||
317 | //MochiKit.Logging.logDebug("--- " + this + ".purgeListeners"); | ||
318 | Clipperz.NotificationCenter.unregister(this); | 313 | Clipperz.NotificationCenter.unregister(this); |
319 | MochiKit.Signal.disconnectAllTo(this); | 314 | MochiKit.Signal.disconnectAllTo(this); |
320 | //MochiKit.Logging.logDebug("<<< Clipperz.PM.UI.Common.Components.BaseComponent.purgeListeners"); | ||
321 | }, | 315 | }, |
322 | */ | 316 | */ |
323 | //----------------------------------------------------- | 317 | //----------------------------------------------------- |
324 | 318 | ||
325 | 'clear': function() { | 319 | 'clear': function() { |
326 | varslotName; | 320 | varslotName; |
327 | var componentId; | 321 | var componentId; |
328 | 322 | ||
329 | MochiKit.Signal.disconnectAllTo(this); | 323 | MochiKit.Signal.disconnectAllTo(this); |
330 | 324 | ||
331 | for (slotName in this.slotComponents()) { | 325 | for (slotName in this.slotComponents()) { |
332 | this.slotComponents()[slotName].clear(); | 326 | this.slotComponents()[slotName].clear(); |
333 | } | 327 | } |
334 | 328 | ||
335 | for (componentId in this.components()) { | 329 | for (componentId in this.components()) { |
336 | this.components()[componentId].clear(); | 330 | this.components()[componentId].clear(); |
337 | } | 331 | } |
338 | 332 | ||
339 | // if (this.element() != null) { | 333 | // if (this.element() != null) { |
340 | // this.element().innerHTML = ""; | 334 | // this.element().innerHTML = ""; |
341 | // } | 335 | // } |
342 | 336 | ||
343 | if (this.displayElement() != null) { | 337 | if (this.displayElement() != null) { |
344 | if (this.element() != this.displayElement()) { | 338 | if (this.element() != this.displayElement()) { |
345 | MochiKit.DOM.removeElement(this.displayElement()); | 339 | MochiKit.DOM.removeElement(this.displayElement()); |
346 | } else { | 340 | } else { |
347 | this.displayElement().innerHTML = ""; | 341 | this.displayElement().innerHTML = ""; |
348 | } | 342 | } |
349 | } | 343 | } |
350 | 344 | ||
351 | if (this.isModal()) { | 345 | if (this.isModal()) { |
352 | //TODO: cleanup when the closed element was shown modally. | 346 | //TODO: cleanup when the closed element was shown modally. |
353 | } | 347 | } |
354 | }, | 348 | }, |
355 | 349 | ||
356 | 350 | ||
357 | 'remove': function() { | 351 | 'remove': function() { |
358 | varslotName; | 352 | varslotName; |
359 | var componentId; | 353 | var componentId; |
360 | 354 | ||
361 | for (slotName in this.slotComponents()) { | 355 | for (slotName in this.slotComponents()) { |
362 | this.slotComponents()[slotName].remove(); | 356 | this.slotComponents()[slotName].remove(); |
363 | delete this.slotComponents()[slotName]; | 357 | delete this.slotComponents()[slotName]; |
364 | } | 358 | } |
365 | 359 | ||
366 | for (componentId in this.components()) { | 360 | for (componentId in this.components()) { |
367 | this.components()[componentId].remove(); | 361 | this.components()[componentId].remove(); |
368 | delete this.components()[componentId]; | 362 | delete this.components()[componentId]; |
369 | } | 363 | } |
370 | 364 | ||
371 | this.clear(); | 365 | this.clear(); |
372 | MochiKit.Signal.disconnectAll(this); | 366 | MochiKit.Signal.disconnectAll(this); |
373 | }, | 367 | }, |
374 | 368 | ||
375 | 'append': function(aNode, aValue) { | 369 | 'append': function(aNode, aValue) { |
376 | return Clipperz.DOM.Helper.append(aNode, aValue); | 370 | return Clipperz.DOM.Helper.append(aNode, aValue); |
377 | }, | 371 | }, |
378 | 372 | ||
379 | 'insertBefore': function (aNode, aValue) { | 373 | 'insertBefore': function (aNode, aValue) { |
380 | return Clipperz.DOM.Helper.insertBefore(aNode, aValue); | 374 | return Clipperz.DOM.Helper.insertBefore(aNode, aValue); |
381 | }, | 375 | }, |
382 | 376 | ||
383 | 'insertAfter': function (aNode, aValue) { | 377 | 'insertAfter': function (aNode, aValue) { |
384 | return Clipperz.DOM.Helper.insertAfter(aNode, aValue); | 378 | return Clipperz.DOM.Helper.insertAfter(aNode, aValue); |
385 | }, | 379 | }, |
386 | 380 | ||
387 | //------------------------------------------------------------------------- | 381 | //------------------------------------------------------------------------- |
388 | 382 | ||
389 | 'getId': function(aValue) { | 383 | 'getId': function(aValue) { |
390 | varresult; | 384 | varresult; |
391 | 385 | ||
392 | if (typeof(aValue) != 'undefined') { | 386 | if (typeof(aValue) != 'undefined') { |
393 | result = this._ids[aValue]; | 387 | result = this._ids[aValue]; |
394 | 388 | ||
395 | if (typeof(result) == 'undefined') { | 389 | if (typeof(result) == 'undefined') { |
396 | _Clipperz_PM_Components_base_id_ ++; | 390 | _Clipperz_PM_Components_base_id_ ++; |
397 | 391 | ||
398 | result = "Clipperz_PM_Components_" + aValue + "_" + _Clipperz_PM_Components_base_id_; | 392 | result = "Clipperz_PM_Components_" + aValue + "_" + _Clipperz_PM_Components_base_id_; |
399 | this._ids[aValue] = result; | 393 | this._ids[aValue] = result; |
400 | } | 394 | } |
401 | } else { | 395 | } else { |
402 | // result = Clipperz.PM.UI.Common.Components.BaseComponent.superclass.getId.call(this); | 396 | // result = Clipperz.PM.UI.Common.Components.BaseComponent.superclass.getId.call(this); |
403 | throw "call to BaseComponent.getId with an undefined value"; | 397 | throw "call to BaseComponent.getId with an undefined value"; |
404 | } | 398 | } |
405 | 399 | ||
406 | return result; | 400 | return result; |
407 | }, | 401 | }, |
408 | 402 | ||
409 | 'getAnchor': function (aValue) { | 403 | 'getAnchor': function (aValue) { |
410 | return '#' + this.getId(aValue); | 404 | return '#' + this.getId(aValue); |
411 | }, | 405 | }, |
412 | 406 | ||
413 | //------------------------------------------------------------------------- | 407 | //------------------------------------------------------------------------- |
414 | 408 | ||
415 | 'getElement': function(aValue) { | 409 | 'getElement': function(aValue) { |
416 | return Clipperz.DOM.get(this.getId(aValue)); | 410 | return Clipperz.DOM.get(this.getId(aValue)); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Button.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Button.js index 1010c9d..1268118 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Button.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Button.js | |||
@@ -1,113 +1,111 @@ | |||
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 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Common.Components.Button = function(args) { | 26 | Clipperz.PM.UI.Common.Components.Button = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
31 | Clipperz.PM.UI.Common.Components.Button.superclass.constructor.apply(this, arguments); | 29 | Clipperz.PM.UI.Common.Components.Button.superclass.constructor.apply(this, arguments); |
32 | 30 | ||
33 | this._element = args.element || Clipperz.Base.exception.raise('MandatoryParameter'); | 31 | this._element = args.element || Clipperz.Base.exception.raise('MandatoryParameter'); |
34 | this._text = args.text || Clipperz.Base.exception.raise('MandatoryParameter'); | 32 | this._text = args.text || Clipperz.Base.exception.raise('MandatoryParameter'); |
35 | this._isDefault = args.isDefault|| false; | 33 | this._isDefault = args.isDefault|| false; |
36 | 34 | ||
37 | this.render(); | 35 | this.render(); |
38 | 36 | ||
39 | return this; | 37 | return this; |
40 | } | 38 | } |
41 | 39 | ||
42 | //============================================================================= | 40 | //============================================================================= |
43 | 41 | ||
44 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.Button, Clipperz.PM.UI.Common.Components.BaseComponent, { | 42 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.Button, Clipperz.PM.UI.Common.Components.BaseComponent, { |
45 | 43 | ||
46 | //------------------------------------------------------------------------- | 44 | //------------------------------------------------------------------------- |
47 | 45 | ||
48 | 'toString': function () { | 46 | 'toString': function () { |
49 | return "Clipperz.PM.UI.Common.Components.Button component"; | 47 | return "Clipperz.PM.UI.Common.Components.Button component"; |
50 | }, | 48 | }, |
51 | 49 | ||
52 | //------------------------------------------------------------------------- | 50 | //------------------------------------------------------------------------- |
53 | 51 | ||
54 | 'text': function () { | 52 | 'text': function () { |
55 | return this._text; | 53 | return this._text; |
56 | }, | 54 | }, |
57 | 55 | ||
58 | 'isDefault': function () { | 56 | 'isDefault': function () { |
59 | return this._isDefault; | 57 | return this._isDefault; |
60 | }, | 58 | }, |
61 | 59 | ||
62 | //------------------------------------------------------------------------- | 60 | //------------------------------------------------------------------------- |
63 | 61 | ||
64 | 'renderSelf': function () { | 62 | 'renderSelf': function () { |
65 | /* | 63 | /* |
66 | this.append(this.element(), {tag:'div', id:this.getId('button'), cls:'button_wrapper', children:[ | 64 | this.append(this.element(), {tag:'div', id:this.getId('button'), cls:'button_wrapper', children:[ |
67 | {tag:'div', id:this.getId('bodyWrapper'), cls:'button_bodyWrapper', children:[ | 65 | {tag:'div', id:this.getId('bodyWrapper'), cls:'button_bodyWrapper', children:[ |
68 | {tag:'div', id:this.getId('body'), cls:'button_body', children:[ | 66 | {tag:'div', id:this.getId('body'), cls:'button_body', children:[ |
69 | {tag:'span', html:this.text()} | 67 | {tag:'span', html:this.text()} |
70 | ]}, | 68 | ]}, |
71 | {tag:'div', id:this.getId('footer'), cls:'button_footer'} | 69 | {tag:'div', id:this.getId('footer'), cls:'button_footer'} |
72 | ]} | 70 | ]} |
73 | ]}); | 71 | ]}); |
74 | */ | 72 | */ |
75 | /* | 73 | /* |
76 | this.append(this.element(), {tag:'div', id:this.getId('button'), cls:'button', children:[ | 74 | this.append(this.element(), {tag:'div', id:this.getId('button'), cls:'button', children:[ |
77 | {tag:'span', html:this.text()} | 75 | {tag:'span', html:this.text()} |
78 | ]}); | 76 | ]}); |
79 | */ | 77 | */ |
80 | this.append(this.element(), {tag:'a', id:this.getId('button'), cls:'button', html:this.text()}); | 78 | this.append(this.element(), {tag:'a', id:this.getId('button'), cls:'button', html:this.text()}); |
81 | 79 | ||
82 | if (this.isDefault()) { | 80 | if (this.isDefault()) { |
83 | MochiKit.DOM.addElementClass(this.getId('button'), 'default'); | 81 | MochiKit.DOM.addElementClass(this.getId('button'), 'default'); |
84 | } | 82 | } |
85 | 83 | ||
86 | // MochiKit.Signal.connect(this.getId('button'), 'onmouseenter',this, 'handleOnMouseEnter'); | 84 | // MochiKit.Signal.connect(this.getId('button'), 'onmouseenter',this, 'handleOnMouseEnter'); |
87 | // MochiKit.Signal.connect(this.getId('button'), 'onmouseleave',this, 'handleOnMouseLeave'); | 85 | // MochiKit.Signal.connect(this.getId('button'), 'onmouseleave',this, 'handleOnMouseLeave'); |
88 | // MochiKit.Signal.connect(this.getId('button'), 'onmousedown',this, 'handleOnMouseDown'); | 86 | // MochiKit.Signal.connect(this.getId('button'), 'onmousedown',this, 'handleOnMouseDown'); |
89 | MochiKit.Signal.connect(this.getId('button'), 'onclick', this, 'handleOnClick'); | 87 | MochiKit.Signal.connect(this.getId('button'), 'onclick', this, 'handleOnClick'); |
90 | }, | 88 | }, |
91 | 89 | ||
92 | //------------------------------------------------------------------------- | 90 | //------------------------------------------------------------------------- |
93 | /* | 91 | /* |
94 | 'handleOnMouseEnter': function (anEvent) { | 92 | 'handleOnMouseEnter': function (anEvent) { |
95 | MochiKit.DOM.addElementClass(this.getId('button'), 'hover'); | 93 | MochiKit.DOM.addElementClass(this.getId('button'), 'hover'); |
96 | }, | 94 | }, |
97 | 95 | ||
98 | 'handleOnMouseLeave': function (anEvent) { | 96 | 'handleOnMouseLeave': function (anEvent) { |
99 | MochiKit.DOM.removeElementClass(this.getId('button'), 'hover'); | 97 | MochiKit.DOM.removeElementClass(this.getId('button'), 'hover'); |
100 | MochiKit.DOM.removeElementClass(this.getId('button'), 'clicked'); | 98 | MochiKit.DOM.removeElementClass(this.getId('button'), 'clicked'); |
101 | }, | 99 | }, |
102 | 100 | ||
103 | 'handleOnMouseDown': function (anEvent) { | 101 | 'handleOnMouseDown': function (anEvent) { |
104 | MochiKit.DOM.addElementClass(this.getId('button'), 'clicked'); | 102 | MochiKit.DOM.addElementClass(this.getId('button'), 'clicked'); |
105 | }, | 103 | }, |
106 | */ | 104 | */ |
107 | 'handleOnClick': function (anEvent) { | 105 | 'handleOnClick': function (anEvent) { |
108 | MochiKit.Signal.signal(this, 'onclick', anEvent); | 106 | MochiKit.Signal.signal(this, 'onclick', anEvent); |
109 | }, | 107 | }, |
110 | 108 | ||
111 | //------------------------------------------------------------------------- | 109 | //------------------------------------------------------------------------- |
112 | __syntaxFix__: "syntax fix" | 110 | __syntaxFix__: "syntax fix" |
113 | }); | 111 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/ComponentSlot.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/ComponentSlot.js index 7f56c1e..2f82359 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/ComponentSlot.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/ComponentSlot.js | |||
@@ -1,61 +1,59 @@ | |||
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 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); |
27 | 25 | ||
28 | //############################################################################# | 26 | //############################################################################# |
29 | 27 | ||
30 | 28 | ||
31 | Clipperz.PM.UI.Common.Components.ComponentSlot = function(aComponent, aSlotName) { | 29 | Clipperz.PM.UI.Common.Components.ComponentSlot = function(aComponent, aSlotName) { |
32 | this._component = aComponent; | 30 | this._component = aComponent; |
33 | this._slotName = aSlotName; | 31 | this._slotName = aSlotName; |
34 | 32 | ||
35 | return this; | 33 | return this; |
36 | } | 34 | } |
37 | 35 | ||
38 | //============================================================================= | 36 | //============================================================================= |
39 | 37 | ||
40 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.ComponentSlot, Object, { | 38 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.ComponentSlot, Object, { |
41 | 39 | ||
42 | //------------------------------------------------------------------------- | 40 | //------------------------------------------------------------------------- |
43 | 41 | ||
44 | 'slotName': function() { | 42 | 'slotName': function() { |
45 | return this._slotName; | 43 | return this._slotName; |
46 | }, | 44 | }, |
47 | 45 | ||
48 | 'component': function() { | 46 | 'component': function() { |
49 | return this._component; | 47 | return this._component; |
50 | }, | 48 | }, |
51 | 49 | ||
52 | //------------------------------------------------------------------------- | 50 | //------------------------------------------------------------------------- |
53 | 51 | ||
54 | 'setContent': function(aComponent) { | 52 | 'setContent': function(aComponent) { |
55 | this.component().setComponentForSlotNamed(aComponent, this.slotName()); | 53 | this.component().setComponentForSlotNamed(aComponent, this.slotName()); |
56 | }, | 54 | }, |
57 | 55 | ||
58 | //------------------------------------------------------------------------- | 56 | //------------------------------------------------------------------------- |
59 | __syntaxFix__: "syntax fix" | 57 | __syntaxFix__: "syntax fix" |
60 | 58 | ||
61 | }); | 59 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/FaviconComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/FaviconComponent.js index 2db2489..bf00ffc 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/FaviconComponent.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/FaviconComponent.js | |||
@@ -1,88 +1,86 @@ | |||
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 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Common.Components.FaviconComponent = function(args) { | 26 | Clipperz.PM.UI.Common.Components.FaviconComponent = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
31 | Clipperz.PM.UI.Common.Components.FaviconComponent.superclass.constructor.apply(this, arguments); | 29 | Clipperz.PM.UI.Common.Components.FaviconComponent.superclass.constructor.apply(this, arguments); |
32 | 30 | ||
33 | this.render(); | 31 | this.render(); |
34 | this.setSrc(args.src); | 32 | this.setSrc(args.src); |
35 | 33 | ||
36 | return this; | 34 | return this; |
37 | } | 35 | } |
38 | 36 | ||
39 | //============================================================================= | 37 | //============================================================================= |
40 | 38 | ||
41 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.FaviconComponent, Clipperz.PM.UI.Common.Components.BaseComponent, { | 39 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.FaviconComponent, Clipperz.PM.UI.Common.Components.BaseComponent, { |
42 | 40 | ||
43 | //------------------------------------------------------------------------- | 41 | //------------------------------------------------------------------------- |
44 | 42 | ||
45 | 'toString': function () { | 43 | 'toString': function () { |
46 | return "Clipperz.PM.UI.Common.Components.FaviconComponent component"; | 44 | return "Clipperz.PM.UI.Common.Components.FaviconComponent component"; |
47 | }, | 45 | }, |
48 | 46 | ||
49 | //------------------------------------------------------------------------- | 47 | //------------------------------------------------------------------------- |
50 | 48 | ||
51 | 'src': function () { | 49 | 'src': function () { |
52 | return this.element().src; | 50 | return this.element().src; |
53 | }, | 51 | }, |
54 | 52 | ||
55 | 'setSrc': function (aValue) { | 53 | 'setSrc': function (aValue) { |
56 | this.element().src = (aValue || Clipperz.PM.Strings.getValue('defaultFaviconUrl')); | 54 | this.element().src = (aValue || Clipperz.PM.Strings.getValue('defaultFaviconUrl')); |
57 | }, | 55 | }, |
58 | 56 | ||
59 | //------------------------------------------------------------------------- | 57 | //------------------------------------------------------------------------- |
60 | 58 | ||
61 | 'clear': function () {}, | 59 | 'clear': function () {}, |
62 | 60 | ||
63 | //------------------------------------------------------------------------- | 61 | //------------------------------------------------------------------------- |
64 | 62 | ||
65 | 'renderSelf': function () { | 63 | 'renderSelf': function () { |
66 | MochiKit.Signal.connect(this.element(), 'onerror',this, 'setDefaultFavicon'); | 64 | MochiKit.Signal.connect(this.element(), 'onerror',this, 'setDefaultFavicon'); |
67 | MochiKit.Signal.connect(this.element(), 'onabort',this, 'setDefaultFavicon'); | 65 | MochiKit.Signal.connect(this.element(), 'onabort',this, 'setDefaultFavicon'); |
68 | MochiKit.Signal.connect(this.element(), 'onload',this, 'handleOnLoad'); | 66 | MochiKit.Signal.connect(this.element(), 'onload',this, 'handleOnLoad'); |
69 | }, | 67 | }, |
70 | 68 | ||
71 | //------------------------------------------------------------------------- | 69 | //------------------------------------------------------------------------- |
72 | 70 | ||
73 | 'setDefaultFavicon': function (anEvent) { | 71 | 'setDefaultFavicon': function (anEvent) { |
74 | MochiKit.Signal.disconnectAll(anEvent.src()); | 72 | MochiKit.Signal.disconnectAll(anEvent.src()); |
75 | this.setSrc(null); | 73 | this.setSrc(null); |
76 | }, | 74 | }, |
77 | 75 | ||
78 | 'handleOnLoad': function (anEvent) { | 76 | 'handleOnLoad': function (anEvent) { |
79 | MochiKit.Signal.disconnectAll(anEvent.src()); | 77 | MochiKit.Signal.disconnectAll(anEvent.src()); |
80 | //console.log("HANDLE ON LOAD", anEvent, anEvent.src().src); | 78 | |
81 | if (anEvent.src().complete == false) { | 79 | if (anEvent.src().complete == false) { |
82 | this.setSrc(null); | 80 | this.setSrc(null); |
83 | } | 81 | } |
84 | }, | 82 | }, |
85 | 83 | ||
86 | //------------------------------------------------------------------------- | 84 | //------------------------------------------------------------------------- |
87 | __syntaxFix__: "syntax fix" | 85 | __syntaxFix__: "syntax fix" |
88 | }); | 86 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/MessagePanelWithProgressBar.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/MessagePanelWithProgressBar.js index 2788b79..020290b 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/MessagePanelWithProgressBar.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/MessagePanelWithProgressBar.js | |||
@@ -1,161 +1,155 @@ | |||
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 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Common.Components.MessagePanelWithProgressBar = function(args) { | 26 | Clipperz.PM.UI.Common.Components.MessagePanelWithProgressBar = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
31 | Clipperz.PM.UI.Common.Components.MessagePanelWithProgressBar.superclass.constructor.apply(this, arguments); | 29 | Clipperz.PM.UI.Common.Components.MessagePanelWithProgressBar.superclass.constructor.apply(this, arguments); |
32 | 30 | ||
33 | // this._openFromElement = args.openFromElement || null; | 31 | // this._openFromElement = args.openFromElement || null; |
34 | this._onOkCloseToElement = args.onOkCloseToElement || null; | 32 | this._onOkCloseToElement = args.onOkCloseToElement || null; |
35 | this._onCancelCloseToElement = args.onCancelCloseToElement|| null; | 33 | this._onCancelCloseToElement = args.onCancelCloseToElement|| null; |
36 | 34 | ||
37 | this._canCancelWhileProcessing= ((typeof(args.canCancelWhileProcessing) == 'undefined') ? true : args.canCancelWhileProcessing); | 35 | this._canCancelWhileProcessing= ((typeof(args.canCancelWhileProcessing) == 'undefined') ? true : args.canCancelWhileProcessing); |
38 | 36 | ||
39 | return this; | 37 | return this; |
40 | } | 38 | } |
41 | 39 | ||
42 | //============================================================================= | 40 | //============================================================================= |
43 | 41 | ||
44 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.MessagePanelWithProgressBar, Clipperz.PM.UI.Common.Components.SimpleMessagePanel, { | 42 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.MessagePanelWithProgressBar, Clipperz.PM.UI.Common.Components.SimpleMessagePanel, { |
45 | 43 | ||
46 | //------------------------------------------------------------------------- | 44 | //------------------------------------------------------------------------- |
47 | 45 | ||
48 | 'toString': function () { | 46 | 'toString': function () { |
49 | return "Clipperz.PM.UI.Common.Components.MessagePanelWithProgressBar component"; | 47 | return "Clipperz.PM.UI.Common.Components.MessagePanelWithProgressBar component"; |
50 | }, | 48 | }, |
51 | 49 | ||
52 | //------------------------------------------------------------------------- | 50 | //------------------------------------------------------------------------- |
53 | /* | 51 | /* |
54 | 'openFromElement': function () { | 52 | 'openFromElement': function () { |
55 | return this._openFromElement; | 53 | return this._openFromElement; |
56 | }, | 54 | }, |
57 | */ | 55 | */ |
58 | //------------------------------------------------------------------------- | 56 | //------------------------------------------------------------------------- |
59 | 57 | ||
60 | 'onOkCloseToElement': function () { | 58 | 'onOkCloseToElement': function () { |
61 | return this._onOkCloseToElement; | 59 | return this._onOkCloseToElement; |
62 | }, | 60 | }, |
63 | 61 | ||
64 | 'setOnOkCloseToElement': function (anElement) { | 62 | 'setOnOkCloseToElement': function (anElement) { |
65 | this._onOkCloseToElement = anElement; | 63 | this._onOkCloseToElement = anElement; |
66 | }, | 64 | }, |
67 | 65 | ||
68 | //------------------------------------------------------------------------- | 66 | //------------------------------------------------------------------------- |
69 | 67 | ||
70 | 'onCancelCloseToElement': function () { | 68 | 'onCancelCloseToElement': function () { |
71 | return this._onCancelCloseToElement; | 69 | return this._onCancelCloseToElement; |
72 | }, | 70 | }, |
73 | 71 | ||
74 | 'setOnCancelCloseToElement': function (anElement) { | 72 | 'setOnCancelCloseToElement': function (anElement) { |
75 | this._onCancelCloseToElement = anElement; | 73 | this._onCancelCloseToElement = anElement; |
76 | }, | 74 | }, |
77 | 75 | ||
78 | //------------------------------------------------------------------------- | 76 | //------------------------------------------------------------------------- |
79 | 77 | ||
80 | 'canCancelWhileProcessing': function () { | 78 | 'canCancelWhileProcessing': function () { |
81 | return this._canCancelWhileProcessing; | 79 | return this._canCancelWhileProcessing; |
82 | }, | 80 | }, |
83 | 81 | ||
84 | //------------------------------------------------------------------------- | 82 | //------------------------------------------------------------------------- |
85 | 83 | ||
86 | 'deferredShowModal': function (someArgs, aResult) { | 84 | 'deferredShowModal': function (someArgs, aResult) { |
87 | if (someArgs['onOkCloseToElement'] != null) { | 85 | if (someArgs['onOkCloseToElement'] != null) { |
88 | this.setOnOkCloseToElement(someArgs['onOkCloseToElement']); | 86 | this.setOnOkCloseToElement(someArgs['onOkCloseToElement']); |
89 | } | 87 | } |
90 | 88 | ||
91 | if (someArgs['onCancelCloseToElement'] != null) { | 89 | if (someArgs['onCancelCloseToElement'] != null) { |
92 | this.setOnCancelCloseToElement(someArgs['onCancelCloseToElement']); | 90 | this.setOnCancelCloseToElement(someArgs['onCancelCloseToElement']); |
93 | } | 91 | } |
94 | 92 | ||
95 | Clipperz.PM.UI.Common.Components.MessagePanelWithProgressBar.superclass.deferredShowModal.apply(this, arguments); | 93 | Clipperz.PM.UI.Common.Components.MessagePanelWithProgressBar.superclass.deferredShowModal.apply(this, arguments); |
96 | return this.deferred(); | 94 | return this.deferred(); |
97 | }, | 95 | }, |
98 | 96 | ||
99 | //------------------------------------------------------------------------- | 97 | //------------------------------------------------------------------------- |
100 | 98 | ||
101 | 'showProgressBar': function () { | 99 | 'showProgressBar': function () { |
102 | varprogressBarElement; | 100 | varprogressBarElement; |
103 | 101 | ||
104 | this.getElement('container').innerHTML = ''; | 102 | this.getElement('container').innerHTML = ''; |
105 | 103 | ||
106 | progressBarElement = this.append(this.getElement('container'), {tag:'div', cls:'progressBarWrapper'}); | 104 | progressBarElement = this.append(this.getElement('container'), {tag:'div', cls:'progressBarWrapper'}); |
107 | this.addComponent(new Clipperz.PM.UI.Common.Components.ProgressBar({'element':progressBarElement})); | 105 | this.addComponent(new Clipperz.PM.UI.Common.Components.ProgressBar({'element':progressBarElement})); |
108 | 106 | ||
109 | if (this.canCancelWhileProcessing() == true) { | 107 | if (this.canCancelWhileProcessing() == true) { |
110 | this.setButtons([{text:"Cancel", result:'CANCEL'}]); | 108 | this.setButtons([{text:"Cancel", result:'CANCEL'}]); |
111 | } else { | 109 | } else { |
112 | this.setButtons([]); | 110 | this.setButtons([]); |
113 | } | 111 | } |
114 | }, | 112 | }, |
115 | 113 | ||
116 | //------------------------------------------------------------------------- | 114 | //------------------------------------------------------------------------- |
117 | 115 | ||
118 | 'showFailure': function (someParameters) { | 116 | 'showFailure': function (someParameters) { |
119 | // this.setType('ALERT'); | 117 | // this.setType('ALERT'); |
120 | this.setType(someParameters['type']); | 118 | this.setType(someParameters['type']); |
121 | // this.setTitle("Login failed"); | 119 | // this.setTitle("Login failed"); |
122 | this.setTitle(someParameters['title']); | 120 | this.setTitle(someParameters['title']); |
123 | // this.setText("Wrong passphrase; the unlock has failed."); | 121 | // this.setText("Wrong passphrase; the unlock has failed."); |
124 | this.setText(someParameters['text']); | 122 | this.setText(someParameters['text']); |
125 | // this.getElement('container').innerHTML = ''; | 123 | // this.getElement('container').innerHTML = ''; |
126 | this.getElement('container').innerHTML = ''; | 124 | this.getElement('container').innerHTML = ''; |
127 | // this.setButtons([{text:"Close", result:'CANCEL', isDefault:true}]); | 125 | // this.setButtons([{text:"Close", result:'CANCEL', isDefault:true}]); |
128 | this.setButtons(someParameters['buttons']); | 126 | this.setButtons(someParameters['buttons']); |
129 | }, | 127 | }, |
130 | 128 | ||
131 | //------------------------------------------------------------------------- | 129 | //------------------------------------------------------------------------- |
132 | 130 | ||
133 | 'closeOk': function () { | 131 | 'closeOk': function () { |
134 | //console.log("=== closeOk"); | ||
135 | this.showProgressBar(); | 132 | this.showProgressBar(); |
136 | MochiKit.Async.callLater(0.5, MochiKit.Base.method(this.deferred(), 'callback')); | 133 | MochiKit.Async.callLater(0.5, MochiKit.Base.method(this.deferred(), 'callback')); |
137 | this._deferred = null; | 134 | this._deferred = null; |
138 | }, | 135 | }, |
139 | 136 | ||
140 | 'closeCancel': function () { | 137 | 'closeCancel': function () { |
141 | //console.log("=== closeCancel"); | ||
142 | this.deferredHideModal({closeToElement:this.onCancelCloseToElement()}); | 138 | this.deferredHideModal({closeToElement:this.onCancelCloseToElement()}); |
143 | this.deferred().cancel(); | 139 | this.deferred().cancel(); |
144 | this._deferred = null; | 140 | this._deferred = null; |
145 | }, | 141 | }, |
146 | 142 | ||
147 | //------------------------------------------------------------------------- | 143 | //------------------------------------------------------------------------- |
148 | 144 | ||
149 | 'deferredDone': function () { | 145 | 'deferredDone': function () { |
150 | //console.log("=== deferredDone"); | ||
151 | return this.deferredHideModal({closeToElement:this.onOkCloseToElement()}); | 146 | return this.deferredHideModal({closeToElement:this.onOkCloseToElement()}); |
152 | }, | 147 | }, |
153 | 148 | ||
154 | 'deferredError': function (someParameters) { | 149 | 'deferredError': function (someParameters) { |
155 | //console.log("=== deferredError"); | ||
156 | this.showFailure(someParameters); | 150 | this.showFailure(someParameters); |
157 | }, | 151 | }, |
158 | 152 | ||
159 | //------------------------------------------------------------------------- | 153 | //------------------------------------------------------------------------- |
160 | __syntaxFix__: "syntax fix" | 154 | __syntaxFix__: "syntax fix" |
161 | }); | 155 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/PasswordEntropyDisplay.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/PasswordEntropyDisplay.js index 089e3d4..78e8c9b 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/PasswordEntropyDisplay.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/PasswordEntropyDisplay.js | |||
@@ -1,137 +1,122 @@ | |||
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 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Common.Components.PasswordEntropyDisplay = function(anElement, args) { | 26 | Clipperz.PM.UI.Common.Components.PasswordEntropyDisplay = function(anElement, args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
31 | //MochiKit.Logging.logDebug(">>> new TextFormField"); | ||
32 | Clipperz.PM.UI.Common.Components.PasswordEntropyDisplay.superclass.constructor.call(this, anElement, args); | 29 | Clipperz.PM.UI.Common.Components.PasswordEntropyDisplay.superclass.constructor.call(this, anElement, args); |
33 | 30 | ||
34 | this._wrapperElement = null; | 31 | this._wrapperElement = null; |
35 | this._entropyElement = null; | 32 | this._entropyElement = null; |
36 | 33 | ||
37 | this.render(); | 34 | this.render(); |
38 | //MochiKit.Logging.logDebug("<<< new TextFormField"); | ||
39 | 35 | ||
40 | return this; | 36 | return this; |
41 | }; | 37 | }; |
42 | 38 | ||
43 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.PasswordEntropyDisplay, Clipperz.PM.UI.Common.Components.BaseComponent, { | 39 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.PasswordEntropyDisplay, Clipperz.PM.UI.Common.Components.BaseComponent, { |
44 | 40 | ||
45 | 'toString': function() { | 41 | 'toString': function() { |
46 | return "Clipperz.PM.UI.Common.Components.PasswordEntropyDisplay"; | 42 | return "Clipperz.PM.UI.Common.Components.PasswordEntropyDisplay"; |
47 | }, | 43 | }, |
48 | 44 | ||
49 | //----------------------------------------------------- | 45 | //----------------------------------------------------- |
50 | 46 | ||
51 | 'wrapperElement': function() { | 47 | 'wrapperElement': function() { |
52 | return this._wrapperElement; | 48 | return this._wrapperElement; |
53 | }, | 49 | }, |
54 | 50 | ||
55 | 'setWrapperElement': function(aValue) { | 51 | 'setWrapperElement': function(aValue) { |
56 | this._wrapperElement = aValue; | 52 | this._wrapperElement = aValue; |
57 | }, | 53 | }, |
58 | 54 | ||
59 | //----------------------------------------------------- | 55 | //----------------------------------------------------- |
60 | 56 | ||
61 | 'passwordElement': function() { | 57 | 'passwordElement': function() { |
62 | return this.element(); | 58 | return this.element(); |
63 | }, | 59 | }, |
64 | 60 | ||
65 | //----------------------------------------------------- | 61 | //----------------------------------------------------- |
66 | 62 | ||
67 | 'entropyElement': function() { | 63 | 'entropyElement': function() { |
68 | return this._entropyElement; | 64 | return this._entropyElement; |
69 | }, | 65 | }, |
70 | 66 | ||
71 | 'setEntropyElement': function(aValue) { | 67 | 'setEntropyElement': function(aValue) { |
72 | this._entropyElement = aValue; | 68 | this._entropyElement = aValue; |
73 | }, | 69 | }, |
74 | 70 | ||
75 | //----------------------------------------------------- | 71 | //----------------------------------------------------- |
76 | 72 | ||
77 | 'render': function() { | 73 | 'render': function() { |
78 | /* | 74 | /* |
79 | MochiKit.Signal.disconnectAllTo(this); | 75 | MochiKit.Signal.disconnectAllTo(this); |
80 | 76 | ||
81 | this.setWrapperElement(this.element().wrap({tag:'div'})); | 77 | this.setWrapperElement(this.element().wrap({tag:'div'})); |
82 | this.setEntropyElement(Clipperz.DOM.Helper.append(this.wrapperElement().dom, {tag:'div', cls:'passwordEntropy', html:" "}, true)); | 78 | this.setEntropyElement(Clipperz.DOM.Helper.append(this.wrapperElement().dom, {tag:'div', cls:'passwordEntropy', html:" "}, true)); |
83 | // this.setEntropyElement(Clipperz.DOM.Helper.insertBefore(this.element(), {tag:'div', cls:'passwordEntropy', html:" "}, true)); | 79 | // this.setEntropyElement(Clipperz.DOM.Helper.insertBefore(this.element(), {tag:'div', cls:'passwordEntropy', html:" "}, true)); |
84 | this.entropyElement().wrap({tag:'div', cls:'passwordEntropyWrapper'}); | 80 | this.entropyElement().wrap({tag:'div', cls:'passwordEntropyWrapper'}); |
85 | 81 | ||
86 | this.updateEntropyElement(); | 82 | this.updateEntropyElement(); |
87 | 83 | ||
88 | this.connect('onkeyup', 'updateEntropyElement'); | 84 | this.connect('onkeyup', 'updateEntropyElement'); |
89 | this.connect('onchange', 'updateEntropyElement'); | 85 | this.connect('onchange', 'updateEntropyElement'); |
90 | this.connect('onblur', 'updateEntropyElement'); | 86 | this.connect('onblur', 'updateEntropyElement'); |
91 | */ | 87 | */ |
92 | MochiKit.Signal.disconnectAllTo(this); | 88 | MochiKit.Signal.disconnectAllTo(this); |
93 | 89 | ||
94 | this.setEntropyElement(this.element()); | 90 | this.setEntropyElement(this.element()); |
95 | this.entropyElement().addClass("entropyLevelIndicator"); | 91 | this.entropyElement().addClass("entropyLevelIndicator"); |
96 | 92 | ||
97 | this.updateEntropyElement(); | 93 | this.updateEntropyElement(); |
98 | 94 | ||
99 | this.connect('onkeyup', 'updateEntropyElement'); | 95 | this.connect('onkeyup', 'updateEntropyElement'); |
100 | this.connect('onchange', 'updateEntropyElement'); | 96 | this.connect('onchange', 'updateEntropyElement'); |
101 | this.connect('onblur', 'updateEntropyElement'); | 97 | this.connect('onblur', 'updateEntropyElement'); |
102 | }, | 98 | }, |
103 | 99 | ||
104 | //----------------------------------------------------- | 100 | //----------------------------------------------------- |
105 | 101 | ||
106 | 'computeEntropyForString': function(aValue) { | 102 | 'computeEntropyForString': function(aValue) { |
107 | return Clipperz.PM.Crypto.passwordEntropy(aValue); | 103 | return Clipperz.PM.Crypto.passwordEntropy(aValue); |
108 | }, | 104 | }, |
109 | 105 | ||
110 | //----------------------------------------------------- | 106 | //----------------------------------------------------- |
111 | 107 | ||
112 | 'updateEntropyElement': function(anEvent) { | 108 | 'updateEntropyElement': function(anEvent) { |
113 | /* | ||
114 | //MochiKit.Logging.logDebug(">>> PasswordEntropyDisplay.updateEntropyElement"); | ||
115 | varmaxExtent; | ||
116 | varentropy; | ||
117 | |||
118 | entropy = Math.min(128, this.computeEntropyForString(this.passwordElement().dom.value)); | ||
119 | //MochiKit.Logging.logDebug("--- PasswordEntropyDisplay.updateEntropyElement - entropy: " + entropy); | ||
120 | this.entropyElement().setStyle('background-position', "0px " + -entropy + "px"); | ||
121 | this.entropyElement().setWidth(this.passwordElement().getWidth() * (entropy/128)); | ||
122 | //MochiKit.Logging.logDebug("<<< PasswordEntropyDisplay.updateEntropyElement"); | ||
123 | */ | ||
124 | varentropy; | 109 | varentropy; |
125 | 110 | ||
126 | entropy = Math.min(128, this.computeEntropyForString(this.passwordElement().dom.value)); | 111 | entropy = Math.min(128, this.computeEntropyForString(this.passwordElement().dom.value)); |
127 | 112 | ||
128 | if (entropy == 0) { | 113 | if (entropy == 0) { |
129 | this.entropyElement().setStyle('background-position', "0px 26px"); | 114 | this.entropyElement().setStyle('background-position', "0px 26px"); |
130 | } else { | 115 | } else { |
131 | this.entropyElement().setStyle('background-position', "0px -" + (128-entropy)*26 + "px"); | 116 | this.entropyElement().setStyle('background-position', "0px -" + (128-entropy)*26 + "px"); |
132 | } | 117 | } |
133 | }, | 118 | }, |
134 | 119 | ||
135 | //----------------------------------------------------- | 120 | //----------------------------------------------------- |
136 | __syntaxFix__: '__syntaxFix__' | 121 | __syntaxFix__: '__syntaxFix__' |
137 | }); | 122 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/ProgressBar.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/ProgressBar.js index 5991530..6638008 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/ProgressBar.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/ProgressBar.js | |||
@@ -1,70 +1,68 @@ | |||
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 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Common.Components.ProgressBar = function(args) { | 26 | Clipperz.PM.UI.Common.Components.ProgressBar = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
31 | Clipperz.PM.UI.Common.Components.ProgressBar.superclass.constructor.apply(this, arguments); | 29 | Clipperz.PM.UI.Common.Components.ProgressBar.superclass.constructor.apply(this, arguments); |
32 | 30 | ||
33 | this._element = args.element|| Clipperz.Base.exception.raise('MandatoryParameter'); | 31 | this._element = args.element|| Clipperz.Base.exception.raise('MandatoryParameter'); |
34 | 32 | ||
35 | this.renderSelf(); | 33 | this.renderSelf(); |
36 | 34 | ||
37 | MochiKit.Signal.connect(Clipperz.PM.UI.Common.Controllers.ProgressBarController.defaultController, 'updateProgress', this, 'updateProgressHandler') | 35 | MochiKit.Signal.connect(Clipperz.PM.UI.Common.Controllers.ProgressBarController.defaultController, 'updateProgress', this, 'updateProgressHandler') |
38 | 36 | ||
39 | return this; | 37 | return this; |
40 | } | 38 | } |
41 | 39 | ||
42 | //============================================================================= | 40 | //============================================================================= |
43 | 41 | ||
44 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.ProgressBar, Clipperz.PM.UI.Common.Components.BaseComponent, { | 42 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.ProgressBar, Clipperz.PM.UI.Common.Components.BaseComponent, { |
45 | 43 | ||
46 | //------------------------------------------------------------------------- | 44 | //------------------------------------------------------------------------- |
47 | 45 | ||
48 | 'toString': function () { | 46 | 'toString': function () { |
49 | return "Clipperz.PM.UI.Common.Components.ProgressBar component"; | 47 | return "Clipperz.PM.UI.Common.Components.ProgressBar component"; |
50 | }, | 48 | }, |
51 | 49 | ||
52 | //------------------------------------------------------------------------- | 50 | //------------------------------------------------------------------------- |
53 | 51 | ||
54 | 'renderSelf': function() { | 52 | 'renderSelf': function() { |
55 | this.append(this.element(), {tag:'div', cls:'loadingBar', children:[ | 53 | this.append(this.element(), {tag:'div', cls:'loadingBar', children:[ |
56 | {tag:'div', cls:'loadingBarProgressBox', children:[ | 54 | {tag:'div', cls:'loadingBarProgressBox', children:[ |
57 | {tag:'div', id:this.getId('loadingBarProgress'), cls:'loadingBarProgress'} | 55 | {tag:'div', id:this.getId('loadingBarProgress'), cls:'loadingBarProgress'} |
58 | ]} | 56 | ]} |
59 | ]}); | 57 | ]}); |
60 | }, | 58 | }, |
61 | 59 | ||
62 | //------------------------------------------------------------------------- | 60 | //------------------------------------------------------------------------- |
63 | 61 | ||
64 | 'updateProgressHandler': function (anEvent) { | 62 | 'updateProgressHandler': function (anEvent) { |
65 | MochiKit.Style.setElementDimensions(this.getId('loadingBarProgress'), {w:anEvent}, '%'); | 63 | MochiKit.Style.setElementDimensions(this.getId('loadingBarProgress'), {w:anEvent}, '%'); |
66 | }, | 64 | }, |
67 | 65 | ||
68 | //------------------------------------------------------------------------- | 66 | //------------------------------------------------------------------------- |
69 | __syntaxFix__: "syntax fix" | 67 | __syntaxFix__: "syntax fix" |
70 | }); | 68 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/SimpleMessagePanel.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/SimpleMessagePanel.js index 1d816a9..8c98811 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/SimpleMessagePanel.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/SimpleMessagePanel.js | |||
@@ -1,118 +1,116 @@ | |||
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 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Common.Components.SimpleMessagePanel = function(args) { | 26 | Clipperz.PM.UI.Common.Components.SimpleMessagePanel = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
31 | Clipperz.PM.UI.Common.Components.SimpleMessagePanel.superclass.constructor.apply(this, arguments); | 29 | Clipperz.PM.UI.Common.Components.SimpleMessagePanel.superclass.constructor.apply(this, arguments); |
32 | 30 | ||
33 | this._title = args.title || Clipperz.Base.exception.raise('MandatoryParameter'); | 31 | this._title = args.title || Clipperz.Base.exception.raise('MandatoryParameter'); |
34 | this._text = args.text || Clipperz.Base.exception.raise('MandatoryParameter'); | 32 | this._text = args.text || Clipperz.Base.exception.raise('MandatoryParameter'); |
35 | this._type = args.type || Clipperz.Base.exception.raise('MandatoryParameter'); //ALERT, INFO, ERROR | 33 | this._type = args.type || Clipperz.Base.exception.raise('MandatoryParameter'); //ALERT, INFO, ERROR |
36 | this._buttons = args.buttons || Clipperz.Base.exception.raise('MandatoryParameter'); | 34 | this._buttons = args.buttons || Clipperz.Base.exception.raise('MandatoryParameter'); |
37 | 35 | ||
38 | this._buttonComponents = []; | 36 | this._buttonComponents = []; |
39 | this._deferred = null; | 37 | this._deferred = null; |
40 | 38 | ||
41 | this.renderModalMask(); | 39 | this.renderModalMask(); |
42 | 40 | ||
43 | return this; | 41 | return this; |
44 | } | 42 | } |
45 | 43 | ||
46 | //============================================================================= | 44 | //============================================================================= |
47 | 45 | ||
48 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.SimpleMessagePanel, Clipperz.PM.UI.Common.Components.BaseComponent, { | 46 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.SimpleMessagePanel, Clipperz.PM.UI.Common.Components.BaseComponent, { |
49 | 47 | ||
50 | //------------------------------------------------------------------------- | 48 | //------------------------------------------------------------------------- |
51 | 49 | ||
52 | 'toString': function () { | 50 | 'toString': function () { |
53 | return "Clipperz.PM.UI.Common.Components.SimpleMessagePanel component"; | 51 | return "Clipperz.PM.UI.Common.Components.SimpleMessagePanel component"; |
54 | }, | 52 | }, |
55 | 53 | ||
56 | //------------------------------------------------------------------------- | 54 | //------------------------------------------------------------------------- |
57 | 55 | ||
58 | 'deferred': function() { | 56 | 'deferred': function() { |
59 | if (this._deferred == null) { | 57 | if (this._deferred == null) { |
60 | this._deferred = new Clipperz.Async.Deferred("SimpleMessagePanel.deferred", {trace:false}); | 58 | this._deferred = new Clipperz.Async.Deferred("SimpleMessagePanel.deferred", {trace:false}); |
61 | } | 59 | } |
62 | 60 | ||
63 | return this._deferred; | 61 | return this._deferred; |
64 | }, | 62 | }, |
65 | 63 | ||
66 | //------------------------------------------------------------------------- | 64 | //------------------------------------------------------------------------- |
67 | 65 | ||
68 | 'title': function () { | 66 | 'title': function () { |
69 | return this._title; | 67 | return this._title; |
70 | }, | 68 | }, |
71 | 69 | ||
72 | 'setTitle': function (aValue) { | 70 | 'setTitle': function (aValue) { |
73 | this._title = aValue; | 71 | this._title = aValue; |
74 | 72 | ||
75 | if (this.getElement('title') != null) { | 73 | if (this.getElement('title') != null) { |
76 | this.getElement('title').innerHTML = aValue; | 74 | this.getElement('title').innerHTML = aValue; |
77 | } | 75 | } |
78 | }, | 76 | }, |
79 | 77 | ||
80 | //------------------------------------------------------------------------- | 78 | //------------------------------------------------------------------------- |
81 | 79 | ||
82 | 'text': function () { | 80 | 'text': function () { |
83 | return this._text; | 81 | return this._text; |
84 | }, | 82 | }, |
85 | 83 | ||
86 | 'setText': function (aValue) { | 84 | 'setText': function (aValue) { |
87 | this._text = aValue; | 85 | this._text = aValue; |
88 | 86 | ||
89 | if (this.getElement('text') != null) { | 87 | if (this.getElement('text') != null) { |
90 | this.getElement('text').innerHTML = aValue; | 88 | this.getElement('text').innerHTML = aValue; |
91 | } | 89 | } |
92 | }, | 90 | }, |
93 | 91 | ||
94 | //------------------------------------------------------------------------- | 92 | //------------------------------------------------------------------------- |
95 | 93 | ||
96 | 'type': function () { | 94 | 'type': function () { |
97 | return this._type; | 95 | return this._type; |
98 | }, | 96 | }, |
99 | 97 | ||
100 | 'setType': function (aValue) { | 98 | 'setType': function (aValue) { |
101 | // if (this.getElement('icon') != null) { | 99 | // if (this.getElement('icon') != null) { |
102 | // MochiKit.DOM.removeElementClass(this.getId('icon'), this._type); | 100 | // MochiKit.DOM.removeElementClass(this.getId('icon'), this._type); |
103 | // MochiKit.DOM.addElementClass(this.getId('icon'), aValue); | 101 | // MochiKit.DOM.addElementClass(this.getId('icon'), aValue); |
104 | // } | 102 | // } |
105 | 103 | ||
106 | this._type = aValue; | 104 | this._type = aValue; |
107 | }, | 105 | }, |
108 | 106 | ||
109 | 'icon': function () { | 107 | 'icon': function () { |
110 | var type = this.type(); | 108 | var type = this.type(); |
111 | var result; | 109 | var result; |
112 | 110 | ||
113 | if (type == 'ALERT') { | 111 | if (type == 'ALERT') { |
114 | result = '!'; | 112 | result = '!'; |
115 | } else if (type == 'INFO') { | 113 | } else if (type == 'INFO') { |
116 | result = 'i'; | 114 | result = 'i'; |
117 | } else if (type == 'ERROR') { | 115 | } else if (type == 'ERROR') { |
118 | result = '!'; | 116 | result = '!'; |
@@ -125,173 +123,165 @@ Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.SimpleMessagePanel, Clippe | |||
125 | 123 | ||
126 | 'buttons': function () { | 124 | 'buttons': function () { |
127 | return this._buttons; | 125 | return this._buttons; |
128 | }, | 126 | }, |
129 | 127 | ||
130 | 'setButtons': function (someValues) { | 128 | 'setButtons': function (someValues) { |
131 | MochiKit.Iter.forEach(this.buttonComponents(), MochiKit.Base.methodcaller('clear')); | 129 | MochiKit.Iter.forEach(this.buttonComponents(), MochiKit.Base.methodcaller('clear')); |
132 | 130 | ||
133 | this._buttons = someValues; | 131 | this._buttons = someValues; |
134 | 132 | ||
135 | if (this.getElement('buttonArea') != null) { | 133 | if (this.getElement('buttonArea') != null) { |
136 | this.renderButtons(); | 134 | this.renderButtons(); |
137 | } | 135 | } |
138 | }, | 136 | }, |
139 | 137 | ||
140 | //......................................................................... | 138 | //......................................................................... |
141 | 139 | ||
142 | 'buttonComponents': function () { | 140 | 'buttonComponents': function () { |
143 | return this._buttonComponents; | 141 | return this._buttonComponents; |
144 | }, | 142 | }, |
145 | 143 | ||
146 | //------------------------------------------------------------------------- | 144 | //------------------------------------------------------------------------- |
147 | 145 | ||
148 | 'renderSelf': function() { | 146 | 'renderSelf': function() { |
149 | this.append(this.element(), {tag:'div', cls:'SimpleMessagePanel', id:this.getId('panel'), children: [ | 147 | this.append(this.element(), {tag:'div', cls:'SimpleMessagePanel', id:this.getId('panel'), children: [ |
150 | // {tag:'div', cls:'header', children:[]}, | 148 | // {tag:'div', cls:'header', children:[]}, |
151 | {tag:'div', cls:'body', children:[ | 149 | {tag:'div', cls:'body', children:[ |
152 | // {tag:'div', id:this.getId('icon'),cls:'img ' + this.type(), children:[{tag:'div'}]}, | 150 | // {tag:'div', id:this.getId('icon'),cls:'img ' + this.type(), children:[{tag:'div'}]}, |
153 | {tag:'div', /*id:this.getId('icon'),*/cls:'img ' + this.type(), children:[{tag:'canvas', id:this.getId('icon')}]}, | 151 | {tag:'div', /*id:this.getId('icon'),*/cls:'img ' + this.type(), children:[{tag:'canvas', id:this.getId('icon')}]}, |
154 | {tag:'h3', id:this.getId('title'),html:this.title()}, | 152 | {tag:'h3', id:this.getId('title'),html:this.title()}, |
155 | {tag:'p', id:this.getId('text'),html:this.text()}, | 153 | {tag:'p', id:this.getId('text'),html:this.text()}, |
156 | {tag:'div', id:this.getId('container')}, | 154 | {tag:'div', id:this.getId('container')}, |
157 | {tag:'div', id:this.getId('buttonArea'), cls:'buttonArea', children:[]} | 155 | {tag:'div', id:this.getId('buttonArea'), cls:'buttonArea', children:[]} |
158 | ]} | 156 | ]} |
159 | // {tag:'div', cls:'footer', children:[]} | 157 | // {tag:'div', cls:'footer', children:[]} |
160 | ]}); | 158 | ]}); |
161 | 159 | ||
162 | Clipperz.PM.UI.Canvas.marks[this.icon()](this.getElement('icon'), "#ffffff"); | 160 | Clipperz.PM.UI.Canvas.marks[this.icon()](this.getElement('icon'), "#ffffff"); |
163 | 161 | ||
164 | MochiKit.Signal.connect(this.getId('panel'), 'onkeydown', this, 'keyDownHandler'); | 162 | MochiKit.Signal.connect(this.getId('panel'), 'onkeydown', this, 'keyDownHandler'); |
165 | 163 | ||
166 | this.renderButtons(); | 164 | this.renderButtons(); |
167 | }, | 165 | }, |
168 | 166 | ||
169 | //------------------------------------------------------------------------- | 167 | //------------------------------------------------------------------------- |
170 | 168 | ||
171 | 'renderButtons': function () { | 169 | 'renderButtons': function () { |
172 | this.getElement('buttonArea').innerHTML = ''; | 170 | this.getElement('buttonArea').innerHTML = ''; |
173 | 171 | ||
174 | MochiKit.Base.map(MochiKit.Base.bind(function (aButton) { | 172 | MochiKit.Base.map(MochiKit.Base.bind(function (aButton) { |
175 | var buttonElement; | 173 | var buttonElement; |
176 | var buttonComponent; | 174 | var buttonComponent; |
177 | 175 | ||
178 | // element = this.append(this.getElement('buttonArea'), {tag:'div', cls:'button' + (aButton['isDefault'] === true ? ' default' : ''), children:[ | 176 | // element = this.append(this.getElement('buttonArea'), {tag:'div', cls:'button' + (aButton['isDefault'] === true ? ' default' : ''), children:[ |
179 | // {tag:'a', href:'#'/*, id:this.getId('buttonLink')*/, html:aButton['text']} | 177 | // {tag:'a', href:'#'/*, id:this.getId('buttonLink')*/, html:aButton['text']} |
180 | // ]}); | 178 | // ]}); |
181 | 179 | ||
182 | buttonElement = this.append(this.getElement('buttonArea'), {tag:'div'}); | 180 | buttonElement = this.append(this.getElement('buttonArea'), {tag:'div'}); |
183 | buttonComponent = new Clipperz.PM.UI.Common.Components.Button({'element':buttonElement, 'text':aButton['text'], 'isDefault':aButton['isDefault']}); | 181 | buttonComponent = new Clipperz.PM.UI.Common.Components.Button({'element':buttonElement, 'text':aButton['text'], 'isDefault':aButton['isDefault']}); |
184 | this.buttonComponents().push(buttonComponent); | 182 | this.buttonComponents().push(buttonComponent); |
185 | 183 | ||
186 | MochiKit.Signal.connect(buttonComponent, 'onclick', MochiKit.Base.method(this, 'buttonEventHandler', aButton)); | 184 | MochiKit.Signal.connect(buttonComponent, 'onclick', MochiKit.Base.method(this, 'buttonEventHandler', aButton)); |
187 | }, this), MochiKit.Iter.reversed(this.buttons())); | 185 | }, this), MochiKit.Iter.reversed(this.buttons())); |
188 | }, | 186 | }, |
189 | 187 | ||
190 | //------------------------------------------------------------------------- | 188 | //------------------------------------------------------------------------- |
191 | 189 | ||
192 | 'displayElement': function() { | 190 | 'displayElement': function() { |
193 | return this.getElement('panel'); | 191 | return this.getElement('panel'); |
194 | }, | 192 | }, |
195 | 193 | ||
196 | //------------------------------------------------------------------------- | 194 | //------------------------------------------------------------------------- |
197 | 195 | ||
198 | 'closeOk': function () { | 196 | 'closeOk': function () { |
199 | this.deferred().callback(); | 197 | this.deferred().callback(); |
200 | this._deferred = null; | 198 | this._deferred = null; |
201 | }, | 199 | }, |
202 | 200 | ||
203 | 'closeCancel': function () { | 201 | 'closeCancel': function () { |
204 | this.deferred().cancel(); | 202 | this.deferred().cancel(); |
205 | this._deferred = null; | 203 | this._deferred = null; |
206 | }, | 204 | }, |
207 | 205 | ||
208 | 'closeError': function () { | 206 | 'closeError': function () { |
209 | this.deferred().errback(); | 207 | this.deferred().errback(); |
210 | this._deferred = null; | 208 | this._deferred = null; |
211 | }, | 209 | }, |
212 | 210 | ||
213 | //------------------------------------------------------------------------- | 211 | //------------------------------------------------------------------------- |
214 | 212 | ||
215 | 'buttonEventHandler': function(aButton, anEvent) { | 213 | 'buttonEventHandler': function(aButton, anEvent) { |
216 | anEvent.preventDefault(); | 214 | anEvent.preventDefault(); |
217 | 215 | ||
218 | // MochiKit.Signal.signal(this, 'cancelEvent'); | 216 | // MochiKit.Signal.signal(this, 'cancelEvent'); |
219 | switch (aButton['result']) { | 217 | switch (aButton['result']) { |
220 | case 'OK': | 218 | case 'OK': |
221 | //console.log("==> OK"); | ||
222 | this.closeOk(); | 219 | this.closeOk(); |
223 | break; | 220 | break; |
224 | case 'CANCEL': | 221 | case 'CANCEL': |
225 | //console.log("==> CANCEL"); | ||
226 | this.closeCancel(); | 222 | this.closeCancel(); |
227 | break; | 223 | break; |
228 | default: | 224 | default: |
229 | //console.log("==> ????"); | ||
230 | this.closeError(); | 225 | this.closeError(); |
231 | break; | 226 | break; |
232 | } | 227 | } |
233 | //console.log("<=="); | ||
234 | }, | 228 | }, |
235 | 229 | ||
236 | //------------------------------------------------------------------------- | 230 | //------------------------------------------------------------------------- |
237 | 231 | ||
238 | 'deferredShow': function (someArgs, aResult) { | 232 | 'deferredShow': function (someArgs, aResult) { |
239 | this.deferredShowModal(someArgs); | 233 | this.deferredShowModal(someArgs); |
240 | 234 | ||
241 | this.deferred().addMethod(this, 'deferredHideModal', {closeToElement:someArgs.onOkCloseToElement }); | 235 | this.deferred().addMethod(this, 'deferredHideModal', {closeToElement:someArgs.onOkCloseToElement }); |
242 | this.deferred().addErrback (MochiKit.Base.method(this, 'deferredHideModal', {closeToElement:someArgs.onCancelCloseToElement })); | 236 | this.deferred().addErrback (MochiKit.Base.method(this, 'deferredHideModal', {closeToElement:someArgs.onCancelCloseToElement })); |
243 | this.deferred().addCallback(MochiKit.Async.succeed, aResult); | 237 | this.deferred().addCallback(MochiKit.Async.succeed, aResult); |
244 | 238 | ||
245 | return this.deferred(); | 239 | return this.deferred(); |
246 | }, | 240 | }, |
247 | 241 | ||
248 | //------------------------------------------------------------------------- | 242 | //------------------------------------------------------------------------- |
249 | 243 | ||
250 | 'modalDialogMask': function () { | 244 | 'modalDialogMask': function () { |
251 | return this.getId('modalDialogMask'); | 245 | return this.getId('modalDialogMask'); |
252 | }, | 246 | }, |
253 | 247 | ||
254 | 'modalDialog': function () { | 248 | 'modalDialog': function () { |
255 | return this.getId('modalDialog'); | 249 | return this.getId('modalDialog'); |
256 | }, | 250 | }, |
257 | 251 | ||
258 | 'modalDialogFrame': function() { | 252 | 'modalDialogFrame': function() { |
259 | return this.getId('modalDialogFrame'); | 253 | return this.getId('modalDialogFrame'); |
260 | }, | 254 | }, |
261 | 255 | ||
262 | //------------------------------------------------------------------------- | 256 | //------------------------------------------------------------------------- |
263 | 257 | ||
264 | 'renderModalMask': function () { | 258 | 'renderModalMask': function () { |
265 | Clipperz.DOM.Helper.append(MochiKit.DOM.currentDocument().body, | 259 | Clipperz.DOM.Helper.append(MochiKit.DOM.currentDocument().body, |
266 | {tag:'div', id:this.getId('modalDialogWrapper'), cls:'modalDialogWrapper simpleMessagePanelMask', children:[ | 260 | {tag:'div', id:this.getId('modalDialogWrapper'), cls:'modalDialogWrapper simpleMessagePanelMask', children:[ |
267 | {tag:'div', id:this.getId('modalDialogMask'), cls:'modalDialogMask simpleMessagePanelMask'}, | 261 | {tag:'div', id:this.getId('modalDialogMask'), cls:'modalDialogMask simpleMessagePanelMask'}, |
268 | {tag:'div', id:this.getId('modalDialogFrame'), cls:'modalDialogFrame simpleMessagePanelMask'}, | 262 | {tag:'div', id:this.getId('modalDialogFrame'), cls:'modalDialogFrame simpleMessagePanelMask'}, |
269 | {tag:'div', id:this.getId('modalDialog'), cls:'modalDialog simpleMessagePanelMask'} | 263 | {tag:'div', id:this.getId('modalDialog'), cls:'modalDialog simpleMessagePanelMask'} |
270 | ]} | 264 | ]} |
271 | ); | 265 | ); |
272 | 266 | ||
273 | MochiKit.Style.hideElement(this.getId('modalDialogMask')); | 267 | MochiKit.Style.hideElement(this.getId('modalDialogMask')); |
274 | MochiKit.Style.hideElement(this.getId('modalDialogFrame')); | 268 | MochiKit.Style.hideElement(this.getId('modalDialogFrame')); |
275 | }, | 269 | }, |
276 | 270 | ||
277 | //------------------------------------------------------------------------- | 271 | //------------------------------------------------------------------------- |
278 | 272 | ||
279 | 'keyDownHandler': function (anEvent) { | 273 | 'keyDownHandler': function (anEvent) { |
280 | if (anEvent.key().string == 'KEY_ENTER') { | 274 | if (anEvent.key().string == 'KEY_ENTER') { |
281 | anEvent.preventDefault(); | 275 | anEvent.preventDefault(); |
282 | //console.log("13 - RETURN ?", this); | ||
283 | this.closeOk(); | 276 | this.closeOk(); |
284 | //console.log('<<< 13') | ||
285 | } | 277 | } |
286 | 278 | ||
287 | if (anEvent.key().string == 'KEY_ESCAPE') { | 279 | if (anEvent.key().string == 'KEY_ESCAPE') { |
288 | anEvent.preventDefault(); | 280 | anEvent.preventDefault(); |
289 | //console.log("27 - ESC ?", this); | ||
290 | this.closeCancel(); | 281 | this.closeCancel(); |
291 | //console.log("<<< 27"); | ||
292 | } | 282 | } |
293 | }, | 283 | }, |
294 | 284 | ||
295 | //------------------------------------------------------------------------- | 285 | //------------------------------------------------------------------------- |
296 | __syntaxFix__: "syntax fix" | 286 | __syntaxFix__: "syntax fix" |
297 | }); | 287 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/TabPanelComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/TabPanelComponent.js index 936514a..1e2a690 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/TabPanelComponent.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/TabPanelComponent.js | |||
@@ -1,66 +1,64 @@ | |||
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 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Common.Components.TabPanelComponent = function(args) { | 26 | Clipperz.PM.UI.Common.Components.TabPanelComponent = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | Clipperz.PM.UI.Common.Components.TabPanelComponent.superclass.constructor.call(this, args); | 28 | Clipperz.PM.UI.Common.Components.TabPanelComponent.superclass.constructor.call(this, args); |
31 | 29 | ||
32 | this._tabPanelController = null; | 30 | this._tabPanelController = null; |
33 | 31 | ||
34 | return this; | 32 | return this; |
35 | } | 33 | } |
36 | 34 | ||
37 | //============================================================================= | 35 | //============================================================================= |
38 | 36 | ||
39 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.TabPanelComponent, Clipperz.PM.UI.Common.Components.BaseComponent, { | 37 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.TabPanelComponent, Clipperz.PM.UI.Common.Components.BaseComponent, { |
40 | 38 | ||
41 | 'toString': function () { | 39 | 'toString': function () { |
42 | return "Clipperz.PM.UI.Common.Components.TabPanelComponent component"; | 40 | return "Clipperz.PM.UI.Common.Components.TabPanelComponent component"; |
43 | }, | 41 | }, |
44 | 42 | ||
45 | //------------------------------------------------------------------------- | 43 | //------------------------------------------------------------------------- |
46 | 44 | ||
47 | 'tabPanelControllerConfiguration': function() { | 45 | 'tabPanelControllerConfiguration': function() { |
48 | return this._tabPanelControllerConfiguration; | 46 | return this._tabPanelControllerConfiguration; |
49 | }, | 47 | }, |
50 | 48 | ||
51 | 'tabPanelController': function() { | 49 | 'tabPanelController': function() { |
52 | if (this._tabPanelController == null) { | 50 | if (this._tabPanelController == null) { |
53 | this._tabPanelController = new Clipperz.PM.UI.Common.Controllers.TabPanelController({component:this, configuration:this.tabPanelControllerConfiguration()}); | 51 | this._tabPanelController = new Clipperz.PM.UI.Common.Controllers.TabPanelController({component:this, configuration:this.tabPanelControllerConfiguration()}); |
54 | } | 52 | } |
55 | 53 | ||
56 | return this._tabPanelController; | 54 | return this._tabPanelController; |
57 | }, | 55 | }, |
58 | 56 | ||
59 | 'initiallySelectedTab': function() { | 57 | 'initiallySelectedTab': function() { |
60 | return this._initiallySelectedTab; | 58 | return this._initiallySelectedTab; |
61 | }, | 59 | }, |
62 | 60 | ||
63 | //------------------------------------------------------------------------- | 61 | //------------------------------------------------------------------------- |
64 | __syntaxFix__: "syntax fix" | 62 | __syntaxFix__: "syntax fix" |
65 | 63 | ||
66 | }); | 64 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Tooltip.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Tooltip.js index 8df7e0e..6517d2a 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Tooltip.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Tooltip.js | |||
@@ -1,214 +1,205 @@ | |||
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 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Common.Components.Tooltip = function(args) { | 26 | Clipperz.PM.UI.Common.Components.Tooltip = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
31 | Clipperz.PM.UI.Common.Components.Tooltip.superclass.constructor.apply(this, arguments); | 29 | Clipperz.PM.UI.Common.Components.Tooltip.superclass.constructor.apply(this, arguments); |
32 | 30 | ||
33 | this._element = args.element|| Clipperz.Base.exception.raise('MandatoryParameter'); | 31 | this._element = args.element|| Clipperz.Base.exception.raise('MandatoryParameter'); |
34 | this._text = args.text || Clipperz.Base.exception.raise('MandatoryParameter'); | 32 | this._text = args.text || Clipperz.Base.exception.raise('MandatoryParameter'); |
35 | this._position = args.position || 'BELOW'; //'BELOW', 'ABOVE', 'LEFT', 'RIGHT' | 33 | this._position = args.position || 'BELOW'; //'BELOW', 'ABOVE', 'LEFT', 'RIGHT' |
36 | 34 | ||
37 | this._boxDimensions = null; | 35 | this._boxDimensions = null; |
38 | this._enabled = (typeof(args.enabled) == 'undefined' ? true : args.enabled); | 36 | this._enabled = (typeof(args.enabled) == 'undefined' ? true : args.enabled); |
39 | this._isVisible = false; | 37 | this._isVisible = false; |
40 | 38 | ||
41 | this.renderSelf(); | 39 | this.renderSelf(); |
42 | 40 | ||
43 | return this; | 41 | return this; |
44 | } | 42 | } |
45 | 43 | ||
46 | //============================================================================= | 44 | //============================================================================= |
47 | 45 | ||
48 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.Tooltip, Clipperz.PM.UI.Common.Components.BaseComponent, { | 46 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.Tooltip, Clipperz.PM.UI.Common.Components.BaseComponent, { |
49 | 47 | ||
50 | //------------------------------------------------------------------------- | 48 | //------------------------------------------------------------------------- |
51 | 49 | ||
52 | 'toString': function () { | 50 | 'toString': function () { |
53 | return "Clipperz.PM.UI.Common.Components.Tooltip component"; | 51 | return "Clipperz.PM.UI.Common.Components.Tooltip component"; |
54 | }, | 52 | }, |
55 | 53 | ||
56 | //------------------------------------------------------------------------- | 54 | //------------------------------------------------------------------------- |
57 | 55 | ||
58 | 'text': function () { | 56 | 'text': function () { |
59 | return this._text; | 57 | return this._text; |
60 | }, | 58 | }, |
61 | 59 | ||
62 | 'setText': function (aValue) { | 60 | 'setText': function (aValue) { |
63 | this._text = aValue; | 61 | this._text = aValue; |
64 | }, | 62 | }, |
65 | 63 | ||
66 | //------------------------------------------------------------------------- | 64 | //------------------------------------------------------------------------- |
67 | 65 | ||
68 | 'position': function () { | 66 | 'position': function () { |
69 | return this._position; | 67 | return this._position; |
70 | }, | 68 | }, |
71 | 69 | ||
72 | 'setPosition': function (aValue) { | 70 | 'setPosition': function (aValue) { |
73 | this._position = aValue; | 71 | this._position = aValue; |
74 | }, | 72 | }, |
75 | 73 | ||
76 | //------------------------------------------------------------------------- | 74 | //------------------------------------------------------------------------- |
77 | 75 | ||
78 | 'enabled': function () { | 76 | 'enabled': function () { |
79 | return this._enabled; | 77 | return this._enabled; |
80 | }, | 78 | }, |
81 | 79 | ||
82 | 'setIsEnabled': function (aValue) { | 80 | 'setIsEnabled': function (aValue) { |
83 | this._enabled = aValue; | 81 | this._enabled = aValue; |
84 | }, | 82 | }, |
85 | 83 | ||
86 | //------------------------------------------------------------------------- | 84 | //------------------------------------------------------------------------- |
87 | 85 | ||
88 | 'isVisible': function () { | 86 | 'isVisible': function () { |
89 | return this._isVisible; | 87 | return this._isVisible; |
90 | }, | 88 | }, |
91 | 89 | ||
92 | 'setIsVisible': function (aValue) { | 90 | 'setIsVisible': function (aValue) { |
93 | this._isVisible = aValue; | 91 | this._isVisible = aValue; |
94 | }, | 92 | }, |
95 | 93 | ||
96 | //------------------------------------------------------------------------- | 94 | //------------------------------------------------------------------------- |
97 | 95 | ||
98 | 'renderSelf': function() { | 96 | 'renderSelf': function() { |
99 | // this.append(this.element(), {tag:'div', id:this.getId('tooltip'), cls:'tooltip ' + this.position(), children:[ | 97 | // this.append(this.element(), {tag:'div', id:this.getId('tooltip'), cls:'tooltip ' + this.position(), children:[ |
100 | // this.append(MochiKit.DOM.currentDocument().body, {tag:'div', id:this.getId('tooltip'), cls:'tooltip ' + this.position(), children:[ | 98 | // this.append(MochiKit.DOM.currentDocument().body, {tag:'div', id:this.getId('tooltip'), cls:'tooltip ' + this.position(), children:[ |
101 | this.append(MochiKit.DOM.getElement('Clipperz_PM_UI_Common_Components_Tooltip_wrapperNode'), {tag:'div', id:this.getId('tooltip'), cls:'tooltip ' + this.position(), children:[ | 99 | this.append(MochiKit.DOM.getElement('Clipperz_PM_UI_Common_Components_Tooltip_wrapperNode'), {tag:'div', id:this.getId('tooltip'), cls:'tooltip ' + this.position(), children:[ |
102 | {tag:'div', id:this.getId('body'), cls:'tooltip_body', children:[ | 100 | {tag:'div', id:this.getId('body'), cls:'tooltip_body', children:[ |
103 | {tag:'div', cls:'tooltip_text', children:[ | 101 | {tag:'div', cls:'tooltip_text', children:[ |
104 | {tag:'span', html:this.text()} | 102 | {tag:'span', html:this.text()} |
105 | ]}//, | 103 | ]}//, |
106 | // {tag:'div', id:this.getId('footer'), cls:'tooltip_footer'} | 104 | // {tag:'div', id:this.getId('footer'), cls:'tooltip_footer'} |
107 | ]}, | 105 | ]}, |
108 | {tag:'div', id:this.getId('arrow'), cls:'tooltip_arrow'} | 106 | {tag:'div', id:this.getId('arrow'), cls:'tooltip_arrow'} |
109 | ]}); | 107 | ]}); |
110 | 108 | ||
111 | this._boxDimensions = MochiKit.Style.getElementDimensions(this.getId('body')); | 109 | this._boxDimensions = MochiKit.Style.getElementDimensions(this.getId('body')); |
112 | // this._boxDimensions.h += MochiKit.Style.getElementDimensions(this.getId('footer')).h; | 110 | // this._boxDimensions.h += MochiKit.Style.getElementDimensions(this.getId('footer')).h; |
113 | 111 | ||
114 | MochiKit.Style.hideElement(this.displayElement()); | 112 | MochiKit.Style.hideElement(this.displayElement()); |
115 | MochiKit.Signal.connect(this.element(), 'onmouseenter', this, 'show'); | 113 | MochiKit.Signal.connect(this.element(), 'onmouseenter', this, 'show'); |
116 | MochiKit.Signal.connect(this.element(), 'onmouseleave', this, 'hide'); | 114 | MochiKit.Signal.connect(this.element(), 'onmouseleave', this, 'hide'); |
117 | }, | 115 | }, |
118 | 116 | ||
119 | //----------------------------------------------------- | 117 | //----------------------------------------------------- |
120 | 118 | ||
121 | 'displayElement': function() { | 119 | 'displayElement': function() { |
122 | return this.getElement('tooltip'); | 120 | return this.getElement('tooltip'); |
123 | }, | 121 | }, |
124 | 122 | ||
125 | //------------------------------------------------------------------------- | 123 | //------------------------------------------------------------------------- |
126 | 124 | ||
127 | 'boxDimensions': function () { | 125 | 'boxDimensions': function () { |
128 | return this._boxDimensions; | 126 | return this._boxDimensions; |
129 | }, | 127 | }, |
130 | 128 | ||
131 | //------------------------------------------------------------------------- | 129 | //------------------------------------------------------------------------- |
132 | 130 | ||
133 | 'show': function () { | 131 | 'show': function () { |
134 | var elementSizeAndPosition; | 132 | var elementSizeAndPosition; |
135 | var arrowPosition; | 133 | var arrowPosition; |
136 | var bodyPosition; | 134 | var bodyPosition; |
137 | 135 | ||
138 | if (this.isVisible() == false) { | 136 | if (this.isVisible() == false) { |
139 | arrowPosition = {}; | 137 | arrowPosition = {}; |
140 | bodyPosition = {}; | 138 | bodyPosition = {}; |
141 | 139 | ||
142 | this.setIsVisible(true); | 140 | this.setIsVisible(true); |
143 | elementSizeAndPosition = Clipperz.Style.getSizeAndPosition(this.element()); | 141 | elementSizeAndPosition = Clipperz.Style.getSizeAndPosition(this.element()); |
144 | //console.log("ELEMENT SIZE AND POSITION", Clipperz.Base.serializeJSON(elementSizeAndPosition)); | ||
145 | //console.log("BOX DIMENSIONS", Clipperz.Base.serializeJSON(this.boxDimensions())); | ||
146 | switch (this.position()) { | 142 | switch (this.position()) { |
147 | case 'ABOVE': | 143 | case 'ABOVE': |
148 | //console.log("ABOVE"); | ||
149 | // MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:36, h:13}, 'px'); | 144 | // MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:36, h:13}, 'px'); |
150 | bodyPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - this.boxDimensions().w/2); | 145 | bodyPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - this.boxDimensions().w/2); |
151 | bodyPosition.y = elementSizeAndPosition.position.y - this.boxDimensions().h - 13; | 146 | bodyPosition.y = elementSizeAndPosition.position.y - this.boxDimensions().h - 13; |
152 | 147 | ||
153 | // arrowPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - 36/2); | 148 | // arrowPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - 36/2); |
154 | // arrowPosition.y = elementSizeAndPosition.position.y - 13; | 149 | // arrowPosition.y = elementSizeAndPosition.position.y - 13; |
155 | break; | 150 | break; |
156 | case 'BELOW': | 151 | case 'BELOW': |
157 | //console.log("BELOW"); | ||
158 | // MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:36, h:13}, 'px'); | 152 | // MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:36, h:13}, 'px'); |
159 | bodyPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - this.boxDimensions().w/2); | 153 | bodyPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - this.boxDimensions().w/2); |
160 | bodyPosition.y = elementSizeAndPosition.position.y + elementSizeAndPosition.dimensions.h + 13; | 154 | bodyPosition.y = elementSizeAndPosition.position.y + elementSizeAndPosition.dimensions.h + 13; |
161 | 155 | ||
162 | // arrowPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - 36/2); | 156 | // arrowPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - 36/2); |
163 | // arrowPosition.y = elementSizeAndPosition.position.y + elementSizeAndPosition.dimensions.h; | 157 | // arrowPosition.y = elementSizeAndPosition.position.y + elementSizeAndPosition.dimensions.h; |
164 | break; | 158 | break; |
165 | case 'LEFT': | 159 | case 'LEFT': |
166 | //console.log("LEFT"); | ||
167 | // MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:13, h:36}, 'px'); | 160 | // MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:13, h:36}, 'px'); |
168 | bodyPosition.x = elementSizeAndPosition.position.x - this.boxDimensions().w - 13; | 161 | bodyPosition.x = elementSizeAndPosition.position.x - this.boxDimensions().w - 13; |
169 | bodyPosition.y = elementSizeAndPosition.position.y + (elementSizeAndPosition.dimensions.h/2 - this.boxDimensions().h/2); | 162 | bodyPosition.y = elementSizeAndPosition.position.y + (elementSizeAndPosition.dimensions.h/2 - this.boxDimensions().h/2); |
170 | 163 | ||
171 | // arrowPosition.x = elementSizeAndPosition.position.x -13; | 164 | // arrowPosition.x = elementSizeAndPosition.position.x -13; |
172 | // arrowPosition.y = elementSizeAndPosition.position.y + (elementSizeAndPosition.dimensions.h/2 - 36/2); | 165 | // arrowPosition.y = elementSizeAndPosition.position.y + (elementSizeAndPosition.dimensions.h/2 - 36/2); |
173 | break; | 166 | break; |
174 | case 'RIGHT': | 167 | case 'RIGHT': |
175 | //console.log("RIGHT"); | ||
176 | // MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:13, h:36}, 'px'); | 168 | // MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:13, h:36}, 'px'); |
177 | bodyPosition.x = elementSizeAndPosition.position.x + elementSizeAndPosition.dimensions.w + 13; | 169 | bodyPosition.x = elementSizeAndPosition.position.x + elementSizeAndPosition.dimensions.w + 13; |
178 | bodyPosition.y = elementSizeAndPosition.position.y + (elementSizeAndPosition.dimensions.h/2 - this.boxDimensions().h/2); | 170 | bodyPosition.y = elementSizeAndPosition.position.y + (elementSizeAndPosition.dimensions.h/2 - this.boxDimensions().h/2); |
179 | 171 | ||
180 | // arrowPosition.x = elementSizeAndPosition.position.x + elementSizeAndPosition.dimensions.w; | 172 | // arrowPosition.x = elementSizeAndPosition.position.x + elementSizeAndPosition.dimensions.w; |
181 | // arrowPosition.y = elementSizeAndPosition.position.y + (elementSizeAndPosition.dimensions.h/2 - 36/2); | 173 | // arrowPosition.y = elementSizeAndPosition.position.y + (elementSizeAndPosition.dimensions.h/2 - 36/2); |
182 | break; | 174 | break; |
183 | } | 175 | } |
184 | //console.log("X: " + bodyPosition.x + ", Y: " + bodyPosition.y); | ||
185 | 176 | ||
186 | MochiKit.Style.setElementPosition(this.getId('tooltip'), bodyPosition); | 177 | MochiKit.Style.setElementPosition(this.getId('tooltip'), bodyPosition); |
187 | // MochiKit.Style.setElementPosition(this.getId('body'), bodyPosition); | 178 | // MochiKit.Style.setElementPosition(this.getId('body'), bodyPosition); |
188 | // MochiKit.Style.setElementPosition(this.getId('arrow'), arrowPosition); | 179 | // MochiKit.Style.setElementPosition(this.getId('arrow'), arrowPosition); |
189 | MochiKit.Visual.appear(this.displayElement(), {duration:0.4}); | 180 | MochiKit.Visual.appear(this.displayElement(), {duration:0.4}); |
190 | } | 181 | } |
191 | }, | 182 | }, |
192 | 183 | ||
193 | 'hide': function () { | 184 | 'hide': function () { |
194 | if (this.isVisible() == true) { | 185 | if (this.isVisible() == true) { |
195 | MochiKit.Visual.fade(this.displayElement(), {duration:0.4}); | 186 | MochiKit.Visual.fade(this.displayElement(), {duration:0.4}); |
196 | this.setIsVisible(false); | 187 | this.setIsVisible(false); |
197 | } | 188 | } |
198 | }, | 189 | }, |
199 | 190 | ||
200 | //------------------------------------------------------------------------- | 191 | //------------------------------------------------------------------------- |
201 | /* | 192 | /* |
202 | 'shouldRemoveElementWhenClearningUp': function () { | 193 | 'shouldRemoveElementWhenClearningUp': function () { |
203 | return false; | 194 | return false; |
204 | }, | 195 | }, |
205 | */ | 196 | */ |
206 | //------------------------------------------------------------------------- | 197 | //------------------------------------------------------------------------- |
207 | __syntaxFix__: "syntax fix" | 198 | __syntaxFix__: "syntax fix" |
208 | }); | 199 | }); |
209 | 200 | ||
210 | Clipperz.PM.UI.Common.Components.Tooltip.initTooltips = function () { | 201 | Clipperz.PM.UI.Common.Components.Tooltip.initTooltips = function () { |
211 | Clipperz.DOM.Helper.insertBefore(MochiKit.DOM.currentDocument().body.childNodes[0], {tag:'div', id:'Clipperz_PM_UI_Common_Components_Tooltip_wrapperNode'}); | 202 | Clipperz.DOM.Helper.insertBefore(MochiKit.DOM.currentDocument().body.childNodes[0], {tag:'div', id:'Clipperz_PM_UI_Common_Components_Tooltip_wrapperNode'}); |
212 | } | 203 | } |
213 | 204 | ||
214 | MochiKit.DOM.addLoadEvent(Clipperz.PM.UI.Common.Components.Tooltip.initTooltips); | 205 | MochiKit.DOM.addLoadEvent(Clipperz.PM.UI.Common.Components.Tooltip.initTooltips); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/TranslatorWidget.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/TranslatorWidget.js index c41fc7c..ba58edd 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/TranslatorWidget.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/TranslatorWidget.js | |||
@@ -1,118 +1,116 @@ | |||
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 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Common.Components.TranslatorWidget = function(args) { | 26 | Clipperz.PM.UI.Common.Components.TranslatorWidget = function(args) { |
29 | Clipperz.log(">>> TranslatorWidget.new"); | 27 | Clipperz.log(">>> TranslatorWidget.new"); |
30 | args = args || {}; | 28 | args = args || {}; |
31 | 29 | ||
32 | Clipperz.PM.UI.Common.Components.TranslatorWidget.superclass.constructor.apply(this, arguments); | 30 | Clipperz.PM.UI.Common.Components.TranslatorWidget.superclass.constructor.apply(this, arguments); |
33 | 31 | ||
34 | // this._element = args.element|| Clipperz.Base.exception.raise('MandatoryParameter'); | 32 | // this._element = args.element|| Clipperz.Base.exception.raise('MandatoryParameter'); |
35 | // this._stringID = args.stringID || MochiKit.DOM.getNodeAttribute(this.element(), 'stringID')|| Clipperz.Base.exception.raise('MandatoryParameter'); | 33 | // this._stringID = args.stringID || MochiKit.DOM.getNodeAttribute(this.element(), 'stringID')|| Clipperz.Base.exception.raise('MandatoryParameter'); |
36 | 34 | ||
37 | //MochiKit.Signal.connect(this.element(), 'onmouseenter', this, 'show'); | 35 | //MochiKit.Signal.connect(this.element(), 'onmouseenter', this, 'show'); |
38 | //MochiKit.Signal.connect(this.element(), 'onmouseleave', this, 'hide'); | 36 | //MochiKit.Signal.connect(this.element(), 'onmouseleave', this, 'hide'); |
39 | 37 | ||
40 | Clipperz.log("<<< TranslatorWidget.new"); | 38 | Clipperz.log("<<< TranslatorWidget.new"); |
41 | return this; | 39 | return this; |
42 | } | 40 | } |
43 | 41 | ||
44 | //============================================================================= | 42 | //============================================================================= |
45 | 43 | ||
46 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.TranslatorWidget, Clipperz.PM.UI.Common.Components.BaseComponent, { | 44 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.TranslatorWidget, Clipperz.PM.UI.Common.Components.BaseComponent, { |
47 | 45 | ||
48 | //------------------------------------------------------------------------- | 46 | //------------------------------------------------------------------------- |
49 | 47 | ||
50 | 'toString': function () { | 48 | 'toString': function () { |
51 | return "Clipperz.PM.UI.Common.Components.TranslatorWidget component"; | 49 | return "Clipperz.PM.UI.Common.Components.TranslatorWidget component"; |
52 | }, | 50 | }, |
53 | 51 | ||
54 | //------------------------------------------------------------------------- | 52 | //------------------------------------------------------------------------- |
55 | /* | 53 | /* |
56 | 'renderSelf': function() { | 54 | 'renderSelf': function() { |
57 | this.append(this.element(), {tag:'div', id:this.getId('tooltip'), cls:'tooltip ' + this.position(), children:[ | 55 | this.append(this.element(), {tag:'div', id:this.getId('tooltip'), cls:'tooltip ' + this.position(), children:[ |
58 | {tag:'div', id:this.getId('body'), cls:'tooltip_body', children:[ | 56 | {tag:'div', id:this.getId('body'), cls:'tooltip_body', children:[ |
59 | {tag:'div', cls:'tooltip_text', children:[ | 57 | {tag:'div', cls:'tooltip_text', children:[ |
60 | {tag:'span', html:this.text()} | 58 | {tag:'span', html:this.text()} |
61 | ]}, | 59 | ]}, |
62 | {tag:'div', id:this.getId('footer'), cls:'tooltip_footer'} | 60 | {tag:'div', id:this.getId('footer'), cls:'tooltip_footer'} |
63 | ]}, | 61 | ]}, |
64 | {tag:'div', id:this.getId('arrow'), cls:'tooltip_arrow'} | 62 | {tag:'div', id:this.getId('arrow'), cls:'tooltip_arrow'} |
65 | ]}); | 63 | ]}); |
66 | 64 | ||
67 | this._boxDimensions = MochiKit.Style.getElementDimensions(this.getId('body')); | 65 | this._boxDimensions = MochiKit.Style.getElementDimensions(this.getId('body')); |
68 | // this._boxDimensions.h += MochiKit.Style.getElementDimensions(this.getId('footer')).h; | 66 | // this._boxDimensions.h += MochiKit.Style.getElementDimensions(this.getId('footer')).h; |
69 | 67 | ||
70 | MochiKit.Style.hideElement(this.displayElement()); | 68 | MochiKit.Style.hideElement(this.displayElement()); |
71 | MochiKit.Signal.connect(this.element(), 'onmouseenter', this, 'show'); | 69 | MochiKit.Signal.connect(this.element(), 'onmouseenter', this, 'show'); |
72 | MochiKit.Signal.connect(this.element(), 'onmouseleave', this, 'hide'); | 70 | MochiKit.Signal.connect(this.element(), 'onmouseleave', this, 'hide'); |
73 | }, | 71 | }, |
74 | */ | 72 | */ |
75 | //----------------------------------------------------- | 73 | //----------------------------------------------------- |
76 | /* | 74 | /* |
77 | 'displayElement': function() { | 75 | 'displayElement': function() { |
78 | return this.getElement('tooltip'); | 76 | return this.getElement('tooltip'); |
79 | }, | 77 | }, |
80 | */ | 78 | */ |
81 | //------------------------------------------------------------------------- | 79 | //------------------------------------------------------------------------- |
82 | /* | 80 | /* |
83 | 'boxDimensions': function () { | 81 | 'boxDimensions': function () { |
84 | return this._boxDimensions; | 82 | return this._boxDimensions; |
85 | }, | 83 | }, |
86 | */ | 84 | */ |
87 | //------------------------------------------------------------------------- | 85 | //------------------------------------------------------------------------- |
88 | 86 | ||
89 | 'show': function (anElement, aStringID) { | 87 | 'show': function (anElement, aStringID) { |
90 | Clipperz.log(">>> Clipperz.PM.UI.Common.Components.TranslatorWidget.show: " + aStringID); | 88 | Clipperz.log(">>> Clipperz.PM.UI.Common.Components.TranslatorWidget.show: " + aStringID); |
91 | /* | 89 | /* |
92 | var elementSizeAndPosition; | 90 | var elementSizeAndPosition; |
93 | var arrowPosition; | 91 | var arrowPosition; |
94 | var bodyPosition; | 92 | var bodyPosition; |
95 | 93 | ||
96 | arrowPosition = {}; | 94 | arrowPosition = {}; |
97 | bodyPosition = {}; | 95 | bodyPosition = {}; |
98 | 96 | ||
99 | elementSizeAndPosition = Clipperz.Style.getSizeAndPosition(this.element()); | 97 | elementSizeAndPosition = Clipperz.Style.getSizeAndPosition(this.element()); |
100 | switch (this.position()) { | 98 | switch (this.position()) { |
101 | case 'ABOVE': | 99 | case 'ABOVE': |
102 | MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:36, h:13}, 'px'); | 100 | MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:36, h:13}, 'px'); |
103 | bodyPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - this.boxDimensions().w/2); | 101 | bodyPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - this.boxDimensions().w/2); |
104 | bodyPosition.y = elementSizeAndPosition.position.y - this.boxDimensions().h - 13; | 102 | bodyPosition.y = elementSizeAndPosition.position.y - this.boxDimensions().h - 13; |
105 | 103 | ||
106 | arrowPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - 36/2); | 104 | arrowPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - 36/2); |
107 | arrowPosition.y = elementSizeAndPosition.position.y - 13; | 105 | arrowPosition.y = elementSizeAndPosition.position.y - 13; |
108 | break; | 106 | break; |
109 | case 'BELOW': | 107 | case 'BELOW': |
110 | MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:36, h:13}, 'px'); | 108 | MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:36, h:13}, 'px'); |
111 | bodyPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - this.boxDimensions().w/2); | 109 | bodyPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - this.boxDimensions().w/2); |
112 | bodyPosition.y = elementSizeAndPosition.position.y + elementSizeAndPosition.dimensions.h + 13; | 110 | bodyPosition.y = elementSizeAndPosition.position.y + elementSizeAndPosition.dimensions.h + 13; |
113 | 111 | ||
114 | arrowPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - 36/2); | 112 | arrowPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - 36/2); |
115 | arrowPosition.y = elementSizeAndPosition.position.y + elementSizeAndPosition.dimensions.h; | 113 | arrowPosition.y = elementSizeAndPosition.position.y + elementSizeAndPosition.dimensions.h; |
116 | break; | 114 | break; |
117 | case 'LEFT': | 115 | case 'LEFT': |
118 | MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:13, h:36}, 'px'); | 116 | MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:13, h:36}, 'px'); |