author | Giulio Cesare Solaroli <giulio.cesare@clipperz.com> | 2011-10-02 23:56:18 (UTC) |
---|---|---|
committer | Giulio Cesare Solaroli <giulio.cesare@clipperz.com> | 2011-10-02 23:56:18 (UTC) |
commit | ef68436ac04da078ffdcacd7e1f785473a303d45 (patch) (unidiff) | |
tree | c403752d66a2c4775f00affd4fa8431b29c5b68c /frontend/gamma/js/Clipperz/PM/UI/Common | |
parent | 597ecfbc0249d83e1b856cbd558340c01237a360 (diff) | |
download | clipperz-ef68436ac04da078ffdcacd7e1f785473a303d45.zip clipperz-ef68436ac04da078ffdcacd7e1f785473a303d45.tar.gz clipperz-ef68436ac04da078ffdcacd7e1f785473a303d45.tar.bz2 |
First version of the newly restructured repository
Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/UI/Common') (more/less context) (ignore whitespace changes)
15 files changed, 2617 insertions, 0 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 new file mode 100644 index 0000000..26f2fc4 --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/BaseComponent.js | |||
@@ -0,0 +1,611 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
7 | and efficient set of cryptographic functions. The library aims to | ||
8 | obtain maximum execution speed while preserving modularity and | ||
9 | reusability. | ||
10 | For further information about its features and functionalities please | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | it and/or modify it under the terms of the GNU Affero General Public | ||
15 | License as published by the Free Software Foundation, either version | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); | ||
30 | |||
31 | //############################################################################# | ||
32 | |||
33 | var _Clipperz_PM_Components_base_id_ = 0; | ||
34 | |||
35 | //############################################################################# | ||
36 | |||
37 | Clipperz.PM.UI.Common.Components.BaseComponent = function(args) { | ||
38 | args = args || {}; | ||
39 | Clipperz.PM.UI.Common.Components.BaseComponent.superclass.constructor.call(this, args); | ||
40 | |||
41 | this._element = args.element || null; | ||
42 | this._ids = {}; | ||
43 | |||
44 | this._slots = {}; | ||
45 | this._slotComponents = {}; | ||
46 | |||
47 | this._components = {}; | ||
48 | |||
49 | this._cachedSlots = {}; | ||
50 | |||
51 | this._isModal = false; | ||
52 | |||
53 | this._isActive = false; | ||
54 | this._elementUsedToEnterModalState; | ||
55 | |||
56 | this._isFullyRendered = false; | ||
57 | this._renderingWaitingQueue = []; | ||
58 | |||
59 | //this._slots = { | ||
60 | // 'header':'header', | ||
61 | // 'body': 'body', | ||
62 | // 'footer':'footer' | ||
63 | //}; | ||
64 | |||
65 | return this; | ||
66 | } | ||
67 | |||
68 | //============================================================================= | ||
69 | |||
70 | //TODO get back to MochiKit.Base.update as we are not extending anything | ||
71 | //MochiKit.Base.update(Clipperz.PM.UI.Common.Components.BaseComponent.prototype, { | ||
72 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.BaseComponent, /*Ext.Component*/ Object, { | ||
73 | |||
74 | 'isClipperzPMComponent': true, | ||
75 | |||
76 | //------------------------------------------------------------------------- | ||
77 | |||
78 | 'toString': function () { | ||
79 | return "Clipperz.PM.UI.Common.Components.BaseComponent component"; | ||
80 | }, | ||
81 | |||
82 | 'componentId': function () { | ||
83 | return this.getId('_id_'); | ||
84 | }, | ||
85 | |||
86 | //------------------------------------------------------------------------- | ||
87 | /* | ||
88 | 'slots': function() { | ||
89 | return this._slots; | ||
90 | }, | ||
91 | */ | ||
92 | 'slotComponents': function() { | ||
93 | return this._slotComponents; | ||
94 | }, | ||
95 | |||
96 | //------------------------------------------------------------------------- | ||
97 | |||
98 | 'components': function () { | ||
99 | return this._components; | ||
100 | }, | ||
101 | |||
102 | 'addComponent': function (aComponent) { | ||
103 | this.components()[aComponent.componentId()] = aComponent; | ||
104 | }, | ||
105 | |||
106 | 'removeComponent': function (aComponent) { | ||
107 | var componentId; | ||
108 | |||
109 | componentId = aComponent.componentId(); | ||
110 | this.components()[componentId].remove(); | ||
111 | delete this.components()[componentId]; | ||
112 | }, | ||
113 | |||
114 | //------------------------------------------------------------------------- | ||
115 | /* | ||
116 | 'domHelper': function() { | ||
117 | return Clipperz.YUI.DomHelper; | ||
118 | }, | ||
119 | */ | ||
120 | //------------------------------------------------------------------------- | ||
121 | /* | ||
122 | 'domHelperAppend': function(aValue) { | ||
123 | Clipperz.YUI.DomHelper.append(this.element().dom, aValue); | ||
124 | }, | ||
125 | */ | ||
126 | //------------------------------------------------------------------------- | ||
127 | |||
128 | 'element': function() { | ||
129 | //MochiKit.Logging.logDebug(">>> BaseComponent.element"); | ||
130 | return MochiKit.DOM.getElement(this._element); | ||
131 | }, | ||
132 | |||
133 | 'setElement': function(aNode) { | ||
134 | this._element = aNode; | ||
135 | }, | ||
136 | |||
137 | //----------------------------------------------------- | ||
138 | |||
139 | 'displayElement': function() { | ||
140 | return this.element(); | ||
141 | }, | ||
142 | |||
143 | //------------------------------------------------------------------------- | ||
144 | |||
145 | 'renderInNode': function(aDomNode) { | ||
146 | this.setElement(aDomNode); | ||
147 | this.render(); | ||
148 | }, | ||
149 | |||
150 | 'render': function() { | ||
151 | this.clear(); | ||
152 | this.renderSelf(); | ||
153 | this.renderComponents(); | ||
154 | if (this.shouldShowTranslationHints()) { | ||
155 | this.renderTranslationHints(); | ||
156 | } | ||
157 | if (this.shouldShowElementWhileRendering()) { | ||
158 | MochiKit.Style.showElement(this.displayElement()); | ||
159 | }; | ||
160 | |||
161 | this._isFullyRendered = true; | ||
162 | |||
163 | MochiKit.Iter.forEach(this.renderingWaitingQueue(), MochiKit.Base.methodcaller('callback')); | ||
164 | this.resetRenderingWaitingQueue(); | ||
165 | }, | ||
166 | |||
167 | 'renderSelf': function() { | ||
168 | throw Clipperz.Base.exception.AbstractMethod; | ||
169 | }, | ||
170 | |||
171 | 'renderComponents': function() { | ||
172 | varslotName; | ||
173 | |||
174 | for (slotName in this.slotComponents()) { | ||
175 | this.slotComponents()[slotName].renderInNode(this.elementForSlotNamed(slotName)); | ||
176 | } | ||
177 | }, | ||
178 | |||
179 | //......................................................................... | ||
180 | |||
181 | 'isFullyRendered': function () { | ||
182 | return this._isFullyRendered; | ||
183 | }, | ||
184 | |||
185 | //......................................................................... | ||
186 | |||
187 | 'renderingWaitingQueue': function () { | ||
188 | return this._renderingWaitingQueue; | ||
189 | }, | ||
190 | |||
191 | 'resetRenderingWaitingQueue': function () { | ||
192 | this._renderingWaitingQueue = []; | ||
193 | }, | ||
194 | |||
195 | //......................................................................... | ||
196 | |||
197 | 'waitUntilFullyRendered': function () { | ||
198 | var deferredResult; | ||
199 | |||
200 | if (this.isFullyRendered() == true) { | ||
201 | deferredResult = MochiKit.Async.succeed | ||
202 | } else { | ||
203 | deferredResult = new Clipperz.Async.Deferred("BaseComponent.waitUntilFullyRendered", {trace:false}); | ||
204 | this.renderingWaitingQueue().push(deferredResult); | ||
205 | } | ||
206 | |||
207 | return deferredResult; | ||
208 | }, | ||
209 | |||
210 | //----------------------------------------------------- | ||
211 | |||
212 | 'renderTranslationHints': function () { | ||
213 | vartranslatableItems; | ||
214 | |||
215 | translatableItems = MochiKit.Selector.findChildElements(this.displayElement(), ['[stringID]']); | ||
216 | MochiKit.Iter.forEach(translatableItems, MochiKit.Base.method(this, 'enhanceTranslatableElement')) | ||
217 | }, | ||
218 | |||
219 | 'enhanceTranslatableElement': function (anElement) { | ||
220 | //Clipperz.log(">>> enhanceTranslatableElement", anElement); | ||
221 | // new Clipperz.PM.UI.Common.Components.TranslatorWidget({ | ||
222 | // 'element':anElement | ||
223 | // }); | ||
224 | |||
225 | MochiKit.Signal.connect(anElement, 'onmouseenter', MochiKit.Base.partial(Clipperz.PM.UI.Common.Components.TranslatorWidget.show, anElement, MochiKit.DOM.getNodeAttribute(anElement, 'stringID'))); | ||
226 | MochiKit.Signal.connect(anElement, 'onmouseleave', Clipperz.PM.UI.Common.Components.TranslatorWidget.hide); | ||
227 | //Clipperz.log("<<< enhanceTranslatableElement"); | ||
228 | }, | ||
229 | |||
230 | //----------------------------------------------------- | ||
231 | |||
232 | 'update': function(args) { | ||
233 | throw Clipperz.Base.exception.AbstractMethod; | ||
234 | }, | ||
235 | |||
236 | 'updateSelf': function(args) { | ||
237 | throw Clipperz.Base.exception.AbstractMethod; | ||
238 | }, | ||
239 | |||
240 | 'updateComponents': function(args) { | ||
241 | throw Clipperz.Base.exception.AbstractMethod; | ||
242 | }, | ||
243 | |||
244 | //----------------------------------------------------- | ||
245 | |||
246 | 'refresh': function() { | ||
247 | throw Clipperz.Base.exception.AbstractMethod; | ||
248 | }, | ||
249 | |||
250 | 'refreshSelf': function() { | ||
251 | throw Clipperz.Base.exception.AbstractMethod; | ||
252 | }, | ||
253 | |||
254 | 'refreshComponents': function(args) { | ||
255 | throw Clipperz.Base.exception.AbstractMethod; | ||
256 | }, | ||
257 | |||
258 | //----------------------------------------------------- | ||
259 | |||
260 | 'checkSlotNamed': function(aSlotName) { | ||
261 | if (typeof(this._slots[aSlotName]) == 'undefined') { | ||
262 | throw new Error("undefined slot"); | ||
263 | }; | ||
264 | }, | ||
265 | |||
266 | //----------------------------------------------------- | ||
267 | |||
268 | 'cachedSlots': function() { | ||
269 | return this._cachedSlots; | ||
270 | }, | ||
271 | |||
272 | 'slotNamed': function(aSlotName) { | ||
273 | var result; | ||
274 | |||
275 | this.checkSlotNamed(aSlotName); | ||
276 | if (typeof(this.cachedSlots()[aSlotName]) == 'undefined') { | ||
277 | this.cachedSlots()[aSlotName] = new Clipperz.PM.UI.Common.Components.ComponentSlot(this,aSlotName); | ||
278 | } | ||
279 | |||
280 | result = this.cachedSlots()[aSlotName]; | ||
281 | |||
282 | return result; | ||
283 | }, | ||
284 | |||
285 | //----------------------------------------------------- | ||
286 | |||
287 | 'elementForSlotNamed': function(aSlotName) { | ||
288 | return MochiKit.DOM.getElement(this._slots[aSlotName]); | ||
289 | }, | ||
290 | |||
291 | //----------------------------------------------------- | ||
292 | |||
293 | 'componentForSlotNamed': function(aSlotName) { | ||
294 | return this.slotComponents()[aSlotName]; | ||
295 | }, | ||
296 | |||
297 | 'setComponentForSlotNamed': function(aComponent, aSlotName) { | ||
298 | var domNode; | ||
299 | |||
300 | this.checkSlotNamed(aSlotName); | ||
301 | |||
302 | if (this.slotComponents()[aSlotName] != null) { | ||
303 | this.slotComponents()[aSlotName].remove(); | ||
304 | } | ||
305 | |||
306 | this.slotComponents()[aSlotName] = aComponent; | ||
307 | |||
308 | // domNode = MochiKit.DOM.getElement(this.slotNamed(aSlotName)); | ||
309 | domNode = this.elementForSlotNamed(aSlotName); | ||
310 | |||
311 | if (domNode != null) { | ||
312 | aComponent.renderInNode(domNode); | ||
313 | } | ||
314 | }, | ||
315 | |||
316 | //----------------------------------------------------- | ||
317 | /* | ||
318 | 'purgeListeners': function() { | ||
319 | //MochiKit.Logging.logDebug(">>> Clipperz.PM.UI.Common.Components.BaseComponent.purgeListeners [" + this + "]"); | ||
320 | //MochiKit.Logging.logDebug("--- " + this + ".purgeListeners"); | ||
321 | Clipperz.NotificationCenter.unregister(this); | ||
322 | MochiKit.Signal.disconnectAllTo(this); | ||
323 | //MochiKit.Logging.logDebug("<<< Clipperz.PM.UI.Common.Components.BaseComponent.purgeListeners"); | ||
324 | }, | ||
325 | */ | ||
326 | //----------------------------------------------------- | ||
327 | |||
328 | 'clear': function() { | ||
329 | varslotName; | ||
330 | var componentId; | ||
331 | |||
332 | MochiKit.Signal.disconnectAllTo(this); | ||
333 | |||
334 | for (slotName in this.slotComponents()) { | ||
335 | this.slotComponents()[slotName].clear(); | ||
336 | } | ||
337 | |||
338 | for (componentId in this.components()) { | ||
339 | this.components()[componentId].clear(); | ||
340 | } | ||
341 | |||
342 | // if (this.element() != null) { | ||
343 | // this.element().innerHTML = ""; | ||
344 | // } | ||
345 | |||
346 | if (this.displayElement() != null) { | ||
347 | if (this.element() != this.displayElement()) { | ||
348 | MochiKit.DOM.removeElement(this.displayElement()); | ||
349 | } else { | ||
350 | this.displayElement().innerHTML = ""; | ||
351 | } | ||
352 | } | ||
353 | |||
354 | if (this.isModal()) { | ||
355 | //TODO: cleanup when the closed element was shown modally. | ||
356 | } | ||
357 | }, | ||
358 | |||
359 | |||
360 | 'remove': function() { | ||
361 | varslotName; | ||
362 | var componentId; | ||
363 | |||
364 | for (slotName in this.slotComponents()) { | ||
365 | this.slotComponents()[slotName].remove(); | ||
366 | delete this.slotComponents()[slotName]; | ||
367 | } | ||
368 | |||
369 | for (componentId in this.components()) { | ||
370 | this.components()[componentId].remove(); | ||
371 | delete this.components()[componentId]; | ||
372 | } | ||
373 | |||
374 | this.clear(); | ||
375 | MochiKit.Signal.disconnectAll(this); | ||
376 | }, | ||
377 | |||
378 | 'append': function(aNode, aValue) { | ||
379 | return Clipperz.DOM.Helper.append(aNode, aValue); | ||
380 | }, | ||
381 | |||
382 | 'insertBefore': function (aNode, aValue) { | ||
383 | return Clipperz.DOM.Helper.insertBefore(aNode, aValue); | ||
384 | }, | ||
385 | |||
386 | 'insertAfter': function (aNode, aValue) { | ||
387 | return Clipperz.DOM.Helper.insertAfter(aNode, aValue); | ||
388 | }, | ||
389 | |||
390 | //------------------------------------------------------------------------- | ||
391 | |||
392 | 'getId': function(aValue) { | ||
393 | varresult; | ||
394 | |||
395 | if (typeof(aValue) != 'undefined') { | ||
396 | result = this._ids[aValue]; | ||
397 | |||
398 | if (typeof(result) == 'undefined') { | ||
399 | _Clipperz_PM_Components_base_id_ ++; | ||
400 | |||
401 | result = "Clipperz_PM_Components_" + aValue + "_" + _Clipperz_PM_Components_base_id_; | ||
402 | this._ids[aValue] = result; | ||
403 | } | ||
404 | } else { | ||
405 | // result = Clipperz.PM.UI.Common.Components.BaseComponent.superclass.getId.call(this); | ||
406 | throw "call to BaseComponent.getId with an undefined value"; | ||
407 | } | ||
408 | |||
409 | return result; | ||
410 | }, | ||
411 | |||
412 | //------------------------------------------------------------------------- | ||
413 | |||
414 | 'getElement': function(aValue) { | ||
415 | return Clipperz.DOM.get(this.getId(aValue)); | ||
416 | }, | ||
417 | |||
418 | //------------------------------------------------------------------------- | ||
419 | |||
420 | 'hideElement': function(anElementName) { | ||
421 | MochiKit.Style.hideElement(this.getElement(anElementName)); | ||
422 | }, | ||
423 | |||
424 | 'showElement': function(anElementName) { | ||
425 | MochiKit.Style.showElement(this.getElement(anElementName)); | ||
426 | }, | ||
427 | |||
428 | //------------------------------------------------------------------------- | ||
429 | |||
430 | 'activate': function () { | ||
431 | this._isActive = true; | ||
432 | }, | ||
433 | |||
434 | 'deactivate': function () { | ||
435 | this._isActive = false; | ||
436 | }, | ||
437 | |||
438 | 'isActive': function () { | ||
439 | return this._isActive; | ||
440 | }, | ||
441 | |||
442 | //------------------------------------------------------------------------- | ||
443 | |||
444 | 'hideSlot': function(aSlotName) { | ||
445 | if (this.componentForSlotNamed(aSlotName)) { | ||
446 | this.componentForSlotNamed(aSlotName).deactivate(); | ||
447 | } | ||
448 | MochiKit.Style.hideElement(this.elementForSlotNamed(aSlotName)); | ||
449 | }, | ||
450 | |||
451 | 'showSlot': function(aSlotName) { | ||
452 | if (this.componentForSlotNamed(aSlotName)) { | ||
453 | this.componentForSlotNamed(aSlotName).activate(); | ||
454 | } | ||
455 | MochiKit.Style.showElement(this.elementForSlotNamed(aSlotName)); | ||
456 | }, | ||
457 | |||
458 | //------------------------------------------------------------------------- | ||
459 | |||
460 | 'shouldShowTranslationHints': function () { | ||
461 | return false; | ||
462 | }, | ||
463 | |||
464 | 'shouldShowElementWhileRendering': function() { | ||
465 | return true; | ||
466 | }, | ||
467 | |||
468 | //'shouldRemoveElementWhenClearningUp': function () { | ||
469 | // return true; | ||
470 | //}, | ||
471 | |||
472 | //------------------------------------------------------------------------- | ||
473 | |||
474 | 'isModal': function() { | ||
475 | return this._isModal; | ||
476 | }, | ||
477 | |||
478 | 'setIsModal': function(aValue) { | ||
479 | this._isModal = aValue; | ||
480 | }, | ||
481 | |||
482 | //------------------------------------------------------------------------- | ||
483 | |||
484 | 'elementUsedToEnterModalState': function () { | ||
485 | return this._elementUsedToEnterModalState; | ||
486 | }, | ||
487 | |||
488 | 'setElementUsedToEnterModalState': function (aValue) { | ||
489 | this._elementUsedToEnterModalState = aValue; | ||
490 | }, | ||
491 | |||
492 | //------------------------------------------------------------------------- | ||
493 | |||
494 | 'modalDialogMask': function () { | ||
495 | return 'modalDialogMask'; | ||
496 | }, | ||
497 | |||
498 | 'modalDialog': function () { | ||
499 | return 'modalDialog'; | ||
500 | }, | ||
501 | |||
502 | 'modalDialogFrame': function() { | ||
503 | return 'modalDialogFrame' | ||
504 | }, | ||
505 | |||
506 | //------------------------------------------------------------------------- | ||
507 | |||
508 | 'deferredShowModal': function(args) { | ||
509 | var deferredResult; | ||
510 | |||
511 | deferredResult = new Clipperz.Async.Deferred("BaseComponent.deferredShowModal", {trace:false}); | ||
512 | |||
513 | deferredResult.addMethod(this, 'setIsModal', true); | ||
514 | deferredResult.addCallback(MochiKit.Style.showElement, this.modalDialogMask()); | ||
515 | deferredResult.addCallback(MochiKit.Base.bind(function(someArgs) { | ||
516 | var result; | ||
517 | var duration; | ||
518 | var from; | ||
519 | var to; | ||
520 | |||
521 | duration = someArgs.duration || 0.4; | ||
522 | |||
523 | this.setElementUsedToEnterModalState(someArgs.openFromElement); | ||
524 | from = Clipperz.Style.getSizeAndPosition(someArgs.openFromElement); | ||
525 | this.renderInNode(this.modalDialog()); | ||
526 | MochiKit.DOM.addElementClass(this.modalDialog(), 'fixed'); | ||
527 | to = Clipperz.Style.getSizeAndPosition(this.displayElement()); | ||
528 | Clipperz.PM.UI.Common.Components.BaseComponent.targetModalDimensionsAndPosition = Clipperz.Base.deepClone(to); | ||
529 | |||
530 | MochiKit.Style.hideElement(this.displayElement()); | ||
531 | MochiKit.Style.showElement(this.modalDialogFrame()); | ||
532 | |||
533 | result = {from:from, to:to, duration:duration}; | ||
534 | return result; | ||
535 | }, this, args)); | ||
536 | deferredResult.addCallback(Clipperz.Visual.deferredResize, this.modalDialogFrame()); | ||
537 | deferredResult.addCallback(MochiKit.Base.bind(function(someArgs) { | ||
538 | MochiKit.Style.hideElement(this.modalDialogFrame()); | ||
539 | MochiKit.Style.showElement(this.displayElement()); | ||
540 | }, this)); | ||
541 | deferredResult.addCallback(MochiKit.Async.succeed, arguments[arguments.length - 1]); | ||
542 | deferredResult.callback(); | ||
543 | |||
544 | return deferredResult; | ||
545 | }, | ||
546 | |||
547 | //------------------------------------------------------------------------- | ||
548 | |||
549 | 'deferredHideModal': function(args) { | ||
550 | var deferredResult; | ||
551 | |||
552 | args = args || {}; | ||
553 | |||
554 | deferredResult = new Clipperz.Async.Deferred("BaseComponent.deferredHideModal", {trace:false}); | ||
555 | deferredResult.addCallback(MochiKit.Base.bind(function(someArgs) { | ||
556 | var result; | ||
557 | var from; | ||
558 | var toElement; | ||
559 | var to; | ||
560 | var duration; | ||
561 | |||
562 | toElement = args.closeToElement || this.elementUsedToEnterModalState(); | ||
563 | duration = someArgs.duration || 0.4; | ||
564 | from = Clipperz.Style.getSizeAndPosition(this.displayElement()); | ||
565 | to = Clipperz.Style.getSizeAndPosition(toElement); | ||
566 | |||
567 | MochiKit.Style.hideElement(this.displayElement()); | ||
568 | MochiKit.Style.showElement(this.modalDialogFrame()); | ||
569 | |||
570 | result = {from:from, to:to, duration:duration}; | ||
571 | return result; | ||
572 | }, this, args)); | ||
573 | deferredResult.addCallback(Clipperz.Visual.deferredResize, this.modalDialogFrame()); | ||
574 | deferredResult.addCallback(MochiKit.Base.bind(function() { | ||
575 | MochiKit.Style.hideElement(this.modalDialogFrame()); | ||
576 | MochiKit.Style.hideElement(this.modalDialogMask()); | ||
577 | }, this)); | ||
578 | deferredResult.addMethod(this, 'setIsModal', false); | ||
579 | deferredResult.addMethod(this, 'clear'); //############## | ||
580 | deferredResult.addCallback(MochiKit.Async.succeed, arguments[arguments.length - 1]); | ||
581 | deferredResult.callback(); | ||
582 | |||
583 | return deferredResult; | ||
584 | }, | ||
585 | |||
586 | //------------------------------------------------------------------------- | ||
587 | |||
588 | __syntaxFix__: "syntax fix" | ||
589 | |||
590 | }); | ||
591 | |||
592 | Clipperz.PM.UI.Common.Components.BaseComponent_modalDialog = function() { | ||
593 | Clipperz.DOM.Helper.append(MochiKit.DOM.currentDocument().body, | ||
594 | {tag:'div', id:'modalDialogWrapper', cls:'modalDialogWrapper', children:[ | ||
595 | {tag:'div', id:'modalDialogMask', cls:'modalDialogMask'}, | ||
596 | {tag:'div', id:'modalDialogFrame', cls:'modalDialogFrame' /*, html:"modal dialog frame"*/}, | ||
597 | {tag:'div', id:'modalDialog', cls:'modalDialog'} | ||
598 | // {tag:'div', id:'modalDialog', cls:'modalDialog', children:[{tag:'div'}]} | ||
599 | ]} | ||
600 | ); | ||
601 | |||
602 | //MochiKit.Style.hideElement('modalDialogWrapper'); | ||
603 | MochiKit.Style.hideElement('modalDialogMask'); | ||
604 | MochiKit.Style.hideElement('modalDialogFrame'); | ||
605 | //MochiKit.Style.hideElement('modalDialog'); | ||
606 | |||
607 | }; | ||
608 | |||
609 | //Clipperz.PM.UI.Common.Components.BaseComponent.targetModalDimensionsAndPosition = {'x':'X', 'y':'Y'}; | ||
610 | |||
611 | MochiKit.DOM.addLoadEvent(Clipperz.PM.UI.Common.Components.BaseComponent_modalDialog); | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Button.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Button.js new file mode 100644 index 0000000..b2761ea --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Button.js | |||
@@ -0,0 +1,108 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
7 | and efficient set of cryptographic functions. The library aims to | ||
8 | obtain maximum execution speed while preserving modularity and | ||
9 | reusability. | ||
10 | For further information about its features and functionalities please | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | it and/or modify it under the terms of the GNU Affero General Public | ||
15 | License as published by the Free Software Foundation, either version | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); | ||
30 | |||
31 | Clipperz.PM.UI.Common.Components.Button = function(args) { | ||
32 | args = args || {}; | ||
33 | |||
34 | Clipperz.PM.UI.Common.Components.Button.superclass.constructor.apply(this, arguments); | ||
35 | |||
36 | this._element = args.element || Clipperz.Base.exception.raise('MandatoryParameter'); | ||
37 | this._text = args.text || Clipperz.Base.exception.raise('MandatoryParameter'); | ||
38 | this._isDefault = args.isDefault|| false; | ||
39 | |||
40 | this.render(); | ||
41 | |||
42 | return this; | ||
43 | } | ||
44 | |||
45 | //============================================================================= | ||
46 | |||
47 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.Button, Clipperz.PM.UI.Common.Components.BaseComponent, { | ||
48 | |||
49 | //------------------------------------------------------------------------- | ||
50 | |||
51 | 'toString': function () { | ||
52 | return "Clipperz.PM.UI.Common.Components.Button component"; | ||
53 | }, | ||
54 | |||
55 | //------------------------------------------------------------------------- | ||
56 | |||
57 | 'text': function () { | ||
58 | return this._text; | ||
59 | }, | ||
60 | |||
61 | 'isDefault': function () { | ||
62 | return this._isDefault; | ||
63 | }, | ||
64 | |||
65 | //------------------------------------------------------------------------- | ||
66 | |||
67 | 'renderSelf': function () { | ||
68 | this.append(this.element(), {tag:'div', id:this.getId('wrapper'), cls:'button_wrapper', children:[ | ||
69 | {tag:'div', id:this.getId('bodyWrapper'), cls:'button_bodyWrapper', children:[ | ||
70 | {tag:'div', id:this.getId('body'), cls:'button_body', children:[ | ||
71 | {tag:'span', html:this.text()} | ||
72 | ]}, | ||
73 | {tag:'div', id:this.getId('footer'), cls:'button_footer'} | ||
74 | ]} | ||
75 | ]}); | ||
76 | |||
77 | if (this.isDefault()) { | ||
78 | MochiKit.DOM.addElementClass(this.getId('wrapper'), 'default'); | ||
79 | } | ||
80 | |||
81 | MochiKit.Signal.connect(this.getId('wrapper'), 'onmouseenter',this, 'handleOnMouseEnter'); | ||
82 | MochiKit.Signal.connect(this.getId('wrapper'), 'onmouseleave',this, 'handleOnMouseLeave'); | ||
83 | MochiKit.Signal.connect(this.getId('wrapper'), 'onmousedown',this, 'handleOnMouseDown'); | ||
84 | MochiKit.Signal.connect(this.getId('wrapper'), 'onclick', this, 'handleOnClick'); | ||
85 | }, | ||
86 | |||
87 | //------------------------------------------------------------------------- | ||
88 | |||
89 | 'handleOnMouseEnter': function (anEvent) { | ||
90 | MochiKit.DOM.addElementClass(this.getId('wrapper'), 'hover'); | ||
91 | }, | ||
92 | |||
93 | 'handleOnMouseLeave': function (anEvent) { | ||
94 | MochiKit.DOM.removeElementClass(this.getId('wrapper'), 'hover'); | ||
95 | MochiKit.DOM.removeElementClass(this.getId('wrapper'), 'clicked'); | ||
96 | }, | ||
97 | |||
98 | 'handleOnMouseDown': function (anEvent) { | ||
99 | MochiKit.DOM.addElementClass(this.getId('wrapper'), 'clicked'); | ||
100 | }, | ||
101 | |||
102 | 'handleOnClick': function (anEvent) { | ||
103 | MochiKit.Signal.signal(this, 'onclick', anEvent); | ||
104 | }, | ||
105 | |||
106 | //------------------------------------------------------------------------- | ||
107 | __syntaxFix__: "syntax fix" | ||
108 | }); | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/ComponentSlot.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/ComponentSlot.js new file mode 100644 index 0000000..0c6e221 --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/ComponentSlot.js | |||
@@ -0,0 +1,64 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
7 | and efficient set of cryptographic functions. The library aims to | ||
8 | obtain maximum execution speed while preserving modularity and | ||
9 | reusability. | ||
10 | For further information about its features and functionalities please | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | it and/or modify it under the terms of the GNU Affero General Public | ||
15 | License as published by the Free Software Foundation, either version | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); | ||
30 | |||
31 | //############################################################################# | ||
32 | |||
33 | |||
34 | Clipperz.PM.UI.Common.Components.ComponentSlot = function(aComponent, aSlotName) { | ||
35 | this._component = aComponent; | ||
36 | this._slotName = aSlotName; | ||
37 | |||
38 | return this; | ||
39 | } | ||
40 | |||
41 | //============================================================================= | ||
42 | |||
43 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.ComponentSlot, Object, { | ||
44 | |||
45 | //------------------------------------------------------------------------- | ||
46 | |||
47 | 'slotName': function() { | ||
48 | return this._slotName; | ||
49 | }, | ||
50 | |||
51 | 'component': function() { | ||
52 | return this._component; | ||
53 | }, | ||
54 | |||
55 | //------------------------------------------------------------------------- | ||
56 | |||
57 | 'setContent': function(aComponent) { | ||
58 | this.component().setComponentForSlotNamed(aComponent, this.slotName()); | ||
59 | }, | ||
60 | |||
61 | //------------------------------------------------------------------------- | ||
62 | __syntaxFix__: "syntax fix" | ||
63 | |||
64 | }); | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/FaviconComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/FaviconComponent.js new file mode 100644 index 0000000..4735f5c --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/FaviconComponent.js | |||
@@ -0,0 +1,91 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
7 | and efficient set of cryptographic functions. The library aims to | ||
8 | obtain maximum execution speed while preserving modularity and | ||
9 | reusability. | ||
10 | For further information about its features and functionalities please | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | it and/or modify it under the terms of the GNU Affero General Public | ||
15 | License as published by the Free Software Foundation, either version | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); | ||
30 | |||
31 | Clipperz.PM.UI.Common.Components.FaviconComponent = function(args) { | ||
32 | args = args || {}; | ||
33 | |||
34 | Clipperz.PM.UI.Common.Components.FaviconComponent.superclass.constructor.apply(this, arguments); | ||
35 | |||
36 | this.render(); | ||
37 | this.setSrc(args.src); | ||
38 | |||
39 | return this; | ||
40 | } | ||
41 | |||
42 | //============================================================================= | ||
43 | |||
44 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.FaviconComponent, Clipperz.PM.UI.Common.Components.BaseComponent, { | ||
45 | |||
46 | //------------------------------------------------------------------------- | ||
47 | |||
48 | 'toString': function () { | ||
49 | return "Clipperz.PM.UI.Common.Components.FaviconComponent component"; | ||
50 | }, | ||
51 | |||
52 | //------------------------------------------------------------------------- | ||
53 | |||
54 | 'src': function () { | ||
55 | return this.element().src; | ||
56 | }, | ||
57 | |||
58 | 'setSrc': function (aValue) { | ||
59 | this.element().src = (aValue || Clipperz.PM.Strings.getValue('defaultFaviconUrl')); | ||
60 | }, | ||
61 | |||
62 | //------------------------------------------------------------------------- | ||
63 | |||
64 | 'clear': function () {}, | ||
65 | |||
66 | //------------------------------------------------------------------------- | ||
67 | |||
68 | 'renderSelf': function () { | ||
69 | MochiKit.Signal.connect(this.element(), 'onerror',this, 'setDefaultFavicon'); | ||
70 | MochiKit.Signal.connect(this.element(), 'onabort',this, 'setDefaultFavicon'); | ||
71 | MochiKit.Signal.connect(this.element(), 'onload',this, 'handleOnLoad'); | ||
72 | }, | ||
73 | |||
74 | //------------------------------------------------------------------------- | ||
75 | |||
76 | 'setDefaultFavicon': function (anEvent) { | ||
77 | MochiKit.Signal.disconnectAll(anEvent.src()); | ||
78 | this.setSrc(null); | ||
79 | }, | ||
80 | |||
81 | 'handleOnLoad': function (anEvent) { | ||
82 | MochiKit.Signal.disconnectAll(anEvent.src()); | ||
83 | //console.log("HANDLE ON LOAD", anEvent, anEvent.src().src); | ||
84 | if (anEvent.src().complete == false) { | ||
85 | this.setSrc(null); | ||
86 | } | ||
87 | }, | ||
88 | |||
89 | //------------------------------------------------------------------------- | ||
90 | __syntaxFix__: "syntax fix" | ||
91 | }); | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/MessagePanelWithProgressBar.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/MessagePanelWithProgressBar.js new file mode 100644 index 0000000..275bbed --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/MessagePanelWithProgressBar.js | |||
@@ -0,0 +1,164 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
7 | and efficient set of cryptographic functions. The library aims to | ||
8 | obtain maximum execution speed while preserving modularity and | ||
9 | reusability. | ||
10 | For further information about its features and functionalities please | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | it and/or modify it under the terms of the GNU Affero General Public | ||
15 | License as published by the Free Software Foundation, either version | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); | ||
30 | |||
31 | Clipperz.PM.UI.Common.Components.MessagePanelWithProgressBar = function(args) { | ||
32 | args = args || {}; | ||
33 | |||
34 | Clipperz.PM.UI.Common.Components.MessagePanelWithProgressBar.superclass.constructor.apply(this, arguments); | ||
35 | |||
36 | // this._openFromElement = args.openFromElement || null; | ||
37 | this._onOkCloseToElement = args.onOkCloseToElement || null; | ||
38 | this._onCancelCloseToElement = args.onCancelCloseToElement|| null; | ||
39 | |||
40 | this._canCancelWhileProcessing= ((typeof(args.canCancelWhileProcessing) == 'undefined') ? true : args.canCancelWhileProcessing); | ||
41 | |||
42 | return this; | ||
43 | } | ||
44 | |||
45 | //============================================================================= | ||
46 | |||
47 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.MessagePanelWithProgressBar, Clipperz.PM.UI.Common.Components.SimpleMessagePanel, { | ||
48 | |||
49 | //------------------------------------------------------------------------- | ||
50 | |||
51 | 'toString': function () { | ||
52 | return "Clipperz.PM.UI.Common.Components.MessagePanelWithProgressBar component"; | ||
53 | }, | ||
54 | |||
55 | //------------------------------------------------------------------------- | ||
56 | /* | ||
57 | 'openFromElement': function () { | ||
58 | return this._openFromElement; | ||
59 | }, | ||
60 | */ | ||
61 | //------------------------------------------------------------------------- | ||
62 | |||
63 | 'onOkCloseToElement': function () { | ||
64 | return this._onOkCloseToElement; | ||
65 | }, | ||
66 | |||
67 | 'setOnOkCloseToElement': function (anElement) { | ||
68 | this._onOkCloseToElement = anElement; | ||
69 | }, | ||
70 | |||
71 | //------------------------------------------------------------------------- | ||
72 | |||
73 | 'onCancelCloseToElement': function () { | ||
74 | return this._onCancelCloseToElement; | ||
75 | }, | ||
76 | |||
77 | 'setOnCancelCloseToElement': function (anElement) { | ||
78 | this._onCancelCloseToElement = anElement; | ||
79 | }, | ||
80 | |||
81 | //------------------------------------------------------------------------- | ||
82 | |||
83 | 'canCancelWhileProcessing': function () { | ||
84 | return this._canCancelWhileProcessing; | ||
85 | }, | ||
86 | |||
87 | //------------------------------------------------------------------------- | ||
88 | |||
89 | 'deferredShowModal': function (someArgs, aResult) { | ||
90 | if (someArgs['onOkCloseToElement'] != null) { | ||
91 | this.setOnOkCloseToElement(someArgs['onOkCloseToElement']); | ||
92 | } | ||
93 | |||
94 | if (someArgs['onCancelCloseToElement'] != null) { | ||
95 | this.setOnCancelCloseToElement(someArgs['onCancelCloseToElement']); | ||
96 | } | ||
97 | |||
98 | Clipperz.PM.UI.Common.Components.MessagePanelWithProgressBar.superclass.deferredShowModal.apply(this, arguments); | ||
99 | return this.deferred(); | ||
100 | }, | ||
101 | |||
102 | //------------------------------------------------------------------------- | ||
103 | |||
104 | 'showProgressBar': function () { | ||
105 | varprogressBarElement; | ||
106 | |||
107 | this.getElement('container').innerHTML = ''; | ||
108 | |||
109 | progressBarElement = this.append(this.getElement('container'), {tag:'div', cls:'progressBarWrapper'}); | ||
110 | this.addComponent(new Clipperz.PM.UI.Common.Components.ProgressBar({'element':progressBarElement})); | ||
111 | |||
112 | if (this.canCancelWhileProcessing() == true) { | ||
113 | this.setButtons([{text:"Cancel", result:'CANCEL'}]); | ||
114 | } else { | ||
115 | this.setButtons([]); | ||
116 | } | ||
117 | }, | ||
118 | |||
119 | //------------------------------------------------------------------------- | ||
120 | |||
121 | 'showFailure': function (someParameters) { | ||
122 | // this.setType('ALERT'); | ||
123 | this.setType(someParameters['type']); | ||
124 | // this.setTitle("Login failed"); | ||
125 | this.setTitle(someParameters['title']); | ||
126 | // this.setText("Wrong passphrase; the unlock has failed."); | ||
127 | this.setText(someParameters['text']); | ||
128 | // this.getElement('container').innerHTML = ''; | ||
129 | this.getElement('container').innerHTML = ''; | ||
130 | // this.setButtons([{text:"Close", result:'CANCEL', isDefault:true}]); | ||
131 | this.setButtons(someParameters['buttons']); | ||
132 | }, | ||
133 | |||
134 | //------------------------------------------------------------------------- | ||
135 | |||
136 | 'closeOk': function () { | ||
137 | //console.log("=== closeOk"); | ||
138 | this.showProgressBar(); | ||
139 | MochiKit.Async.callLater(0.5, MochiKit.Base.method(this.deferred(), 'callback')); | ||
140 | this._deferred = null; | ||
141 | }, | ||
142 | |||
143 | 'closeCancel': function () { | ||
144 | //console.log("=== closeCancel"); | ||
145 | this.deferredHideModal({closeToElement:this.onCancelCloseToElement()}); | ||
146 | this.deferred().cancel(); | ||
147 | this._deferred = null; | ||
148 | }, | ||
149 | |||
150 | //------------------------------------------------------------------------- | ||
151 | |||
152 | 'deferredDone': function () { | ||
153 | //console.log("=== deferredDone"); | ||
154 | return this.deferredHideModal({closeToElement:this.onOkCloseToElement()}); | ||
155 | }, | ||
156 | |||
157 | 'deferredError': function (someParameters) { | ||
158 | //console.log("=== deferredError"); | ||
159 | this.showFailure(someParameters); | ||
160 | }, | ||
161 | |||
162 | //------------------------------------------------------------------------- | ||
163 | __syntaxFix__: "syntax fix" | ||
164 | }); | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/PasswordEntropyDisplay.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/PasswordEntropyDisplay.js new file mode 100644 index 0000000..c1b4f13 --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/PasswordEntropyDisplay.js | |||
@@ -0,0 +1,140 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
7 | and efficient set of cryptographic functions. The library aims to | ||
8 | obtain maximum execution speed while preserving modularity and | ||
9 | reusability. | ||
10 | For further information about its features and functionalities please | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | it and/or modify it under the terms of the GNU Affero General Public | ||
15 | License as published by the Free Software Foundation, either version | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); | ||
30 | |||
31 | Clipperz.PM.UI.Common.Components.PasswordEntropyDisplay = function(anElement, args) { | ||
32 | args = args || {}; | ||
33 | |||
34 | //MochiKit.Logging.logDebug(">>> new TextFormField"); | ||
35 | Clipperz.PM.UI.Common.Components.PasswordEntropyDisplay.superclass.constructor.call(this, anElement, args); | ||
36 | |||
37 | this._wrapperElement = null; | ||
38 | this._entropyElement = null; | ||
39 | |||
40 | this.render(); | ||
41 | //MochiKit.Logging.logDebug("<<< new TextFormField"); | ||
42 | |||
43 | return this; | ||
44 | }; | ||
45 | |||
46 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.PasswordEntropyDisplay, Clipperz.PM.UI.Common.Components.BaseComponent, { | ||
47 | |||
48 | 'toString': function() { | ||
49 | return "Clipperz.PM.UI.Common.Components.PasswordEntropyDisplay"; | ||
50 | }, | ||
51 | |||
52 | //----------------------------------------------------- | ||
53 | |||
54 | 'wrapperElement': function() { | ||
55 | return this._wrapperElement; | ||
56 | }, | ||
57 | |||
58 | 'setWrapperElement': function(aValue) { | ||
59 | this._wrapperElement = aValue; | ||
60 | }, | ||
61 | |||
62 | //----------------------------------------------------- | ||
63 | |||
64 | 'passwordElement': function() { | ||
65 | return this.element(); | ||
66 | }, | ||
67 | |||
68 | //----------------------------------------------------- | ||
69 | |||
70 | 'entropyElement': function() { | ||
71 | return this._entropyElement; | ||
72 | }, | ||
73 | |||
74 | 'setEntropyElement': function(aValue) { | ||
75 | this._entropyElement = aValue; | ||
76 | }, | ||
77 | |||
78 | //----------------------------------------------------- | ||
79 | |||
80 | 'render': function() { | ||
81 | /* | ||
82 | MochiKit.Signal.disconnectAllTo(this); | ||
83 | |||
84 | this.setWrapperElement(this.element().wrap({tag:'div'})); | ||
85 | this.setEntropyElement(Clipperz.DOM.Helper.append(this.wrapperElement().dom, {tag:'div', cls:'passwordEntropy', html:" "}, true)); | ||
86 | // this.setEntropyElement(Clipperz.DOM.Helper.insertBefore(this.element(), {tag:'div', cls:'passwordEntropy', html:" "}, true)); | ||
87 | this.entropyElement().wrap({tag:'div', cls:'passwordEntropyWrapper'}); | ||
88 | |||
89 | this.updateEntropyElement(); | ||
90 | |||
91 | this.connect('onkeyup', 'updateEntropyElement'); | ||
92 | this.connect('onchange', 'updateEntropyElement'); | ||
93 | this.connect('onblur', 'updateEntropyElement'); | ||
94 | */ | ||
95 | MochiKit.Signal.disconnectAllTo(this); | ||
96 | |||
97 | this.setEntropyElement(this.element()); | ||
98 | this.entropyElement().addClass("entropyLevelIndicator"); | ||
99 | |||
100 | this.updateEntropyElement(); | ||
101 | |||
102 | this.connect('onkeyup', 'updateEntropyElement'); | ||
103 | this.connect('onchange', 'updateEntropyElement'); | ||
104 | this.connect('onblur', 'updateEntropyElement'); | ||
105 | }, | ||
106 | |||
107 | //----------------------------------------------------- | ||
108 | |||
109 | 'computeEntropyForString': function(aValue) { | ||
110 | return Clipperz.PM.Crypto.passwordEntropy(aValue); | ||
111 | }, | ||
112 | |||
113 | //----------------------------------------------------- | ||
114 | |||
115 | 'updateEntropyElement': function(anEvent) { | ||
116 | /* | ||
117 | //MochiKit.Logging.logDebug(">>> PasswordEntropyDisplay.updateEntropyElement"); | ||
118 | varmaxExtent; | ||
119 | varentropy; | ||
120 | |||
121 | entropy = Math.min(128, this.computeEntropyForString(this.passwordElement().dom.value)); | ||
122 | //MochiKit.Logging.logDebug("--- PasswordEntropyDisplay.updateEntropyElement - entropy: " + entropy); | ||
123 | this.entropyElement().setStyle('background-position', "0px " + -entropy + "px"); | ||
124 | this.entropyElement().setWidth(this.passwordElement().getWidth() * (entropy/128)); | ||
125 | //MochiKit.Logging.logDebug("<<< PasswordEntropyDisplay.updateEntropyElement"); | ||
126 | */ | ||
127 | varentropy; | ||
128 | |||
129 | entropy = Math.min(128, this.computeEntropyForString(this.passwordElement().dom.value)); | ||
130 | |||
131 | if (entropy == 0) { | ||
132 | this.entropyElement().setStyle('background-position', "0px 26px"); | ||
133 | } else { | ||
134 | this.entropyElement().setStyle('background-position', "0px -" + (128-entropy)*26 + "px"); | ||
135 | } | ||
136 | }, | ||
137 | |||
138 | //----------------------------------------------------- | ||
139 | __syntaxFix__: '__syntaxFix__' | ||
140 | }); | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/ProgressBar.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/ProgressBar.js new file mode 100644 index 0000000..7e7f8fe --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/ProgressBar.js | |||
@@ -0,0 +1,73 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
7 | and efficient set of cryptographic functions. The library aims to | ||
8 | obtain maximum execution speed while preserving modularity and | ||
9 | reusability. | ||
10 | For further information about its features and functionalities please | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | it and/or modify it under the terms of the GNU Affero General Public | ||
15 | License as published by the Free Software Foundation, either version | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); | ||
30 | |||
31 | Clipperz.PM.UI.Common.Components.ProgressBar = function(args) { | ||
32 | args = args || {}; | ||
33 | |||
34 | Clipperz.PM.UI.Common.Components.ProgressBar.superclass.constructor.apply(this, arguments); | ||
35 | |||
36 | this._element = args.element|| Clipperz.Base.exception.raise('MandatoryParameter'); | ||
37 | |||
38 | this.renderSelf(); | ||
39 | |||
40 | MochiKit.Signal.connect(Clipperz.PM.UI.Common.Controllers.ProgressBarController.defaultController, 'updateProgress', this, 'updateProgressHandler') | ||
41 | |||
42 | return this; | ||
43 | } | ||
44 | |||
45 | //============================================================================= | ||
46 | |||
47 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.ProgressBar, Clipperz.PM.UI.Common.Components.BaseComponent, { | ||
48 | |||
49 | //------------------------------------------------------------------------- | ||
50 | |||
51 | 'toString': function () { | ||
52 | return "Clipperz.PM.UI.Common.Components.ProgressBar component"; | ||
53 | }, | ||
54 | |||
55 | //------------------------------------------------------------------------- | ||
56 | |||
57 | 'renderSelf': function() { | ||
58 | this.append(this.element(), {tag:'div', cls:'loadingBar', children:[ | ||
59 | {tag:'div', cls:'loadingBarProgressBox', children:[ | ||
60 | {tag:'div', id:this.getId('loadingBarProgress'), cls:'loadingBarProgress'} | ||
61 | ]} | ||
62 | ]}); | ||
63 | }, | ||
64 | |||
65 | //------------------------------------------------------------------------- | ||
66 | |||
67 | 'updateProgressHandler': function (anEvent) { | ||
68 | MochiKit.Style.setElementDimensions(this.getId('loadingBarProgress'), {w:anEvent}, '%'); | ||
69 | }, | ||
70 | |||
71 | //------------------------------------------------------------------------- | ||
72 | __syntaxFix__: "syntax fix" | ||
73 | }); | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/SimpleMessagePanel.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/SimpleMessagePanel.js new file mode 100644 index 0000000..b9bb850 --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/SimpleMessagePanel.js | |||
@@ -0,0 +1,282 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
7 | and efficient set of cryptographic functions. The library aims to | ||
8 | obtain maximum execution speed while preserving modularity and | ||
9 | reusability. | ||
10 | For further information about its features and functionalities please | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | it and/or modify it under the terms of the GNU Affero General Public | ||
15 | License as published by the Free Software Foundation, either version | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | ||
30 | |||
31 | Clipperz.PM.UI.Common.Components.SimpleMessagePanel = function(args) { | ||
32 | args = args || {}; | ||
33 | |||
34 | Clipperz.PM.UI.Common.Components.SimpleMessagePanel.superclass.constructor.apply(this, arguments); | ||
35 | |||
36 | this._title = args.title || Clipperz.Base.exception.raise('MandatoryParameter'); | ||
37 | this._text = args.text || Clipperz.Base.exception.raise('MandatoryParameter'); | ||
38 | this._type = args.type || Clipperz.Base.exception.raise('MandatoryParameter'); //ALERT, INFO, ERROR | ||
39 | this._buttons = args.buttons || Clipperz.Base.exception.raise('MandatoryParameter'); | ||
40 | |||
41 | this._buttonComponents = []; | ||
42 | this._deferred = null; | ||
43 | |||
44 | this.renderModalMask(); | ||
45 | |||
46 | return this; | ||
47 | } | ||
48 | |||
49 | //============================================================================= | ||
50 | |||
51 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.SimpleMessagePanel, Clipperz.PM.UI.Common.Components.BaseComponent, { | ||
52 | |||
53 | //------------------------------------------------------------------------- | ||
54 | |||
55 | 'toString': function () { | ||
56 | return "Clipperz.PM.UI.Common.Components.SimpleMessagePanel component"; | ||
57 | }, | ||
58 | |||
59 | //------------------------------------------------------------------------- | ||
60 | |||
61 | 'deferred': function() { | ||
62 | if (this._deferred == null) { | ||
63 | this._deferred = new Clipperz.Async.Deferred("SimpleMessagePanel.deferred", {trace:false}); | ||
64 | } | ||
65 | |||
66 | return this._deferred; | ||
67 | }, | ||
68 | |||
69 | //------------------------------------------------------------------------- | ||
70 | |||
71 | 'title': function () { | ||
72 | return this._title; | ||
73 | }, | ||
74 | |||
75 | 'setTitle': function (aValue) { | ||
76 | this._title = aValue; | ||
77 | |||
78 | if (this.getElement('title') != null) { | ||
79 | this.getElement('title').innerHTML = aValue; | ||
80 | } | ||
81 | }, | ||
82 | |||
83 | //------------------------------------------------------------------------- | ||
84 | |||
85 | 'text': function () { | ||
86 | return this._text; | ||
87 | }, | ||
88 | |||
89 | 'setText': function (aValue) { | ||
90 | this._text = aValue; | ||
91 | |||
92 | if (this.getElement('text') != null) { | ||
93 | this.getElement('text').innerHTML = aValue; | ||
94 | } | ||
95 | }, | ||
96 | |||
97 | //------------------------------------------------------------------------- | ||
98 | |||
99 | 'type': function () { | ||
100 | return this._type; | ||
101 | }, | ||
102 | |||
103 | 'setType': function (aValue) { | ||
104 | if (this.getElement('icon') != null) { | ||
105 | MochiKit.DOM.removeElementClass(this.getId('icon'), this._type); | ||
106 | MochiKit.DOM.addElementClass(this.getId('icon'), aValue); | ||
107 | } | ||
108 | |||
109 | this._type = aValue; | ||
110 | }, | ||
111 | |||
112 | //------------------------------------------------------------------------- | ||
113 | |||
114 | 'buttons': function () { | ||
115 | return this._buttons; | ||
116 | }, | ||
117 | |||
118 | 'setButtons': function (someValues) { | ||
119 | MochiKit.Iter.forEach(this.buttonComponents(), MochiKit.Base.methodcaller('clear')); | ||
120 | |||
121 | this._buttons = someValues; | ||
122 | |||
123 | if (this.getElement('buttonArea') != null) { | ||
124 | this.renderButtons(); | ||
125 | } | ||
126 | }, | ||
127 | |||
128 | //......................................................................... | ||
129 | |||
130 | 'buttonComponents': function () { | ||
131 | return this._buttonComponents; | ||
132 | }, | ||
133 | |||
134 | //------------------------------------------------------------------------- | ||
135 | |||
136 | 'renderSelf': function() { | ||
137 | this.append(this.element(), {tag:'div', cls:'SimpleMessagePanel', id:this.getId('panel'), children: [ | ||
138 | {tag:'div', cls:'header', children:[]}, | ||
139 | {tag:'div', cls:'body', children:[ | ||
140 | {tag:'div', id:this.getId('icon'),cls:'img ' + this.type(), children:[{tag:'div'}]}, | ||
141 | {tag:'h3', id:this.getId('title'),html:this.title()}, | ||
142 | {tag:'p', id:this.getId('text'),html:this.text()}, | ||
143 | {tag:'div', id:this.getId('container')}, | ||
144 | {tag:'div', id:this.getId('buttonArea'), cls:'buttonArea', children:[]} | ||
145 | ]}, | ||
146 | {tag:'div', cls:'footer', children:[]} | ||
147 | ]}); | ||
148 | |||
149 | MochiKit.Signal.connect(this.getId('panel'), 'onkeydown', this, 'keyDownHandler'); | ||
150 | |||
151 | this.renderButtons(); | ||
152 | }, | ||
153 | |||
154 | //------------------------------------------------------------------------- | ||
155 | |||
156 | 'renderButtons': function () { | ||
157 | this.getElement('buttonArea').innerHTML = ''; | ||
158 | |||
159 | MochiKit.Base.map(MochiKit.Base.bind(function (aButton) { | ||
160 | var buttonElement; | ||
161 | var buttonComponent; | ||
162 | |||
163 | // element = this.append(this.getElement('buttonArea'), {tag:'div', cls:'button' + (aButton['isDefault'] === true ? ' default' : ''), children:[ | ||
164 | // {tag:'a', href:'#'/*, id:this.getId('buttonLink')*/, html:aButton['text']} | ||
165 | // ]}); | ||
166 | |||
167 | buttonElement = this.append(this.getElement('buttonArea'), {tag:'div'}); | ||
168 | buttonComponent = new Clipperz.PM.UI.Common.Components.Button({'element':buttonElement, 'text':aButton['text'], 'isDefault':aButton['isDefault']}); | ||
169 | this.buttonComponents().push(buttonComponent); | ||
170 | |||
171 | MochiKit.Signal.connect(buttonComponent, 'onclick', MochiKit.Base.method(this, 'buttonEventHandler', aButton)); | ||
172 | }, this), MochiKit.Iter.reversed(this.buttons())); | ||
173 | }, | ||
174 | |||
175 | //------------------------------------------------------------------------- | ||
176 | |||
177 | 'displayElement': function() { | ||
178 | return this.getElement('panel'); | ||
179 | }, | ||
180 | |||
181 | //------------------------------------------------------------------------- | ||
182 | |||
183 | 'closeOk': function () { | ||
184 | this.deferred().callback(); | ||
185 | this._deferred = null; | ||
186 | }, | ||
187 | |||
188 | 'closeCancel': function () { | ||
189 | this.deferred().cancel(); | ||
190 | this._deferred = null; | ||
191 | }, | ||
192 | |||
193 | 'closeError': function () { | ||
194 | this.deferred().errback(); | ||
195 | this._deferred = null; | ||
196 | }, | ||
197 | |||
198 | //------------------------------------------------------------------------- | ||
199 | |||
200 | 'buttonEventHandler': function(aButton, anEvent) { | ||
201 | anEvent.preventDefault(); | ||
202 | |||
203 | // MochiKit.Signal.signal(this, 'cancelEvent'); | ||
204 | switch (aButton['result']) { | ||
205 | case 'OK': | ||
206 | //console.log("==> OK"); | ||
207 | this.closeOk(); | ||
208 | break; | ||
209 | case 'CANCEL': | ||
210 | //console.log("==> CANCEL"); | ||
211 | this.closeCancel(); | ||
212 | break; | ||
213 | default: | ||
214 | //console.log("==> ????"); | ||
215 | this.closeError(); | ||
216 | break; | ||
217 | } | ||
218 | //console.log("<=="); | ||
219 | }, | ||
220 | |||
221 | //------------------------------------------------------------------------- | ||
222 | |||
223 | 'deferredShow': function (someArgs, aResult) { | ||
224 | this.deferredShowModal(someArgs); | ||
225 | |||
226 | this.deferred().addMethod(this, 'deferredHideModal', {closeToElement:someArgs.onOkCloseToElement }); | ||
227 | this.deferred().addErrback (MochiKit.Base.method(this, 'deferredHideModal', {closeToElement:someArgs.onCancelCloseToElement })); | ||
228 | this.deferred().addCallback(MochiKit.Async.succeed, aResult); | ||
229 | |||
230 | return this.deferred(); | ||
231 | }, | ||
232 | |||
233 | //------------------------------------------------------------------------- | ||
234 | |||
235 | 'modalDialogMask': function () { | ||
236 | return this.getId('modalDialogMask'); | ||
237 | }, | ||
238 | |||
239 | 'modalDialog': function () { | ||
240 | return this.getId('modalDialog'); | ||
241 | }, | ||
242 | |||
243 | 'modalDialogFrame': function() { | ||
244 | return this.getId('modalDialogFrame'); | ||
245 | }, | ||
246 | |||
247 | //------------------------------------------------------------------------- | ||
248 | |||
249 | 'renderModalMask': function () { | ||
250 | Clipperz.DOM.Helper.append(MochiKit.DOM.currentDocument().body, | ||
251 | {tag:'div', id:this.getId('modalDialogWrapper'), cls:'modalDialogWrapper simpleMessagePanelMask', children:[ | ||
252 | {tag:'div', id:this.getId('modalDialogMask'), cls:'modalDialogMask simpleMessagePanelMask'}, | ||
253 | {tag:'div', id:this.getId('modalDialogFrame'), cls:'modalDialogFrame simpleMessagePanelMask'}, | ||
254 | {tag:'div', id:this.getId('modalDialog'), cls:'modalDialog simpleMessagePanelMask'} | ||
255 | ]} | ||
256 | ); | ||
257 | |||
258 | MochiKit.Style.hideElement(this.getId('modalDialogMask')); | ||
259 | MochiKit.Style.hideElement(this.getId('modalDialogFrame')); | ||
260 | }, | ||
261 | |||
262 | //------------------------------------------------------------------------- | ||
263 | |||
264 | 'keyDownHandler': function (anEvent) { | ||
265 | if (anEvent.key().string == 'KEY_ENTER') { | ||
266 | anEvent.preventDefault(); | ||
267 | //console.log("13 - RETURN ?", this); | ||
268 | this.closeOk(); | ||
269 | //console.log('<<< 13') | ||
270 | } | ||
271 | |||
272 | if (anEvent.key().string == 'KEY_ESCAPE') { | ||
273 | anEvent.preventDefault(); | ||
274 | //console.log("27 - ESC ?", this); | ||
275 | this.closeCancel(); | ||
276 | //console.log("<<< 27"); | ||
277 | } | ||
278 | }, | ||
279 | |||
280 | //------------------------------------------------------------------------- | ||
281 | __syntaxFix__: "syntax fix" | ||
282 | }); | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/TabPanelComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/TabPanelComponent.js new file mode 100644 index 0000000..afb3bf9 --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/TabPanelComponent.js | |||
@@ -0,0 +1,69 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
7 | and efficient set of cryptographic functions. The library aims to | ||
8 | obtain maximum execution speed while preserving modularity and | ||
9 | reusability. | ||
10 | For further information about its features and functionalities please | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | it and/or modify it under the terms of the GNU Affero General Public | ||
15 | License as published by the Free Software Foundation, either version | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); | ||
30 | |||
31 | Clipperz.PM.UI.Common.Components.TabPanelComponent = function(args) { | ||
32 | args = args || {}; | ||
33 | Clipperz.PM.UI.Common.Components.TabPanelComponent.superclass.constructor.call(this, args); | ||
34 | |||
35 | this._tabPanelController = null; | ||
36 | |||
37 | return this; | ||
38 | } | ||
39 | |||
40 | //============================================================================= | ||
41 | |||
42 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.TabPanelComponent, Clipperz.PM.UI.Common.Components.BaseComponent, { | ||
43 | |||
44 | 'toString': function () { | ||
45 | return "Clipperz.PM.UI.Common.Components.TabPanelComponent component"; | ||
46 | }, | ||
47 | |||
48 | //------------------------------------------------------------------------- | ||
49 | |||
50 | 'tabPanelControllerConfiguration': function() { | ||
51 | return this._tabPanelControllerConfiguration; | ||
52 | }, | ||
53 | |||
54 | 'tabPanelController': function() { | ||
55 | if (this._tabPanelController == null) { | ||
56 | this._tabPanelController = new Clipperz.PM.UI.Common.Controllers.TabPanelController({component:this, configuration:this.tabPanelControllerConfiguration()}); | ||
57 | } | ||
58 | |||
59 | return this._tabPanelController; | ||
60 | }, | ||
61 | |||
62 | 'initiallySelectedTab': function() { | ||
63 | return this._initiallySelectedTab; | ||
64 | }, | ||
65 | |||
66 | //------------------------------------------------------------------------- | ||
67 | __syntaxFix__: "syntax fix" | ||
68 | |||
69 | }); | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Tooltip.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Tooltip.js new file mode 100644 index 0000000..7507b86 --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Tooltip.js | |||
@@ -0,0 +1,216 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
7 | and efficient set of cryptographic functions. The library aims to | ||
8 | obtain maximum execution speed while preserving modularity and | ||
9 | reusability. | ||
10 | For further information about its features and functionalities please | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | it and/or modify it under the terms of the GNU Affero General Public | ||
15 | License as published by the Free Software Foundation, either version | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); | ||
30 | |||
31 | Clipperz.PM.UI.Common.Components.Tooltip = function(args) { | ||
32 | args = args || {}; | ||
33 | |||
34 | Clipperz.PM.UI.Common.Components.Tooltip.superclass.constructor.apply(this, arguments); | ||
35 | |||
36 | this._element = args.element|| Clipperz.Base.exception.raise('MandatoryParameter'); | ||
37 | this._text = args.text || Clipperz.Base.exception.raise('MandatoryParameter'); | ||
38 | this._position = args.position || 'BELOW'; //'BELOW', 'ABOVE', 'LEFT', 'RIGHT' | ||
39 | |||
40 | this._boxDimensions = null; | ||
41 | this._enabled = (typeof(args.enabled) == 'undefined' ? true : args.enabled); | ||
42 | this._isVisible = false; | ||
43 | |||
44 | this.renderSelf(); | ||
45 | |||
46 | return this; | ||
47 | } | ||
48 | |||
49 | //============================================================================= | ||
50 | |||
51 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.Tooltip, Clipperz.PM.UI.Common.Components.BaseComponent, { | ||
52 | |||
53 | //------------------------------------------------------------------------- | ||
54 | |||
55 | 'toString': function () { | ||
56 | return "Clipperz.PM.UI.Common.Components.Tooltip component"; | ||
57 | }, | ||
58 | |||
59 | //------------------------------------------------------------------------- | ||
60 | |||
61 | 'text': function () { | ||
62 | return this._text; | ||
63 | }, | ||
64 | |||
65 | 'setText': function (aValue) { | ||
66 | this._text = aValue; | ||
67 | }, | ||
68 | |||
69 | //------------------------------------------------------------------------- | ||
70 | |||
71 | 'position': function () { | ||
72 | return this._position; | ||
73 | }, | ||
74 | |||
75 | 'setPosition': function (aValue) { | ||
76 | this._position = aValue; | ||
77 | }, | ||
78 | |||
79 | //------------------------------------------------------------------------- | ||
80 | |||
81 | 'enabled': function () { | ||
82 | return this._enabled; | ||
83 | }, | ||
84 | |||
85 | 'setIsEnabled': function (aValue) { | ||
86 | this._enabled = aValue; | ||
87 | }, | ||
88 | |||
89 | //------------------------------------------------------------------------- | ||
90 | |||
91 | 'isVisible': function () { | ||
92 | return this._isVisible; | ||
93 | }, | ||
94 | |||
95 | 'setIsVisible': function (aValue) { | ||
96 | this._isVisible = aValue; | ||
97 | }, | ||
98 | |||
99 | //------------------------------------------------------------------------- | ||
100 | |||
101 | 'renderSelf': function() { | ||
102 | // this.append(this.element(), {tag:'div', id:this.getId('tooltip'), cls:'tooltip ' + this.position(), children:[ | ||
103 | // this.append(MochiKit.DOM.currentDocument().body, {tag:'div', id:this.getId('tooltip'), cls:'tooltip ' + this.position(), children:[ | ||
104 | this.append(MochiKit.DOM.getElement('Clipperz_PM_UI_Common_Components_Tooltip_wrapperNode'), {tag:'div', id:this.getId('tooltip'), cls:'tooltip ' + this.position(), children:[ | ||
105 | {tag:'div', id:this.getId('body'), cls:'tooltip_body', children:[ | ||
106 | {tag:'div', cls:'tooltip_text', children:[ | ||
107 | {tag:'span', html:this.text()} | ||
108 | ]}, | ||
109 | {tag:'div', id:this.getId('footer'), cls:'tooltip_footer'} | ||
110 | ]}, | ||
111 | {tag:'div', id:this.getId('arrow'), cls:'tooltip_arrow'} | ||
112 | ]}); | ||
113 | |||
114 | this._boxDimensions = MochiKit.Style.getElementDimensions(this.getId('body')); | ||
115 | // this._boxDimensions.h += MochiKit.Style.getElementDimensions(this.getId('footer')).h; | ||
116 | |||
117 | MochiKit.Style.hideElement(this.displayElement()); | ||
118 | MochiKit.Signal.connect(this.element(), 'onmouseenter', this, 'show'); | ||
119 | MochiKit.Signal.connect(this.element(), 'onmouseleave', this, 'hide'); | ||
120 | }, | ||
121 | |||
122 | //----------------------------------------------------- | ||
123 | |||
124 | 'displayElement': function() { | ||
125 | return this.getElement('tooltip'); | ||
126 | }, | ||
127 | |||
128 | //------------------------------------------------------------------------- | ||
129 | |||
130 | 'boxDimensions': function () { | ||
131 | return this._boxDimensions; | ||
132 | }, | ||
133 | |||
134 | //------------------------------------------------------------------------- | ||
135 | |||
136 | 'show': function () { | ||
137 | var elementSizeAndPosition; | ||
138 | var arrowPosition; | ||
139 | var bodyPosition; | ||
140 | |||
141 | if (this.isVisible() == false) { | ||
142 | arrowPosition = {}; | ||
143 | bodyPosition = {}; | ||
144 | |||
145 | this.setIsVisible(true); | ||
146 | elementSizeAndPosition = Clipperz.Style.getSizeAndPosition(this.element()); | ||
147 | //console.log("ELEMENT SIZE AND POSITION", Clipperz.Base.serializeJSON(elementSizeAndPosition)); | ||
148 | //console.log("BOX DIMENSIONS", Clipperz.Base.serializeJSON(this.boxDimensions())); | ||
149 | switch (this.position()) { | ||
150 | case 'ABOVE': | ||
151 | //console.log("ABOVE"); | ||
152 | MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:36, h:13}, 'px'); | ||
153 | bodyPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - this.boxDimensions().w/2); | ||
154 | bodyPosition.y = elementSizeAndPosition.position.y - this.boxDimensions().h - 13; | ||
155 | |||
156 | arrowPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - 36/2); | ||
157 | arrowPosition.y = elementSizeAndPosition.position.y - 13; | ||
158 | break; | ||
159 | case 'BELOW': | ||
160 | //console.log("BELOW"); | ||
161 | MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:36, h:13}, 'px'); | ||
162 | bodyPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - this.boxDimensions().w/2); | ||
163 | bodyPosition.y = elementSizeAndPosition.position.y + elementSizeAndPosition.dimensions.h + 13; | ||
164 | |||
165 | arrowPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - 36/2); | ||
166 | arrowPosition.y = elementSizeAndPosition.position.y + elementSizeAndPosition.dimensions.h; | ||
167 | break; | ||
168 | case 'LEFT': | ||
169 | //console.log("LEFT"); | ||
170 | MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:13, h:36}, 'px'); | ||
171 | bodyPosition.x = elementSizeAndPosition.position.x - this.boxDimensions().w - 13; | ||
172 | bodyPosition.y = elementSizeAndPosition.position.y + (elementSizeAndPosition.dimensions.h/2 - this.boxDimensions().h/2); | ||
173 | |||
174 | arrowPosition.x = elementSizeAndPosition.position.x -13; | ||
175 | arrowPosition.y = elementSizeAndPosition.position.y + (elementSizeAndPosition.dimensions.h/2 - 36/2); | ||
176 | break; | ||
177 | case 'RIGHT': | ||
178 | //console.log("RIGHT"); | ||
179 | MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:13, h:36}, 'px'); | ||
180 | bodyPosition.x = elementSizeAndPosition.position.x + elementSizeAndPosition.dimensions.w + 13; | ||
181 | bodyPosition.y = elementSizeAndPosition.position.y + (elementSizeAndPosition.dimensions.h/2 - this.boxDimensions().h/2); | ||
182 | |||
183 | arrowPosition.x = elementSizeAndPosition.position.x + elementSizeAndPosition.dimensions.w; | ||
184 | arrowPosition.y = elementSizeAndPosition.position.y + (elementSizeAndPosition.dimensions.h/2 - 36/2); | ||
185 | break; | ||
186 | } | ||
187 | //console.log("X: " + bodyPosition.x + ", Y: " + bodyPosition.y); | ||
188 | |||
189 | MochiKit.Style.setElementPosition(this.getId('body'), bodyPosition); | ||
190 | MochiKit.Style.setElementPosition(this.getId('arrow'), arrowPosition); | ||
191 | MochiKit.Visual.appear(this.displayElement(), {duration:0.4}); | ||
192 | } | ||
193 | }, | ||
194 | |||
195 | 'hide': function () { | ||
196 | if (this.isVisible() == true) { | ||
197 | MochiKit.Visual.fade(this.displayElement(), {duration:0.4}); | ||
198 | this.setIsVisible(false); | ||
199 | } | ||
200 | }, | ||
201 | |||
202 | //------------------------------------------------------------------------- | ||
203 | /* | ||
204 | 'shouldRemoveElementWhenClearningUp': function () { | ||
205 | return false; | ||
206 | }, | ||
207 | */ | ||
208 | //------------------------------------------------------------------------- | ||
209 | __syntaxFix__: "syntax fix" | ||
210 | }); | ||
211 | |||
212 | Clipperz.PM.UI.Common.Components.Tooltip.initTooltips = function () { | ||
213 | Clipperz.DOM.Helper.insertBefore(MochiKit.DOM.currentDocument().body.childNodes[0], {tag:'div', id:'Clipperz_PM_UI_Common_Components_Tooltip_wrapperNode'}); | ||
214 | } | ||
215 | |||
216 | 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 new file mode 100644 index 0000000..c31969e --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/TranslatorWidget.js | |||
@@ -0,0 +1,170 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
7 | and efficient set of cryptographic functions. The library aims to | ||
8 | obtain maximum execution speed while preserving modularity and | ||
9 | reusability. | ||
10 | For further information about its features and functionalities please | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | it and/or modify it under the terms of the GNU Affero General Public | ||
15 | License as published by the Free Software Foundation, either version | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); | ||
30 | |||
31 | Clipperz.PM.UI.Common.Components.TranslatorWidget = function(args) { | ||
32 | Clipperz.log(">>> TranslatorWidget.new"); | ||
33 | args = args || {}; | ||
34 | |||
35 | Clipperz.PM.UI.Common.Components.TranslatorWidget.superclass.constructor.apply(this, arguments); | ||
36 | |||
37 | // this._element = args.element|| Clipperz.Base.exception.raise('MandatoryParameter'); | ||
38 | // this._stringID = args.stringID || MochiKit.DOM.getNodeAttribute(this.element(), 'stringID')|| Clipperz.Base.exception.raise('MandatoryParameter'); | ||
39 | |||
40 | //MochiKit.Signal.connect(this.element(), 'onmouseenter', this, 'show'); | ||
41 | //MochiKit.Signal.connect(this.element(), 'onmouseleave', this, 'hide'); | ||
42 | |||
43 | Clipperz.log("<<< TranslatorWidget.new"); | ||
44 | return this; | ||
45 | } | ||
46 | |||
47 | //============================================================================= | ||
48 | |||
49 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.TranslatorWidget, Clipperz.PM.UI.Common.Components.BaseComponent, { | ||
50 | |||
51 | //------------------------------------------------------------------------- | ||
52 | |||
53 | 'toString': function () { | ||
54 | return "Clipperz.PM.UI.Common.Components.TranslatorWidget component"; | ||
55 | }, | ||
56 | |||
57 | //------------------------------------------------------------------------- | ||
58 | /* | ||
59 | 'renderSelf': function() { | ||
60 | this.append(this.element(), {tag:'div', id:this.getId('tooltip'), cls:'tooltip ' + this.position(), children:[ | ||
61 | {tag:'div', id:this.getId('body'), cls:'tooltip_body', children:[ | ||
62 | {tag:'div', cls:'tooltip_text', children:[ | ||
63 | {tag:'span', html:this.text()} | ||
64 | ]}, | ||
65 | {tag:'div', id:this.getId('footer'), cls:'tooltip_footer'} | ||
66 | ]}, | ||
67 | {tag:'div', id:this.getId('arrow'), cls:'tooltip_arrow'} | ||
68 | ]}); | ||
69 | |||
70 | this._boxDimensions = MochiKit.Style.getElementDimensions(this.getId('body')); | ||
71 | // this._boxDimensions.h += MochiKit.Style.getElementDimensions(this.getId('footer')).h; | ||
72 | |||
73 | MochiKit.Style.hideElement(this.displayElement()); | ||
74 | MochiKit.Signal.connect(this.element(), 'onmouseenter', this, 'show'); | ||
75 | MochiKit.Signal.connect(this.element(), 'onmouseleave', this, 'hide'); | ||
76 | }, | ||
77 | */ | ||
78 | //----------------------------------------------------- | ||
79 | /* | ||
80 | 'displayElement': function() { | ||
81 | return this.getElement('tooltip'); | ||
82 | }, | ||
83 | */ | ||
84 | //------------------------------------------------------------------------- | ||
85 | /* | ||
86 | 'boxDimensions': function () { | ||
87 | return this._boxDimensions; | ||
88 | }, | ||
89 | */ | ||
90 | //------------------------------------------------------------------------- | ||
91 | |||
92 | 'show': function (anElement, aStringID) { | ||
93 | Clipperz.log(">>> Clipperz.PM.UI.Common.Components.TranslatorWidget.show: " + aStringID); | ||
94 | /* | ||
95 | var elementSizeAndPosition; | ||
96 | var arrowPosition; | ||
97 | var bodyPosition; | ||
98 | |||
99 | arrowPosition = {}; | ||
100 | bodyPosition = {}; | ||
101 | |||
102 | elementSizeAndPosition = Clipperz.Style.getSizeAndPosition(this.element()); | ||
103 | switch (this.position()) { | ||
104 | case 'ABOVE': | ||
105 | MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:36, h:13}, 'px'); | ||
106 | bodyPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - this.boxDimensions().w/2); | ||
107 | bodyPosition.y = elementSizeAndPosition.position.y - this.boxDimensions().h - 13; | ||
108 | |||
109 | arrowPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - 36/2); | ||
110 | arrowPosition.y = elementSizeAndPosition.position.y - 13; | ||
111 | break; | ||
112 | case 'BELOW': | ||
113 | MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:36, h:13}, 'px'); | ||
114 | bodyPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - this.boxDimensions().w/2); | ||
115 | bodyPosition.y = elementSizeAndPosition.position.y + elementSizeAndPosition.dimensions.h + 13; | ||
116 | |||
117 | arrowPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - 36/2); | ||
118 | arrowPosition.y = elementSizeAndPosition.position.y + elementSizeAndPosition.dimensions.h; | ||
119 | break; | ||
120 | case 'LEFT': | ||
121 | MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:13, h:36}, 'px'); | ||
122 | bodyPosition.x = elementSizeAndPosition.position.x - this.boxDimensions().w - 13; | ||
123 | bodyPosition.y = elementSizeAndPosition.position.y + (elementSizeAndPosition.dimensions.h/2 - this.boxDimensions().h/2); | ||
124 | |||
125 | arrowPosition.x = elementSizeAndPosition.position.x -13; | ||
126 | arrowPosition.y = elementSizeAndPosition.position.y + (elementSizeAndPosition.dimensions.h/2 - 36/2); | ||
127 | break; | ||
128 | case 'RIGHT': | ||
129 | MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:13, h:36}, 'px'); | ||
130 | break; | ||
131 | } | ||
132 | |||
133 | // MochiKit.Style.setElementPosition(this.getId('body'), bodyPosition); | ||
134 | MochiKit.Style.setElementPosition(this.getId('body'), bodyPosition); | ||
135 | MochiKit.Style.setElementPosition(this.getId('arrow'), arrowPosition); | ||
136 | MochiKit.Visual.appear(this.displayElement(), {duration:0.4}); | ||
137 | */ | ||
138 | }, | ||
139 | |||
140 | //------------------------------------------------------------------------- | ||
141 | |||
142 | 'hide': function () { | ||
143 | Clipperz.log("<<< Clipperz.PM.UI.Common.Components.TranslatorWidget.hide"); | ||
144 | // MochiKit.Visual.fade(this.displayElement(), {duration:0.4}); | ||
145 | }, | ||
146 | |||
147 | //------------------------------------------------------------------------- | ||
148 | __syntaxFix__: "syntax fix" | ||
149 | }); | ||
150 | |||
151 | //############################################################################# | ||
152 | |||
153 | Clipperz.PM.UI.Common.Components.TranslatorWidget._widget = null; | ||
154 | |||
155 | Clipperz.PM.UI.Common.Components.TranslatorWidget.widget = function () { | ||
156 | if (Clipperz.PM.UI.Common.Components.TranslatorWidget._widget == null) { | ||
157 | Clipperz.PM.UI.Common.Components.TranslatorWidget._widget = new Clipperz.PM.UI.Common.Components.TranslatorWidget(); | ||
158 | } | ||
159 | |||
160 | return Clipperz.PM.UI.Common.Components.TranslatorWidget._widget; | ||
161 | } | ||
162 | Clipperz.PM.UI.Common.Components.TranslatorWidget.show = function (anElement, aStringID) { | ||
163 | Clipperz.PM.UI.Common.Components.TranslatorWidget.widget().show(anElement, aStringID); | ||
164 | } | ||
165 | |||
166 | Clipperz.PM.UI.Common.Components.TranslatorWidget.hide = function () { | ||
167 | Clipperz.PM.UI.Common.Components.TranslatorWidget.widget().hide(); | ||
168 | } | ||
169 | |||
170 | //############################################################################# | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/DirectLoginRunner.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/DirectLoginRunner.js new file mode 100644 index 0000000..e534435 --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/DirectLoginRunner.js | |||
@@ -0,0 +1,267 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
7 | and efficient set of cryptographic functions. The library aims to | ||
8 | obtain maximum execution speed while preserving modularity and | ||
9 | reusability. | ||
10 | For further information about its features and functionalities please | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | it and/or modify it under the terms of the GNU Affero General Public | ||
15 | License as published by the Free Software Foundation, either version | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | Clipperz.Base.module('Clipperz.PM.UI.Common.Controllers'); | ||
30 | |||
31 | Clipperz.PM.UI.Common.Controllers.DirectLoginRunner = function(args) { | ||
32 | this._directLogin = args['directLogin'] || Clipperz.Base.exception.raise('MandatoryParameter'); | ||
33 | this._target = Clipperz.PM.Crypto.randomKey(); | ||
34 | |||
35 | return this; | ||
36 | } | ||
37 | |||
38 | MochiKit.Base.update(Clipperz.PM.UI.Common.Controllers.DirectLoginRunner.prototype, { | ||
39 | |||
40 | 'toString': function() { | ||
41 | return "Clipperz.PM.UI.Common.Controllers.DirectLoginRunner"; | ||
42 | }, | ||
43 | |||
44 | //----------------------------------------------------------------------------- | ||
45 | |||
46 | 'directLogin': function () { | ||
47 | return this._directLogin; | ||
48 | }, | ||
49 | |||
50 | //----------------------------------------------------------------------------- | ||
51 | |||
52 | 'target': function () { | ||
53 | return this._target; | ||
54 | }, | ||
55 | |||
56 | //============================================================================= | ||
57 | |||
58 | 'setWindowTitle': function (aWindow, aTitle) { | ||
59 | aWindow.document.title = aTitle; | ||
60 | }, | ||
61 | |||
62 | 'setWindowBody': function (aWindow, anHTML) { | ||
63 | aWindow.document.body.innerHTML = anHTML; | ||
64 | }, | ||
65 | |||
66 | //============================================================================= | ||
67 | |||
68 | 'initialWindowSetup': function (aWindow) { | ||
69 | this.setWindowTitle(aWindow, "Loading Clipperz Direct Login"); | ||
70 | this.setWindowBody (aWindow, MochiKit.DOM.toHTML(MochiKit.DOM.H3("Loading Clipperz Direct Login ..."))); | ||
71 | }, | ||
72 | |||
73 | //----------------------------------------------------------------------------- | ||
74 | |||
75 | 'updateWindowWithDirectLoginLabel': function (aWindow, aLabel) { | ||
76 | var titleText; | ||
77 | var bodyText; | ||
78 | |||
79 | titleText = "Loading '__label__' Direct Login".replace(/__label__/, aLabel) | ||
80 | bodyText = "Loading '__label__' Direct Login... ".replace(/__label__/, aLabel) | ||
81 | |||
82 | this.setWindowTitle(aWindow, titleText); | ||
83 | this.setWindowBody (aWindow, MochiKit.DOM.toHTML(MochiKit.DOM.H3(bodyText))); | ||
84 | }, | ||
85 | |||
86 | //----------------------------------------------------------------------------- | ||
87 | |||
88 | 'updateWindowWithHTMLContent': function (aWindow, anHtml) { | ||
89 | this.setWindowBody(aWindow, anHtml); | ||
90 | }, | ||
91 | |||
92 | //============================================================================= | ||
93 | |||
94 | 'submitLoginForm': function(aWindow, aSubmitFunction) { | ||
95 | MochiKit.DOM.withWindow(aWindow, MochiKit.Base.bind(function () { | ||
96 | var formElement; | ||
97 | var submitButtons; | ||
98 | |||
99 | formElement = MochiKit.DOM.getElement('directLoginForm'); | ||
100 | |||
101 | submitButtons = MochiKit.Base.filter(function(anInputElement) { | ||
102 | return ((anInputElement.tagName.toLowerCase() == 'input') && (anInputElement.getAttribute('type').toLowerCase() == 'submit')); | ||
103 | }, formElement.elements); | ||
104 | |||
105 | if (submitButtons.length == 0) { | ||
106 | if (typeof(formElement.submit) == 'function') { | ||
107 | formElement.submit(); | ||
108 | } else { | ||
109 | aSubmitFunction.apply(formElement); | ||
110 | } | ||
111 | /* | ||
112 | varformSubmitFunction; | ||
113 | |||
114 | formSubmitFunction = MochiKit.Base.method(formElement, 'submit'); | ||
115 | if (Clipperz_IEisBroken == true) { | ||
116 | formElement.submit(); | ||
117 | } else { | ||
118 | formSubmitFunction(); | ||
119 | } | ||
120 | */ | ||
121 | } else { | ||
122 | submitButtons[0].click(); | ||
123 | } | ||
124 | }, this)); | ||
125 | }, | ||
126 | |||
127 | //------------------------------------------------------------------------- | ||
128 | |||
129 | 'runSubmitFormDirectLogin': function (aWindow, someAttributes) { | ||
130 | var html; | ||
131 | var formElement; | ||
132 | var submitFunction; | ||
133 | |||
134 | formElement = MochiKit.DOM.FORM({ | ||
135 | 'id':'directLoginForm', | ||
136 | 'method':someAttributes['formAttributes']['method'], | ||
137 | 'action':someAttributes['formAttributes']['action'] | ||
138 | }); | ||
139 | |||
140 | submitFunction = formElement.submit; | ||
141 | |||
142 | MochiKit.DOM.appendChildNodes(formElement, MochiKit.Base.map(function (anInputAttributes) { | ||
143 | return MochiKit.DOM.INPUT({'type':'hidden', 'name':anInputAttributes[0], 'value':anInputAttributes[1]}); | ||
144 | }, MochiKit.Base.items(someAttributes['inputValues']))); | ||
145 | |||
146 | html =''; | ||
147 | html += '<h3>Loading ' + someAttributes['label'] + ' ...</h3>'; | ||
148 | html +=MochiKit.DOM.appendChildNodes(MochiKit.DOM.DIV(), MochiKit.DOM.appendChildNodes(MochiKit.DOM.DIV({style:'display:none; visibility:hidden;'}), formElement)).innerHTML; | ||
149 | |||
150 | this.updateWindowWithHTMLContent(aWindow, html); | ||
151 | this.submitLoginForm(aWindow, submitFunction); | ||
152 | }, | ||
153 | |||
154 | //------------------------------------------------------------------------- | ||
155 | |||
156 | 'runHttpAuthDirectLogin': function(aWindow, someAttributes) { | ||
157 | var completeUrl; | ||
158 | var url; | ||
159 | |||
160 | //console.log("runHttpAuthDirectLogin", someAttributes); | ||
161 | url = someAttributes['inputValues']['url']; | ||
162 | |||
163 | if (/^https?\:\/\//.test(url) == false) { | ||
164 | url = 'http://' + url; | ||
165 | } | ||
166 | |||
167 | if (Clipperz_IEisBroken === true) { | ||
168 | completeUrl = url; | ||
169 | } else { | ||
170 | var username; | ||
171 | var password; | ||
172 | |||
173 | username = someAttributes['inputValues']['username']; | ||
174 | password = someAttributes['inputValues']['password']; | ||
175 | /(^https?\:\/\/)?(.*)/.test(url); | ||
176 | |||
177 | completeUrl = RegExp.$1 + username + ':' + password + '@' + RegExp.$2; | ||
178 | } | ||
179 | |||
180 | window.open(completeUrl, this.target()); | ||
181 | }, | ||
182 | |||
183 | //============================================================================= | ||
184 | |||
185 | 'runDirectLogin': function (aWindow) { | ||
186 | var deferredResult; | ||
187 | |||
188 | //console.log(">>> runDirectLogin"); | ||
189 | deferredResult = new Clipperz.Async.Deferred("DirectLoginRunner.openDirectLogin", {trace:false}); | ||
190 | deferredResult.addMethod(this, 'initialWindowSetup', aWindow); | ||
191 | deferredResult.addMethod(this.directLogin(), 'label'); | ||
192 | deferredResult.addMethod(this, 'updateWindowWithDirectLoginLabel', aWindow); | ||
193 | deferredResult.collectResults({ | ||
194 | 'type': MochiKit.Base.method(this.directLogin(), 'type'), | ||
195 | 'label': MochiKit.Base.method(this.directLogin(), 'label'), | ||
196 | 'formAttributes':MochiKit.Base.method(this.directLogin(), 'formAttributes'), | ||
197 | 'inputValues': MochiKit.Base.method(this.directLogin(), 'inputValues') | ||
198 | }); | ||
199 | //deferredResult.addCallback(function (aValue) { console.log("SOME ATTRIBUTES", aValue); return aValue; }); | ||
200 | deferredResult.addCallback(MochiKit.Base.bind(function (someAttributes) { | ||
201 | //console.log("SOME ATTRIBUTES", someAttributes); | ||
202 | switch (someAttributes['type']) { | ||
203 | case 'http_auth': | ||
204 | this.runHttpAuthDirectLogin(aWindow, someAttributes); | ||
205 | break; | ||
206 | case 'simple_url': | ||
207 | this.runSimpleUrlDirectLogin(aWindow, someAttributes); | ||
208 | break; | ||
209 | default: | ||
210 | this.runSubmitFormDirectLogin(aWindow, someAttributes); | ||
211 | break; | ||
212 | } | ||
213 | }, this)); | ||
214 | deferredResult.callback(); | ||
215 | //console.log("<<< runDirectLogin"); | ||
216 | |||
217 | return deferredResult; | ||
218 | }, | ||
219 | |||
220 | //============================================================================= | ||
221 | |||
222 | 'run': function () { | ||
223 | var newWindow; | ||
224 | |||
225 | newWindow = window.open(Clipperz.PM.Strings.getValue('directLoginJumpPageUrl'), this.target()); | ||
226 | |||
227 | return this.runDirectLogin(newWindow); | ||
228 | }, | ||
229 | |||
230 | //============================================================================= | ||
231 | |||
232 | 'test': function () { | ||
233 | var iFrame; | ||
234 | var newWindow; | ||
235 | |||
236 | iFrame = MochiKit.DOM.createDOM('iframe'); | ||
237 | MochiKit.DOM.appendChildNodes(MochiKit.DOM.currentDocument().body, iFrame); | ||
238 | |||
239 | newWindow = iFrame.contentWindow; | ||
240 | |||
241 | return this.runDirectLogin(newWindow); | ||
242 | }, | ||
243 | |||
244 | //============================================================================= | ||
245 | __syntaxFix__: "syntax fix" | ||
246 | }); | ||
247 | |||
248 | //----------------------------------------------------------------------------- | ||
249 | |||
250 | Clipperz.PM.UI.Common.Controllers.DirectLoginRunner.openDirectLogin = function (aDirectLogin) { | ||
251 | varrunner; | ||
252 | |||
253 | runner = new Clipperz.PM.UI.Common.Controllers.DirectLoginRunner({directLogin:aDirectLogin}); | ||
254 | return runner.run(); | ||
255 | }; | ||
256 | |||
257 | //----------------------------------------------------------------------------- | ||
258 | |||
259 | Clipperz.PM.UI.Common.Controllers.DirectLoginRunner.testDirectLogin = function (aDirectLogin) { | ||
260 | varrunner; | ||
261 | |||
262 | //console.log(">>>>>> TESTING DIRECT LOGIN"); | ||
263 | runner = new Clipperz.PM.UI.Common.Controllers.DirectLoginRunner({directLogin:aDirectLogin}); | ||
264 | return runner.test(); | ||
265 | }; | ||
266 | |||
267 | //----------------------------------------------------------------------------- | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/ProgressBarController.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/ProgressBarController.js new file mode 100644 index 0000000..a4fa400 --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/ProgressBarController.js | |||
@@ -0,0 +1,143 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
7 | and efficient set of cryptographic functions. The library aims to | ||
8 | obtain maximum execution speed while preserving modularity and | ||
9 | reusability. | ||
10 | For further information about its features and functionalities please | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | it and/or modify it under the terms of the GNU Affero General Public | ||
15 | License as published by the Free Software Foundation, either version | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | Clipperz.Base.module('Clipperz.PM.UI.Common.Controllers'); | ||
30 | |||
31 | Clipperz.PM.UI.Common.Controllers.ProgressBarController = function(args) { | ||
32 | args = args || {}; | ||
33 | |||
34 | this._numberOfSteps= 0; | ||
35 | this._currentStep= 0; | ||
36 | |||
37 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'initProgress', this, 'initProgressHandle'); | ||
38 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'updateProgress',this, 'updateProgressHandle'); | ||
39 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'advanceProgress',this, 'advanceProgressHandle'); | ||
40 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'progressDone', this, 'progressDoneHandle'); | ||
41 | |||
42 | return this; | ||
43 | } | ||
44 | |||
45 | MochiKit.Base.update(Clipperz.PM.UI.Common.Controllers.ProgressBarController.prototype, { | ||
46 | |||
47 | 'toString': function() { | ||
48 | return "Clipperz.PM.UI.Common.Controllers.ProgressBarController"; | ||
49 | }, | ||
50 | |||
51 | //----------------------------------------------------------------------------- | ||
52 | |||
53 | 'numberOfSteps': function() { | ||
54 | return this._numberOfSteps; | ||
55 | }, | ||
56 | |||
57 | 'setNumberOfSteps': function (aValue) { | ||
58 | this._numberOfSteps = aValue; | ||
59 | }, | ||
60 | |||
61 | 'updateNumberOfSteps': function (aValue) { | ||
62 | this._numberOfSteps += aValue; | ||
63 | }, | ||
64 | |||
65 | //----------------------------------------------------------------------------- | ||
66 | |||
67 | 'currentStep': function() { | ||
68 | return this._currentStep; | ||
69 | }, | ||
70 | |||
71 | 'advanceCurrentStep': function () { | ||
72 | this._currentStep ++; | ||
73 | }, | ||
74 | |||
75 | //----------------------------------------------------------------------------- | ||
76 | |||
77 | 'completedPercentage': function () { | ||
78 | var result; | ||
79 | //Clipperz.log(">>> completedPercentage" + this.currentStep() + "/" + this.numberOfSteps(), this.currentStep() / this.numberOfSteps()); | ||
80 | if (this.numberOfSteps() == 0) { | ||
81 | result = 0; | ||
82 | } else { | ||
83 | result = (Math.min(100, 100 * (this.currentStep() / this.numberOfSteps()))); | ||
84 | } | ||
85 | //Clipperz.log("<<< completedPercentage", result); | ||
86 | return result; | ||
87 | }, | ||
88 | |||
89 | //----------------------------------------------------------------------------- | ||
90 | |||
91 | 'resetStatus': function () { | ||
92 | this._numberOfSteps= 0; | ||
93 | this._currentStep= 0; | ||
94 | }, | ||
95 | |||
96 | //----------------------------------------------------------------------------- | ||
97 | |||
98 | 'updateProgress': function () { | ||
99 | //Clipperz.log(">>> updateProgress: " + this.completedPercentage() + "%"); | ||
100 | MochiKit.Signal.signal(this, 'updateProgress', this.completedPercentage()); | ||
101 | }, | ||
102 | |||
103 | //============================================================================= | ||
104 | |||
105 | 'initProgressHandle': function (anEvent) { | ||
106 | //Clipperz.log(">>> initProgressHandle - steps: " + (anEvent != null ? anEvent['steps'] : 0)); | ||
107 | this.resetStatus(); | ||
108 | if (anEvent != null) { | ||
109 | this.setNumberOfSteps(anEvent['steps']); | ||
110 | } | ||
111 | MochiKit.Signal.signal(this, 'initProgress'); | ||
112 | this.updateProgress(); | ||
113 | }, | ||
114 | |||
115 | //............................................................................. | ||
116 | |||
117 | 'updateProgressHandle': function (anEvent) { | ||
118 | this.updateNumberOfSteps(anEvent['extraSteps']); | ||
119 | //Clipperz.log("=== updateProgressHandle - steps: " + this.numberOfSteps() + " (extra " + anEvent['extraSteps'] + ")"); | ||
120 | this.updateProgress(); | ||
121 | }, | ||
122 | |||
123 | //............................................................................. | ||
124 | |||
125 | 'advanceProgressHandle': function (anEvent) { | ||
126 | this.advanceCurrentStep(); | ||
127 | //Clipperz.log("--- advanceProgressHandle: " + this.currentStep() + "/" + this.numberOfSteps()); | ||
128 | this.updateProgress(); | ||
129 | }, | ||
130 | |||
131 | //............................................................................. | ||
132 | |||
133 | 'progressDoneHandle': function (anEvent) { | ||
134 | //Clipperz.log("<<< progressDoneHandle: " + this.currentStep() + "/" + this.numberOfSteps()); | ||
135 | this.resetStatus(); | ||
136 | MochiKit.Signal.signal(this, 'progressDone'); | ||
137 | }, | ||
138 | |||
139 | //============================================================================= | ||
140 | __syntaxFix__: "syntax fix" | ||
141 | }); | ||
142 | |||
143 | Clipperz.PM.UI.Common.Controllers.ProgressBarController.defaultController = new Clipperz.PM.UI.Common.Controllers.ProgressBarController(); | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/TabPanelController.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/TabPanelController.js new file mode 100644 index 0000000..fbc5929 --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/TabPanelController.js | |||
@@ -0,0 +1,188 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
7 | and efficient set of cryptographic functions. The library aims to | ||
8 | obtain maximum execution speed while preserving modularity and | ||
9 | reusability. | ||
10 | For further information about its features and functionalities please | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | it and/or modify it under the terms of the GNU Affero General Public | ||
15 | License as published by the Free Software Foundation, either version | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | Clipperz.Base.module('Clipperz.PM.UI.Common.Controllers'); | ||
30 | |||
31 | Clipperz.PM.UI.Common.Controllers.TabPanelController = function(args) { | ||
32 | args = args || {}; | ||
33 | |||
34 | this._component = args.component; | ||
35 | this._configuration = args.configuration; | ||
36 | this._isEnabled = args.enabled || true; | ||
37 | |||
38 | this._selectedTab = null; | ||
39 | return this; | ||
40 | } | ||
41 | |||
42 | MochiKit.Base.update(Clipperz.PM.UI.Common.Controllers.TabPanelController.prototype, { | ||
43 | |||
44 | 'toString': function() { | ||
45 | return "Clipperz.PM.UI.Common.Controllers.TabPanelController"; | ||
46 | }, | ||
47 | |||
48 | //----------------------------------------------------------------------------- | ||
49 | |||
50 | 'component': function() { | ||
51 | return this._component; | ||
52 | }, | ||
53 | |||
54 | 'configuration': function() { | ||
55 | return this._configuration; | ||
56 | }, | ||
57 | |||
58 | //----------------------------------------------------------------------------- | ||
59 | |||
60 | 'getElement': function(anElementID) { | ||
61 | return this.component().getElement(anElementID); | ||
62 | }, | ||
63 | |||
64 | 'tabForTabElement': function(anElement) { | ||
65 | varresult; | ||
66 | |||
67 | for (result in this.configuration()) { | ||
68 | if (this.getElement(this.configuration()[result]['tab']) == anElement) { | ||
69 | break; | ||
70 | } | ||
71 | } | ||
72 | |||
73 | return result; | ||
74 | }, | ||
75 | |||
76 | //----------------------------------------------------------------------------- | ||
77 | |||
78 | 'setupTab': function(aConfiguration) { | ||
79 | vartabElement; | ||
80 | |||
81 | tabElement = this.getElement(aConfiguration['tab']); | ||
82 | |||
83 | MochiKit.DOM.removeElementClass(tabElement, 'selected'); | ||
84 | MochiKit.Signal.connect(tabElement, 'onclick', this, 'handleTabClick') | ||
85 | }, | ||
86 | |||
87 | 'setupPanel': function(aConfiguration) { | ||
88 | this.hidePanel(aConfiguration['panel']); | ||
89 | }, | ||
90 | |||
91 | 'setup': function(args) { | ||
92 | args = args || {}; | ||
93 | |||
94 | MochiKit.Base.map(MochiKit.Base.method(this, 'setupTab'),MochiKit.Base.values(this.configuration())); | ||
95 | MochiKit.Base.map(MochiKit.Base.method(this, 'setupPanel'),MochiKit.Base.values(this.configuration())); | ||
96 | this.selectTab(args.selected); | ||
97 | }, | ||
98 | |||
99 | //----------------------------------------------------------------------------- | ||
100 | |||
101 | 'hidePanel': function(aPanel) { | ||
102 | MochiKit.DOM.removeElementClass(this.getElement(aPanel), 'selected'); | ||
103 | }, | ||
104 | |||
105 | 'selectTab': function(aTab) { | ||
106 | if ((aTab != this.selectedTab()) && (this.isEnabled())) { | ||
107 | if (this.selectedTab() != null) { | ||
108 | MochiKit.DOM.removeElementClass(this.getElement(this.configuration()[this.selectedTab()]['tab']),'selected'); | ||
109 | MochiKit.DOM.removeElementClass(this.getElement(this.configuration()[this.selectedTab()]['panel']),'selected'); | ||
110 | } | ||
111 | |||
112 | if (aTab != null) { | ||
113 | MochiKit.DOM.addElementClass(this.getElement(this.configuration()[aTab]['tab']),'selected'); | ||
114 | MochiKit.DOM.addElementClass(this.getElement(this.configuration()[aTab]['panel']),'selected'); | ||
115 | } | ||
116 | |||
117 | this.setSelectedTab(aTab); | ||
118 | MochiKit.Signal.signal(this, 'tabSelected', aTab); | ||
119 | } | ||
120 | }, | ||
121 | |||
122 | //----------------------------------------------------------------------------- | ||
123 | |||
124 | 'selectedTab': function() { | ||
125 | return this._selectedTab; | ||
126 | }, | ||
127 | |||
128 | 'setSelectedTab': function(aTab) { | ||
129 | this._selectedTab = aTab; | ||
130 | }, | ||
131 | |||
132 | //----------------------------------------------------------------------------- | ||
133 | |||
134 | 'selectedTabElement': function() { | ||
135 | var result; | ||
136 | |||
137 | if (this.selectedTab() != null) { | ||
138 | result = this.getElement(this.configuration()[this.selectedTab()]['tab']); | ||
139 | } else { | ||
140 | result = null; | ||
141 | } | ||
142 | |||
143 | return null; | ||
144 | }, | ||
145 | |||
146 | 'selectedTabPanelElement': function() { | ||
147 | var result; | ||
148 | |||
149 | if (this.selectedTab() != null) { | ||
150 | result = this.getElement(this.configuration()[this.selectedTab()]['panel']); | ||
151 | } else { | ||
152 | result = null; | ||
153 | } | ||
154 | |||
155 | return result; | ||
156 | }, | ||
157 | |||
158 | //----------------------------------------------------------------------------- | ||
159 | |||
160 | 'handleTabClick': function(anEvent) { | ||
161 | this.selectTab(this.tabForTabElement(anEvent.src())); | ||
162 | anEvent.preventDefault(); | ||
163 | }, | ||
164 | |||
165 | //============================================================================= | ||
166 | |||
167 | 'isEnabled': function () { | ||
168 | return this._isEnabled; | ||
169 | }, | ||
170 | |||
171 | 'enable': function () { | ||
172 | this._isEnabled = true; | ||
173 | MochiKit.Base.map(MochiKit.Base.bind(function (aTabComponentID) { | ||
174 | MochiKit.DOM.removeElementClass(this.getElement(this.configuration()[aTabComponentID]['tab']), 'disabled'); | ||
175 | }, this), MochiKit.Base.keys(this.configuration())); | ||
176 | }, | ||
177 | |||
178 | 'disable': function () { | ||
179 | this._isEnabled = false; | ||
180 | MochiKit.Base.map(MochiKit.Base.bind(function (aTabComponentID) { | ||
181 | MochiKit.DOM.addElementClass(this.getElement(this.configuration()[aTabComponentID]['tab']), 'disabled'); | ||
182 | }, this), MochiKit.Base.keys(this.configuration())); | ||
183 | }, | ||
184 | |||
185 | //============================================================================= | ||
186 | |||
187 | __syntaxFix__: "syntax fix" | ||
188 | }); | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/WizardController.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/WizardController.js new file mode 100644 index 0000000..868cea6 --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/WizardController.js | |||
@@ -0,0 +1,31 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
7 | and efficient set of cryptographic functions. The library aims to | ||
8 | obtain maximum execution speed while preserving modularity and | ||
9 | reusability. | ||
10 | For further information about its features and functionalities please | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | it and/or modify it under the terms of the GNU Affero General Public | ||
15 | License as published by the Free Software Foundation, either version | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | //Still empty, but here it should be reasonable to factor in code duplicated between | ||
30 | //- DirectLoginWizardController | ||
31 | //- NewUserWizardController \ No newline at end of file | ||