author | Clipperz <info@clipperz.com> | 2013-01-08 15:21:04 (UTC) |
---|---|---|
committer | Clipperz <info@clipperz.com> | 2013-01-08 15:21:04 (UTC) |
commit | 816fc35420a434b1d54ae5833d617608f7456048 (patch) (unidiff) | |
tree | 95b8caf354083593d7775e4dda6f4c556b44a2d9 /frontend/gamma/js/Clipperz/PM/UI | |
parent | 267603e3aa3cf0029411e67ae14018b52344c296 (diff) | |
download | clipperz-816fc35420a434b1d54ae5833d617608f7456048.zip clipperz-816fc35420a434b1d54ae5833d617608f7456048.tar.gz clipperz-816fc35420a434b1d54ae5833d617608f7456048.tar.bz2 |
Updated version of /gamma
Tons of changes, included a new draft of the mobile version (still VERY rough)
Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/UI') (more/less context) (ignore whitespace changes)
15 files changed, 1246 insertions, 783 deletions
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/BaseComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/BaseComponent.js index 2a03fdf..b9d7adf 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/BaseComponent.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/BaseComponent.js | |||
@@ -313,192 +313,196 @@ Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.BaseComponent, /*Ext.Compo | |||
313 | //----------------------------------------------------- | 313 | //----------------------------------------------------- |
314 | /* | 314 | /* |
315 | 'purgeListeners': function() { | 315 | 'purgeListeners': function() { |
316 | //MochiKit.Logging.logDebug(">>> Clipperz.PM.UI.Common.Components.BaseComponent.purgeListeners [" + this + "]"); | 316 | //MochiKit.Logging.logDebug(">>> Clipperz.PM.UI.Common.Components.BaseComponent.purgeListeners [" + this + "]"); |
317 | //MochiKit.Logging.logDebug("--- " + this + ".purgeListeners"); | 317 | //MochiKit.Logging.logDebug("--- " + this + ".purgeListeners"); |
318 | Clipperz.NotificationCenter.unregister(this); | 318 | Clipperz.NotificationCenter.unregister(this); |
319 | MochiKit.Signal.disconnectAllTo(this); | 319 | MochiKit.Signal.disconnectAllTo(this); |
320 | //MochiKit.Logging.logDebug("<<< Clipperz.PM.UI.Common.Components.BaseComponent.purgeListeners"); | 320 | //MochiKit.Logging.logDebug("<<< Clipperz.PM.UI.Common.Components.BaseComponent.purgeListeners"); |
321 | }, | 321 | }, |
322 | */ | 322 | */ |
323 | //----------------------------------------------------- | 323 | //----------------------------------------------------- |
324 | 324 | ||
325 | 'clear': function() { | 325 | 'clear': function() { |
326 | varslotName; | 326 | varslotName; |
327 | var componentId; | 327 | var componentId; |
328 | 328 | ||
329 | MochiKit.Signal.disconnectAllTo(this); | 329 | MochiKit.Signal.disconnectAllTo(this); |
330 | 330 | ||
331 | for (slotName in this.slotComponents()) { | 331 | for (slotName in this.slotComponents()) { |
332 | this.slotComponents()[slotName].clear(); | 332 | this.slotComponents()[slotName].clear(); |
333 | } | 333 | } |
334 | 334 | ||
335 | for (componentId in this.components()) { | 335 | for (componentId in this.components()) { |
336 | this.components()[componentId].clear(); | 336 | this.components()[componentId].clear(); |
337 | } | 337 | } |
338 | 338 | ||
339 | // if (this.element() != null) { | 339 | // if (this.element() != null) { |
340 | // this.element().innerHTML = ""; | 340 | // this.element().innerHTML = ""; |
341 | // } | 341 | // } |
342 | 342 | ||
343 | if (this.displayElement() != null) { | 343 | if (this.displayElement() != null) { |
344 | if (this.element() != this.displayElement()) { | 344 | if (this.element() != this.displayElement()) { |
345 | MochiKit.DOM.removeElement(this.displayElement()); | 345 | MochiKit.DOM.removeElement(this.displayElement()); |
346 | } else { | 346 | } else { |
347 | this.displayElement().innerHTML = ""; | 347 | this.displayElement().innerHTML = ""; |
348 | } | 348 | } |
349 | } | 349 | } |
350 | 350 | ||
351 | if (this.isModal()) { | 351 | if (this.isModal()) { |
352 | //TODO: cleanup when the closed element was shown modally. | 352 | //TODO: cleanup when the closed element was shown modally. |
353 | } | 353 | } |
354 | }, | 354 | }, |
355 | 355 | ||
356 | 356 | ||
357 | 'remove': function() { | 357 | 'remove': function() { |
358 | varslotName; | 358 | varslotName; |
359 | var componentId; | 359 | var componentId; |
360 | 360 | ||
361 | for (slotName in this.slotComponents()) { | 361 | for (slotName in this.slotComponents()) { |
362 | this.slotComponents()[slotName].remove(); | 362 | this.slotComponents()[slotName].remove(); |
363 | delete this.slotComponents()[slotName]; | 363 | delete this.slotComponents()[slotName]; |
364 | } | 364 | } |
365 | 365 | ||
366 | for (componentId in this.components()) { | 366 | for (componentId in this.components()) { |
367 | this.components()[componentId].remove(); | 367 | this.components()[componentId].remove(); |
368 | delete this.components()[componentId]; | 368 | delete this.components()[componentId]; |
369 | } | 369 | } |
370 | 370 | ||
371 | this.clear(); | 371 | this.clear(); |
372 | MochiKit.Signal.disconnectAll(this); | 372 | MochiKit.Signal.disconnectAll(this); |
373 | }, | 373 | }, |
374 | 374 | ||
375 | 'append': function(aNode, aValue) { | 375 | 'append': function(aNode, aValue) { |
376 | return Clipperz.DOM.Helper.append(aNode, aValue); | 376 | return Clipperz.DOM.Helper.append(aNode, aValue); |
377 | }, | 377 | }, |
378 | 378 | ||
379 | 'insertBefore': function (aNode, aValue) { | 379 | 'insertBefore': function (aNode, aValue) { |
380 | return Clipperz.DOM.Helper.insertBefore(aNode, aValue); | 380 | return Clipperz.DOM.Helper.insertBefore(aNode, aValue); |
381 | }, | 381 | }, |
382 | 382 | ||
383 | 'insertAfter': function (aNode, aValue) { | 383 | 'insertAfter': function (aNode, aValue) { |
384 | return Clipperz.DOM.Helper.insertAfter(aNode, aValue); | 384 | return Clipperz.DOM.Helper.insertAfter(aNode, aValue); |
385 | }, | 385 | }, |
386 | 386 | ||
387 | //------------------------------------------------------------------------- | 387 | //------------------------------------------------------------------------- |
388 | 388 | ||
389 | 'getId': function(aValue) { | 389 | 'getId': function(aValue) { |
390 | varresult; | 390 | varresult; |
391 | 391 | ||
392 | if (typeof(aValue) != 'undefined') { | 392 | if (typeof(aValue) != 'undefined') { |
393 | result = this._ids[aValue]; | 393 | result = this._ids[aValue]; |
394 | 394 | ||
395 | if (typeof(result) == 'undefined') { | 395 | if (typeof(result) == 'undefined') { |
396 | _Clipperz_PM_Components_base_id_ ++; | 396 | _Clipperz_PM_Components_base_id_ ++; |
397 | 397 | ||
398 | result = "Clipperz_PM_Components_" + aValue + "_" + _Clipperz_PM_Components_base_id_; | 398 | result = "Clipperz_PM_Components_" + aValue + "_" + _Clipperz_PM_Components_base_id_; |
399 | this._ids[aValue] = result; | 399 | this._ids[aValue] = result; |
400 | } | 400 | } |
401 | } else { | 401 | } else { |
402 | // result = Clipperz.PM.UI.Common.Components.BaseComponent.superclass.getId.call(this); | 402 | // result = Clipperz.PM.UI.Common.Components.BaseComponent.superclass.getId.call(this); |
403 | throw "call to BaseComponent.getId with an undefined value"; | 403 | throw "call to BaseComponent.getId with an undefined value"; |
404 | } | 404 | } |
405 | 405 | ||
406 | return result; | 406 | return result; |
407 | }, | 407 | }, |
408 | 408 | ||
409 | 'getAnchor': function (aValue) { | ||
410 | return '#' + this.getId(aValue); | ||
411 | }, | ||
412 | |||
409 | //------------------------------------------------------------------------- | 413 | //------------------------------------------------------------------------- |
410 | 414 | ||
411 | 'getElement': function(aValue) { | 415 | 'getElement': function(aValue) { |
412 | return Clipperz.DOM.get(this.getId(aValue)); | 416 | return Clipperz.DOM.get(this.getId(aValue)); |
413 | }, | 417 | }, |
414 | 418 | ||
415 | //------------------------------------------------------------------------- | 419 | //------------------------------------------------------------------------- |
416 | 420 | ||
417 | 'hideElement': function(anElementName) { | 421 | 'hideElement': function(anElementName) { |
418 | MochiKit.Style.hideElement(this.getElement(anElementName)); | 422 | MochiKit.Style.hideElement(this.getElement(anElementName)); |
419 | }, | 423 | }, |
420 | 424 | ||
421 | 'showElement': function(anElementName) { | 425 | 'showElement': function(anElementName) { |
422 | MochiKit.Style.showElement(this.getElement(anElementName)); | 426 | MochiKit.Style.showElement(this.getElement(anElementName)); |
423 | }, | 427 | }, |
424 | 428 | ||
425 | //------------------------------------------------------------------------- | 429 | //------------------------------------------------------------------------- |
426 | 430 | ||
427 | 'activate': function () { | 431 | 'activate': function () { |
428 | this._isActive = true; | 432 | this._isActive = true; |
429 | }, | 433 | }, |
430 | 434 | ||
431 | 'deactivate': function () { | 435 | 'deactivate': function () { |
432 | this._isActive = false; | 436 | this._isActive = false; |
433 | }, | 437 | }, |
434 | 438 | ||
435 | 'isActive': function () { | 439 | 'isActive': function () { |
436 | return this._isActive; | 440 | return this._isActive; |
437 | }, | 441 | }, |
438 | 442 | ||
439 | //------------------------------------------------------------------------- | 443 | //------------------------------------------------------------------------- |
440 | 444 | ||
441 | 'hideSlot': function(aSlotName) { | 445 | 'hideSlot': function(aSlotName) { |
442 | if (this.componentForSlotNamed(aSlotName)) { | 446 | if (this.componentForSlotNamed(aSlotName)) { |
443 | this.componentForSlotNamed(aSlotName).deactivate(); | 447 | this.componentForSlotNamed(aSlotName).deactivate(); |
444 | } | 448 | } |
445 | MochiKit.Style.hideElement(this.elementForSlotNamed(aSlotName)); | 449 | MochiKit.Style.hideElement(this.elementForSlotNamed(aSlotName)); |
446 | }, | 450 | }, |
447 | 451 | ||
448 | 'showSlot': function(aSlotName) { | 452 | 'showSlot': function(aSlotName) { |
449 | if (this.componentForSlotNamed(aSlotName)) { | 453 | if (this.componentForSlotNamed(aSlotName)) { |
450 | this.componentForSlotNamed(aSlotName).activate(); | 454 | this.componentForSlotNamed(aSlotName).activate(); |
451 | } | 455 | } |
452 | MochiKit.Style.showElement(this.elementForSlotNamed(aSlotName)); | 456 | MochiKit.Style.showElement(this.elementForSlotNamed(aSlotName)); |
453 | }, | 457 | }, |
454 | 458 | ||
455 | //------------------------------------------------------------------------- | 459 | //------------------------------------------------------------------------- |
456 | 460 | ||
457 | 'shouldShowTranslationHints': function () { | 461 | 'shouldShowTranslationHints': function () { |
458 | return false; | 462 | return false; |
459 | }, | 463 | }, |
460 | 464 | ||
461 | 'shouldShowElementWhileRendering': function() { | 465 | 'shouldShowElementWhileRendering': function() { |
462 | return true; | 466 | return true; |
463 | }, | 467 | }, |
464 | 468 | ||
465 | //'shouldRemoveElementWhenClearningUp': function () { | 469 | //'shouldRemoveElementWhenClearningUp': function () { |
466 | // return true; | 470 | // return true; |
467 | //}, | 471 | //}, |
468 | 472 | ||
469 | //------------------------------------------------------------------------- | 473 | //------------------------------------------------------------------------- |
470 | 474 | ||
471 | 'isModal': function() { | 475 | 'isModal': function() { |
472 | return this._isModal; | 476 | return this._isModal; |
473 | }, | 477 | }, |
474 | 478 | ||
475 | 'setIsModal': function(aValue) { | 479 | 'setIsModal': function(aValue) { |
476 | this._isModal = aValue; | 480 | this._isModal = aValue; |
477 | }, | 481 | }, |
478 | 482 | ||
479 | //------------------------------------------------------------------------- | 483 | //------------------------------------------------------------------------- |
480 | 484 | ||
481 | 'elementUsedToEnterModalState': function () { | 485 | 'elementUsedToEnterModalState': function () { |
482 | return this._elementUsedToEnterModalState; | 486 | return this._elementUsedToEnterModalState; |
483 | }, | 487 | }, |
484 | 488 | ||
485 | 'setElementUsedToEnterModalState': function (aValue) { | 489 | 'setElementUsedToEnterModalState': function (aValue) { |
486 | this._elementUsedToEnterModalState = aValue; | 490 | this._elementUsedToEnterModalState = aValue; |
487 | }, | 491 | }, |
488 | 492 | ||
489 | //------------------------------------------------------------------------- | 493 | //------------------------------------------------------------------------- |
490 | 494 | ||
491 | 'modalDialogMask': function () { | 495 | 'modalDialogMask': function () { |
492 | return 'modalDialogMask'; | 496 | return 'modalDialogMask'; |
493 | }, | 497 | }, |
494 | 498 | ||
495 | 'modalDialog': function () { | 499 | 'modalDialog': function () { |
496 | return 'modalDialog'; | 500 | return 'modalDialog'; |
497 | }, | 501 | }, |
498 | 502 | ||
499 | 'modalDialogFrame': function() { | 503 | 'modalDialogFrame': function() { |
500 | return 'modalDialogFrame' | 504 | return 'modalDialogFrame' |
501 | }, | 505 | }, |
502 | 506 | ||
503 | //------------------------------------------------------------------------- | 507 | //------------------------------------------------------------------------- |
504 | 508 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Button.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Button.js index 716d851..1010c9d 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Button.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Button.js | |||
@@ -1,105 +1,113 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2011 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz Community Edition. |
6 | Clipperz Community Edition is an online password manager. | 6 | Clipperz Community Edition is an online password manager. |
7 | For further information about its features and functionalities please | 7 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 8 | refer to http://www.clipperz.com. |
9 | 9 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 10 | * Clipperz Community Edition is free software: you can redistribute |
11 | it and/or modify it under the terms of the GNU Affero General Public | 11 | it and/or modify it under the terms of the GNU Affero General Public |
12 | License as published by the Free Software Foundation, either version | 12 | License as published by the Free Software Foundation, either version |
13 | 3 of the License, or (at your option) any later version. | 13 | 3 of the License, or (at your option) any later version. |
14 | 14 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 15 | * Clipperz Community Edition is distributed in the hope that it will |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 16 | be useful, but WITHOUT ANY WARRANTY; without even the implied |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 18 | See the GNU Affero General Public License for more details. |
19 | 19 | ||
20 | * You should have received a copy of the GNU Affero General Public | 20 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 21 | License along with Clipperz Community Edition. If not, see |
22 | <http://www.gnu.org/licenses/>. | 22 | <http://www.gnu.org/licenses/>. |
23 | 23 | ||
24 | */ | 24 | */ |
25 | 25 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); | 26 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); |
27 | 27 | ||
28 | Clipperz.PM.UI.Common.Components.Button = function(args) { | 28 | Clipperz.PM.UI.Common.Components.Button = function(args) { |
29 | args = args || {}; | 29 | args = args || {}; |
30 | 30 | ||
31 | Clipperz.PM.UI.Common.Components.Button.superclass.constructor.apply(this, arguments); | 31 | Clipperz.PM.UI.Common.Components.Button.superclass.constructor.apply(this, arguments); |
32 | 32 | ||
33 | this._element = args.element || Clipperz.Base.exception.raise('MandatoryParameter'); | 33 | this._element = args.element || Clipperz.Base.exception.raise('MandatoryParameter'); |
34 | this._text = args.text || Clipperz.Base.exception.raise('MandatoryParameter'); | 34 | this._text = args.text || Clipperz.Base.exception.raise('MandatoryParameter'); |
35 | this._isDefault = args.isDefault|| false; | 35 | this._isDefault = args.isDefault|| false; |
36 | 36 | ||
37 | this.render(); | 37 | this.render(); |
38 | 38 | ||
39 | return this; | 39 | return this; |
40 | } | 40 | } |
41 | 41 | ||
42 | //============================================================================= | 42 | //============================================================================= |
43 | 43 | ||
44 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.Button, Clipperz.PM.UI.Common.Components.BaseComponent, { | 44 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.Button, Clipperz.PM.UI.Common.Components.BaseComponent, { |
45 | 45 | ||
46 | //------------------------------------------------------------------------- | 46 | //------------------------------------------------------------------------- |
47 | 47 | ||
48 | 'toString': function () { | 48 | 'toString': function () { |
49 | return "Clipperz.PM.UI.Common.Components.Button component"; | 49 | return "Clipperz.PM.UI.Common.Components.Button component"; |
50 | }, | 50 | }, |
51 | 51 | ||
52 | //------------------------------------------------------------------------- | 52 | //------------------------------------------------------------------------- |
53 | 53 | ||
54 | 'text': function () { | 54 | 'text': function () { |
55 | return this._text; | 55 | return this._text; |
56 | }, | 56 | }, |
57 | 57 | ||
58 | 'isDefault': function () { | 58 | 'isDefault': function () { |
59 | return this._isDefault; | 59 | return this._isDefault; |
60 | }, | 60 | }, |
61 | 61 | ||
62 | //------------------------------------------------------------------------- | 62 | //------------------------------------------------------------------------- |
63 | 63 | ||
64 | 'renderSelf': function () { | 64 | 'renderSelf': function () { |
65 | this.append(this.element(), {tag:'div', id:this.getId('wrapper'), cls:'button_wrapper', children:[ | 65 | /* |
66 | this.append(this.element(), {tag:'div', id:this.getId('button'), cls:'button_wrapper', children:[ | ||
66 | {tag:'div', id:this.getId('bodyWrapper'), cls:'button_bodyWrapper', children:[ | 67 | {tag:'div', id:this.getId('bodyWrapper'), cls:'button_bodyWrapper', children:[ |
67 | {tag:'div', id:this.getId('body'), cls:'button_body', children:[ | 68 | {tag:'div', id:this.getId('body'), cls:'button_body', children:[ |
68 | {tag:'span', html:this.text()} | 69 | {tag:'span', html:this.text()} |
69 | ]}, | 70 | ]}, |
70 | {tag:'div', id:this.getId('footer'), cls:'button_footer'} | 71 | {tag:'div', id:this.getId('footer'), cls:'button_footer'} |
71 | ]} | 72 | ]} |
72 | ]}); | 73 | ]}); |
74 | */ | ||
75 | /* | ||
76 | this.append(this.element(), {tag:'div', id:this.getId('button'), cls:'button', children:[ | ||
77 | {tag:'span', html:this.text()} | ||
78 | ]}); | ||
79 | */ | ||
80 | this.append(this.element(), {tag:'a', id:this.getId('button'), cls:'button', html:this.text()}); | ||
73 | 81 | ||
74 | if (this.isDefault()) { | 82 | if (this.isDefault()) { |
75 | MochiKit.DOM.addElementClass(this.getId('wrapper'), 'default'); | 83 | MochiKit.DOM.addElementClass(this.getId('button'), 'default'); |
76 | } | 84 | } |
77 | 85 | ||
78 | MochiKit.Signal.connect(this.getId('wrapper'), 'onmouseenter',this, 'handleOnMouseEnter'); | 86 | // MochiKit.Signal.connect(this.getId('button'), 'onmouseenter',this, 'handleOnMouseEnter'); |
79 | MochiKit.Signal.connect(this.getId('wrapper'), 'onmouseleave',this, 'handleOnMouseLeave'); | 87 | // MochiKit.Signal.connect(this.getId('button'), 'onmouseleave',this, 'handleOnMouseLeave'); |
80 | MochiKit.Signal.connect(this.getId('wrapper'), 'onmousedown',this, 'handleOnMouseDown'); | 88 | // MochiKit.Signal.connect(this.getId('button'), 'onmousedown',this, 'handleOnMouseDown'); |
81 | MochiKit.Signal.connect(this.getId('wrapper'), 'onclick', this, 'handleOnClick'); | 89 | MochiKit.Signal.connect(this.getId('button'), 'onclick', this, 'handleOnClick'); |
82 | }, | 90 | }, |
83 | 91 | ||
84 | //------------------------------------------------------------------------- | 92 | //------------------------------------------------------------------------- |
85 | 93 | /* | |
86 | 'handleOnMouseEnter': function (anEvent) { | 94 | 'handleOnMouseEnter': function (anEvent) { |
87 | MochiKit.DOM.addElementClass(this.getId('wrapper'), 'hover'); | 95 | MochiKit.DOM.addElementClass(this.getId('button'), 'hover'); |
88 | }, | 96 | }, |
89 | 97 | ||
90 | 'handleOnMouseLeave': function (anEvent) { | 98 | 'handleOnMouseLeave': function (anEvent) { |
91 | MochiKit.DOM.removeElementClass(this.getId('wrapper'), 'hover'); | 99 | MochiKit.DOM.removeElementClass(this.getId('button'), 'hover'); |
92 | MochiKit.DOM.removeElementClass(this.getId('wrapper'), 'clicked'); | 100 | MochiKit.DOM.removeElementClass(this.getId('button'), 'clicked'); |
93 | }, | 101 | }, |
94 | 102 | ||
95 | 'handleOnMouseDown': function (anEvent) { | 103 | 'handleOnMouseDown': function (anEvent) { |
96 | MochiKit.DOM.addElementClass(this.getId('wrapper'), 'clicked'); | 104 | MochiKit.DOM.addElementClass(this.getId('button'), 'clicked'); |
97 | }, | 105 | }, |
98 | 106 | */ | |
99 | 'handleOnClick': function (anEvent) { | 107 | 'handleOnClick': function (anEvent) { |
100 | MochiKit.Signal.signal(this, 'onclick', anEvent); | 108 | MochiKit.Signal.signal(this, 'onclick', anEvent); |
101 | }, | 109 | }, |
102 | 110 | ||
103 | //------------------------------------------------------------------------- | 111 | //------------------------------------------------------------------------- |
104 | __syntaxFix__: "syntax fix" | 112 | __syntaxFix__: "syntax fix" |
105 | }); | 113 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/SimpleMessagePanel.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/SimpleMessagePanel.js index 1992154..1d816a9 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/SimpleMessagePanel.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/SimpleMessagePanel.js | |||
@@ -5,237 +5,255 @@ Copyright 2008-2011 Clipperz Srl | |||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz Community Edition. |
6 | Clipperz Community Edition is an online password manager. | 6 | Clipperz Community Edition is an online password manager. |
7 | For further information about its features and functionalities please | 7 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 8 | refer to http://www.clipperz.com. |
9 | 9 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 10 | * Clipperz Community Edition is free software: you can redistribute |
11 | it and/or modify it under the terms of the GNU Affero General Public | 11 | it and/or modify it under the terms of the GNU Affero General Public |
12 | License as published by the Free Software Foundation, either version | 12 | License as published by the Free Software Foundation, either version |
13 | 3 of the License, or (at your option) any later version. | 13 | 3 of the License, or (at your option) any later version. |
14 | 14 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 15 | * Clipperz Community Edition is distributed in the hope that it will |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 16 | be useful, but WITHOUT ANY WARRANTY; without even the implied |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 18 | See the GNU Affero General Public License for more details. |
19 | 19 | ||
20 | * You should have received a copy of the GNU Affero General Public | 20 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 21 | License along with Clipperz Community Edition. If not, see |
22 | <http://www.gnu.org/licenses/>. | 22 | <http://www.gnu.org/licenses/>. |
23 | 23 | ||
24 | */ | 24 | */ |
25 | 25 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 27 | ||
28 | Clipperz.PM.UI.Common.Components.SimpleMessagePanel = function(args) { | 28 | Clipperz.PM.UI.Common.Components.SimpleMessagePanel = function(args) { |
29 | args = args || {}; | 29 | args = args || {}; |
30 | 30 | ||
31 | Clipperz.PM.UI.Common.Components.SimpleMessagePanel.superclass.constructor.apply(this, arguments); | 31 | Clipperz.PM.UI.Common.Components.SimpleMessagePanel.superclass.constructor.apply(this, arguments); |
32 | 32 | ||
33 | this._title = args.title || Clipperz.Base.exception.raise('MandatoryParameter'); | 33 | this._title = args.title || Clipperz.Base.exception.raise('MandatoryParameter'); |
34 | this._text = args.text || Clipperz.Base.exception.raise('MandatoryParameter'); | 34 | this._text = args.text || Clipperz.Base.exception.raise('MandatoryParameter'); |
35 | this._type = args.type || Clipperz.Base.exception.raise('MandatoryParameter'); //ALERT, INFO, ERROR | 35 | this._type = args.type || Clipperz.Base.exception.raise('MandatoryParameter'); //ALERT, INFO, ERROR |
36 | this._buttons = args.buttons || Clipperz.Base.exception.raise('MandatoryParameter'); | 36 | this._buttons = args.buttons || Clipperz.Base.exception.raise('MandatoryParameter'); |
37 | 37 | ||
38 | this._buttonComponents = []; | 38 | this._buttonComponents = []; |
39 | this._deferred = null; | 39 | this._deferred = null; |
40 | 40 | ||
41 | this.renderModalMask(); | 41 | this.renderModalMask(); |
42 | 42 | ||
43 | return this; | 43 | return this; |
44 | } | 44 | } |
45 | 45 | ||
46 | //============================================================================= | 46 | //============================================================================= |
47 | 47 | ||
48 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.SimpleMessagePanel, Clipperz.PM.UI.Common.Components.BaseComponent, { | 48 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.SimpleMessagePanel, Clipperz.PM.UI.Common.Components.BaseComponent, { |
49 | 49 | ||
50 | //------------------------------------------------------------------------- | 50 | //------------------------------------------------------------------------- |
51 | 51 | ||
52 | 'toString': function () { | 52 | 'toString': function () { |
53 | return "Clipperz.PM.UI.Common.Components.SimpleMessagePanel component"; | 53 | return "Clipperz.PM.UI.Common.Components.SimpleMessagePanel component"; |
54 | }, | 54 | }, |
55 | 55 | ||
56 | //------------------------------------------------------------------------- | 56 | //------------------------------------------------------------------------- |
57 | 57 | ||
58 | 'deferred': function() { | 58 | 'deferred': function() { |
59 | if (this._deferred == null) { | 59 | if (this._deferred == null) { |
60 | this._deferred = new Clipperz.Async.Deferred("SimpleMessagePanel.deferred", {trace:false}); | 60 | this._deferred = new Clipperz.Async.Deferred("SimpleMessagePanel.deferred", {trace:false}); |
61 | } | 61 | } |
62 | 62 | ||
63 | return this._deferred; | 63 | return this._deferred; |
64 | }, | 64 | }, |
65 | 65 | ||
66 | //------------------------------------------------------------------------- | 66 | //------------------------------------------------------------------------- |
67 | 67 | ||
68 | 'title': function () { | 68 | 'title': function () { |
69 | return this._title; | 69 | return this._title; |
70 | }, | 70 | }, |
71 | 71 | ||
72 | 'setTitle': function (aValue) { | 72 | 'setTitle': function (aValue) { |
73 | this._title = aValue; | 73 | this._title = aValue; |
74 | 74 | ||
75 | if (this.getElement('title') != null) { | 75 | if (this.getElement('title') != null) { |
76 | this.getElement('title').innerHTML = aValue; | 76 | this.getElement('title').innerHTML = aValue; |
77 | } | 77 | } |
78 | }, | 78 | }, |
79 | 79 | ||
80 | //------------------------------------------------------------------------- | 80 | //------------------------------------------------------------------------- |
81 | 81 | ||
82 | 'text': function () { | 82 | 'text': function () { |
83 | return this._text; | 83 | return this._text; |
84 | }, | 84 | }, |
85 | 85 | ||
86 | 'setText': function (aValue) { | 86 | 'setText': function (aValue) { |
87 | this._text = aValue; | 87 | this._text = aValue; |
88 | 88 | ||
89 | if (this.getElement('text') != null) { | 89 | if (this.getElement('text') != null) { |
90 | this.getElement('text').innerHTML = aValue; | 90 | this.getElement('text').innerHTML = aValue; |
91 | } | 91 | } |
92 | }, | 92 | }, |
93 | 93 | ||
94 | //------------------------------------------------------------------------- | 94 | //------------------------------------------------------------------------- |
95 | 95 | ||
96 | 'type': function () { | 96 | 'type': function () { |
97 | return this._type; | 97 | return this._type; |
98 | }, | 98 | }, |
99 | 99 | ||
100 | 'setType': function (aValue) { | 100 | 'setType': function (aValue) { |
101 | if (this.getElement('icon') != null) { | 101 | // if (this.getElement('icon') != null) { |
102 | MochiKit.DOM.removeElementClass(this.getId('icon'), this._type); | 102 | // MochiKit.DOM.removeElementClass(this.getId('icon'), this._type); |
103 | MochiKit.DOM.addElementClass(this.getId('icon'), aValue); | 103 | // MochiKit.DOM.addElementClass(this.getId('icon'), aValue); |
104 | } | 104 | // } |
105 | 105 | ||
106 | this._type = aValue; | 106 | this._type = aValue; |
107 | }, | 107 | }, |
108 | 108 | ||
109 | 'icon': function () { | ||
110 | var type = this.type(); | ||
111 | var result; | ||
112 | |||
113 | if (type == 'ALERT') { | ||
114 | result = '!'; | ||
115 | } else if (type == 'INFO') { | ||
116 | result = 'i'; | ||
117 | } else if (type == 'ERROR') { | ||
118 | result = '!'; | ||
119 | } | ||
120 | |||
121 | return result; | ||
122 | }, | ||
123 | |||
109 | //------------------------------------------------------------------------- | 124 | //------------------------------------------------------------------------- |
110 | 125 | ||
111 | 'buttons': function () { | 126 | 'buttons': function () { |
112 | return this._buttons; | 127 | return this._buttons; |
113 | }, | 128 | }, |
114 | 129 | ||
115 | 'setButtons': function (someValues) { | 130 | 'setButtons': function (someValues) { |
116 | MochiKit.Iter.forEach(this.buttonComponents(), MochiKit.Base.methodcaller('clear')); | 131 | MochiKit.Iter.forEach(this.buttonComponents(), MochiKit.Base.methodcaller('clear')); |
117 | 132 | ||
118 | this._buttons = someValues; | 133 | this._buttons = someValues; |
119 | 134 | ||
120 | if (this.getElement('buttonArea') != null) { | 135 | if (this.getElement('buttonArea') != null) { |
121 | this.renderButtons(); | 136 | this.renderButtons(); |
122 | } | 137 | } |
123 | }, | 138 | }, |
124 | 139 | ||
125 | //......................................................................... | 140 | //......................................................................... |
126 | 141 | ||
127 | 'buttonComponents': function () { | 142 | 'buttonComponents': function () { |
128 | return this._buttonComponents; | 143 | return this._buttonComponents; |
129 | }, | 144 | }, |
130 | 145 | ||
131 | //------------------------------------------------------------------------- | 146 | //------------------------------------------------------------------------- |
132 | 147 | ||
133 | 'renderSelf': function() { | 148 | 'renderSelf': function() { |
134 | this.append(this.element(), {tag:'div', cls:'SimpleMessagePanel', id:this.getId('panel'), children: [ | 149 | this.append(this.element(), {tag:'div', cls:'SimpleMessagePanel', id:this.getId('panel'), children: [ |
135 | {tag:'div', cls:'header', children:[]}, | 150 | // {tag:'div', cls:'header', children:[]}, |
136 | {tag:'div', cls:'body', children:[ | 151 | {tag:'div', cls:'body', children:[ |
137 | {tag:'div', id:this.getId('icon'),cls:'img ' + this.type(), children:[{tag:'div'}]}, | 152 | // {tag:'div', id:this.getId('icon'),cls:'img ' + this.type(), children:[{tag:'div'}]}, |
153 | {tag:'div', /*id:this.getId('icon'),*/cls:'img ' + this.type(), children:[{tag:'canvas', id:this.getId('icon')}]}, | ||
138 | {tag:'h3', id:this.getId('title'),html:this.title()}, | 154 | {tag:'h3', id:this.getId('title'),html:this.title()}, |
139 | {tag:'p', id:this.getId('text'),html:this.text()}, | 155 | {tag:'p', id:this.getId('text'),html:this.text()}, |
140 | {tag:'div', id:this.getId('container')}, | 156 | {tag:'div', id:this.getId('container')}, |
141 | {tag:'div', id:this.getId('buttonArea'), cls:'buttonArea', children:[]} | 157 | {tag:'div', id:this.getId('buttonArea'), cls:'buttonArea', children:[]} |
142 | ]}, | 158 | ]} |
143 | {tag:'div', cls:'footer', children:[]} | 159 | // {tag:'div', cls:'footer', children:[]} |
144 | ]}); | 160 | ]}); |
145 | 161 | ||
162 | Clipperz.PM.UI.Canvas.marks[this.icon()](this.getElement('icon'), "#ffffff"); | ||
163 | |||
146 | MochiKit.Signal.connect(this.getId('panel'), 'onkeydown', this, 'keyDownHandler'); | 164 | MochiKit.Signal.connect(this.getId('panel'), 'onkeydown', this, 'keyDownHandler'); |
147 | 165 | ||
148 | this.renderButtons(); | 166 | this.renderButtons(); |
149 | }, | 167 | }, |
150 | 168 | ||
151 | //------------------------------------------------------------------------- | 169 | //------------------------------------------------------------------------- |
152 | 170 | ||
153 | 'renderButtons': function () { | 171 | 'renderButtons': function () { |
154 | this.getElement('buttonArea').innerHTML = ''; | 172 | this.getElement('buttonArea').innerHTML = ''; |
155 | 173 | ||
156 | MochiKit.Base.map(MochiKit.Base.bind(function (aButton) { | 174 | MochiKit.Base.map(MochiKit.Base.bind(function (aButton) { |
157 | var buttonElement; | 175 | var buttonElement; |
158 | var buttonComponent; | 176 | var buttonComponent; |
159 | 177 | ||
160 | // element = this.append(this.getElement('buttonArea'), {tag:'div', cls:'button' + (aButton['isDefault'] === true ? ' default' : ''), children:[ | 178 | // element = this.append(this.getElement('buttonArea'), {tag:'div', cls:'button' + (aButton['isDefault'] === true ? ' default' : ''), children:[ |
161 | // {tag:'a', href:'#'/*, id:this.getId('buttonLink')*/, html:aButton['text']} | 179 | // {tag:'a', href:'#'/*, id:this.getId('buttonLink')*/, html:aButton['text']} |
162 | // ]}); | 180 | // ]}); |
163 | 181 | ||
164 | buttonElement = this.append(this.getElement('buttonArea'), {tag:'div'}); | 182 | buttonElement = this.append(this.getElement('buttonArea'), {tag:'div'}); |
165 | buttonComponent = new Clipperz.PM.UI.Common.Components.Button({'element':buttonElement, 'text':aButton['text'], 'isDefault':aButton['isDefault']}); | 183 | buttonComponent = new Clipperz.PM.UI.Common.Components.Button({'element':buttonElement, 'text':aButton['text'], 'isDefault':aButton['isDefault']}); |
166 | this.buttonComponents().push(buttonComponent); | 184 | this.buttonComponents().push(buttonComponent); |
167 | 185 | ||
168 | MochiKit.Signal.connect(buttonComponent, 'onclick', MochiKit.Base.method(this, 'buttonEventHandler', aButton)); | 186 | MochiKit.Signal.connect(buttonComponent, 'onclick', MochiKit.Base.method(this, 'buttonEventHandler', aButton)); |
169 | }, this), MochiKit.Iter.reversed(this.buttons())); | 187 | }, this), MochiKit.Iter.reversed(this.buttons())); |
170 | }, | 188 | }, |
171 | 189 | ||
172 | //------------------------------------------------------------------------- | 190 | //------------------------------------------------------------------------- |
173 | 191 | ||
174 | 'displayElement': function() { | 192 | 'displayElement': function() { |
175 | return this.getElement('panel'); | 193 | return this.getElement('panel'); |
176 | }, | 194 | }, |
177 | 195 | ||
178 | //------------------------------------------------------------------------- | 196 | //------------------------------------------------------------------------- |
179 | 197 | ||
180 | 'closeOk': function () { | 198 | 'closeOk': function () { |
181 | this.deferred().callback(); | 199 | this.deferred().callback(); |
182 | this._deferred = null; | 200 | this._deferred = null; |
183 | }, | 201 | }, |
184 | 202 | ||
185 | 'closeCancel': function () { | 203 | 'closeCancel': function () { |
186 | this.deferred().cancel(); | 204 | this.deferred().cancel(); |
187 | this._deferred = null; | 205 | this._deferred = null; |
188 | }, | 206 | }, |
189 | 207 | ||
190 | 'closeError': function () { | 208 | 'closeError': function () { |
191 | this.deferred().errback(); | 209 | this.deferred().errback(); |
192 | this._deferred = null; | 210 | this._deferred = null; |
193 | }, | 211 | }, |
194 | 212 | ||
195 | //------------------------------------------------------------------------- | 213 | //------------------------------------------------------------------------- |
196 | 214 | ||
197 | 'buttonEventHandler': function(aButton, anEvent) { | 215 | 'buttonEventHandler': function(aButton, anEvent) { |
198 | anEvent.preventDefault(); | 216 | anEvent.preventDefault(); |
199 | 217 | ||
200 | // MochiKit.Signal.signal(this, 'cancelEvent'); | 218 | // MochiKit.Signal.signal(this, 'cancelEvent'); |
201 | switch (aButton['result']) { | 219 | switch (aButton['result']) { |
202 | case 'OK': | 220 | case 'OK': |
203 | //console.log("==> OK"); | 221 | //console.log("==> OK"); |
204 | this.closeOk(); | 222 | this.closeOk(); |
205 | break; | 223 | break; |
206 | case 'CANCEL': | 224 | case 'CANCEL': |
207 | //console.log("==> CANCEL"); | 225 | //console.log("==> CANCEL"); |
208 | this.closeCancel(); | 226 | this.closeCancel(); |
209 | break; | 227 | break; |
210 | default: | 228 | default: |
211 | //console.log("==> ????"); | 229 | //console.log("==> ????"); |
212 | this.closeError(); | 230 | this.closeError(); |
213 | break; | 231 | break; |
214 | } | 232 | } |
215 | //console.log("<=="); | 233 | //console.log("<=="); |
216 | }, | 234 | }, |
217 | 235 | ||
218 | //------------------------------------------------------------------------- | 236 | //------------------------------------------------------------------------- |
219 | 237 | ||
220 | 'deferredShow': function (someArgs, aResult) { | 238 | 'deferredShow': function (someArgs, aResult) { |
221 | this.deferredShowModal(someArgs); | 239 | this.deferredShowModal(someArgs); |
222 | 240 | ||
223 | this.deferred().addMethod(this, 'deferredHideModal', {closeToElement:someArgs.onOkCloseToElement }); | 241 | this.deferred().addMethod(this, 'deferredHideModal', {closeToElement:someArgs.onOkCloseToElement }); |
224 | this.deferred().addErrback (MochiKit.Base.method(this, 'deferredHideModal', {closeToElement:someArgs.onCancelCloseToElement })); | 242 | this.deferred().addErrback (MochiKit.Base.method(this, 'deferredHideModal', {closeToElement:someArgs.onCancelCloseToElement })); |
225 | this.deferred().addCallback(MochiKit.Async.succeed, aResult); | 243 | this.deferred().addCallback(MochiKit.Async.succeed, aResult); |
226 | 244 | ||
227 | return this.deferred(); | 245 | return this.deferred(); |
228 | }, | 246 | }, |
229 | 247 | ||
230 | //------------------------------------------------------------------------- | 248 | //------------------------------------------------------------------------- |
231 | 249 | ||
232 | 'modalDialogMask': function () { | 250 | 'modalDialogMask': function () { |
233 | return this.getId('modalDialogMask'); | 251 | return this.getId('modalDialogMask'); |
234 | }, | 252 | }, |
235 | 253 | ||
236 | 'modalDialog': function () { | 254 | 'modalDialog': function () { |
237 | return this.getId('modalDialog'); | 255 | return this.getId('modalDialog'); |
238 | }, | 256 | }, |
239 | 257 | ||
240 | 'modalDialogFrame': function() { | 258 | 'modalDialogFrame': function() { |
241 | return this.getId('modalDialogFrame'); | 259 | return this.getId('modalDialogFrame'); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/CardDetail.js b/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/CardDetail.js new file mode 100644 index 0000000..32dfa63 --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/CardDetail.js | |||
@@ -0,0 +1,299 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz Community Edition. | ||
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | ||
8 | refer to http://www.clipperz.com. | ||
9 | |||
10 | * Clipperz Community Edition is free software: you can redistribute | ||
11 | it and/or modify it under the terms of the GNU Affero General Public | ||
12 | License as published by the Free Software Foundation, either version | ||
13 | 3 of the License, or (at your option) any later version. | ||
14 | |||
15 | * Clipperz Community Edition is distributed in the hope that it will | ||
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
18 | See the GNU Affero General Public License for more details. | ||
19 | |||
20 | * You should have received a copy of the GNU Affero General Public | ||
21 | License along with Clipperz Community Edition. If not, see | ||
22 | <http://www.gnu.org/licenses/>. | ||
23 | |||
24 | */ | ||
25 | |||
26 | Clipperz.Base.module('Clipperz.PM.UI.Mobile.Components'); | ||
27 | |||
28 | Clipperz.PM.UI.Mobile.Components.CardDetail = function(args) { | ||
29 | args = args || {}; | ||
30 | |||
31 | Clipperz.PM.UI.Mobile.Components.CardDetail.superclass.constructor.apply(this, arguments); | ||
32 | |||
33 | //this._cardReference = null; | ||
34 | |||
35 | return this; | ||
36 | } | ||
37 | |||
38 | //============================================================================= | ||
39 | |||
40 | Clipperz.Base.extend(Clipperz.PM.UI.Mobile.Components.CardDetail, Clipperz.PM.UI.Common.Components.BaseComponent, { | ||
41 | |||
42 | //------------------------------------------------------------------------- | ||
43 | |||
44 | 'toString': function () { | ||
45 | return "Clipperz.PM.UI.Mobile.Components.CardDetail component"; | ||
46 | }, | ||
47 | |||
48 | //------------------------------------------------------------------------- | ||
49 | /* | ||
50 | 'cardReference': function () { | ||
51 | return this._cardReference; | ||
52 | }, | ||
53 | |||
54 | 'setCardReference': function (aValue) { | ||
55 | this._cardReference = aValue; | ||
56 | }, | ||
57 | */ | ||
58 | //------------------------------------------------------------------------- | ||
59 | |||
60 | 'renderSelf': function () { | ||
61 | console.log("CardDetail.renderSelf"); | ||
62 | this.append(this.element(), {tag:'div', cls:'cardDetail', children:[ | ||
63 | {tag:'div', cls:'toolbar', children:[ | ||
64 | {tag:'a', href:'#', cls:'back', html:"List"}, | ||
65 | {tag:'h1', id:this.getId('cardTitle'), html:"…"} | ||
66 | ]}, | ||
67 | {tag:'div', cls:'scroll', id:this.getId('cardDetails'), children:[ | ||
68 | ]} | ||
69 | ]}); | ||
70 | }, | ||
71 | /* | ||
72 | 'renderSelf': function() { | ||
73 | this.append(this.element(), [ | ||
74 | {tag:'div', cls:'cardDetail', id:this.getId('cardDetail'), children:[ | ||
75 | {tag:'div', id:this.getId('progressBar')} //, | ||
76 | ]} | ||
77 | ]); | ||
78 | |||
79 | this.addComponent(new Clipperz.PM.UI.Common.Components.ProgressBar({'element':this.getElement('progressBar')})); | ||
80 | MochiKit.Signal.signal(Clipperz.PM.UI.Common.Controllers.ProgressBarController.defaultController, 'updateProgress', 0); | ||
81 | }, | ||
82 | */ | ||
83 | |||
84 | 'setTitle': function (aValue) { | ||
85 | this.getElement('cardTitle').innerHTML = aValue; | ||
86 | }, | ||
87 | |||
88 | 'fieldListElement': function () { | ||
89 | varresult; | ||
90 | |||
91 | result = this.getElement('fieldList'); | ||
92 | if (result == null) { | ||
93 | result = this.append(this.getElement('cardDetails'), {tag:'ul', cls:'rounded', id:this.getId('fieldList')}); | ||
94 | } | ||
95 | |||
96 | return result; | ||
97 | }, | ||
98 | |||
99 | 'renderFieldValues': function (someFieldValues) { | ||
100 | varfieldClass; | ||
101 | |||
102 | if ((someFieldValues['actionType'] != 'NONE') || (someFieldValues['label'] != '') && (someFieldValues['value'] != '')) { | ||
103 | if (someFieldValues['isHidden'] == true) { | ||
104 | fieldClass = 'password'; | ||
105 | } else { | ||
106 | fieldClass = ''; | ||
107 | } | ||
108 | |||
109 | this.append(this.fieldListElement(), {tag:'li', cls:'cardField', children:[ | ||
110 | {tag:'a', href:'#', cls:fieldClass, html:someFieldValues['value'], children:[ | ||
111 | {tag:'small', cls:'label', html:someFieldValues['label']} | ||
112 | ]} | ||
113 | ]}) | ||
114 | } | ||
115 | }, | ||
116 | |||
117 | 'addField': function (aField) { | ||
118 | var deferredResult; | ||
119 | varfieldValues; | ||
120 | |||
121 | fieldValues = {}; | ||
122 | deferredResult = new Clipperz.Async.Deferred("CardDetail.addField", {trace:false}); | ||
123 | deferredResult.addMethod(aField, 'label'); | ||
124 | deferredResult.addCallback(function (aValue) { fieldValues['label'] = aValue; }); | ||
125 | deferredResult.addMethod(aField, 'value'); | ||
126 | deferredResult.addCallback(function (aValue) { fieldValues['value'] = aValue; }); | ||
127 | deferredResult.addMethod(aField, 'actionType'); | ||
128 | deferredResult.addCallback(function (aValue) { fieldValues['actionType'] = aValue; }); | ||
129 | deferredResult.addMethod(aField, 'isHidden'); | ||
130 | deferredResult.addCallback(function (aValue) { fieldValues['isHidden'] = aValue; }); | ||
131 | deferredResult.addMethod(this, 'renderFieldValues', fieldValues); | ||
132 | deferredResult.callback(); | ||
133 | |||
134 | return deferredResult; | ||
135 | }, | ||
136 | |||
137 | //------------------------------------------------------------------------- | ||
138 | |||
139 | 'directLoginElement': function () { | ||
140 | varresult; | ||
141 | |||
142 | result = this.getElement('directLoginList'); | ||
143 | if (result == null) { | ||
144 | this.append(this.getElement('cardDetails'), {tag:'h2', html:"Direct login"}); | ||
145 | result = this.append(this.getElement('cardDetails'), {tag:'ul', cls:'rounded', id:this.getId('directLoginList')}); | ||
146 | } | ||
147 | |||
148 | return result; | ||
149 | }, | ||
150 | |||
151 | 'addDirectLogin': function (aDirectLogin) { | ||
152 | this.append(this.directLoginElement(), {tag:'li', cls:'directLogin forward', children:[ | ||
153 | {tag:'a', href:'#', html:"direct login", children:[ | ||
154 | {tag:'small', cls:'favicon', children:[{tag:'img', cls:'favicon', src:'http://www.clipperz.com/favicon.ico'}]} | ||
155 | ]} | ||
156 | ]}) | ||
157 | |||
158 | console.log("ADD DIRECT LOGIN", aDirectLogin); | ||
159 | }, | ||
160 | |||
161 | //========================================================================= | ||
162 | |||
163 | 'showCard': function (aCard) { | ||
164 | var deferredResult; | ||
165 | |||
166 | // this.render(); | ||
167 | |||
168 | console.log("CardDetail.showCard", aCard); | ||
169 | deferredResult = new Clipperz.Async.Deferred("CardDetail.showCard", {trace:false}); | ||
170 | deferredResult.addMethod(aCard, 'label'); | ||
171 | deferredResult.addMethod(this, 'setTitle'); | ||
172 | |||
173 | deferredResult.addMethod(aCard, 'fields'); | ||
174 | deferredResult.addCallback(MochiKit.Base.values); | ||
175 | deferredResult.addCallback(MochiKit.Base.map, MochiKit.Base.method(this, 'addField')); | ||
176 | |||
177 | deferredResult.addMethod(aCard, 'directLogins'); | ||
178 | deferredResult.addCallback(MochiKit.Base.values); | ||
179 | deferredResult.addCallback(MochiKit.Base.map, MochiKit.Base.method(this, 'addDirectLogin')); | ||
180 | |||
181 | |||
182 | deferredResult.callback(); | ||
183 | |||
184 | return deferredResult; | ||
185 | // return Clipperz.Async.callbacks("CardDialogController.updateComponentState", [ | ||
186 | // MochiKit.Base.method(this.record(), 'hasPendingChanges'), | ||
187 | // MochiKit.Base.method(this.cardDialogComponent(), 'setShouldEnableSaving'), | ||
188 | // | ||
189 | // MochiKit.Base.method(this.record(), 'label'), | ||
190 | // MochiKit.Base.method(this.cardDialogComponent(), 'setTitle'), | ||
191 | // MochiKit.Base.method(this.record(), 'notes'), | ||
192 | // MochiKit.Base.method(this.cardDialogComponent(), 'setNotes'), | ||
193 | // | ||
194 | // MochiKit.Base.method(this.record(), 'fields'), | ||
195 | // MochiKit.Base.values, | ||
196 | // MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.method(this, 'addCardDialogComponentWithField')), | ||
197 | // | ||
198 | // MochiKit.Base.method(this.record(), 'directLogins'), | ||
199 | // MochiKit.Base.values, | ||
200 | // MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.method(this, 'addCardDialogComponentWithDirectLogin')), | ||
201 | // | ||
202 | // MochiKit.Base.method(this.cardDialogComponent(), 'resetNewFieldInputs'), | ||
203 | // MochiKit.Base.noop | ||
204 | // ], {trace:false}); | ||
205 | |||
206 | }, | ||
207 | |||
208 | //========================================================================= | ||
209 | |||
210 | 'showCardDetails': function (someData) { | ||
211 | this.element().innerHTML = ''; | ||
212 | this.append(this.element(), [ | ||
213 | {tag:'fieldset', id:this.getId('fields'), children:MochiKit.Base.map(function (aFieldData) { | ||
214 | return {tag:'div', cls:'row', children:[ | ||
215 | {tag:'label', html:aFieldData['label']}, | ||
216 | // {tag:'span', cls:('fieldValue ' + (aFieldData['isHidden']? 'password' : 'text')), html:aFieldData['value']} | ||
217 | {tag:'div', cls:('fieldValue ' + (aFieldData['isHidden']? 'password' : 'text')), children:[ | ||
218 | {tag:'div', children:[{tag:'p', html:aFieldData['value']}]} | ||
219 | ]} | ||
220 | // {tag:'input', type:'text', cls:('fieldValue ' + (aFieldData['isHidden']? 'password' : 'text')), value:aFieldData['value'], disabled:true} | ||
221 | |||
222 | ]} | ||
223 | }, someData['fields'])} | ||
224 | ]); | ||
225 | |||
226 | MochiKit.Iter.forEach(MochiKit.Selector.findChildElements(this.element(), ['span.password']), MochiKit.Base.bind(function (aPasswordElement) { | ||
227 | MochiKit.Signal.connect(aPasswordElement, 'onclick', function (anEvent) { alert(MochiKit.DOM.scrapeText(anEvent.src())); }) | ||
228 | }, this)); | ||
229 | |||
230 | if (someData['directLogins'].length > 0) { | ||
231 | this.append(this.element(), [ | ||
232 | {tag:'h2', html:"Direct logins"}, | ||
233 | {tag:'fieldset', id:this.getId('directLogins'), children:MochiKit.Base.map(function (aDirectLoginData) { | ||
234 | return {tag:'div', cls:'row', id:('directLogin_' + aDirectLoginData['_reference']), children:[ | ||
235 | {tag:'img', cls:'favicon', src:aDirectLoginData['favicon']}, | ||
236 | // {tag:'input', cls:'directLogin', disabled:'disabled', type:'text', name:aDirectLoginData['label'], value:aDirectLoginData['label']} | ||
237 | {tag:'span', cls:'directLogin', html:aDirectLoginData['label']} | ||
238 | ]} | ||
239 | }, someData['directLogins'])} | ||
240 | ]); | ||
241 | |||
242 | MochiKit.Base.map(MochiKit.Base.bind(function (aRowNode) { | ||
243 | MochiKit.Signal.connect(aRowNode, 'onclick', this, 'directLoginClickHandler'); | ||
244 | }, this), | ||
245 | MochiKit.Selector.findChildElements(this.getElement('directLogins'), ['div.row']) | ||
246 | ) | ||
247 | }; | ||
248 | |||
249 | if (someData['notes'] != '') { | ||
250 | this.append(this.element(), [ | ||
251 | {tag:'h2', html:"Notes"}, | ||
252 | {tag:'fieldset', id:this.getId('fieldset'), children:[ | ||
253 | {tag:'div', cls:'row notes', children:[ | ||
254 | {tag:'span', html:someData['notes']} | ||
255 | ]} | ||
256 | ]} | ||
257 | ]); | ||
258 | }; | ||
259 | |||
260 | return true; | ||
261 | }, | ||
262 | |||
263 | //------------------------------------------------------------------------- | ||
264 | /* | ||
265 | 'toggleClickHandler': function (anEvent) { | ||
266 | varnextState; | ||
267 | varfieldValue; | ||
268 | |||
269 | //console.log("TOGGLE"); | ||
270 | anEvent.preventDefault; | ||
271 | fieldValue = MochiKit.Selector.findChildElements(anEvent.src().parentNode.parentNode, ['span.password'])[0]; | ||
272 | |||
273 | nextState = (MochiKit.DOM.getNodeAttribute(anEvent.src(), 'toggled') != 'true'); | ||
274 | if (nextState) { | ||
275 | MochiKit.DOM.removeElementClass(fieldValue, 'clear'); | ||
276 | } else { | ||
277 | MochiKit.DOM.addElementClass(fieldValue, 'clear'); | ||
278 | } | ||
279 | |||
280 | MochiKit.DOM.setNodeAttribute(anEvent.src(), 'toggled', nextState); | ||
281 | }, | ||
282 | * / | ||
283 | //========================================================================= | ||
284 | /* | ||
285 | 'directLoginClickHandler': function (anEvent) { | ||
286 | anEvent.preventDefault(); | ||
287 | |||
288 | if (/(directLogin_)/.test(anEvent.src().id)) { | ||
289 | var directLoginReference; | ||
290 | |||
291 | directLoginReference = anEvent.src().id.match(/(directLogin_)(.*)/)[2]; | ||
292 | MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'selectedDirectLogin', {cardReference:this.cardReference(), directLoginReference:directLoginReference}); | ||
293 | } | ||
294 | }, | ||
295 | */ | ||
296 | //========================================================================= | ||
297 | |||
298 | __syntaxFix__: "syntax fix" | ||
299 | }); | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/iPhone/Components/CardList.js b/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/CardList.js index c3f2701..a4aa212 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/iPhone/Components/CardList.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/CardList.js | |||
@@ -1,201 +1,254 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2011 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz Community Edition. |
6 | Clipperz Community Edition is an online password manager. | 6 | Clipperz Community Edition is an online password manager. |
7 | For further information about its features and functionalities please | 7 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 8 | refer to http://www.clipperz.com. |
9 | 9 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 10 | * Clipperz Community Edition is free software: you can redistribute |
11 | it and/or modify it under the terms of the GNU Affero General Public | 11 | it and/or modify it under the terms of the GNU Affero General Public |
12 | License as published by the Free Software Foundation, either version | 12 | License as published by the Free Software Foundation, either version |
13 | 3 of the License, or (at your option) any later version. | 13 | 3 of the License, or (at your option) any later version. |
14 | 14 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 15 | * Clipperz Community Edition is distributed in the hope that it will |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 16 | be useful, but WITHOUT ANY WARRANTY; without even the implied |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 18 | See the GNU Affero General Public License for more details. |
19 | 19 | ||
20 | * You should have received a copy of the GNU Affero General Public | 20 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 21 | License along with Clipperz Community Edition. If not, see |
22 | <http://www.gnu.org/licenses/>. | 22 | <http://www.gnu.org/licenses/>. |
23 | 23 | ||
24 | */ | 24 | */ |
25 | 25 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.iPhone.Components'); | 26 | Clipperz.Base.module('Clipperz.PM.UI.Mobile.Components'); |
27 | 27 | ||
28 | Clipperz.PM.UI.iPhone.Components.CardList = function(args) { | 28 | Clipperz.PM.UI.Mobile.Components.CardList = function(args) { |
29 | args = args || {}; | 29 | args = args || {}; |
30 | 30 | ||
31 | Clipperz.PM.UI.iPhone.Components.CardList.superclass.constructor.apply(this, arguments); | 31 | Clipperz.PM.UI.Mobile.Components.CardList.superclass.constructor.apply(this, arguments); |
32 | 32 | ||
33 | this._cardDetail = null; | 33 | this._cardDetail = null; |
34 | 34 | ||
35 | return this; | 35 | return this; |
36 | } | 36 | } |
37 | 37 | ||
38 | //============================================================================= | 38 | //============================================================================= |
39 | 39 | ||
40 | Clipperz.Base.extend(Clipperz.PM.UI.iPhone.Components.CardList, Clipperz.PM.UI.Common.Components.BaseComponent, { | 40 | Clipperz.Base.extend(Clipperz.PM.UI.Mobile.Components.CardList, Clipperz.PM.UI.Common.Components.BaseComponent, { |
41 | 41 | ||
42 | //------------------------------------------------------------------------- | 42 | //------------------------------------------------------------------------- |
43 | 43 | ||
44 | 'toString': function () { | 44 | 'toString': function () { |
45 | return "Clipperz.PM.UI.iPhone.Components.CardList component"; | 45 | return "Clipperz.PM.UI.Mobile.Components.CardList component"; |
46 | }, | 46 | }, |
47 | 47 | ||
48 | //------------------------------------------------------------------------- | 48 | //------------------------------------------------------------------------- |
49 | 49 | ||
50 | 'renderSelf': function(/*aContainer, aPosition*/) { | 50 | 'renderSelf': function () { |
51 | this.append(this.element(), [ | 51 | this.append(this.element(), {tag:'div', cls:'cardList', children:[ |
52 | {tag:'div', cls:'toolbar', id:'toolbar', children:[ | 52 | {tag:'div', cls:'toolbar', children:[ |
53 | {tag:'h1', id:'pageTitle', html:"cards"}, | 53 | {tag:'h1', html:"clipperz"}, |
54 | {tag:'a', id:'backButton', cls:'button', href:'#', html:"cards"} | 54 | // {tag:'input', name:'search', type:'search', autocomplete:'off', placeholder:"search", id:this.getId('search')}, |
55 | {tag:'a', href:'#', id:'settings', cls:'button', html:"*"} | ||
55 | ]}, | 56 | ]}, |
56 | {tag:'div', cls:'cardList', id:this.getId('cardList'), children:[ | 57 | {tag:'div', cls:'scroll', id:this.getId('listBox'), children:[ |
57 | {tag:'form', title:'search', cls:'panel cardListSearchForm', id:this.getId('cardListSearchForm'), children:[ | 58 | {tag:'ul', cls:'rounded', id:this.getId('list'), children:[ |
58 | {tag:'input', type:'search', name:'search', value:"", placeholder:"search", id:this.getId('searchField')} | 59 | {tag:'li', html:'loading'} |
59 | ]}, | 60 | ]} |
60 | {tag:'ul', cls:'panel cardListPanel', id:this.getId('cardListPanel'), children:[]} | 61 | ]} |
61 | ]}, | 62 | ]}); |
62 | {tag:'div', cls:'panel cardDetailPanel', id:this.getId('cardDetail')} | 63 | |
63 | ]); | 64 | MochiKit.Signal.connect(this.getElement('list'), 'onclick', this, 'cardSelectionHandler'); |
64 | 65 | MochiKit.Signal.connect(this.getElement('list'), 'ontouchstart',this, 'cardSelectionHandler'); | |
65 | MochiKit.Signal.connect(this.getElement('cardListSearchForm'), 'onsubmit', this,'searchHandler'); | 66 | // MochiKit.Signal.connect(this.getElement('cardListSearchForm'), 'onsubmit', this,'searchHandler'); |
66 | MochiKit.Signal.connect(this.getElement('cardListSearchForm'), 'onkeydown', this,'searchHandler'); | 67 | // MochiKit.Signal.connect(this.getElement('cardListSearchForm'), 'onkeydown', this,'searchHandler'); |
67 | MochiKit.Signal.connect(this.getElement('cardListSearchForm'), 'onkeyup', this,'searchHandler'); | 68 | // MochiKit.Signal.connect(this.getElement('cardListSearchForm'), 'onkeyup', this,'searchHandler'); |
68 | 69 | ||
69 | MochiKit.Signal.connect(this.getElement('cardListPanel'), 'onclick', this,'cardListClickHandler'); | 70 | // MochiKit.Signal.connect(this.getElement('cardListPanel'), 'onclick', this,'cardListClickHandler'); |
70 | MochiKit.Signal.connect('backButton', 'onclick', this,'backButtonClickHandler'); | 71 | // MochiKit.Signal.connect('backButton', 'onclick', this,'backButtonClickHandler'); |
71 | 72 | ||
72 | MochiKit.Style.hideElement('backButton'); | 73 | // MochiKit.Style.hideElement('backButton'); |
73 | MochiKit.Style.hideElement(this.getElement('cardDetail')); | 74 | // MochiKit.Style.hideElement(this.getElement('cardDetail')); |
74 | }, | 75 | }, |
75 | 76 | ||
76 | //------------------------------------------------------------------------- | 77 | 'showCards': function (someCards) { |
78 | varcardListElement; | ||
79 | if (this.isFullyRendered() == false) { | ||
80 | this.render(); | ||
81 | }; | ||
82 | |||
83 | cardListElement = this.getElement('list') | ||
84 | |||
85 | cardInfo = { | ||
86 | '_rowObject': MochiKit.Async.succeed, | ||
87 | '_reference': MochiKit.Base.methodcaller('reference'), | ||
88 | '_searchableContent':MochiKit.Base.methodcaller('searchableContent'), | ||
89 | 'label': MochiKit.Base.methodcaller('label'), | ||
90 | 'favicon': MochiKit.Base.methodcaller('favicon') | ||
91 | }; | ||
92 | |||
93 | //console.log("someCards", someCards); | ||
94 | deferredResult = new Clipperz.Async.Deferred("CardList.showCards", {trace:false}); | ||
95 | deferredResult.addCallback(MochiKit.Base.map, Clipperz.Async.collectResults("CardList.value - collectResults", cardInfo, {trace:false})); | ||
96 | deferredResult.addCallback(Clipperz.Async.collectAll); | ||
97 | deferredResult.addCallback(MochiKit.Base.methodcaller('sort', Clipperz.Base.caseInsensitiveKeyComparator('label'))); | ||
98 | deferredResult.addCallbackPass(MochiKit.DOM.replaceChildNodes, cardListElement); | ||
99 | // deferredResult.addCallbackPass(MochiKit.DOM.removeElementClass, cardListElement, 'loading'); | ||
100 | deferredResult.addCallback(MochiKit.Base.map, MochiKit.Base.method(this, 'appendCardToList', cardListElement)); | ||
101 | deferredResult.callback(someCards); | ||
102 | }, | ||
103 | |||
104 | 'appendCardToList': function (aCardListElement, aCardInfo) { | ||
105 | //console.log("appendCardToList", aCardInfo); | ||
106 | this.append(aCardListElement, {tag:'li', cls:'cardListItem arrow', cardreference:aCardInfo['_reference'], children:[ | ||
107 | {tag:'a', href:'#', html:aCardInfo['label'], children:[ | ||
108 | {tag:'small', cls:'favicon', children:[{tag:'img', cls:'favicon', src:aCardInfo['favicon']}]} | ||
109 | ]} | ||
110 | ]}); | ||
111 | }, | ||
112 | |||
113 | 'cardSelectionHandler': function (anEvent) { | ||
114 | var listElement; | ||
115 | varcardReference; | ||
116 | |||
117 | anEvent.preventDefault(); | ||
118 | |||
119 | listElement = anEvent.target(); | ||
120 | if (MochiKit.DOM.getNodeAttribute(listElement, 'cardreference') == null) { | ||
121 | listElement = MochiKit.DOM.getFirstParentByTagAndClassName(anEvent.target(), tagName='li', className='cardListItem'); | ||
122 | } | ||
123 | cardReference = MochiKit.DOM.getNodeAttribute(listElement, 'cardreference'); | ||
124 | console.log("###", listElement, cardReference); | ||
125 | //TODO: Notify card with reference MochiKit.DOM.getNodeAttribute(listElement, 'cardreference') has been selected | ||
126 | MochiKit.Signal.signal(this, 'selectedCard', cardReference); | ||
127 | }, | ||
77 | 128 | ||
129 | //------------------------------------------------------------------------- | ||
130 | /* | ||
78 | 'searchHandler': function (anEvent) { | 131 | 'searchHandler': function (anEvent) { |
79 | if ((typeof(anEvent.key()) != 'undefined') && (anEvent.key().string == 'KEY_ENTER')) { //RETURN | 132 | if ((typeof(anEvent.key()) != 'undefined') && (anEvent.key().string == 'KEY_ENTER')) { //RETURN |
80 | anEvent.preventDefault(); | 133 | anEvent.preventDefault(); |
81 | } else { | 134 | } else { |
82 | if ((typeof(anEvent.key()) != 'undefined') && (anEvent.key().string == 'KEY_ESCAPE')) { | 135 | if ((typeof(anEvent.key()) != 'undefined') && (anEvent.key().string == 'KEY_ESCAPE')) { |
83 | anEvent.target().value = ""; | 136 | anEvent.target().value = ""; |
84 | } | 137 | } |
85 | 138 | ||
86 | if (anEvent.type() == 'keyup') { | 139 | if (anEvent.type() == 'keyup') { |
87 | MochiKit.Signal.signal(this, 'searchEvent', anEvent.target().value); | 140 | MochiKit.Signal.signal(this, 'searchEvent', anEvent.target().value); |
88 | } | 141 | } |
89 | } | 142 | } |
90 | }, | 143 | }, |
91 | 144 | ||
92 | //------------------------------------------------------------------------- | 145 | //------------------------------------------------------------------------- |
93 | 146 | ||
94 | 'update': function (someObjects) { | 147 | 'update': function (someObjects) { |
95 | varcardListPanel; | 148 | varcardListPanel; |
96 | var i,c; | 149 | var i,c; |
97 | 150 | ||
98 | cardListPanel = this.getElement('cardListPanel'); | 151 | cardListPanel = this.getElement('cardListPanel'); |
99 | cardListPanel.innerHTML = ''; | 152 | cardListPanel.innerHTML = ''; |
100 | 153 | ||
101 | c = someObjects.length; | 154 | c = someObjects.length; |
102 | 155 | ||
103 | for (i=0; i<c; i++) { | 156 | for (i=0; i<c; i++) { |
104 | this.append(cardListPanel, {tag:'li', cls:'cardListItem', id:('cardListItem_' + someObjects[i]['_reference']), children:[ | 157 | this.append(cardListPanel, {tag:'li', cls:'cardListItem', id:('cardListItem_' + someObjects[i]['_reference']), children:[ |
105 | {tag:'img', src:(someObjects[i]['favicon'] ? someObjects[i]['favicon'] : 'data:application/octet-stream;charset=utf-8;base64,AAABAAEAFxcAAAEAGAD8BgAAFgAAACgAAAAXAAAALgAAAAEAGAAAAAAAAAAAABIXAAASFwAAAAAAAAAAAAD///////////////////////////////////////////////////////////////////////////////////////////9zAC////////////////////////////////////////////////////////////////////////////////////////////9pAG////////////////////////////////////////////////////////////////////////////////////////////9rAC////////////////////////////////////////////////////////////////////////////////////////////9yAHP////////////////////////IyMizs7O6urrq6ur////////////Ozs6zs7Ozs7Pq6ur///////////////////////8AAAD////////////////////V1dWXl5eXl5eXl5elpaX4+Pj////Ozs6Xl5eXl5eXl5eenp7///////////////////////8AAAD////////////////////Ozs6Xl5eXl5eXl5eXl5fBwcHq6uqenp6Xl5eXl5eXl5eXl5f///////////////////////8AAAD////////////////////j4+OXl5eXl5eXl5eXl5eXl5elpaWXl5eXl5eXl5eXl5ezs7P///////////////////////8AAAD////////////////////////IyMiXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eenp7x8fH////////////////////////////////////////////////////4+PilpaWXl5eXl5eXl5eXl5eXl5eXl5eXl5fOzs7////////////////////////////////////////////////////////q6uq6urqXl5eXl5eXl5eXl5eXl5eXl5eenp7V1dX4+Pj///////////////////////8AAAD////////////4+PjOzs6lpaWXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5e6urrj4+P///////////////8AAAD////////////BwcGXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5fx8fH///////////8AAAD///////////+zs7OXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5fj4+P///////////8AAAD////////////IyMiXl5eXl5eXl5eXl5e6urqXl5eXl5eXl5eXl5esrKylpaWXl5eXl5eXl5eenp7x8fH///////////8AAAD////////////////Ozs7Ozs7V1dX4+Pj///+Xl5eXl5eXl5eXl5fOzs7////q6urOzs7Ozs7q6ur///////////////8AAAD///////////////////////////////////+Xl5eXl5eXl5eXl5fOzs7///////////////////////////////////8AAAD///////////////////////////////////+Xl5eXl5eXl5eXl5fOzs7///////////////////////////////////8AAAD///////////////////////////////////+Xl5eXl5eXl5eXl5fOzs7///////////////////////////////////8AAAD////////////////////////////////////IyMiXl5eXl5eenp7x8fH///////////////////////////////////8AAAD////////////////////////////////////////j4+Pj4+Px8fH///////////////////////////////////////8AAAD///////////////////////////////////////////////////////////////////////////////////////////8AAAD///////////////////////////////////////////////////////////////////////////////////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAo=')}, | 158 | {tag:'img', src:(someObjects[i]['favicon'] ? someObjects[i]['favicon'] : 'data:application/octet-stream;charset=utf-8;base64,AAABAAEAFxcAAAEAGAD8BgAAFgAAACgAAAAXAAAALgAAAAEAGAAAAAAAAAAAABIXAAASFwAAAAAAAAAAAAD///////////////////////////////////////////////////////////////////////////////////////////9zAC////////////////////////////////////////////////////////////////////////////////////////////9pAG////////////////////////////////////////////////////////////////////////////////////////////9rAC////////////////////////////////////////////////////////////////////////////////////////////9yAHP////////////////////////IyMizs7O6urrq6ur////////////Ozs6zs7Ozs7Pq6ur///////////////////////8AAAD////////////////////V1dWXl5eXl5eXl5elpaX4+Pj////Ozs6Xl5eXl5eXl5eenp7///////////////////////8AAAD////////////////////Ozs6Xl5eXl5eXl5eXl5fBwcHq6uqenp6Xl5eXl5eXl5eXl5f///////////////////////8AAAD////////////////////j4+OXl5eXl5eXl5eXl5eXl5elpaWXl5eXl5eXl5eXl5ezs7P///////////////////////8AAAD////////////////////////IyMiXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eenp7x8fH////////////////////////////////////////////////////4+PilpaWXl5eXl5eXl5eXl5eXl5eXl5eXl5fOzs7////////////////////////////////////////////////////////q6uq6urqXl5eXl5eXl5eXl5eXl5eXl5eenp7V1dX4+Pj///////////////////////8AAAD////////////4+PjOzs6lpaWXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5e6urrj4+P///////////////8AAAD////////////BwcGXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5fx8fH///////////8AAAD///////////+zs7OXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5fj4+P///////////8AAAD////////////IyMiXl5eXl5eXl5eXl5e6urqXl5eXl5eXl5eXl5esrKylpaWXl5eXl5eXl5eenp7x8fH///////////8AAAD////////////////Ozs7Ozs7V1dX4+Pj///+Xl5eXl5eXl5eXl5fOzs7////q6urOzs7Ozs7q6ur///////////////8AAAD///////////////////////////////////+Xl5eXl5eXl5eXl5fOzs7///////////////////////////////////8AAAD///////////////////////////////////+Xl5eXl5eXl5eXl5fOzs7///////////////////////////////////8AAAD///////////////////////////////////+Xl5eXl5eXl5eXl5fOzs7///////////////////////////////////8AAAD////////////////////////////////////IyMiXl5eXl5eenp7x8fH///////////////////////////////////8AAAD////////////////////////////////////////j4+Pj4+Px8fH///////////////////////////////////////8AAAD///////////////////////////////////////////////////////////////////////////////////////////8AAAD///////////////////////////////////////////////////////////////////////////////////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAo=')}, |
106 | {tag:'a', id:('cardListReference_' + someObjects[i]['_reference']), href:'#', html:someObjects[i]['label']} | 159 | {tag:'a', id:('cardListReference_' + someObjects[i]['_reference']), href:'#', html:someObjects[i]['label']} |
107 | ]}) | 160 | ]}) |
108 | 161 | ||
109 | MochiKit.Signal.connect('cardListItem_' + someObjects[i]['_reference'], 'onclick', this, 'cardListClickHandler'); | 162 | MochiKit.Signal.connect('cardListItem_' + someObjects[i]['_reference'], 'onclick', this, 'cardListClickHandler'); |
110 | } | 163 | } |
111 | 164 | ||
112 | }, | 165 | }, |
113 | 166 | ||
114 | 'cardListClickHandler': function (anEvent) { | 167 | 'cardListClickHandler': function (anEvent) { |
115 | anEvent.preventDefault(); | 168 | anEvent.preventDefault(); |
116 | 169 | ||
117 | if (/(cardListReference_|cardListItem_)/.test(anEvent.target().id)) { | 170 | if (/(cardListReference_|cardListItem_)/.test(anEvent.target().id)) { |
118 | var cardListReference; | 171 | var cardListReference; |
119 | 172 | ||
120 | cardListReference = anEvent.target().id.match(/(cardListReference_|cardListItem_)(.*)/)[2]; | 173 | cardListReference = anEvent.target().id.match(/(cardListReference_|cardListItem_)(.*)/)[2]; |
121 | //console.log("Showing detail for card named", cardListReference); | 174 | //console.log("Showing detail for card named", cardListReference); |
122 | MochiKit.Signal.signal(this, 'selectedCard', cardListReference); | 175 | MochiKit.Signal.signal(this, 'selectedCard', cardListReference); |
123 | } | 176 | } |
124 | }, | 177 | }, |
125 | 178 | ||
126 | //========================================================================= | 179 | //========================================================================= |
127 | 180 | ||
128 | 'cardDetail': function (someData) { | 181 | 'cardDetail': function (someData) { |
129 | if (this._cardDetail == null) { | 182 | if (this._cardDetail == null) { |
130 | this._cardDetail = new Clipperz.PM.UI.iPhone.Components.CardDetail({element:this.getElement('cardDetail')}); | 183 | this._cardDetail = new Clipperz.PM.UI.Mobile.Components.CardDetail({element:this.getElement('cardDetail')}); |
131 | } | 184 | } |
132 | 185 | ||
133 | return this._cardDetail; | 186 | return this._cardDetail; |
134 | }, | 187 | }, |
135 | 188 | ||
136 | //------------------------------------------------------------------------- | 189 | //------------------------------------------------------------------------- |
137 | 190 | ||
138 | 'removeCardDetail': function () { | 191 | 'removeCardDetail': function () { |
139 | if (this._cardDetail != null) { | 192 | if (this._cardDetail != null) { |
140 | this._cardDetail.remove(); | 193 | this._cardDetail.remove(); |
141 | this._cardDetail = null; | 194 | this._cardDetail = null; |
142 | } | 195 | } |
143 | }, | 196 | }, |
144 | 197 | ||
145 | //========================================================================= | 198 | //========================================================================= |
146 | 199 | ||
147 | 'showCard': function (someData) { | 200 | 'showCard': function (someData) { |
148 | vardeferredResult; | 201 | vardeferredResult; |
149 | varoffset; | 202 | varoffset; |
150 | 203 | ||
151 | offset = ((MochiKit.DOM.getNodeAttribute(MochiKit.DOM.currentDocument().body, 'orientation') == 'portrait') ? 320 : 480); | 204 | offset = ((MochiKit.DOM.getNodeAttribute(MochiKit.DOM.currentDocument().body, 'orientation') == 'portrait') ? 320 : 480); |
152 | this.cardDetail().render(); | 205 | this.cardDetail().render(); |
153 | this.cardDetail().setCardReference(someData['_reference']); | 206 | this.cardDetail().setCardReference(someData['_reference']); |
154 | MochiKit.Style.setElementPosition(this.cardDetail().element(), {x:offset}); | 207 | MochiKit.Style.setElementPosition(this.cardDetail().element(), {x:offset}); |
155 | new MochiKit.Visual.Sequence([ | 208 | new MochiKit.Visual.Sequence([ |
156 | // new MochiKit.Visual.Move(this.cardDetail().element(), {x:offset, y:45, mode:'absolute', duration:0, sync:true}), | 209 | // new MochiKit.Visual.Move(this.cardDetail().element(), {x:offset, y:45, mode:'absolute', duration:0, sync:true}), |
157 | new MochiKit.Visual.Parallel([ | 210 | new MochiKit.Visual.Parallel([ |
158 | new MochiKit.Visual.Move(this.getElement('cardList'), {x:-offset, y:0, mode:'relative',transition:MochiKit.Visual.Transitions.linear, sync:true}), | 211 | new MochiKit.Visual.Move(this.getElement('cardList'), {x:-offset, y:0, mode:'relative',transition:MochiKit.Visual.Transitions.linear, sync:true}), |
159 | new MochiKit.Visual.Move(this.getElement('cardDetail'), {x:0, y:45, mode:'absolute',transition:MochiKit.Visual.Transitions.linear, sync:true}), | 212 | new MochiKit.Visual.Move(this.getElement('cardDetail'), {x:0, y:45, mode:'absolute',transition:MochiKit.Visual.Transitions.linear, sync:true}), |
160 | // new MochiKit.Visual.ScrollTo('toolbar', {sync:true}), | 213 | // new MochiKit.Visual.ScrollTo('toolbar', {sync:true}), |
161 | MochiKit.Visual.appear ('backButton', { transition:MochiKit.Visual.Transitions.linear, sync:true}) | 214 | MochiKit.Visual.appear ('backButton', { transition:MochiKit.Visual.Transitions.linear, sync:true}) |
162 | ], {duration:1, sync:true}), | 215 | ], {duration:1, sync:true}), |
163 | MochiKit.Visual.fade(this.getElement('cardList'), {duration:0, sync:true}) | 216 | MochiKit.Visual.fade(this.getElement('cardList'), {duration:0, sync:true}) |
164 | ], {}) | 217 | ], {}) |
165 | 218 | ||
166 | MochiKit.DOM.getElement('pageTitle').innerHTML = someData['title']; | 219 | MochiKit.DOM.getElement('pageTitle').innerHTML = someData['title']; |
167 | 220 | ||
168 | return true; | 221 | return true; |
169 | }, | 222 | }, |
170 | 223 | ||
171 | //------------------------------------------------------------------------- | 224 | //------------------------------------------------------------------------- |
172 | 225 | ||
173 | 'showCardDetails': function (someData) { | 226 | 'showCardDetails': function (someData) { |
174 | return this.cardDetail().showCardDetails(someData); | 227 | return this.cardDetail().showCardDetails(someData); |
175 | }, | 228 | }, |
176 | 229 | ||
177 | //========================================================================= | 230 | //========================================================================= |
178 | 231 | ||
179 | 'backButtonClickHandler': function (anEvent) { | 232 | 'backButtonClickHandler': function (anEvent) { |
180 | varoffset; | 233 | varoffset; |
181 | 234 | ||
182 | anEvent.preventDefault(); | 235 | anEvent.preventDefault(); |
183 | 236 | ||
184 | MochiKit.DOM.getElement('pageTitle').innerHTML = "cards"; | 237 | MochiKit.DOM.getElement('pageTitle').innerHTML = "cards"; |
185 | 238 | ||
186 | offset = ((MochiKit.DOM.getNodeAttribute(MochiKit.DOM.currentDocument().body, 'orientation') == 'portrait') ? 320 : 480); | 239 | offset = ((MochiKit.DOM.getNodeAttribute(MochiKit.DOM.currentDocument().body, 'orientation') == 'portrait') ? 320 : 480); |
187 | MochiKit.Style.setElementPosition(this.getElement('cardList'), {x:-offset}); | 240 | MochiKit.Style.setElementPosition(this.getElement('cardList'), {x:-offset}); |
188 | MochiKit.DOM.showElement(this.getElement('cardList')); | 241 | MochiKit.DOM.showElement(this.getElement('cardList')); |
189 | 242 | ||
190 | new MochiKit.Visual.Parallel([ | 243 | new MochiKit.Visual.Parallel([ |
191 | new MochiKit.Visual.Move(this.getElement('cardList'), {x:offset, y:0, mode:'relative',transition:MochiKit.Visual.Transitions.linear, sync:true}), | 244 | new MochiKit.Visual.Move(this.getElement('cardList'), {x:offset, y:0, mode:'relative',transition:MochiKit.Visual.Transitions.linear, sync:true}), |
192 | new MochiKit.Visual.Move(this.getElement('cardDetail'), {x:offset, y:0, mode:'relative',transition:MochiKit.Visual.Transitions.linear, sync:true}), | 245 | new MochiKit.Visual.Move(this.getElement('cardDetail'), {x:offset, y:0, mode:'relative',transition:MochiKit.Visual.Transitions.linear, sync:true}), |
193 | MochiKit.Visual.fade (this.getElement('cardDetail'), { transition:MochiKit.Visual.Transitions.linear, sync:true}), | 246 | MochiKit.Visual.fade (this.getElement('cardDetail'), { transition:MochiKit.Visual.Transitions.linear, sync:true}), |
194 | MochiKit.Visual.fade ('backButton', { transition:MochiKit.Visual.Transitions.linear, sync:true}) | 247 | MochiKit.Visual.fade ('backButton', { transition:MochiKit.Visual.Transitions.linear, sync:true}) |
195 | ], {duration:1, afterFinish:MochiKit.Base.method(this, 'removeCardDetail')}) | 248 | ], {duration:1, afterFinish:MochiKit.Base.method(this, 'removeCardDetail')}) |
196 | 249 | ||
197 | }, | 250 | }, |
198 | 251 | */ | |
199 | //========================================================================= | 252 | //========================================================================= |
200 | __syntaxFix__: "syntax fix" | 253 | __syntaxFix__: "syntax fix" |
201 | }); | 254 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/LoginForm.js b/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/LoginForm.js new file mode 100644 index 0000000..eafcdbc --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/LoginForm.js | |||
@@ -0,0 +1,356 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz Community Edition. | ||
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | ||
8 | refer to http://www.clipperz.com. | ||
9 | |||
10 | * Clipperz Community Edition is free software: you can redistribute | ||
11 | it and/or modify it under the terms of the GNU Affero General Public | ||
12 | License as published by the Free Software Foundation, either version | ||
13 | 3 of the License, or (at your option) any later version. | ||
14 | |||
15 | * Clipperz Community Edition is distributed in the hope that it will | ||
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
18 | See the GNU Affero General Public License for more details. | ||
19 | |||
20 | * You should have received a copy of the GNU Affero General Public | ||
21 | License along with Clipperz Community Edition. If not, see | ||
22 | <http://www.gnu.org/licenses/>. | ||
23 | |||
24 | */ | ||
25 | |||
26 | Clipperz.Base.module('Clipperz.PM.UI.Mobile.Components'); | ||
27 | |||
28 | Clipperz.PM.UI.Mobile.Components.LoginForm = function(args) { | ||
29 | args = args || {}; | ||
30 | |||
31 | this._pin = ''; | ||
32 | |||
33 | this._message = null; | ||
34 | this._steps = 0; | ||
35 | this._actualSteps = 0; | ||
36 | |||
37 | this._callback = null; | ||
38 | this._errorCallback = null; | ||
39 | |||
40 | this._mode = 'CREDENTIALS'; | ||
41 | |||
42 | Clipperz.PM.UI.Mobile.Components.LoginForm.superclass.constructor.apply(this, arguments); | ||
43 | |||
44 | return this; | ||
45 | } | ||
46 | |||
47 | //============================================================================= | ||
48 | |||
49 | Clipperz.Base.extend(Clipperz.PM.UI.Mobile.Components.LoginForm, Clipperz.PM.UI.Common.Components.BaseComponent, { | ||
50 | |||
51 | //------------------------------------------------------------------------- | ||
52 | |||
53 | 'toString': function () { | ||
54 | return "Clipperz.PM.UI.Mobile.Components.LoginForm component"; | ||
55 | }, | ||
56 | |||
57 | //------------------------------------------------------------------------- | ||
58 | |||
59 | 'callback': function () { | ||
60 | return this._callback; | ||
61 | }, | ||
62 | |||
63 | 'errorCallback': function () { | ||
64 | return this._errorCallback; | ||
65 | }, | ||
66 | |||
67 | //------------------------------------------------------------------------- | ||
68 | |||
69 | 'mode': function () { | ||
70 | return this._mode; | ||
71 | }, | ||
72 | |||
73 | 'setMode': function (aValue) { | ||
74 | this._mode = aValue; | ||
75 | }, | ||
76 | |||
77 | //.......................................................................... | ||
78 | |||
79 | 'pin': function () { | ||
80 | return this._pin; | ||
81 | }, | ||
82 | |||
83 | 'setPin': function (aValue) { | ||
84 | this._pin = aValue; | ||
85 | }, | ||
86 | |||
87 | //.......................................................................... | ||
88 | |||
89 | 'username': function () { | ||
90 | return this._username; | ||
91 | }, | ||
92 | |||
93 | 'setUsername': function (aValue) { | ||
94 | this._username = aValue; | ||
95 | }, | ||
96 | |||
97 | //.......................................................................... | ||
98 | |||
99 | 'passphrase': function () { | ||
100 | return this._passphrase; | ||
101 | }, | ||
102 | |||
103 | 'setPassphrase': function (aValue) { | ||
104 | this._passphrase = aValue; | ||
105 | }, | ||
106 | |||
107 | //------------------------------------------------------------------------- | ||
108 | |||
109 | 'message': function () { | ||
110 | return this._message; | ||
111 | }, | ||
112 | |||
113 | '_setMessage': function (aValue) { | ||
114 | this._message = aValue; | ||
115 | |||
116 | if (aValue == null) { | ||
117 | MochiKit.Style.hideElement(this.getElement('credentialsMessage')); | ||
118 | } else { | ||
119 | this.getElement('message').innerHTML = aValue; | ||
120 | MochiKit.Style.showElement(this.getElement('credentialsMessage')); | ||
121 | } | ||
122 | }, | ||
123 | |||
124 | 'setMessage': function (aValue) { | ||
125 | this._setMessage(aValue); | ||
126 | MochiKit.DOM.removeElementClass(this.getElement('credentialsMessage'), 'error'); | ||
127 | }, | ||
128 | |||
129 | 'setErrorMessage': function (aValue) { | ||
130 | this._setMessage(aValue); | ||
131 | MochiKit.DOM.addElementClass(this.getElement('credentialsMessage'), 'error'); | ||
132 | }, | ||
133 | |||
134 | //------------------------------------------------------------------------- | ||
135 | |||
136 | 'setCallbacks': function (args) { | ||
137 | this._callback = args['callback']; | ||
138 | this._errorCallback = args['errorCallback']; | ||
139 | }, | ||
140 | |||
141 | 'showErrors': function (args) { | ||
142 | //console.log("LoginForm.showErrors", args); | ||
143 | if (args['previousFailedAttempt'] == 'LOGIN') { | ||
144 | this.setErrorMessage("Wrong credentials"); | ||
145 | } else if (args['previousFailedAttempt'] == 'PIN') { | ||
146 | if (args['failedAttempts'] == -1) { | ||
147 | this.setErrorMessage("Wrong PIN - Resetted"); | ||
148 | } else { | ||
149 | this.setErrorMessage("Wrong PIN"); | ||
150 | } | ||
151 | } else { | ||
152 | this.setMessage(null); | ||
153 | } | ||
154 | }, | ||
155 | |||
156 | 'updateWithArgs': function (args) { | ||
157 | this.renderIfNeeded(); | ||
158 | this.setCallbacks(args); | ||
159 | this.showErrors(args); | ||
160 | this.updateRendering(); | ||
161 | }, | ||
162 | |||
163 | 'showPinLogin': function (args) { | ||
164 | this.setPin(''); | ||
165 | this.setMode('PIN'); | ||
166 | this.updateWithArgs(args); | ||
167 | |||
168 | // $(this.getAnchor('PIN')).focus(); | ||
169 | this.getElement('PIN').focus(); | ||
170 | }, | ||
171 | |||
172 | 'showCredentialsLogin': function (args) { | ||
173 | this.setMode('CREDENTIALS'); | ||
174 | this.updateWithArgs(args); | ||
175 | |||
176 | if (this.getElement('usernameField').value.length == 0) { | ||
177 | // $(this.getAnchor('usernameField')).focus(); | ||
178 | this.getElement('usernameField').focus(); | ||
179 | } else { | ||
180 | // $(this.getAnchor('passphraseField')).focus(); | ||
181 | this.getElement('passphraseField').focus(); | ||
182 | this.getElement('passphraseField').select(); | ||
183 | } | ||
184 | }, | ||
185 | |||
186 | //------------------------------------------------------------------------- | ||
187 | |||
188 | 'renderIfNeeded': function () { | ||
189 | if (this.isFullyRendered() == false) { | ||
190 | this.render(); | ||
191 | }; | ||
192 | this.updateRendering(); | ||
193 | }, | ||
194 | |||
195 | 'updateRendering': function () { | ||
196 | MochiKit.Style.showElement(this.getElement('credentialsBody')); | ||
197 | MochiKit.Style.hideElement(this.getElement('validating')); | ||
198 | |||
199 | // this.hideAllPanes(); | ||
200 | MochiKit.Base.map(function (aNode) { MochiKit.Style.hideElement(aNode); }, MochiKit.Selector.findDocElements('div.credentialsBody > div')); | ||
201 | if (this.mode() == 'CREDENTIALS') { | ||
202 | selectedPanel = this.getElement('credentials') | ||
203 | } else if (this.mode() == 'PIN') { | ||
204 | selectedPanel = this.getElement('pin') | ||
205 | // this.updatePinDisplay(); | ||
206 | } else { | ||
207 | throw 'Unhandled login form mode'; | ||
208 | } | ||
209 | MochiKit.Style.showElement(selectedPanel); | ||
210 | |||
211 | MochiKit.Style.hideElement(this.getElement('validating')); | ||
212 | }, | ||
213 | |||
214 | 'renderSelf': function() { | ||
215 | var selectedPanel; | ||
216 | this.append(this.element(), {tag:'div', id:'login', children:[ | ||
217 | {tag:'div', cls:'toolbar', children:[ | ||
218 | {tag:'h1', html:"clipperz"} | ||
219 | ]}, | ||
220 | {tag:'div', cls:'scroll', children:[ | ||
221 | //================================================================== | ||
222 | {tag:'div', cls:'credentialsMessage', id:this.getId('credentialsMessage'), children:[ | ||
223 | {tag:'h1', cls:'message', id:this.getId('message'), html:"Message"} | ||
224 | ]}, | ||
225 | //================================================================== | ||
226 | {tag:'div', cls:'credentialsBody', id:this.getId('credentialsBody'), children:[ | ||
227 | //-------------------------------------------------------------- | ||
228 | {tag:'div', cls:'pin', id:this.getId('pin'), children:[ | ||
229 | {tag:'form', cls:'scroll', id:this.getId('pinForm'), children:[ | ||
230 | {tag:'ul', cls:'edit rounded', children:[ | ||
231 | {tag:'li', children:[{tag:'input', type:'number', name:'PIN', placeholder:"PIN", id:this.getId('PIN') }]}, | ||
232 | ]}, | ||
233 | {tag:'a', href:'#', cls:'greenButton', id:this.getId('pinSubmitButton'), html:"Login"} | ||
234 | ]} | ||
235 | ]}, | ||
236 | //-------------------------------------------------------------- | ||
237 | {tag:'div', cls:'credentials', id:this.getId('credentials'), children:[ | ||
238 | {tag:'form', cls:'scroll', id:this.getId('credentialsForm'), children:[ | ||
239 | {tag:'ul', cls:'edit rounded', children:[ | ||
240 | {tag:'li', children:[{tag:'input', type:'email', name:'name', /*value:'joe',*/ placeholder:"username", id:this.getId('usernameField') }]}, | ||
241 | {tag:'li', children:[{tag:'input', type:'password', name:'passphrase', /*value:'clipperz',*/placeholder:"passphrase", id:this.getId('passphraseField') }]} | ||
242 | ]}, | ||
243 | {tag:'a', href:'#', cls:'greenButton', id:this.getId('credentialsSubmitButton'), html:"Login"} | ||
244 | // {tag:'input', type:'submit', cls:'greenButton', id:this.getId('credentialsSubmitButton'), value:"Login"} | ||
245 | |||
246 | ]} | ||
247 | ]}, | ||
248 | //-------------------------------------------------------------- | ||
249 | ]}, | ||
250 | //================================================================== | ||
251 | {tag:'div', cls:'validating', id:this.getId('validating'), children:[ | ||
252 | {tag:'div', cls:'loading', children:[ | ||
253 | {tag:'div', cls:'spinner', children:[ | ||
254 | {tag:'div', cls:'bar01'}, | ||
255 | {tag:'div', cls:'bar02'}, | ||
256 | {tag:'div', cls:'bar03'}, | ||
257 | {tag:'div', cls:'bar04'}, | ||
258 | {tag:'div', cls:'bar05'}, | ||
259 | {tag:'div', cls:'bar06'}, | ||
260 | {tag:'div', cls:'bar07'}, | ||
261 | {tag:'div', cls:'bar08'}, | ||
262 | {tag:'div', cls:'bar09'}, | ||
263 | {tag:'div', cls:'bar10'}, | ||
264 | {tag:'div', cls:'bar11'}, | ||
265 | {tag:'div', cls:'bar12'} | ||
266 | ]} | ||
267 | ]}, | ||
268 | {tag:'div', id:this.getId('loadingMessage')}, | ||
269 | {tag:'a', href:'#', cls:'grayButton', id:this.getId('loginCancelButton'), html:"Cancel"} | ||
270 | ]} | ||
271 | //================================================================== | ||
272 | ]} | ||
273 | ]}); | ||
274 | |||
275 | MochiKit.Signal.connect(this.getElement('credentialsForm'), 'onsubmit', this, 'submitCredentialsHandler'); | ||
276 | MochiKit.Signal.connect(this.getElement('credentialsSubmitButton'), 'onclick', this, 'submitCredentialsHandler'); | ||
277 | |||
278 | MochiKit.Signal.connect(this.getElement('pinForm'), 'onsubmit', this, 'submitPinHandler'); | ||
279 | MochiKit.Signal.connect(this.getElement('pinSubmitButton'), 'onclick', this, 'submitPinHandler'); | ||
280 | |||
281 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'initProgress', this, 'initProgressHandle'); | ||
282 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'updateProgress',this, 'updateProgressHandle'); | ||
283 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'advanceProgress',this, 'advanceProgressHandle'); | ||
284 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'progressDone', this, 'progressDoneHandle'); | ||
285 | }, | ||
286 | |||
287 | //------------------------------------------------------------------------- | ||
288 | |||
289 | 'submitPinHandler': function (anEvent) { | ||
290 | varpin; | ||
291 | |||
292 | this.setMessage(null); | ||
293 | pin = this.getElement('PIN').value; | ||
294 | // $(this.getAnchor('PIN')).blur(); | ||
295 | this.getElement('PIN').blur(); | ||
296 | |||
297 | credentials = Clipperz.PM.PIN.credentialsWithPIN(pin); | ||
298 | this.loginWithCredentials(credentials); | ||
299 | }, | ||
300 | |||
301 | 'submitCredentialsHandler': function (anEvent) { | ||
302 | //console.log("submitCredentialsHandler"); | ||
303 | varcredentials; | ||
304 | |||
305 | this.setMessage(null); | ||
306 | |||
307 | credentials = {}; | ||
308 | credentials['username'] = this.getElement('usernameField').value; | ||
309 | credentials['passphrase'] = this.getElement('passphraseField').value; | ||
310 | // $(this.getAnchor('passphraseField')).blur(); | ||
311 | this.getElement('passphraseField').blur(); | ||
312 | |||
313 | this.loginWithCredentials(credentials); | ||
314 | }, | ||
315 | |||
316 | //------------------------------------------------------------------------- | ||
317 | |||
318 | 'loginWithCredentials': function (someCredentials) { | ||
319 | varargs; | ||
320 | |||
321 | args = {}; | ||
322 | args['credentials'] = someCredentials; | ||
323 | args['errorCallback'] = this.errorCallback(); | ||
324 | |||
325 | MochiKit.Style.hideElement(this.getElement('credentialsBody')); | ||
326 | MochiKit.Style.showElement(this.getElement('validating')); | ||
327 | |||
328 | MochiKit.Async.callLater(0.1, this.callback(), args); | ||
329 | }, | ||
330 | |||
331 | //------------------------------------------------------------------------- | ||
332 | |||
333 | 'initProgressHandle': function (anEvent) { | ||
334 | //console.log("** initProgressHandle", anEvent); | ||
335 | this._steps = anEvent['steps']; | ||
336 | this._actualSteps = 0; | ||
337 | }, | ||
338 | |||
339 | 'updateProgressHandle': function (anEvent) { | ||
340 | //console.log("** updateProgressHandle", anEvent); | ||
341 | this._steps += anEvent['extraSteps']; | ||
342 | }, | ||
343 | |||
344 | 'advanceProgressHandle': function (anEvent) { | ||
345 | //console.log("** advanceProgressHandle", anEvent); | ||
346 | this._actualSteps ++; | ||
347 | //console.log("STEPS: " + this._actualSteps + "/" + this._steps); | ||
348 | }, | ||
349 | |||
350 | 'progressDoneHandle': function (anEvent) { | ||
351 | //console.log("** progressDoneHandle", anEvent); | ||
352 | }, | ||
353 | |||
354 | //------------------------------------------------------------------------- | ||
355 | __syntaxFix__: "syntax fix" | ||
356 | }); | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Mobile/Controllers/MainController.js b/frontend/gamma/js/Clipperz/PM/UI/Mobile/Controllers/MainController.js new file mode 100644 index 0000000..12a61f7 --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Mobile/Controllers/MainController.js | |||
@@ -0,0 +1,393 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz Community Edition. | ||
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | ||
8 | refer to http://www.clipperz.com. | ||
9 | |||
10 | * Clipperz Community Edition is free software: you can redistribute | ||
11 | it and/or modify it under the terms of the GNU Affero General Public | ||
12 | License as published by the Free Software Foundation, either version | ||
13 | 3 of the License, or (at your option) any later version. | ||
14 | |||
15 | * Clipperz Community Edition is distributed in the hope that it will | ||
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
18 | See the GNU Affero General Public License for more details. | ||
19 | |||
20 | * You should have received a copy of the GNU Affero General Public | ||
21 | License along with Clipperz Community Edition. If not, see | ||
22 | <http://www.gnu.org/licenses/>. | ||
23 | |||
24 | */ | ||
25 | |||
26 | Clipperz.Base.module('Clipperz.PM.UI.Mobile.Controllers'); | ||
27 | |||
28 | Clipperz.PM.UI.Mobile.Controllers.MainController = function() { | ||
29 | this._jQTouch = null; | ||
30 | this._user = null; | ||
31 | this._proxy = null; | ||
32 | this._loginForm = null; | ||
33 | this._cardList = null; | ||
34 | this._cardDetail= null; | ||
35 | |||
36 | return this; | ||
37 | } | ||
38 | |||
39 | MochiKit.Base.update(Clipperz.PM.UI.Mobile.Controllers.MainController.prototype, { | ||
40 | |||
41 | 'toString': function () { | ||
42 | return "Clipperz.PM.UI.Mobile.Controllers.MainController"; | ||
43 | }, | ||
44 | |||
45 | //------------------------------------------------------------------------- | ||
46 | |||
47 | 'user': function () { | ||
48 | return this._user; | ||
49 | }, | ||
50 | |||
51 | 'setUser': function (aValue) { | ||
52 | this._user = aValue; | ||
53 | }, | ||
54 | |||
55 | //------------------------------------------------------------------------- | ||
56 | |||
57 | 'jQTouch': function () { | ||
58 | return this._jQTouch; | ||
59 | }, | ||
60 | |||
61 | 'setJQTouch': function (aValue) { | ||
62 | this._jQTouch = aValue; | ||
63 | }, | ||
64 | |||
65 | //========================================================================= | ||
66 | |||
67 | 'run': function () { | ||
68 | console.log("MainController.run"); | ||
69 | |||
70 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'doLogin', MochiKit.Base.method(this, 'doLogin')); | ||
71 | Clipperz.DOM.Helper.overwrite(MochiKit.DOM.currentDocument().body, {tag:'div', id:'jqt', children:[ | ||
72 | {tag:'div', id:'loginForm'}, | ||
73 | {tag:'div', id:'cardList'}, | ||
74 | {tag:'div', id:'cardDetail'}, | ||
75 | {tag:'div', id:'preferences'} | ||
76 | ]}); | ||
77 | |||
78 | this.showLoginForm(); | ||
79 | |||
80 | this.initjQTouch(); | ||
81 | |||
82 | |||
83 | // this.showAddToHomeScreenBaloon(); | ||
84 | // this.selectInitialProxy(); | ||
85 | }, | ||
86 | |||
87 | 'initjQTouch': function () { | ||
88 | var jqt; | ||
89 | |||
90 | jqt = new $.jQTouch({ | ||
91 | icon: 'data:image/png;charset=utf-8;base64,iVBORw0KGgoAAAANSUhEUgAAAHIAAAByCAIAAAAAvxIqAAAD8GlDQ1BJQ0MgUHJvZmlsZQAAKJGNVd1v21QUP4lvXKQWP6Cxjg4Vi69VU1u5GxqtxgZJk6XpQhq5zdgqpMl1bhpT1za2021Vn/YCbwz4A4CyBx6QeEIaDMT2su0BtElTQRXVJKQ9dNpAaJP2gqpwrq9Tu13GuJGvfznndz7v0TVAx1ea45hJGWDe8l01n5GPn5iWO1YhCc9BJ/RAp6Z7TrpcLgIuxoVH1sNfIcHeNwfa6/9zdVappwMknkJsVz19HvFpgJSpO64PIN5G+fAp30Hc8TziHS4miFhheJbjLMMzHB8POFPqKGKWi6TXtSriJcT9MzH5bAzzHIK1I08t6hq6zHpRdu2aYdJYuk9Q/881bzZa8Xrx6fLmJo/iu4/VXnfH1BB/rmu5ScQvI77m+BkmfxXxvcZcJY14L0DymZp7pML5yTcW61PvIN6JuGr4halQvmjNlCa4bXJ5zj6qhpxrujeKPYMXEd+q00KR5yNAlWZzrF+Ie+uNsdC/MO4tTOZafhbroyXuR3Df08bLiHsQf+ja6gTPWVimZl7l/oUrjl8OcxDWLbNU5D6JRL2gxkDu16fGuC054OMhclsyXTOOFEL+kmMGs4i5kfNuQ62EnBuam8tzP+Q+tSqhz9SuqpZlvR1EfBiOJTSgYMMM7jpYsAEyqJCHDL4dcFFTAwNMlFDUUpQYiadhDmXteeWAw3HEmA2s15k1RmnP4RHuhBybdBOF7MfnICmSQ2SYjIBM3iRvkcMki9IRcnDTthyLz2Ld2fTzPjTQK+Mdg8y5nkZfFO+se9LQr3/09xZr+5GcaSufeAfAww60mAPx+q8u/bAr8rFCLrx7s+v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1kTg1Lnzcs9CWY7SDg9/3f/a0v7By/WdHU0RlbvWJJI85GkoimGAP5ZG7XLf2nndU//tVu0xjHya24CpPcXcfae+D48cSU5cuWVotuy7RUiR1NXvfQ4+ccp8Izn4phW8a7vcqWldOYfoERgqGqTrnta4/3vrn3ICqUdL8MrsZKFwBnz51/9VBm+oL1cxuMjKt+8zfifE/Fxr6GQl8kmvHNXD9HSP7a57pv/NvtHd3dw82N/SGBy75P/cmW//rA6qv1xAwwSf2fn77z3ttXXBP/FGiccTXW2L1/p5vABCYwgQlMYAL/2fH/AdkCEQl+/Ar/AAAAAElFTkSuQmCCCg==', | ||
92 | // icon4: 'jqtouch4.png', | ||
93 | // startupScreen: null, //Pass a string path to a 320px x 460px startup screen for full screen apps. | ||
94 | statusBar: 'black-translucent', //Styles the status bar when running as a fullscreen app. Other options are `default`, `black`, and `black-translucent`. | ||
95 | // addGlossToIcon: true, //Set to 'false' to prevent automatic glossy button effect on icon. | ||
96 | preloadImages: false, //Pass an array of image paths to load them before page loads. Ex: `['images/link_over.png', 'images/link_select.png']` | ||
97 | fixedViewport: true, //Removes the user's ability to scale the page. Ensures the site behaves more like an application. | ||
98 | // fullScreen: true, //The website will become a fullscreen application when saved to a user's home screen. Set to `false` to disable. | ||
99 | // fullScreenClass: 'fullscreen' //Adds a class to the `<body>` when running in full-screen mode, to allow for easy detection and styling. Set to `false` to disable. | ||
100 | // themeSelectionSelector: '#jqt #themes ul', //??? | ||
101 | |||
102 | // useAnimations: true, //Set to `false` to disable all animations. | ||
103 | // useFastTouch: true, //Removes ~350ms onClick delay when tapping a link (use in conjunction with the .tap() event) **Experimental** | ||
104 | // useTouchScroll: true, //Adds support for iOS5 scrolling. Set to false to disable. **Experimental** | ||
105 | |||
106 | cacheGetRequests: false, //Automatically caches GET requests, so subsequent taps reference the pre-loaded views. (default: true) | ||
107 | |||
108 | // backSelector: '.back, .cancel, .goback', //A CSS selector for back links/buttons. When clicked, the page history goes back one, automatically reversing whichever entrance animation was used. | ||
109 | |||
110 | // cubeSelector: '.cube', //Link selector for a cube animation. | ||
111 | // dissolveSelector: '.dissolve', //Link selector for a dissolve animation. | ||
112 | // fadeSelector: '.fade', //Link selector for a fade animation. | ||
113 | // flipSelector: '.flip', //Link selector for a 3d flip animation. | ||
114 | formSelector: null, //Sets which forms are automatically submitted via Ajax. (default: 'form') | ||
115 | // popSelector: '.pop', //Link selector for a pop animation. (default: '.pop') | ||
116 | // slideSelector: 'body > * > ul li a', //Link selector for the default slide-left transition. By default applies to all links within an unordered list. Accepts any jQuery-capable selector `'li > a, a:not(.dontslide)'`, etc. (default: 'body > * > ul li a') | ||
117 | // slideupSelector: '.slideup', //Link selector for a slide up animation. (default: '.slideup') | ||
118 | // submitSelector: '.submit', //Selector which, when clicked, will submit its parent form (and close keyboard if open). (default: '.submit') | ||
119 | // swapSelector: '.swap', //Link selector for 3d swap animation. (default: '.swap') | ||
120 | // touchSelector: 'a, .touch', //Selector for items which are automatically given expanded touch events. This makes ordinary links more responsive and provides trigger events like `swipe` (default: 'a, .touch') | ||
121 | |||
122 | debug: false | ||
123 | }); | ||
124 | |||
125 | this.setJQTouch(jqt); | ||
126 | }, | ||
127 | |||
128 | //========================================================================= | ||
129 | |||
130 | 'showAddToHomeScreenBaloon': function () { | ||
131 | console.log(">>> showAddToHomeScreenBaloon"); | ||
132 | }, | ||
133 | |||
134 | //------------------------------------------------------------------------- | ||
135 | |||
136 | 'selectInitialProxy': function () { | ||
137 | //console.log(">>> selectInitialProxy"); | ||
138 | if (this.isOnline()) { | ||
139 | //console.log("--- selectInitialProxy: using default proxy"); | ||
140 | this._proxy = Clipperz.PM.Proxy.defaultProxy; | ||
141 | } else { | ||
142 | if (this.hasLocalData()) { | ||
143 | //console.log("--- selectInitialProxy: using local cache proxy"); | ||
144 | this._proxy = new Clipperz.PM.Proxy.OfflineCache({'shouldPayTolls':false}); | ||
145 | } else { | ||
146 | this.showOfflineError(); | ||
147 | } | ||
148 | } | ||
149 | }, | ||
150 | |||
151 | //------------------------------------------------------------------------- | ||
152 | |||
153 | 'showLoginForm': function (args) { | ||
154 | args = args || {}; | ||
155 | |||
156 | args['callback'] = MochiKit.Base.method(this, 'doLogin'); | ||
157 | |||
158 | if (Clipperz.PM.PIN.isSet()) { | ||
159 | args['errorCallback'] = MochiKit.Base.method(this, 'handleFailedPinLogin'); | ||
160 | this.loginForm().showPinLogin(args); | ||
161 | } else { | ||
162 | args['errorCallback'] = MochiKit.Base.method(this, 'handleFailedCredentialsLogin'); | ||
163 | this.loginForm().showCredentialsLogin(args); | ||
164 | } | ||
165 | }, | ||
166 | |||
167 | //......................................................................... | ||
168 | |||
169 | 'handleFailedCredentialsLogin': function () { | ||
170 | console.log("LOGIN FAILED"); | ||
171 | this.showLoginForm({'previousFailedAttempt':'LOGIN'}); | ||
172 | }, | ||
173 | |||
174 | //......................................................................... | ||
175 | |||
176 | 'handleFailedPinLogin': function () { | ||
177 | varfailedAttempts; | ||
178 | varstatus; | ||
179 | |||
180 | failedAttempts = Clipperz.PM.PIN.recordFailedAttempt(); | ||
181 | this.showLoginForm({'previousFailedAttempt':'PIN', 'failedAttempts': failedAttempts}); | ||
182 | }, | ||
183 | |||
184 | //------------------------------------------------------------------------- | ||
185 | |||
186 | 'doLogin': function (someArgs) { | ||
187 | var deferredResult; | ||
188 | var credentials; | ||
189 | var errorCallback; | ||
190 | var user; | ||
191 | var getPassphraseDelegate; | ||
192 | |||
193 | //console.log(">>> MainController.doLogin", someArgs); | ||
194 | credentials = someArgs['credentials']; | ||
195 | errorCallback = someArgs['errorCallback'] || MochiKit.Base.noop; | ||
196 | |||
197 | getPassphraseDelegate = MochiKit.Base.partial(MochiKit.Async.succeed, credentials.passphrase); | ||
198 | user = new Clipperz.PM.DataModel.User({'username':credentials.username, 'getPassphraseFunction':getPassphraseDelegate}); | ||
199 | |||
200 | deferredResult = new Clipperz.Async.Deferred('MainController.doLogin', {trace:false}); | ||
201 | deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'initProgress', {'steps':4}); | ||
202 | deferredResult.addCallback(MochiKit.Async.wait, 0.1); | ||
203 | deferredResult.addMethod(Clipperz.Crypto.PRNG.defaultRandomGenerator(), 'deferredEntropyCollection'); | ||
204 | deferredResult.addMethod(user, 'login'); | ||
205 | deferredResult.addCallbacks( | ||
206 | MochiKit.Base.method(this, 'processSuccessfulLogin', user), | ||
207 | errorCallback | ||
208 | ); | ||
209 | deferredResult.callback(); | ||
210 | |||
211 | return deferredResult; | ||
212 | }, | ||
213 | |||
214 | //.......................................................................... | ||
215 | |||
216 | 'processSuccessfulLogin': function (aUser) { | ||
217 | var deferredResult; | ||
218 | |||
219 | deferredResult = new Clipperz.Async.Deferred('MainController.processSuccessfulLogin', {trace:false}); | ||
220 | deferredResult.addMethod(Clipperz.PM.PIN, 'resetFailedAttemptCount'); | ||
221 | // deferredResult.addMethod(this, 'removeLoginForm'); | ||
222 | deferredResult.addMethod(this, 'setUser', aUser); | ||
223 | deferredResult.addMethod(this, 'setupApplication'); | ||
224 | deferredResult.addMethod(this, 'runApplication'); | ||
225 | deferredResult.callback(); | ||
226 | |||
227 | return deferredResult; | ||
228 | }, | ||
229 | |||
230 | //------------------------------------------------------------------------- | ||
231 | |||
232 | 'setupApplication': function () { | ||
233 | vardeferredResult; | ||
234 | |||
235 | console.log(">>> setupApplication"); | ||
236 | deferredResult = new Clipperz.Async.Deferred("MainController.setupApplication", {trace:false}); | ||
237 | deferredResult.addMethod(this, 'welcomeFirstTimeUser'); | ||
238 | deferredResult.addMethod(this, 'showPaymentReminder'); | ||
239 | deferredResult.addMethod(this, 'copyDataLocally'); | ||
240 | deferredResult.callback(arguments); | ||
241 | |||
242 | return deferredResult; | ||
243 | }, | ||
244 | |||
245 | |||
246 | //.......................................................................... | ||
247 | |||
248 | 'isFirstTimeUser': function () { | ||
249 | return false; | ||
250 | }, | ||
251 | |||
252 | 'welcomeFirstTimeUser': function () { | ||
253 | vardeferredResult; | ||
254 | |||
255 | deferredResult = new Clipperz.Async.Deferred('MainController.welcomeFirstTimeUser', {trace:false}); | ||
256 | |||
257 | if (this.isFirstTimeUser()) { | ||
258 | deferredResult.addCallback(function () { console.log("--> welcome"); }); | ||
259 | } | ||
260 | deferredResult.callback(); | ||
261 | |||
262 | return deferredResult; | ||
263 | }, | ||
264 | |||
265 | //.......................................................................... | ||
266 | |||
267 | 'shouldShowPaymentReminder': function () { | ||
268 | return true; | ||
269 | }, | ||
270 | |||
271 | 'showPaymentReminder': function () { | ||
272 | vardeferredResult; | ||
273 | |||
274 | deferredResult = new Clipperz.Async.Deferred('MainController.showPaymentReminder', {trace:false}); | ||
275 | |||
276 | if (this.shouldShowPaymentReminder()) { | ||
277 | deferredResult.addCallback(function () { console.log("--> payment reminder"); }); | ||
278 | } | ||
279 | deferredResult.callback(); | ||
280 | |||
281 | return deferredResult; | ||
282 | }, | ||
283 | |||
284 | //.......................................................................... | ||
285 | |||
286 | 'canCopyDataLocally': function () { | ||
287 | return false; | ||
288 | }, | ||
289 | |||
290 | 'copyDataLocally': function () { | ||
291 | vardeferredResult; | ||
292 | |||
293 | deferredResult = new Clipperz.Async.Deferred('MainController.copyDataLocally', {trace:false}); | ||
294 | |||
295 | if (this.canCopyDataLocally()) { | ||
296 | deferredResult.addCallback(function () { console.log("--> copy data locally"); }); | ||
297 | } | ||
298 | deferredResult.callback(); | ||
299 | |||
300 | return deferredResult; | ||
301 | |||
302 | }, | ||
303 | |||
304 | //------------------------------------------------------------------------- | ||
305 | |||
306 | 'runApplication': function () { | ||
307 | var deferredResult; | ||
308 | |||
309 | //console.log(">>> runApplication"); | ||
310 | deferredResult = new Clipperz.Async.Deferred('MainController.runApplication', {trace:true}); | ||
311 | deferredResult.addMethod(this.user(), 'getRecords'); | ||
312 | deferredResult.addMethod(this, 'showCards'); | ||
313 | deferredResult.callback(); | ||
314 | |||
315 | return deferredResult; | ||
316 | }, | ||
317 | |||
318 | //========================================================================= | ||
319 | |||
320 | 'showOfflineError': function (anException) { | ||
321 | alert("Error: " + anException); | ||
322 | throw anException; | ||
323 | }, | ||
324 | |||
325 | //========================================================================= | ||
326 | |||
327 | 'isOnline': function() { | ||
328 | return navigator.onLine; | ||
329 | }, | ||
330 | |||
331 | 'hasLocalData': function() { | ||
332 | return false; | ||
333 | }, | ||
334 | |||
335 | //========================================================================= | ||
336 | |||
337 | 'loginForm': function() { | ||
338 | if (this._loginForm == null) { | ||
339 | this._loginForm = new Clipperz.PM.UI.Mobile.Components.LoginForm({element:MochiKit.DOM.getElement('loginForm')}); | ||
340 | } | ||
341 | |||
342 | return this._loginForm; | ||
343 | }, | ||
344 | |||
345 | 'removeLoginForm': function () { | ||
346 | if (this._loginForm != null) { | ||
347 | this._loginForm.remove(); | ||
348 | this._loginForm = null; | ||
349 | } | ||
350 | }, | ||
351 | |||
352 | //------------------------------------------------------------------------- | ||
353 | |||
354 | 'cardList': function () { | ||
355 | if (this._cardList == null) { | ||
356 | this._cardList = new Clipperz.PM.UI.Mobile.Components.CardList({element:MochiKit.DOM.getElement('cardList')}); | ||
357 | MochiKit.Signal.connect(this._cardList, 'selectedCard', this, 'selectCardHandler'); | ||
358 | } | ||
359 | |||
360 | return this._cardList; | ||
361 | }, | ||
362 | |||
363 | 'showCards': function (someCards) { | ||
364 | this.cardList().showCards(someCards); | ||
365 | this.jQTouch().goTo('#cardList', 'slideleft'); | ||
366 | }, | ||
367 | |||
368 | //------------------------------------------------------------------------- | ||
369 | |||
370 | 'cardDetail': function () { | ||
371 | if (this._cardDetail == null) { | ||
372 | this._cardDetail = new Clipperz.PM.UI.Mobile.Components.CardDetail({element:MochiKit.DOM.getElement('cardDetail')}); | ||
373 | } | ||
374 | |||
375 | return this._cardDetail; | ||
376 | }, | ||
377 | |||
378 | 'selectCardHandler': function (aCardReference) { | ||
379 | var deferredResult; | ||
380 | |||
381 | deferredResult = new Clipperz.Async.Deferred("MainController.selectCardHandler", {trace:true}); | ||
382 | deferredResult.addMethod(this.cardDetail(), 'render'); | ||
383 | deferredResult.addMethod(this.jQTouch(), 'goTo', '#cardDetail', 'slideleft'); | ||
384 | deferredResult.addMethod(this.user(), 'getRecord', aCardReference); | ||
385 | deferredResult.addMethod(this.cardDetail(), 'showCard'); | ||
386 | deferredResult.callback(); | ||
387 | |||
388 | return deferredResult; | ||
389 | }, | ||
390 | |||
391 | //========================================================================= | ||
392 | __syntaxFix__: "syntax fix" | ||
393 | }); | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/AccountPanel.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/AccountPanel.js index ee6d7a3..d6b0574 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/AccountPanel.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/AccountPanel.js | |||
@@ -1,145 +1,150 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2011 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz Community Edition. |
6 | Clipperz Community Edition is an online password manager. | 6 | Clipperz Community Edition is an online password manager. |
7 | For further information about its features and functionalities please | 7 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 8 | refer to http://www.clipperz.com. |
9 | 9 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 10 | * Clipperz Community Edition is free software: you can redistribute |
11 | it and/or modify it under the terms of the GNU Affero General Public | 11 | it and/or modify it under the terms of the GNU Affero General Public |
12 | License as published by the Free Software Foundation, either version | 12 | License as published by the Free Software Foundation, either version |
13 | 3 of the License, or (at your option) any later version. | 13 | 3 of the License, or (at your option) any later version. |
14 | 14 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 15 | * Clipperz Community Edition is distributed in the hope that it will |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 16 | be useful, but WITHOUT ANY WARRANTY; without even the implied |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 18 | See the GNU Affero General Public License for more details. |
19 | 19 | ||
20 | * You should have received a copy of the GNU Affero General Public | 20 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 21 | License along with Clipperz Community Edition. If not, see |
22 | <http://www.gnu.org/licenses/>. | 22 | <http://www.gnu.org/licenses/>. |
23 | 23 | ||
24 | */ | 24 | */ |
25 | 25 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 27 | ||
28 | Clipperz.PM.UI.Web.Components.AccountPanel = function(args) { | 28 | Clipperz.PM.UI.Web.Components.AccountPanel = function(args) { |
29 | args = args || {}; | 29 | args = args || {}; |
30 | 30 | ||
31 | Clipperz.PM.UI.Web.Components.AccountPanel.superclass.constructor.apply(this, arguments); | 31 | Clipperz.PM.UI.Web.Components.AccountPanel.superclass.constructor.apply(this, arguments); |
32 | 32 | ||
33 | //this._initiallySelectedTab = args.selected || 'ACCOUNT'; | 33 | //this._initiallySelectedTab = args.selected || 'ACCOUNT'; |
34 | this._initiallySelectedTab = args.selected || 'PASSPHRASE'; | 34 | this._initiallySelectedTab = args.selected || 'PASSPHRASE'; |
35 | this._tabPanelControllerConfiguration = { | 35 | this._tabPanelControllerConfiguration = { |
36 | // 'ACCOUNT': { | 36 | // 'ACCOUNT': { |
37 | // tab:'accountTab', | 37 | // tab:'accountTab', |
38 | // panel:'accountPanel' | 38 | // panel:'accountPanel' |
39 | // }, | 39 | // }, |
40 | 'PASSPHRASE': { | 40 | 'PASSPHRASE': { |
41 | tab:'passphraseTab', | 41 | tab:'passphraseTab', |
42 | panel:'passphrasePanel' | 42 | panel:'passphrasePanel' |
43 | }, | 43 | }, |
44 | 'OTP': { | ||
45 | tab:'OTPTab', | ||
46 | panel:'OTPPanel' | ||
47 | }, | ||
44 | 'PREFERENCES': { | 48 | 'PREFERENCES': { |
45 | tab:'preferencesTab', | 49 | tab:'preferencesTab', |
46 | panel:'preferencesPanel' | 50 | panel:'preferencesPanel' |
47 | }, | 51 | }, |
48 | 'LOGIN_HISTORY': { | 52 | 'LOGIN_HISTORY': { |
49 | tab:'loginHistoryTab', | 53 | tab:'loginHistoryTab', |
50 | panel:'loginHistoryPanel' | 54 | panel:'loginHistoryPanel' |
51 | } | 55 | } |
52 | }; | 56 | }; |
53 | 57 | ||
54 | return this; | 58 | return this; |
55 | } | 59 | } |
56 | 60 | ||
57 | //============================================================================= | 61 | //============================================================================= |
58 | 62 | ||
59 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.AccountPanel, Clipperz.PM.UI.Common.Components.TabPanelComponent, { | 63 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.AccountPanel, Clipperz.PM.UI.Common.Components.TabPanelComponent, { |
60 | 64 | ||
61 | //------------------------------------------------------------------------- | 65 | //------------------------------------------------------------------------- |
62 | 66 | ||
63 | 'toString': function () { | 67 | 'toString': function () { |
64 | return "Clipperz.PM.UI.Web.Components.AccountPanel component"; | 68 | return "Clipperz.PM.UI.Web.Components.AccountPanel component"; |
65 | }, | 69 | }, |
66 | 70 | ||
67 | //------------------------------------------------------------------------- | 71 | //------------------------------------------------------------------------- |
68 | 72 | ||
69 | 'renderSelf': function(/*aContainer, aPosition*/) { | 73 | 'renderSelf': function(/*aContainer, aPosition*/) { |
70 | //Clipperz.log("AccountPanel.renderSelf element", this.element()); | 74 | //Clipperz.log("AccountPanel.renderSelf element", this.element()); |
71 | this.append(this.element(), [ | 75 | this.append(this.element(), [ |
72 | {tag:'div', cls:'header', children:[ | 76 | {tag:'div', cls:'header', children:[ |
73 | {tag:'div', cls:'subPanelTabs', children:[ | 77 | {tag:'div', cls:'subPanelTabs', children:[ |
74 | {tag:'ul', children:[ | 78 | {tag:'ul', children:[ |
75 | // {tag:'li', id:this.getId('accountTab'), children:[{tag:'a', href:'#', html:'Account'}], cls:'first'}, | 79 | // {tag:'li', id:this.getId('accountTab'), children:[{tag:'a', href:'#', html:'Account'}], cls:'first'}, |
76 | {tag:'li', id:this.getId('passphraseTab'), children:[{tag:'a', href:'#', html:'Passphrase'}], cls:'first'}, | 80 | {tag:'li', id:this.getId('passphraseTab'), children:[{tag:'a', href:'#', html:'Passphrase'}], cls:'first'}, |
81 | {tag:'li', id:this.getId('OTPTab'), children:[{tag:'a', href:'#', html:'One Time Passwords'}]}, | ||
77 | {tag:'li', id:this.getId('preferencesTab'), children:[{tag:'a', href:'#', html:'Preferences'}]}, | 82 | {tag:'li', id:this.getId('preferencesTab'), children:[{tag:'a', href:'#', html:'Preferences'}]}, |
78 | {tag:'li', id:this.getId('loginHistoryTab'),children:[{tag:'a', href:'#', html:'Login history'}]} | 83 | {tag:'li', id:this.getId('loginHistoryTab'),children:[{tag:'a', href:'#', html:'Login history'}]} |
79 | ]} | 84 | ]} |
80 | ]} | 85 | ]} |
81 | ]}, | 86 | ]}, |
82 | {tag:'div', cls:'body', children:[ | 87 | {tag:'div', cls:'body', children:[ |
83 | {tag:'div', cls:'accountPanel', children:[ | 88 | {tag:'div', cls:'accountPanel', children:[ |
84 | {tag:'div', cls:'subPanelContent', children:[ | 89 | {tag:'div', cls:'subPanelContent', children:[ |
85 | {tag:'ul', children:[ | 90 | {tag:'ul', children:[ |
86 | // {tag:'li', id:this.getId('accountPanel'),children:[ | 91 | // {tag:'li', id:this.getId('accountPanel'),children:[ |
87 | // {tag:'h3', html:"-- Account --"} | 92 | // {tag:'h3', html:"-- Account --"} |
88 | // ]}, | 93 | // ]}, |
89 | {tag:'li', id:this.getId('passphrasePanel'),children:[ | 94 | {tag:'li', id:this.getId('passphrasePanel'),children:[ |
90 | {tag:'h3', cls:'changePassphrase', html:"Change passphrase"}, | 95 | {tag:'h3', cls:'changePassphrase', html:"Change passphrase"}, |
91 | {tag:'form', id:this.getId('changePassphrase'), cls:'changePassphrase', children:[ | 96 | {tag:'form', id:this.getId('changePassphrase'), cls:'changePassphrase', children:[ |
92 | {tag:'div', cls:'currentCredentials', children:[ | 97 | {tag:'div', cls:'currentCredentials', children:[ |
93 | {tag:'div', cls:'field username', children:[ | 98 | {tag:'div', cls:'field username', children:[ |
94 | {tag:'label', html:"username", 'for':this.getId('currentUsername')}, | 99 | {tag:'label', html:"username", 'for':this.getId('currentUsername')}, |
95 | {tag:'input', id:this.getId('currentUsername')} | 100 | {tag:'input', id:this.getId('currentUsername')} |
96 | ]}, | 101 | ]}, |
97 | {tag:'div', cls:'field passphrase', children:[ | 102 | {tag:'div', cls:'field passphrase', children:[ |
98 | {tag:'label', html:"passphrase", 'for':this.getId('currentPassphrase')}, | 103 | {tag:'label', html:"passphrase", 'for':this.getId('currentPassphrase')}, |
99 | {tag:'input', id:this.getId('currentPassphrase')} | 104 | {tag:'input', id:this.getId('currentPassphrase')} |
100 | ]} | 105 | ]} |
101 | ]}, | 106 | ]}, |
102 | {tag:'div', cls:'newPassphrase', children:[ | 107 | {tag:'div', cls:'newPassphrase', children:[ |
103 | {tag:'div', cls:'field', children:[ | 108 | {tag:'div', cls:'field', children:[ |
104 | {tag:'label', html:"new passphrase", 'for':this.getId('newPassphrase')}, | 109 | {tag:'label', html:"new passphrase", 'for':this.getId('newPassphrase')}, |
105 | {tag:'input', id:this.getId('newPassphrase')} | 110 | {tag:'input', id:this.getId('newPassphrase')} |
106 | ]}, | 111 | ]}, |
107 | {tag:'div', cls:'field', children:[ | 112 | {tag:'div', cls:'field', children:[ |
108 | {tag:'label', html:"re-new passphrase", 'for':this.getId('reNewPassphrase')}, | 113 | {tag:'label', html:"re-new passphrase", 'for':this.getId('reNewPassphrase')}, |
109 | {tag:'input', id:this.getId('reNewPassphrase')} | 114 | {tag:'input', id:this.getId('reNewPassphrase')} |
110 | ]} | 115 | ]} |
111 | ]}, | 116 | ]}, |
112 | {tag:'div', cls:'confirm', children:[ | 117 | {tag:'div', cls:'confirm', children:[ |
113 | {tag:'input', type:'checkbox', id:this.getId('confirm')}, | 118 | {tag:'input', type:'checkbox', id:this.getId('confirm')}, |
114 | {tag:'label', html:"I understand that Clipperz will not be able to recover a lost passphrase", 'for':this.getId('confirm')} | 119 | {tag:'label', html:"I understand that Clipperz will not be able to recover a lost passphrase", 'for':this.getId('confirm')} |
115 | ]} | 120 | ]} |
116 | ]}, | 121 | ]}, |
117 | {tag:'div', cls:'clear'}, | 122 | {tag:'div', cls:'clear'}, |
118 | {tag:'div', cls:'confirmButton', id:this.getId('confirmationButton'), children:[ | 123 | {tag:'div', cls:'confirmButton', id:this.getId('confirmationButton'), children:[ |
119 | {tag:'span', html:"change passphrase"} | 124 | {tag:'span', html:"change passphrase"} |
120 | ]}, | 125 | ]} |
121 | 126 | ]}, | |
122 | {tag:'h3', cls:'manageOTP', html:"Manage One-Time Passphrases"}, | 127 | {tag:'li', id:this.getId('OTPPanel'), children:[ |
123 | {} | 128 | // {tag:'h3', html:"Manage One-Time Passphrases"} |
124 | ]}, | 129 | ]}, |
125 | {tag:'li', id:this.getId('preferencesPanel'), children:[ | 130 | {tag:'li', id:this.getId('preferencesPanel'), children:[ |
126 | {tag:'h3', html:"-- Preferences --"} | 131 | // {tag:'h3', html:"-- Preferences --"} |
127 | ]}, | 132 | ]}, |
128 | {tag:'li', id:this.getId('loginHistoryPanel'), children:[ | 133 | {tag:'li', id:this.getId('loginHistoryPanel'), children:[ |
129 | {tag:'h3', html:"-- Login History --"} | 134 | // {tag:'h3', html:"-- Login History --"} |
130 | ]} | 135 | ]} |
131 | ]} | 136 | ]} |
132 | ]} | 137 | ]} |
133 | ]} | 138 | ]} |
134 | ]}, | 139 | ]}, |
135 | {tag:'div', cls:'footer'} | 140 | {tag:'div', cls:'footer'} |
136 | ]); | 141 | ]); |
137 | 142 | ||
138 | this.tabPanelController().setup({selected:this.initiallySelectedTab()}); | 143 | this.tabPanelController().setup({selected:this.initiallySelectedTab()}); |
139 | }, | 144 | }, |
140 | 145 | ||
141 | //------------------------------------------------------------------------- | 146 | //------------------------------------------------------------------------- |
142 | 147 | ||
143 | 148 | ||
144 | __syntaxFix__: "syntax fix" | 149 | __syntaxFix__: "syntax fix" |
145 | }); | 150 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DataPanel.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DataPanel.js index d2f1045..462d864 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DataPanel.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DataPanel.js | |||
@@ -1,108 +1,116 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2011 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz Community Edition. |
6 | Clipperz Community Edition is an online password manager. | 6 | Clipperz Community Edition is an online password manager. |
7 | For further information about its features and functionalities please | 7 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 8 | refer to http://www.clipperz.com. |
9 | 9 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 10 | * Clipperz Community Edition is free software: you can redistribute |
11 | it and/or modify it under the terms of the GNU Affero General Public | 11 | it and/or modify it under the terms of the GNU Affero General Public |
12 | License as published by the Free Software Foundation, either version | 12 | License as published by the Free Software Foundation, either version |
13 | 3 of the License, or (at your option) any later version. | 13 | 3 of the License, or (at your option) any later version. |
14 | 14 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 15 | * Clipperz Community Edition is distributed in the hope that it will |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 16 | be useful, but WITHOUT ANY WARRANTY; without even the implied |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 18 | See the GNU Affero General Public License for more details. |
19 | 19 | ||
20 | * You should have received a copy of the GNU Affero General Public | 20 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 21 | License along with Clipperz Community Edition. If not, see |
22 | <http://www.gnu.org/licenses/>. | 22 | <http://www.gnu.org/licenses/>. |
23 | 23 | ||
24 | */ | 24 | */ |
25 | 25 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 27 | ||
28 | Clipperz.PM.UI.Web.Components.DataPanel = function(args) { | 28 | Clipperz.PM.UI.Web.Components.DataPanel = function(args) { |
29 | args = args || {}; | 29 | args = args || {}; |
30 | 30 | ||
31 | Clipperz.PM.UI.Web.Components.DataPanel.superclass.constructor.apply(this, arguments); | 31 | Clipperz.PM.UI.Web.Components.DataPanel.superclass.constructor.apply(this, arguments); |
32 | 32 | ||
33 | this._initiallySelectedTab = args.selected || 'OFFLINE_COPY'; | 33 | this._initiallySelectedTab = args.selected || 'OFFLINE_COPY'; |
34 | this._tabPanelControllerConfiguration = { | 34 | this._tabPanelControllerConfiguration = { |
35 | 'OFFLINE_COPY': { | 35 | 'OFFLINE_COPY': { |
36 | tab:'offlineCopyTab', | 36 | tab:'offlineCopyTab', |
37 | panel:'offlineCopyPanel' | 37 | panel:'offlineCopyPanel' |
38 | }, | 38 | }, |
39 | 'SHARING': { | 39 | 'SHARING': { |
40 | tab:'sharingTab', | 40 | tab:'sharingTab', |
41 | panel:'sharingPanel' | 41 | panel:'sharingPanel' |
42 | }, | 42 | }, |
43 | 'IMPORT': { | 43 | 'IMPORT': { |
44 | tab:'importTab', | 44 | tab:'importTab', |
45 | panel:'importPanel' | 45 | panel:'importPanel' |
46 | }, | 46 | }, |
47 | 'EXPORT': { | 47 | 'EXPORT': { |
48 | tab:'exportTab', | 48 | tab:'exportTab', |
49 | panel:'exportPanel' | 49 | panel:'exportPanel' |
50 | } | 50 | } |
51 | }; | 51 | }; |
52 | 52 | ||
53 | return this; | 53 | return this; |
54 | } | 54 | } |
55 | 55 | ||
56 | //============================================================================= | 56 | //============================================================================= |
57 | 57 | ||
58 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.DataPanel, Clipperz.PM.UI.Common.Components.TabPanelComponent, { | 58 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.DataPanel, Clipperz.PM.UI.Common.Components.TabPanelComponent, { |
59 | 59 | ||
60 | //------------------------------------------------------------------------- | 60 | //------------------------------------------------------------------------- |
61 | 61 | ||
62 | 'toString': function () { | 62 | 'toString': function () { |
63 | return "Clipperz.PM.UI.Web.Components.DataPanel component"; | 63 | return "Clipperz.PM.UI.Web.Components.DataPanel component"; |
64 | }, | 64 | }, |
65 | 65 | ||
66 | //------------------------------------------------------------------------- | 66 | //------------------------------------------------------------------------- |
67 | 67 | ||
68 | 'renderSelf': function(/*aContainer, aPosition*/) { | 68 | 'renderSelf': function(/*aContainer, aPosition*/) { |
69 | this.append(this.element(), [ | 69 | this.append(this.element(), [ |
70 | {tag:'div', cls:'header', children:[ | 70 | {tag:'div', cls:'header', children:[ |
71 | {tag:'div', cls:'subPanelTabs', children:[ | 71 | {tag:'div', cls:'subPanelTabs', children:[ |
72 | {tag:'ul', children:[ | 72 | {tag:'ul', children:[ |
73 | {tag:'li', id:this.getId('offlineCopyTab'),children:[{tag:'a', href:'#', html:'Offline copy'}], cls:'first'}, | 73 | {tag:'li', id:this.getId('offlineCopyTab'),children:[{tag:'a', href:'#', html:'Offline copy'}], cls:'first'}, |
74 | {tag:'li', id:this.getId('sharingTab'), children:[{tag:'a', href:'#', html:'Sharing'}]}, | 74 | {tag:'li', id:this.getId('sharingTab'), children:[{tag:'a', href:'#', html:'Sharing'}]}, |
75 | {tag:'li', id:this.getId('importTab'), children:[{tag:'a', href:'#', html:'Import'}]}, | 75 | {tag:'li', id:this.getId('importTab'), children:[{tag:'a', href:'#', html:'Import'}]}, |
76 | {tag:'li', id:this.getId('exportTab'), children:[{tag:'a', href:'#', html:'Export'}]} | 76 | {tag:'li', id:this.getId('exportTab'), children:[{tag:'a', href:'#', html:'Export'}]} |
77 | ]} | 77 | ]} |
78 | ]} | 78 | ]} |
79 | ]}, | 79 | ]}, |
80 | {tag:'div', cls:'body', children:[ | 80 | {tag:'div', cls:'body', children:[ |
81 | {tag:'div', cls:'accountPanel', children:[ | 81 | {tag:'div', cls:'accountPanel', children:[ |
82 | {tag:'div', cls:'subPanelContent', children:[ | 82 | {tag:'div', cls:'subPanelContent', children:[ |
83 | {tag:'ul', children:[ | 83 | {tag:'ul', children:[ |
84 | {tag:'li', id:this.getId('offlineCopyPanel'),children:[ | 84 | {tag:'li', id:this.getId('offlineCopyPanel'),children:[ |
85 | {tag:'h3', html:"Offline copy"} | 85 | // {tag:'h3', html:"Offline copy"}, |
86 | {tag:'p', html:"With just one click you can dump all your encrypted data from Clipperz servers to your hard disk and create a read-only offline version of Clipperz to be used when you are not connected to the Internet."}, | ||
87 | {tag:'a', id:this.getId('offlineCopyDownloadLink'), href:'#', html:"Download", cls:'downloadOfflineCopy'} | ||
86 | ]}, | 88 | ]}, |
87 | {tag:'li', id:this.getId('sharingPanel'),children:[ | 89 | {tag:'li', id:this.getId('sharingPanel'),children:[ |
88 | {tag:'h3', html:"Sharing"} | 90 | // {tag:'h3', html:"Sharing"} |
89 | ]}, | 91 | ]}, |
90 | {tag:'li', id:this.getId('importPanel'), children:[ | 92 | {tag:'li', id:this.getId('importPanel'), children:[ |
91 | {tag:'h3', html:"Import"} | 93 | // {tag:'h3', html:"Import"} |
92 | ]}, | 94 | ]}, |
93 | {tag:'li', id:this.getId('exportPanel'), children:[ | 95 | {tag:'li', id:this.getId('exportPanel'), children:[ |
94 | {tag:'h3', html:"Export"} | 96 | // {tag:'h3', html:"Export"} |
95 | ]} | 97 | ]} |
96 | ]} | 98 | ]} |
97 | ]} | 99 | ]} |
98 | ]} | 100 | ]} |
99 | ]}, | 101 | ]}, |
100 | {tag:'div', cls:'footer'} | 102 | {tag:'div', cls:'footer'} |
101 | ]); | 103 | ]); |
102 | 104 | ||
103 | this.tabPanelController().setup({selected:this.initiallySelectedTab()}); | 105 | this.tabPanelController().setup({selected:this.initiallySelectedTab()}); |
106 | MochiKit.Signal.connect(this.getId('offlineCopyDownloadLink'), 'onclick', this, 'downloadOfflineCopy'); | ||
104 | }, | 107 | }, |
105 | 108 | ||
109 | 'downloadOfflineCopy': function (anEvent) { | ||
110 | anEvent.preventDefault(); | ||
111 | MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'downloadOfflineCopy', anEvent.src()); | ||
112 | }, | ||
113 | |||
106 | //------------------------------------------------------------------------- | 114 | //------------------------------------------------------------------------- |
107 | __syntaxFix__: "syntax fix" | 115 | __syntaxFix__: "syntax fix" |
108 | }); | 116 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginProgress.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginProgress.js index 5d082b5..26506e7 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginProgress.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginProgress.js | |||
@@ -1,152 +1,156 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2011 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz Community Edition. |
6 | Clipperz Community Edition is an online password manager. | 6 | Clipperz Community Edition is an online password manager. |
7 | For further information about its features and functionalities please | 7 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 8 | refer to http://www.clipperz.com. |
9 | 9 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 10 | * Clipperz Community Edition is free software: you can redistribute |
11 | it and/or modify it under the terms of the GNU Affero General Public | 11 | it and/or modify it under the terms of the GNU Affero General Public |
12 | License as published by the Free Software Foundation, either version | 12 | License as published by the Free Software Foundation, either version |
13 | 3 of the License, or (at your option) any later version. | 13 | 3 of the License, or (at your option) any later version. |
14 | 14 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 15 | * Clipperz Community Edition is distributed in the hope that it will |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 16 | be useful, but WITHOUT ANY WARRANTY; without even the implied |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 18 | See the GNU Affero General Public License for more details. |
19 | 19 | ||
20 | * You should have received a copy of the GNU Affero General Public | 20 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 21 | License along with Clipperz Community Edition. If not, see |
22 | <http://www.gnu.org/licenses/>. | 22 | <http://www.gnu.org/licenses/>. |
23 | 23 | ||
24 | */ | 24 | */ |
25 | 25 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 27 | ||
28 | Clipperz.PM.UI.Web.Components.LoginProgress = function(args) { | 28 | Clipperz.PM.UI.Web.Components.LoginProgress = function(args) { |
29 | args = args || {}; | 29 | args = args || {}; |
30 | 30 | ||
31 | Clipperz.PM.UI.Web.Components.LoginProgress.superclass.constructor.apply(this, arguments); | 31 | Clipperz.PM.UI.Web.Components.LoginProgress.superclass.constructor.apply(this, arguments); |
32 | 32 | ||
33 | this._deferred = null; | 33 | this._deferred = null; |
34 | 34 | ||
35 | return this; | 35 | return this; |
36 | } | 36 | } |
37 | 37 | ||
38 | //============================================================================= | 38 | //============================================================================= |
39 | 39 | ||
40 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.LoginProgress, Clipperz.PM.UI.Common.Components.BaseComponent, { | 40 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.LoginProgress, Clipperz.PM.UI.Common.Components.BaseComponent, { |
41 | 41 | ||
42 | //------------------------------------------------------------------------- | 42 | //------------------------------------------------------------------------- |
43 | 43 | ||
44 | 'toString': function () { | 44 | 'toString': function () { |
45 | return "Clipperz.PM.UI.Web.Components.LoginProgress component"; | 45 | return "Clipperz.PM.UI.Web.Components.LoginProgress component"; |
46 | }, | 46 | }, |
47 | 47 | ||
48 | //------------------------------------------------------------------------- | 48 | //------------------------------------------------------------------------- |
49 | 49 | ||
50 | 'deferred': function() { | 50 | 'deferred': function() { |
51 | return this._deferred; | 51 | return this._deferred; |
52 | }, | 52 | }, |
53 | 53 | ||
54 | 'setDeferred': function(aValue) { | 54 | 'setDeferred': function(aValue) { |
55 | this._deferred = aValue; | 55 | this._deferred = aValue; |
56 | }, | 56 | }, |
57 | 57 | ||
58 | //------------------------------------------------------------------------- | 58 | //------------------------------------------------------------------------- |
59 | 59 | ||
60 | 'renderSelf': function() { | 60 | 'renderSelf': function() { |
61 | // var loginProgressElement; | 61 | // var loginProgressElement; |
62 | // | 62 | // |
63 | // loginProgressElement = MochiKit.DOM.getElement('loginProgress'); | 63 | // loginProgressElement = MochiKit.DOM.getElement('loginProgress'); |
64 | // | 64 | // |
65 | // if (loginProgressElement == null) { | 65 | // if (loginProgressElement == null) { |
66 | // loginProgressElement = this.append(this.element(), {tag:'div', id:'loginProgress', cls:'LoginProgress'}, true); | 66 | // loginProgressElement = this.append(this.element(), {tag:'div', id:'loginProgress', cls:'LoginProgress'}, true); |
67 | // } | 67 | // } |
68 | 68 | ||
69 | //console.log(">> LoginProgress.renderSelf", this.element()); | 69 | //console.log(">> LoginProgress.renderSelf", this.element()); |
70 | this.append(this.element(), {tag:'div', id:'loginProgress', cls:'LoginProgress', children: [ | 70 | this.append(this.element(), {tag:'div', id:'loginProgress', cls:'LoginProgress', children: [ |
71 | // this.append(loginProgressElement, [ | 71 | // this.append(loginProgressElement, [ |
72 | {tag:'div', cls:'header', children:[ | 72 | {tag:'div', cls:'header', children:[ |
73 | {tag:'h3', id:this.getId('title'), html:"login progress"} | 73 | {tag:'h3', id:this.getId('title'), html:"login progress"} |
74 | ]}, | 74 | ]}, |
75 | {tag:'div', cls:'body', children:[ | 75 | {tag:'div', cls:'body', children:[ |
76 | {tag:'div', id:this.getId('progressBar')}, | 76 | {tag:'div', id:this.getId('progressBar')}, |
77 | {tag:'div', id:this.getId('errorBox'), cls:'errorBox', children:[ | 77 | {tag:'div', id:this.getId('errorBox'), cls:'errorBox', children:[ |
78 | // {tag:'div',cls:'img ALERT', children:[{tag:'div'}]}, | 78 | // {tag:'div',cls:'img ALERT', children:[{tag:'div'}]}, |
79 | {tag:'div',cls:'img ALERT', children:[{tag:'canvas', id:this.getId('canvas')}]}, | 79 | {tag:'div',cls:'img ALERT', children:[{tag:'canvas', id:this.getId('canvas')}]}, |
80 | {tag:'p', html:"Login failed"} | 80 | {tag:'p', html:"Login failed"} |
81 | ]} | 81 | ]} |
82 | ]}, | 82 | ]}, |
83 | {tag:'div', cls:'footer', children:[ | 83 | {tag:'div', cls:'footer', children:[ |
84 | {tag:'div', cls:'buttonArea', id:this.getId('buttonArea'), children:[ | 84 | {tag:'div', cls:'buttonArea', id:this.getId('buttonArea'), children:[ |
85 | {tag:'div', cls:'button', id:this.getId('button'), children:[ | 85 | // {tag:'div', cls:'button', id:this.getId('button'), children:[ |
86 | {tag:'a', href:'#', id:this.getId('buttonLink'), html:"cancel"} | 86 | // {tag:'a', href:'#', id:this.getId('buttonLink'), html:"cancel"} |
87 | ]} | 87 | // ]} |
88 | {tag:'a', cls:'button', id:this.getId('button'), html:"cancel"} | ||
88 | ]} | 89 | ]} |
89 | ]} | 90 | ]} |
90 | ]}); | 91 | ]}); |
91 | // ]); | 92 | // ]); |
92 | 93 | ||
93 | Clipperz.PM.UI.Canvas.marks['!'](this.getElement('canvas'), "#ffffff"); | 94 | Clipperz.PM.UI.Canvas.marks['!'](this.getElement('canvas'), "#ffffff"); |
94 | 95 | ||
95 | this.addComponent(new Clipperz.PM.UI.Common.Components.ProgressBar({'element':this.getElement('progressBar')})); | 96 | this.addComponent(new Clipperz.PM.UI.Common.Components.ProgressBar({'element':this.getElement('progressBar')})); |
96 | MochiKit.Style.hideElement(this.getElement('errorBox')); | 97 | MochiKit.Style.hideElement(this.getElement('errorBox')); |
97 | 98 | ||
98 | MochiKit.Signal.connect(this.getId('buttonLink'), 'onclick', this, 'cancelEventHandler'); | 99 | // MochiKit.Signal.connect(this.getId('buttonLink'), 'onclick', this, 'cancelEventHandler'); |
100 | MochiKit.Signal.connect(this.getId('button'), 'onclick', this, 'cancelEventHandler'); | ||
99 | }, | 101 | }, |
100 | 102 | ||
101 | //------------------------------------------------------------------------- | 103 | //------------------------------------------------------------------------- |
102 | 104 | ||
103 | 'displayElement': function() { | 105 | 'displayElement': function() { |
104 | return MochiKit.DOM.getElement('loginProgress'); | 106 | return MochiKit.DOM.getElement('loginProgress'); |
105 | }, | 107 | }, |
106 | 108 | ||
107 | //------------------------------------------------------------------------- | 109 | //------------------------------------------------------------------------- |
108 | 110 | ||
109 | 'cancelEventHandler': function(anEvent) { | 111 | 'cancelEventHandler': function(anEvent) { |
110 | anEvent.preventDefault(); | 112 | anEvent.preventDefault(); |
111 | 113 | ||
112 | MochiKit.Signal.signal(this, 'cancelEvent'); | 114 | MochiKit.Signal.signal(this, 'cancelEvent'); |
113 | }, | 115 | }, |
114 | 116 | ||
115 | //------------------------------------------------------------------------- | 117 | //------------------------------------------------------------------------- |
116 | 118 | ||
117 | 'disableCancel': function() { | 119 | 'disableCancel': function() { |
118 | MochiKit.Style.hideElement(this.getElement('buttonArea')); | 120 | MochiKit.Style.hideElement(this.getElement('buttonArea')); |
119 | }, | 121 | }, |
120 | 122 | ||
121 | //------------------------------------------------------------------------- | 123 | //------------------------------------------------------------------------- |
122 | 124 | ||
123 | 'showErrorMessage': function() { | 125 | 'showErrorMessage': function() { |
124 | this.getElement('buttonLink').innerHTML = "close"; | 126 | // this.getElement('buttonLink').innerHTML = "close"; |
127 | this.getElement('button').innerHTML = "close"; | ||
128 | MochiKit.DOM.addElementClass(this.getElement('button'), 'default'); | ||
125 | 129 | ||
126 | MochiKit.Style.hideElement(this.getElement('progressBar')); | 130 | MochiKit.Style.hideElement(this.getElement('progressBar')); |
127 | 131 | ||
128 | this.getElement('title').innerHTML = "Error"; | 132 | this.getElement('title').innerHTML = "Error"; |
129 | MochiKit.Style.showElement(this.getElement('errorBox')); | 133 | MochiKit.Style.showElement(this.getElement('errorBox')); |
130 | MochiKit.Style.showElement(this.getElement('buttonArea')); | 134 | MochiKit.Style.showElement(this.getElement('buttonArea')); |
131 | }, | 135 | }, |
132 | 136 | ||
133 | //------------------------------------------------------------------------- | 137 | //------------------------------------------------------------------------- |
134 | 138 | ||
135 | 'deferredHideModalAndRemove': function(someParameters, aResult) { | 139 | 'deferredHideModalAndRemove': function(someParameters, aResult) { |
136 | vardeferredResult; | 140 | vardeferredResult; |
137 | 141 | ||
138 | deferredResult = new Clipperz.Async.Deferred("LoginProgress.deferredHideModalAndRemove", {trace:false}); | 142 | deferredResult = new Clipperz.Async.Deferred("LoginProgress.deferredHideModalAndRemove", {trace:false}); |
139 | deferredResult.addMethod(this, 'deferredHideModal'); | 143 | deferredResult.addMethod(this, 'deferredHideModal'); |
140 | deferredResult.addMethod(this, 'remove'); | 144 | deferredResult.addMethod(this, 'remove'); |
141 | deferredResult.addCallback(function () { | 145 | deferredResult.addCallback(function () { |
142 | return aResult; | 146 | return aResult; |
143 | }); | 147 | }); |
144 | deferredResult.callback(someParameters); | 148 | deferredResult.callback(someParameters); |
145 | 149 | ||
146 | return deferredResult; | 150 | return deferredResult; |
147 | }, | 151 | }, |
148 | 152 | ||
149 | //------------------------------------------------------------------------- | 153 | //------------------------------------------------------------------------- |
150 | 154 | ||
151 | __syntaxFix__: "syntax fix" | 155 | __syntaxFix__: "syntax fix" |
152 | }); | 156 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/ToolsPanel.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/ToolsPanel.js index 3ee6189..0fa369f 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/ToolsPanel.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/ToolsPanel.js | |||
@@ -1,110 +1,110 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2011 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz Community Edition. |
6 | Clipperz Community Edition is an online password manager. | 6 | Clipperz Community Edition is an online password manager. |
7 | For further information about its features and functionalities please | 7 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 8 | refer to http://www.clipperz.com. |
9 | 9 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 10 | * Clipperz Community Edition is free software: you can redistribute |
11 | it and/or modify it under the terms of the GNU Affero General Public | 11 | it and/or modify it under the terms of the GNU Affero General Public |
12 | License as published by the Free Software Foundation, either version | 12 | License as published by the Free Software Foundation, either version |
13 | 3 of the License, or (at your option) any later version. | 13 | 3 of the License, or (at your option) any later version. |
14 | 14 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 15 | * Clipperz Community Edition is distributed in the hope that it will |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 16 | be useful, but WITHOUT ANY WARRANTY; without even the implied |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 18 | See the GNU Affero General Public License for more details. |
19 | 19 | ||
20 | * You should have received a copy of the GNU Affero General Public | 20 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 21 | License along with Clipperz Community Edition. If not, see |
22 | <http://www.gnu.org/licenses/>. | 22 | <http://www.gnu.org/licenses/>. |
23 | 23 | ||
24 | */ | 24 | */ |
25 | 25 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 27 | ||
28 | Clipperz.PM.UI.Web.Components.ToolsPanel = function(args) { | 28 | Clipperz.PM.UI.Web.Components.ToolsPanel = function(args) { |
29 | args = args || {}; | 29 | args = args || {}; |
30 | 30 | ||
31 | Clipperz.PM.UI.Web.Components.ToolsPanel.superclass.constructor.apply(this, arguments); | 31 | Clipperz.PM.UI.Web.Components.ToolsPanel.superclass.constructor.apply(this, arguments); |
32 | 32 | ||
33 | this._initiallySelectedTab = args.selected || 'PASSWORD_GENERATOR'; | 33 | this._initiallySelectedTab = args.selected || 'PASSWORD_GENERATOR'; |
34 | this._tabPanelControllerConfiguration = { | 34 | this._tabPanelControllerConfiguration = { |
35 | 'PASSWORD_GENERATOR': { | 35 | 'PASSWORD_GENERATOR': { |
36 | tab:'passwordGeneratorTab', | 36 | tab:'passwordGeneratorTab', |
37 | panel:'passwordGeneratorPanel' | 37 | panel:'passwordGeneratorPanel' |
38 | }, | 38 | }, |
39 | 'BOOKMARKLET': { | 39 | 'BOOKMARKLET': { |
40 | tab:'bookmarkletTab', | 40 | tab:'bookmarkletTab', |
41 | panel:'bookmarkletPanel' | 41 | panel:'bookmarkletPanel' |
42 | }, | 42 | }, |
43 | 'COMPACT_EDITION': { | 43 | 'COMPACT_EDITION': { |
44 | tab:'compactEditionTab', | 44 | tab:'compactEditionTab', |
45 | panel:'compactEditionPanel' | 45 | panel:'compactEditionPanel' |
46 | }, | 46 | }, |
47 | 'HTTP_AUTH': { | 47 | 'HTTP_AUTH': { |
48 | tab:'httpAuthTab', | 48 | tab:'httpAuthTab', |
49 | panel:'httpAuthPanel' | 49 | panel:'httpAuthPanel' |
50 | } | 50 | } |
51 | }; | 51 | }; |
52 | 52 | ||
53 | return this; | 53 | return this; |
54 | } | 54 | } |
55 | 55 | ||
56 | //============================================================================= | 56 | //============================================================================= |
57 | 57 | ||
58 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.ToolsPanel, Clipperz.PM.UI.Common.Components.TabPanelComponent, { | 58 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.ToolsPanel, Clipperz.PM.UI.Common.Components.TabPanelComponent, { |
59 | 59 | ||
60 | //------------------------------------------------------------------------- | 60 | //------------------------------------------------------------------------- |
61 | 61 | ||
62 | 'toString': function () { | 62 | 'toString': function () { |
63 | return "Clipperz.PM.UI.Web.Components.ToolsPanel component"; | 63 | return "Clipperz.PM.UI.Web.Components.ToolsPanel component"; |
64 | }, | 64 | }, |
65 | 65 | ||
66 | //------------------------------------------------------------------------- | 66 | //------------------------------------------------------------------------- |
67 | 67 | ||
68 | 'renderSelf': function(/*aContainer, aPosition*/) { | 68 | 'renderSelf': function(/*aContainer, aPosition*/) { |
69 | this.append(this.element(), [ | 69 | this.append(this.element(), [ |
70 | {tag:'div', cls:'header', children:[ | 70 | {tag:'div', cls:'header', children:[ |
71 | {tag:'div', cls:'subPanelTabs', children:[ | 71 | {tag:'div', cls:'subPanelTabs', children:[ |
72 | {tag:'ul', children:[ | 72 | {tag:'ul', children:[ |
73 | {tag:'li', id:this.getId('passwordGeneratorTab'),children:[{tag:'a', href:'#', html:'Password generator'}], cls:'first'}, | 73 | {tag:'li', id:this.getId('passwordGeneratorTab'),children:[{tag:'a', href:'#', html:'Password generator'}], cls:'first'}, |
74 | {tag:'li', id:this.getId('bookmarkletTab'), children:[{tag:'a', href:'#', html:'Bookmarklet'}]}, | 74 | {tag:'li', id:this.getId('bookmarkletTab'), children:[{tag:'a', href:'#', html:'Bookmarklet'}]}, |
75 | {tag:'li', id:this.getId('compactEditionTab'), children:[{tag:'a', href:'#', html:'Compact edition'}]}, | 75 | {tag:'li', id:this.getId('compactEditionTab'), children:[{tag:'a', href:'#', html:'Compact edition'}]}, |
76 | {tag:'li', id:this.getId('httpAuthTab'), children:[{tag:'a', href:'#', html:'HTTP Auth'}]} | 76 | {tag:'li', id:this.getId('httpAuthTab'), children:[{tag:'a', href:'#', html:'HTTP Auth'}]} |
77 | ]} | 77 | ]} |
78 | ]} | 78 | ]} |
79 | ]}, | 79 | ]}, |
80 | {tag:'div', cls:'body', children:[ | 80 | {tag:'div', cls:'body', children:[ |
81 | {tag:'div', cls:'accountPanel', children:[ | 81 | {tag:'div', cls:'accountPanel', children:[ |
82 | {tag:'div', cls:'subPanelContent', children:[ | 82 | {tag:'div', cls:'subPanelContent', children:[ |
83 | {tag:'ul', children:[ | 83 | {tag:'ul', children:[ |
84 | {tag:'li', id:this.getId('passwordGeneratorPanel'),children:[ | 84 | {tag:'li', id:this.getId('passwordGeneratorPanel'),children:[ |
85 | {tag:'h3', html:"Password generator"} | 85 | // {tag:'h3', html:"Password generator"} |
86 | ]}, | 86 | ]}, |
87 | {tag:'li', id:this.getId('bookmarkletPanel'),children:[ | 87 | {tag:'li', id:this.getId('bookmarkletPanel'),children:[ |
88 | {tag:'h3', html:"Bookmarklet"} | 88 | // {tag:'h3', html:"Bookmarklet"} |
89 | ]}, | 89 | ]}, |
90 | {tag:'li', id:this.getId('compactEditionPanel'), children:[ | 90 | {tag:'li', id:this.getId('compactEditionPanel'), children:[ |
91 | {tag:'h3', html:"Compact edition"} | 91 | // {tag:'h3', html:"Compact edition"} |
92 | ]}, | 92 | ]}, |
93 | {tag:'li', id:this.getId('httpAuthPanel'), children:[ | 93 | {tag:'li', id:this.getId('httpAuthPanel'), children:[ |
94 | {tag:'h3', html:"HTTP Auth"} | 94 | // {tag:'h3', html:"HTTP Auth"} |
95 | ]} | 95 | ]} |
96 | ]} | 96 | ]} |
97 | ]} | 97 | ]} |
98 | ]} | 98 | ]} |
99 | ]}, | 99 | ]}, |
100 | {tag:'div', cls:'footer'} | 100 | {tag:'div', cls:'footer'} |
101 | ]); | 101 | ]); |
102 | 102 | ||
103 | this.tabPanelController().setup({selected:this.initiallySelectedTab()}); | 103 | this.tabPanelController().setup({selected:this.initiallySelectedTab()}); |
104 | }, | 104 | }, |
105 | 105 | ||
106 | //------------------------------------------------------------------------- | 106 | //------------------------------------------------------------------------- |
107 | 107 | ||
108 | 108 | ||
109 | __syntaxFix__: "syntax fix" | 109 | __syntaxFix__: "syntax fix" |
110 | }); | 110 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/AppController.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/AppController.js index 9a0e744..1ab2e69 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/AppController.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/AppController.js | |||
@@ -138,189 +138,214 @@ MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.AppController.prototype, { | |||
138 | 'dataPanel': function () { | 138 | 'dataPanel': function () { |
139 | if (this._dataPanel == null) { | 139 | if (this._dataPanel == null) { |
140 | this._dataPanel = new Clipperz.PM.UI.Web.Components.DataPanel(); | 140 | this._dataPanel = new Clipperz.PM.UI.Web.Components.DataPanel(); |
141 | } | 141 | } |
142 | 142 | ||
143 | return this._dataPanel; | 143 | return this._dataPanel; |
144 | }, | 144 | }, |
145 | 145 | ||
146 | //......................................................................... | 146 | //......................................................................... |
147 | 147 | ||
148 | 'toolsPanel': function () { | 148 | 'toolsPanel': function () { |
149 | if (this._toolsPanel == null) { | 149 | if (this._toolsPanel == null) { |
150 | this._toolsPanel = new Clipperz.PM.UI.Web.Components.ToolsPanel(); | 150 | this._toolsPanel = new Clipperz.PM.UI.Web.Components.ToolsPanel(); |
151 | } | 151 | } |
152 | 152 | ||
153 | return this._toolsPanel; | 153 | return this._toolsPanel; |
154 | }, | 154 | }, |
155 | 155 | ||
156 | //----------------------------------------------------------------------------- | 156 | //----------------------------------------------------------------------------- |
157 | 157 | ||
158 | 'filterController': function () { | 158 | 'filterController': function () { |
159 | if (this._filterController == null) { | 159 | if (this._filterController == null) { |
160 | this._filterController = new Clipperz.PM.UI.Web.Controllers.FilterController(); | 160 | this._filterController = new Clipperz.PM.UI.Web.Controllers.FilterController(); |
161 | } | 161 | } |
162 | 162 | ||
163 | return this._filterController; | 163 | return this._filterController; |
164 | }, | 164 | }, |
165 | 165 | ||
166 | 'cardsController': function() { | 166 | 'cardsController': function() { |
167 | if (this._cardsController == null) { | 167 | if (this._cardsController == null) { |
168 | this._cardsController = new Clipperz.PM.UI.Web.Controllers.CardsController({'filterController':this._filterController}); | 168 | this._cardsController = new Clipperz.PM.UI.Web.Controllers.CardsController({'filterController':this._filterController}); |
169 | } | 169 | } |
170 | 170 | ||
171 | return this._cardsController; | 171 | return this._cardsController; |
172 | }, | 172 | }, |
173 | 173 | ||
174 | //----------------------------------------------------------------------------- | 174 | //----------------------------------------------------------------------------- |
175 | /* | 175 | /* |
176 | 'directLoginsController': function() { | 176 | 'directLoginsController': function() { |
177 | //Clipperz.log(">>> AppController.directLoginsController"); | 177 | //Clipperz.log(">>> AppController.directLoginsController"); |
178 | if (this._directLoginsController == null) { | 178 | if (this._directLoginsController == null) { |
179 | this._directLoginsController = new Clipperz.PM.UI.Web.Controllers.DirectLoginsController({'filterController':this._filterController}); | 179 | this._directLoginsController = new Clipperz.PM.UI.Web.Controllers.DirectLoginsController({'filterController':this._filterController}); |
180 | } | 180 | } |
181 | //Clipperz.log("<<< AppController.directLoginsController"); | 181 | //Clipperz.log("<<< AppController.directLoginsController"); |
182 | 182 | ||
183 | return this._directLoginsController; | 183 | return this._directLoginsController; |
184 | }, | 184 | }, |
185 | */ | 185 | */ |
186 | //----------------------------------------------------------------------------- | 186 | //----------------------------------------------------------------------------- |
187 | 187 | ||
188 | 'populateUserInfo': function() { | 188 | 'populateUserInfo': function() { |
189 | var deferredResult; | 189 | var deferredResult; |
190 | 190 | ||
191 | deferredResult = new Clipperz.Async.Deferred("AppController.populateUserInfo", {trace:false}); | 191 | deferredResult = new Clipperz.Async.Deferred("AppController.populateUserInfo", {trace:false}); |
192 | deferredResult.collectResults({ | 192 | deferredResult.collectResults({ |
193 | 'username':MochiKit.Base.methodcaller('displayName'), | 193 | 'username':MochiKit.Base.methodcaller('displayName'), |
194 | 'cardsNumber':[ | 194 | 'cardsNumber':[ |
195 | MochiKit.Base.methodcaller('getRecords'), | 195 | MochiKit.Base.methodcaller('getRecords'), |
196 | function (someResults) { return someResults.length; } | 196 | function (someResults) { return someResults.length; } |
197 | ], | 197 | ], |
198 | 'directLoginsNumber': [ | 198 | 'directLoginsNumber': [ |
199 | MochiKit.Base.methodcaller('getDirectLogins'), | 199 | MochiKit.Base.methodcaller('getDirectLogins'), |
200 | function (someResults) { return someResults.length; } | 200 | function (someResults) { return someResults.length; } |
201 | ] | 201 | ] |
202 | }) | 202 | }) |
203 | deferredResult.addMethod(this.userInfoBox(), 'updateUserDetails'); | 203 | deferredResult.addMethod(this.userInfoBox(), 'updateUserDetails'); |
204 | deferredResult.callback(this.user()); | 204 | deferredResult.callback(this.user()); |
205 | 205 | ||
206 | return deferredResult; | 206 | return deferredResult; |
207 | }, | 207 | }, |
208 | 208 | ||
209 | //----------------------------------------------------------------------------- | 209 | //----------------------------------------------------------------------------- |
210 | 210 | ||
211 | 'run': function(args) { | 211 | 'run': function(args) { |
212 | var deferredResult; | 212 | var deferredResult; |
213 | varslot; | 213 | varslot; |
214 | varpage; | 214 | varpage; |
215 | var user; | 215 | var user; |
216 | 216 | ||
217 | slot = args.slot; | 217 | slot = args.slot; |
218 | user = args.user; | 218 | user = args.user; |
219 | 219 | ||
220 | this.setUser(user); | 220 | this.setUser(user); |
221 | 221 | ||
222 | slot.setContent(this.appPage()); | 222 | slot.setContent(this.appPage()); |
223 | 223 | ||
224 | this.appPage().slotNamed('userInfoBox').setContent(this.userInfoBox()); | 224 | this.appPage().slotNamed('userInfoBox').setContent(this.userInfoBox()); |
225 | this.appPage().slotNamed('tabSidePanel').setContent(this.tabSidePanel()); | 225 | this.appPage().slotNamed('tabSidePanel').setContent(this.tabSidePanel()); |
226 | 226 | ||
227 | this.appPage().slotNamed('accountPanel').setContent(this.accountPanel()); | 227 | this.appPage().slotNamed('accountPanel').setContent(this.accountPanel()); |
228 | this.appPage().slotNamed('dataPanel').setContent(this.dataPanel()); | 228 | this.appPage().slotNamed('dataPanel').setContent(this.dataPanel()); |
229 | this.appPage().slotNamed('toolsPanel').setContent(this.toolsPanel()); | 229 | this.appPage().slotNamed('toolsPanel').setContent(this.toolsPanel()); |
230 | 230 | ||
231 | this.hideAllAppPageTabSlots(); | 231 | this.hideAllAppPageTabSlots(); |
232 | this.appPage().showSlot(this.slotNameForTab('cards')); | 232 | this.appPage().showSlot(this.slotNameForTab('cards')); |
233 | 233 | ||
234 | MochiKit.Signal.connect(this.tabSidePanel(), 'tabSelected',this, 'handleTabSelected'); | 234 | MochiKit.Signal.connect(this.tabSidePanel(), 'tabSelected', this, 'handleTabSelected'); |
235 | MochiKit.Signal.connect(this.tabSidePanel(), 'addCard', this, 'handleAddCard'); | 235 | MochiKit.Signal.connect(this.tabSidePanel(), 'addCard', this, 'handleAddCard'); |
236 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'addCard', this, 'handleAddCard'); | 236 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'addCard', this, 'handleAddCard'); |
237 | |||
238 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'downloadOfflineCopy',this, 'handleDownloadOfflineCopy'); | ||
237 | 239 | ||
238 | deferredResult = new Clipperz.Async.Deferred("AppController.run", {trace:false}); | 240 | deferredResult = new Clipperz.Async.Deferred("AppController.run", {trace:false}); |
239 | 241 | ||
240 | deferredResult.addMethod(this.cardsController(), 'run', {slot:this.appPage().slotNamed('cardGrid'), user:user}); | 242 | deferredResult.addMethod(this.cardsController(), 'run', {slot:this.appPage().slotNamed('cardGrid'), user:user}); |
241 | // deferredResult.addMethod(this.directLoginsController(), 'run', {slot:this.appPage().slotNamed('directLoginGrid'), user:user}); | 243 | // deferredResult.addMethod(this.directLoginsController(), 'run', {slot:this.appPage().slotNamed('directLoginGrid'), user:user}); |
242 | deferredResult.addMethod(this, 'populateUserInfo'); | 244 | deferredResult.addMethod(this, 'populateUserInfo'); |
243 | 245 | ||
244 | deferredResult.addCallback(MochiKit.Visual.ScrollTo, 'miscLinks', {duration:0}); | 246 | deferredResult.addCallback(MochiKit.Visual.ScrollTo, 'miscLinks', {duration:0}); |
245 | deferredResult.addCallback(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'CARDS_CONTROLLER_DID_RUN'); | 247 | deferredResult.addCallback(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'CARDS_CONTROLLER_DID_RUN'); |
246 | deferredResult.addMethod(this.tabSidePanel(), 'selectTab', 'cards'); | 248 | deferredResult.addMethod(this.tabSidePanel(), 'selectTab', 'cards'); |
247 | deferredResult.callback(); | 249 | deferredResult.callback(); |
248 | }, | 250 | }, |
249 | 251 | ||
250 | //----------------------------------------------------------------------------- | 252 | //----------------------------------------------------------------------------- |
251 | 253 | ||
252 | 'handleTabSelected': function (selectedTabName) { | 254 | 'handleTabSelected': function (selectedTabName) { |
253 | var aTabName; | 255 | var aTabName; |
254 | var aSlotName; | 256 | var aSlotName; |
255 | 257 | ||
256 | //Clipperz.log(">>> AppController.handleTabSelected", selectedTabName); | 258 | //Clipperz.log(">>> AppController.handleTabSelected", selectedTabName); |
257 | this.hideAllAppPageTabSlots(); | 259 | this.hideAllAppPageTabSlots(); |
258 | this.appPage().showSlot(this.slotNameForTab(selectedTabName)); | 260 | this.appPage().showSlot(this.slotNameForTab(selectedTabName)); |
259 | 261 | ||
260 | switch (selectedTabName) { | 262 | switch (selectedTabName) { |
261 | case 'cards': | 263 | case 'cards': |
262 | this.cardsController().focus(); | 264 | this.cardsController().focus(); |
263 | break; | 265 | break; |
264 | // case 'directLogins': | 266 | // case 'directLogins': |
265 | // this.directLoginsController().focus(); | 267 | // this.directLoginsController().focus(); |
266 | // break; | 268 | // break; |
267 | case 'data': | 269 | case 'data': |
268 | break; | 270 | break; |
269 | case 'account': | 271 | case 'account': |
270 | break; | 272 | break; |
271 | case 'tools': | 273 | case 'tools': |
272 | break; | 274 | break; |
273 | } | 275 | } |
274 | //Clipperz.log("<-- AppController.handleTabSelected", aTabName); | 276 | //Clipperz.log("<-- AppController.handleTabSelected", aTabName); |
275 | }, | 277 | }, |
276 | 278 | ||
277 | //============================================================================= | 279 | //============================================================================= |
278 | 280 | ||
279 | 'handleAddCard': function (aSourceElement) { | 281 | 'handleAddCard': function (aSourceElement) { |
280 | //Clipperz.log("=== AppController.addCard", aSourceElement); | 282 | //Clipperz.log("=== AppController.addCard", aSourceElement); |
281 | this.cardsController().addCard(aSourceElement); | 283 | this.cardsController().addCard(aSourceElement); |
282 | }, | 284 | }, |
283 | 285 | ||
284 | //============================================================================= | 286 | //============================================================================= |
285 | 287 | ||
286 | 'userDataSuccessfullySavedHandler': function (anEvent) { | 288 | 'userDataSuccessfullySavedHandler': function (anEvent) { |
287 | this.populateUserInfo(); | 289 | this.populateUserInfo(); |
288 | }, | 290 | }, |
289 | 291 | ||
290 | //============================================================================= | 292 | //============================================================================= |
291 | 293 | ||
292 | 'handleLogout': function(anEvent) { | 294 | 'handleLogout': function(anEvent) { |
293 | var deferredResult; | 295 | var deferredResult; |
294 | 296 | ||
295 | deferredResult = new Clipperz.Async.Deferred("AppController.handleLogout", {trace:false}); | 297 | deferredResult = new Clipperz.Async.Deferred("AppController.handleLogout", {trace:false}); |
296 | deferredResult.addMethod(this.user(), 'logout'); | 298 | deferredResult.addMethod(this.user(), 'logout'); |
297 | deferredResult.addCallback(MochiKit.Signal.signal, this, 'logout'); | 299 | deferredResult.addCallback(MochiKit.Signal.signal, this, 'logout'); |
298 | deferredResult.callback(); | 300 | deferredResult.callback(); |
299 | 301 | ||
300 | return deferredResult; | 302 | return deferredResult; |
301 | }, | 303 | }, |
302 | 304 | ||
303 | //----------------------------------------------------------------------------- | 305 | //----------------------------------------------------------------------------- |
304 | 306 | ||
305 | 'handleLock': function (anEvent) { | 307 | 'handleLock': function (anEvent) { |
306 | return Clipperz.Async.callbacks("AppController.handleLock", [ | 308 | return Clipperz.Async.callbacks("AppController.handleLock", [ |
307 | MochiKit.Base.method(this.cardsController(), 'deleteAllCleanTextData'), | 309 | MochiKit.Base.method(this.cardsController(), 'deleteAllCleanTextData'), |
308 | MochiKit.Base.method(this.user(), 'lock') | 310 | MochiKit.Base.method(this.user(), 'lock') |
309 | ], {trace:false}); | 311 | ], {trace:false}); |
310 | }, | 312 | }, |
311 | 313 | ||
312 | //............................................................................. | 314 | //............................................................................. |
313 | 315 | ||
314 | 'handleUnlock': function (anEvent) { | 316 | 'handleUnlock': function (anEvent) { |
315 | return Clipperz.Async.callbacks("AppController.handleUnock", [ | 317 | return Clipperz.Async.callbacks("AppController.handleUnock", [ |
316 | MochiKit.Base.partial(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'initProgress'), | 318 | MochiKit.Base.partial(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'initProgress'), |
317 | MochiKit.Base.method(this.user(), 'login'), | 319 | MochiKit.Base.method(this.user(), 'login'), |
318 | MochiKit.Base.method(this.cardsController(), 'focus'), | 320 | MochiKit.Base.method(this.cardsController(), 'focus'), |
319 | MochiKit.Base.partial(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'progressDone'), | 321 | MochiKit.Base.partial(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'progressDone'), |
320 | MochiKit.Base.method(this.userInfoBox(), 'unlock') | 322 | MochiKit.Base.method(this.userInfoBox(), 'unlock') |
321 | ], {trace:false}); | 323 | ], {trace:false}); |
322 | }, | 324 | }, |
323 | 325 | ||
326 | 'handleDownloadOfflineCopy': function (anEvent) { | ||
327 | console.log("AppController.handleDownloadOfflineCopy"); | ||
328 | var downloadHref; | ||
329 | |||
330 | downloadHref = window.location.href.replace(/\/[^\/]*$/,'') + Clipperz_dumpUrl; | ||
331 | |||
332 | if (Clipperz_IEisBroken == true) { | ||
333 | window.open(downloadHref, ""); | ||
334 | } else { | ||
335 | vardeferredResult; | ||
336 | var newWindow; | ||
337 | |||
338 | newWindow = window.open("", ""); | ||
339 | |||
340 | deferredResult = new Clipperz.Async.Deferred("AppController.handleDownloadOfflineCopy", {trace:true}); | ||
341 | deferredResult.addCallback(MochiKit.Base.method(this.user().connection(), 'message'), 'echo', {'echo':"echo"}); | ||
342 | deferredResult.addCallback(function(aWindow) { | ||
343 | aWindow.location.href = downloadHref; | ||
344 | }, newWindow); | ||
345 | deferredResult.callback(); | ||
346 | } | ||
347 | }, | ||
348 | |||
324 | //============================================================================= | 349 | //============================================================================= |
325 | __syntaxFix__: "syntax fix" | 350 | __syntaxFix__: "syntax fix" |
326 | }); | 351 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/iPhone/Components/CardDetail.js b/frontend/gamma/js/Clipperz/PM/UI/iPhone/Components/CardDetail.js deleted file mode 100644 index 5380aa1..0000000 --- a/frontend/gamma/js/Clipperz/PM/UI/iPhone/Components/CardDetail.js +++ b/dev/null | |||
@@ -1,163 +0,0 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz Community Edition. | ||
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | ||
8 | refer to http://www.clipperz.com. | ||
9 | |||
10 | * Clipperz Community Edition is free software: you can redistribute | ||
11 | it and/or modify it under the terms of the GNU Affero General Public | ||
12 | License as published by the Free Software Foundation, either version | ||
13 | 3 of the License, or (at your option) any later version. | ||
14 | |||
15 | * Clipperz Community Edition is distributed in the hope that it will | ||
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
18 | See the GNU Affero General Public License for more details. | ||
19 | |||
20 | * You should have received a copy of the GNU Affero General Public | ||
21 | License along with Clipperz Community Edition. If not, see | ||
22 | <http://www.gnu.org/licenses/>. | ||
23 | |||
24 | */ | ||
25 | |||
26 | Clipperz.Base.module('Clipperz.PM.UI.iPhone.Components'); | ||
27 | |||
28 | Clipperz.PM.UI.iPhone.Components.CardDetail = function(args) { | ||
29 | args = args || {}; | ||
30 | |||
31 | Clipperz.PM.UI.iPhone.Components.CardDetail.superclass.constructor.apply(this, arguments); | ||
32 | |||
33 | this._cardReference = null; | ||
34 | |||
35 | return this; | ||
36 | } | ||
37 | |||
38 | //============================================================================= | ||
39 | |||
40 | Clipperz.Base.extend(Clipperz.PM.UI.iPhone.Components.CardDetail, Clipperz.PM.UI.Common.Components.BaseComponent, { | ||
41 | |||
42 | //------------------------------------------------------------------------- | ||
43 | |||
44 | 'toString': function () { | ||
45 | return "Clipperz.PM.UI.iPhone.Components.CardDetail component"; | ||
46 | }, | ||
47 | |||
48 | //------------------------------------------------------------------------- | ||
49 | |||
50 | 'cardReference': function () { | ||
51 | return this._cardReference; | ||
52 | }, | ||
53 | |||
54 | 'setCardReference': function (aValue) { | ||
55 | this._cardReference = aValue; | ||
56 | }, | ||
57 | |||
58 | //------------------------------------------------------------------------- | ||
59 | |||
60 | 'renderSelf': function(/*aContainer, aPosition*/) { | ||
61 | this.append(this.element(), [ | ||
62 | {tag:'div', cls:'cardDetail', id:this.getId('cardDetail'), children:[ | ||
63 | {tag:'div', id:this.getId('progressBar')} //, | ||
64 | // {tag:'h1', cls:'loading', html:"loading"} | ||
65 | ]} | ||
66 | ]); | ||
67 | |||
68 | this.addComponent(new Clipperz.PM.UI.Common.Components.ProgressBar({'element':this.getElement('progressBar')})); | ||
69 | MochiKit.Signal.signal(Clipperz.PM.UI.Common.Controllers.ProgressBarController.defaultController, 'updateProgress', 0); | ||
70 | }, | ||
71 | |||
72 | //========================================================================= | ||
73 | |||
74 | 'showCardDetails': function (someData) { | ||
75 | this.element().innerHTML = ''; | ||
76 | this.append(this.element(), [ | ||
77 | {tag:'fieldset', id:this.getId('fields'), children:MochiKit.Base.map(function (aFieldData) { | ||
78 | return {tag:'div', cls:'row', children:[ | ||
79 | {tag:'label', html:aFieldData['label']}, | ||
80 | // {tag:'span', cls:('fieldValue ' + (aFieldData['isHidden']? 'password' : 'text')), html:aFieldData['value']} | ||
81 | {tag:'div', cls:('fieldValue ' + (aFieldData['isHidden']? 'password' : 'text')), children:[ | ||
82 | {tag:'div', children:[{tag:'p', html:aFieldData['value']}]} | ||
83 | ]} | ||
84 | // {tag:'input', type:'text', cls:('fieldValue ' + (aFieldData['isHidden']? 'password' : 'text')), value:aFieldData['value'], disabled:true} | ||
85 | |||
86 | ]} | ||
87 | }, someData['fields'])} | ||
88 | ]); | ||
89 | |||
90 | MochiKit.Iter.forEach(MochiKit.Selector.findChildElements(this.element(), ['span.password']), MochiKit.Base.bind(function (aPasswordElement) { | ||
91 | MochiKit.Signal.connect(aPasswordElement, 'onclick', function (anEvent) { alert(MochiKit.DOM.scrapeText(anEvent.src())); }) | ||
92 | }, this)); | ||
93 | |||
94 | if (someData['directLogins'].length > 0) { | ||
95 | this.append(this.element(), [ | ||
96 | {tag:'h2', html:"Direct logins"}, | ||
97 | {tag:'fieldset', id:this.getId('directLogins'), children:MochiKit.Base.map(function (aDirectLoginData) { | ||
98 | return {tag:'div', cls:'row', id:('directLogin_' + aDirectLoginData['_reference']), children:[ | ||
99 | {tag:'img', cls:'favicon', src:aDirectLoginData['favicon']}, | ||
100 | // {tag:'input', cls:'directLogin', disabled:'disabled', type:'text', name:aDirectLoginData['label'], value:aDirectLoginData['label']} | ||
101 | {tag:'span', cls:'directLogin', html:aDirectLoginData['label']} | ||
102 | ]} | ||
103 | }, someData['directLogins'])} | ||
104 | ]); | ||
105 | |||
106 | MochiKit.Base.map(MochiKit.Base.bind(function (aRowNode) { | ||
107 | MochiKit.Signal.connect(aRowNode, 'onclick', this, 'directLoginClickHandler'); | ||
108 | }, this), | ||
109 | MochiKit.Selector.findChildElements(this.getElement('directLogins'), ['div.row']) | ||
110 | ) | ||
111 | }; | ||
112 | |||
113 | if (someData['notes'] != '') { | ||
114 | this.append(this.element(), [ | ||
115 | {tag:'h2', html:"Notes"}, | ||
116 | {tag:'fieldset', id:this.getId('fieldset'), children:[ | ||
117 | {tag:'div', cls:'row notes', children:[ | ||
118 | {tag:'span', html:someData['notes']} | ||
119 | ]} | ||
120 | ]} | ||
121 | ]); | ||
122 | }; | ||
123 | |||
124 | return true; | ||
125 | }, | ||
126 | |||
127 | //------------------------------------------------------------------------- | ||
128 | /* | ||
129 | 'toggleClickHandler': function (anEvent) { | ||
130 | varnextState; | ||
131 | varfieldValue; | ||
132 | |||
133 | //console.log("TOGGLE"); | ||
134 | anEvent.preventDefault; | ||
135 | fieldValue = MochiKit.Selector.findChildElements(anEvent.src().parentNode.parentNode, ['span.password'])[0]; | ||
136 | |||
137 | nextState = (MochiKit.DOM.getNodeAttribute(anEvent.src(), 'toggled') != 'true'); | ||
138 | if (nextState) { | ||
139 | MochiKit.DOM.removeElementClass(fieldValue, 'clear'); | ||
140 | } else { | ||
141 | MochiKit.DOM.addElementClass(fieldValue, 'clear'); | ||
142 | } | ||
143 | |||
144 | MochiKit.DOM.setNodeAttribute(anEvent.src(), 'toggled', nextState); | ||
145 | }, | ||
146 | */ | ||
147 | //========================================================================= | ||
148 | |||
149 | 'directLoginClickHandler': function (anEvent) { | ||
150 | anEvent.preventDefault(); | ||
151 | |||
152 | if (/(directLogin_)/.test(anEvent.src().id)) { | ||
153 | var directLoginReference; | ||
154 | |||
155 | directLoginReference = anEvent.src().id.match(/(directLogin_)(.*)/)[2]; | ||
156 | MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'selectedDirectLogin', {cardReference:this.cardReference(), directLoginReference:directLoginReference}); | ||
157 | } | ||
158 | }, | ||
159 | |||
160 | //========================================================================= | ||
161 | |||
162 | __syntaxFix__: "syntax fix" | ||
163 | }); | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/iPhone/Components/LoginForm.js b/frontend/gamma/js/Clipperz/PM/UI/iPhone/Components/LoginForm.js deleted file mode 100644 index 5341878..0000000 --- a/frontend/gamma/js/Clipperz/PM/UI/iPhone/Components/LoginForm.js +++ b/dev/null | |||
@@ -1,178 +0,0 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz Community Edition. | ||
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | ||
8 | refer to http://www.clipperz.com. | ||
9 | |||
10 | * Clipperz Community Edition is free software: you can redistribute | ||
11 | it and/or modify it under the terms of the GNU Affero General Public | ||
12 | License as published by the Free Software Foundation, either version | ||
13 | 3 of the License, or (at your option) any later version. | ||
14 | |||
15 | * Clipperz Community Edition is distributed in the hope that it will | ||
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
18 | See the GNU Affero General Public License for more details. | ||
19 | |||
20 | * You should have received a copy of the GNU Affero General Public | ||
21 | License along with Clipperz Community Edition. If not, see | ||
22 | <http://www.gnu.org/licenses/>. | ||
23 | |||
24 | */ | ||
25 | |||
26 | Clipperz.Base.module('Clipperz.PM.UI.iPhone.Components'); | ||
27 | |||
28 | Clipperz.PM.UI.iPhone.Components.LoginForm = function(args) { | ||
29 | args = args || {}; | ||
30 | |||
31 | Clipperz.PM.UI.iPhone.Components.LoginForm.superclass.constructor.apply(this, arguments); | ||
32 | |||
33 | return this; | ||
34 | } | ||
35 | |||
36 | //============================================================================= | ||
37 | |||
38 | Clipperz.Base.extend(Clipperz.PM.UI.iPhone.Components.LoginForm, Clipperz.PM.UI.Common.Components.BaseComponent, { | ||
39 | |||
40 | //------------------------------------------------------------------------- | ||
41 | |||
42 | 'toString': function () { | ||
43 | return "Clipperz.PM.UI.iPhone.Components.LoginForm component"; | ||
44 | }, | ||
45 | |||
46 | //------------------------------------------------------------------------- | ||
47 | |||
48 | 'focusOnUsername': function () { | ||
49 | this.getElement('username').focus(); | ||
50 | }, | ||
51 | |||
52 | //------------------------------------------------------------------------- | ||
53 | |||
54 | 'username': function () { | ||
55 | return this.getElement('username').value; | ||
56 | }, | ||
57 | |||
58 | 'passphrase': function () { | ||
59 | return this.getElement('passphrase').value; | ||
60 | }, | ||
61 | |||
62 | //------------------------------------------------------------------------- | ||
63 | |||
64 | 'renderSelf': function(/*aContainer, aPosition*/) { | ||
65 | this.append(this.element(), [ | ||
66 | {tag:'div', cls:'toolbar iPhoneClipperzToolbar', children:[ | ||
67 | {tag:'h1', id:'pageTitle', html:'Clipperz'}, | ||
68 | {tag:'a', id:'backButton', cls:'button', href:'#', html:"back"} | ||
69 | ]}, | ||
70 | {tag:'form', title:'Theaters', cls:'panel toolbarlessPanel loginForm', id:this.getId('loginFormPanel'), children:[ | ||
71 | {tag:'fieldset', id:this.getId('fieldset'), children:[ | ||
72 | {tag:'div', cls:'row', children:[ | ||
73 | {tag:'label', html:"username"}, | ||
74 | {tag:'input', type:'text', name:'username', value:"", autocorrect:'off', autocapitalize:'off', id:this.getId('username')} | ||
75 | ]}, | ||
76 | {tag:'div', cls:'row', children:[ | ||
77 | {tag:'label', html:"passphrase"}, | ||
78 | {tag:'input', type:'password', name:'passphrase', value:"", id:this.getId('passphrase')} | ||
79 | ]} | ||
80 | ]}, | ||
81 | {tag:'a', cls:'whiteButton', type:'submit', href:'#', html:"Login", id:this.getId('submit')} | ||
82 | ]}, | ||
83 | {tag:'div', cls:'panel toolbarlessPanel loginProgressPanel', id:this.getId('loginProgressPanel'), children:[ | ||
84 | {tag:'div', id:this.getId('progressBar')} //, | ||
85 | // {tag:'a', cls:'whiteButton', type:'submit', href:'#', html:"Cancel", id:this.getId('cancel')} | ||
86 | ]}, | ||
87 | {tag:'div', cls:'panel loginErrorPanel', id:this.getId('loginErrorPanel'), children:[ | ||
88 | {tag:'div', cls:'errorMessage', id:this.getId('errorMessageBox'), children:[ | ||
89 | {tag:'h2', id:this.getId('errorMessage'), html:"Login failed"} | ||
90 | ]} | ||
91 | ]} | ||
92 | ]); | ||
93 | |||
94 | MochiKit.Signal.connect(this.getElement('submit'), 'onclick',this, 'submitHandler'); | ||
95 | MochiKit.Signal.connect(this.getElement('loginFormPanel'), 'onsubmit',this, 'submitHandler'); | ||
96 | |||
97 | // MochiKit.Signal.connect(this.getElement('cancel'), 'onclick',this, 'cancelHandler'); | ||
98 | MochiKit.Signal.connect('backButton', 'onclick',this, 'backHandler'); | ||
99 | |||
100 | this.addComponent(new Clipperz.PM.UI.Common.Components.ProgressBar({'element':this.getElement('progressBar')})); | ||
101 | |||
102 | // MochiKit.Style.hideElement(this.getElement('errorMessage')); | ||
103 | |||
104 | this.showLoginForm(); | ||
105 | // MochiKit.Async.callLater(0.2, MochiKit.Base.method(this, 'focusOnUsername')); | ||
106 | }, | ||
107 | |||
108 | //------------------------------------------------------------------------- | ||
109 | |||
110 | 'showLoginForm': function () { | ||
111 | MochiKit.Style.showElement(this.getElement('loginFormPanel')); | ||
112 | MochiKit.Style.hideElement(this.getElement('loginProgressPanel')); | ||
113 | MochiKit.Style.hideElement(this.getElement('loginErrorPanel')); | ||
114 | MochiKit.Style.hideElement('backButton'); | ||
115 | }, | ||
116 | |||
117 | 'slideInLoginForm': function () { | ||
118 | varoffset; | ||
119 | |||
120 | offset = ((MochiKit.DOM.getNodeAttribute(MochiKit.DOM.currentDocument().body, 'orientation') == 'portrait') ? 320 : 480); | ||
121 | |||
122 | MochiKit.Style.showElement(this.getElement('loginFormPanel')); | ||
123 | MochiKit.Style.setElementPosition(this.getElement('loginFormPanel'), {x:-offset, y:0}); | ||
124 | |||
125 | new MochiKit.Visual.Sequence([ | ||
126 | new MochiKit.Visual.Parallel([ | ||
127 | new MochiKit.Visual.Move(this.getElement('loginErrorPanel'), {x:offset, y:0, mode:'relative',transition:MochiKit.Visual.Transitions.linear, sync:true}), | ||
128 | new MochiKit.Visual.Move(this.getElement('loginFormPanel'), {x:0, y:0, mode:'absolute',transition:MochiKit.Visual.Transitions.linear, sync:true}), | ||
129 | MochiKit.Visual.fade ('backButton', { transition:MochiKit.Visual.Transitions.linear, sync:true}) | ||
130 | ], {duration:0.5, sync:true}), | ||
131 | MochiKit.Visual.fade(this.getElement('loginErrorPanel'), {duration:0, sync:true}) | ||
132 | ], {}) | ||
133 | }, | ||
134 | |||
135 | 'showLoginProgress': function () { | ||
136 | MochiKit.Style.hideElement(this.getElement('loginFormPanel')); | ||
137 | MochiKit.Style.showElement(this.getElement('loginProgressPanel')); | ||
138 | }, | ||
139 | |||
140 | 'showLoginError': function (anError) { | ||
141 | this.getElement('errorMessage').innerHTML = "Login error"; | ||
142 | |||
143 | MochiKit.Style.showElement('backButton'); | ||
144 | MochiKit.Style.hideElement(this.getElement('loginProgressPanel')); | ||
145 | MochiKit.Style.showElement(this.getElement('loginErrorPanel')); | ||
146 | MochiKit.Style.setElementPosition(this.getElement('loginErrorPanel'), {x:0, y:45}); | ||
147 | }, | ||
148 | |||
149 | //------------------------------------------------------------------------- | ||
150 | /* | ||
151 | 'disableCancelButton': function () { | ||
152 | MochiKit.DOM.hideElement(this.getElement('cancel')); | ||
153 | }, | ||
154 | */ | ||
155 | //------------------------------------------------------------------------- | ||
156 | |||
157 | 'submitHandler': function (anEvent) { | ||
158 | anEvent.preventDefault(); | ||
159 | |||
160 | MochiKit.Signal.signal(this, 'doLogin', {'username':this.username(), 'passphrase':this.passphrase()}); | ||
161 | }, | ||
162 | |||
163 | 'cancelHandler': function (anEvent) { | ||
164 | anEvent.preventDefault(); | ||
165 | |||
166 | //console.log("CANCEL"); | ||
167 | }, | ||
168 | |||
169 | 'backHandler': function (anEvent) { | ||
170 | anEvent.preventDefault(); | ||
171 | |||
172 | this.slideInLoginForm(); | ||
173 | }, | ||
174 | |||
175 | //------------------------------------------------------------------------- | ||
176 | |||
177 | __syntaxFix__: "syntax fix" | ||
178 | }); | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/iPhone/Controllers/MainController.js b/frontend/gamma/js/Clipperz/PM/UI/iPhone/Controllers/MainController.js deleted file mode 100644 index 3fcaae1..0000000 --- a/frontend/gamma/js/Clipperz/PM/UI/iPhone/Controllers/MainController.js +++ b/dev/null | |||
@@ -1,369 +0,0 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz Community Edition. | ||
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | ||
8 | refer to http://www.clipperz.com. | ||
9 | |||
10 | * Clipperz Community Edition is free software: you can redistribute | ||
11 | it and/or modify it under the terms of the GNU Affero General Public | ||
12 | License as published by the Free Software Foundation, either version | ||
13 | 3 of the License, or (at your option) any later version. | ||
14 | |||
15 | * Clipperz Community Edition is distributed in the hope that it will | ||
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
18 | See the GNU Affero General Public License for more details. | ||
19 | |||
20 | * You should have received a copy of the GNU Affero General Public | ||
21 | License along with Clipperz Community Edition. If not, see | ||
22 | <http://www.gnu.org/licenses/>. | ||
23 | |||
24 | */ | ||
25 | |||
26 | Clipperz.Base.module('Clipperz.PM.UI.iPhone.Controllers'); | ||
27 | |||
28 | //Some parts of this controller have been derived from the iUI library. | ||
29 | |||
30 | Clipperz.PM.UI.iPhone.Controllers.MainController = function() { | ||
31 | this._loginForm = null; | ||
32 | this._cardList = null; | ||
33 | this._cachedValues =null; | ||
34 | this._user = null; | ||
35 | |||
36 | if (typeof window.onorientationchange == 'object') { | ||
37 | MochiKit.Signal.connect(window, 'onorientationchange', this, 'orientationChangeHandler'); | ||
38 | MochiKit.Async.callLater(0, MochiKit.Base.method(this, 'orientationChangeHandler')); | ||
39 | } else { | ||
40 | this.setOrientation('portrait'); | ||
41 | // this.setOrientation('landscape'); | ||
42 | } | ||
43 | |||
44 | this.addMetaTag('viewport', 'width=devicewidth; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;'); | ||
45 | this.addMetaTag('apple-mobile-web-app-capable', 'yes'); | ||
46 | this.addMetaTag('apple-mobile-web-app-status-bar-style', 'black'); | ||
47 | |||
48 | this.addLinkTag('apple-touch-icon', 'data:image/png;charset=utf-8;base64,iVBORw0KGgoAAAANSUhEUgAAAF8AAABfCAYAAACOTBv1AAAAC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xojmbA8R7T/ZvTKF3W7rsHwDB/SL+jkDIqpbxH/qdMrX+f5U6JIfRbrkR5Eu+VGkS34U6ZIfRbrkR5Eu+VGkS34U6ZIfRbrkR5H/Bx8z6HmTXnicAAAAAElFTkSuQmCCCg=='); | ||
49 | //this.addLinkTag('apple-touch-startup-image', 'default.png'); | ||
50 | |||
51 | // if (!window.navigator.standalone)// not running as an installed app | ||
52 | |||
53 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'selectedDirectLogin', this, 'selectedDirectLoginHandler'); | ||
54 | |||
55 | MochiKit.DOM.addElementClass(document.body, 'iPhone'); | ||
56 | return this; | ||
57 | } | ||
58 | |||
59 | MochiKit.Base.update(Clipperz.PM.UI.iPhone.Controllers.MainController.prototype, { | ||
60 | |||
61 | 'toString': function () { | ||
62 | return "Clipperz.PM.UI.iPhone.Controllers.MainController"; | ||
63 | }, | ||
64 | |||
65 | //========================================================================= | ||
66 | |||
67 | 'user': function () { | ||
68 | return this._user; | ||
69 | }, | ||
70 | |||
71 | 'setUser': function (aValue) { | ||
72 | this._user = aValue; | ||
73 | }, | ||
74 | |||
75 | //========================================================================= | ||
76 | |||
77 | 'loginForm': function() { | ||
78 | if (this._loginForm == null) { | ||
79 | MochiKit.DOM.removeElement('mainDiv'); | ||
80 | this._loginForm = new Clipperz.PM.UI.iPhone.Components.LoginForm({element:MochiKit.DOM.currentDocument().body}); | ||
81 | MochiKit.Signal.connect(this._loginForm, 'doLogin', this, 'doLoginHandler') | ||
82 | } | ||
83 | |||
84 | return this._loginForm; | ||
85 | }, | ||
86 | |||
87 | 'removeLoginForm': function () { | ||
88 | if (this._loginForm != null) { | ||
89 | this._loginForm.remove(); | ||
90 | this._loginForm = null; | ||
91 | } | ||
92 | }, | ||
93 | |||
94 | //----------------------------------------------------------------------------- | ||
95 | |||
96 | 'cardList': function () { | ||
97 | if (this._cardList == null) { | ||
98 | this._cardList = new Clipperz.PM.UI.iPhone.Components.CardList({element:MochiKit.DOM.currentDocument().body}); | ||
99 | MochiKit.Signal.connect(this._cardList, 'searchEvent',this, 'searchEventHandler') | ||
100 | MochiKit.Signal.connect(this._cardList, 'selectedCard',this, 'selecetedCardHandler') | ||
101 | } | ||
102 | |||
103 | return this._cardList; | ||
104 | }, | ||
105 | |||
106 | //========================================================================= | ||
107 | |||
108 | 'currentWidth': function () { | ||
109 | return this._currentWidth; | ||
110 | }, | ||
111 | |||
112 | 'setCurrentWidth': function (aValue) { | ||
113 | this._currentWidth = aValue; | ||
114 | }, | ||
115 | |||
116 | //========================================================================= | ||
117 | |||
118 | 'orientationChangeHandler': function () { | ||
119 | switch(window.orientation) { | ||
120 | case 0: | ||
121 | this.setOrientation('portrait'); | ||
122 | break; | ||
123 | case 90: | ||
124 | case -90: | ||
125 | this.setOrientation('landscape'); | ||
126 | break; | ||
127 | } | ||
128 | }, | ||
129 | |||
130 | //------------------------------------------------------------------------- | ||
131 | |||
132 | 'setOrientation': function (anOrientation) { | ||
133 | document.body.setAttribute('orientation', anOrientation); | ||
134 | setTimeout(scrollTo, 100, 0, 1); | ||
135 | }, | ||
136 | |||
137 | //------------------------------------------------------------------------- | ||
138 | |||
139 | 'slidePages': function (fromPage, toPage, backwards) { | ||
140 | var axis; | ||
141 | var slideDone; | ||
142 | |||
143 | slideDone = function () { | ||
144 | // console.log("slideDone"); | ||
145 | if (!hasClass(toPage, "dialog")) { | ||
146 | fromPage.removeAttribute("selected"); | ||
147 | } | ||
148 | checkTimer = setInterval(checkOrientAndLocation, 300); | ||
149 | setTimeout(updatePage, 0, toPage, fromPage); | ||
150 | fromPage.removeEventListener('webkitTransitionEnd', slideDone, false); | ||
151 | } | ||
152 | |||
153 | axis = (backwards ? fromPage : toPage).getAttribute("axis"); | ||
154 | |||
155 | clearInterval(checkTimer); | ||
156 | |||
157 | if (canDoSlideAnim() && axis != 'y') { | ||
158 | slide2(fromPage, toPage, backwards, slideDone); | ||
159 | } else { | ||
160 | slide1(fromPage, toPage, backwards, axis, slideDone); | ||
161 | } | ||
162 | }, | ||
163 | |||
164 | //------------------------------------------------------------------------- | ||
165 | |||
166 | 'getCachedValues': function () { | ||
167 | var deferredResult; | ||
168 | |||
169 | if (this._cachedObjects != null) { | ||
170 | deferredResult = MochiKit.Async.succeed(this._cachedObjects); | ||
171 | } else { | ||
172 | deferredResult = new Clipperz.Async.Deferred("MainController.getCachedValues", {trace:false}); | ||
173 | deferredResult.addMethod(this.user(), 'getRecords'); | ||
174 | deferredResult.addCallback(MochiKit.Base.map, Clipperz.Async.collectResults("MainController.getCachedValues - collectResults", { | ||
175 | '_rowObject': MochiKit.Async.succeed, | ||
176 | '_reference': MochiKit.Base.methodcaller('reference'), | ||
177 | 'label': MochiKit.Base.methodcaller('label'), | ||
178 | 'favicon': MochiKit.Base.methodcaller('favicon'), | ||
179 | '_searchableContent':MochiKit.Base.methodcaller('searchableContent') | ||
180 | }, {trace:false})); | ||
181 | deferredResult.addCallback(Clipperz.Async.collectAll); | ||
182 | deferredResult.addCallback(MochiKit.Base.bind(function (someRows) { | ||
183 | this._cachedObjects = someRows; | ||
184 | return this._cachedObjects; | ||
185 | }, this)); | ||
186 | deferredResult.callback(); | ||
187 | } | ||
188 | |||
189 | return deferredResult; | ||
190 | }, | ||
191 | //========================================================================= | ||
192 | |||
193 | 'run': function(shouldShowRegistrationForm) { | ||
194 | this.loginForm().render(); | ||
195 | MochiKit.Async.callLater(1, MochiKit.Base.method(this.loginForm(), 'focusOnUsername')); | ||
196 | }, | ||
197 | |||
198 | //========================================================================= | ||
199 | |||
200 | 'doLoginHandler': function (someArgs) { | ||
201 | var deferredResult; | ||
202 | varparameters; | ||
203 | varshouldUseOTP; | ||
204 | // var loginProgress; | ||
205 | varuser; | ||
206 | var getPassphraseDelegate; | ||
207 | |||
208 | parameters = someArgs; | ||
209 | shouldUseOTP = (typeof(parameters.passphrase) == 'undefined'); | ||
210 | |||
211 | getPassphraseDelegate = MochiKit.Base.partial(MochiKit.Async.succeed, parameters.passphrase); | ||
212 | user = new Clipperz.PM.DataModel.User({'username':parameters.username, 'getPassphraseFunction':getPassphraseDelegate}); | ||
213 | |||
214 | deferredResult = new Clipperz.Async.Deferred("MainController.doLogin", {trace:false}); | ||
215 | deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'initProgress', {'steps':4}); | ||
216 | deferredResult.addMethod(this.loginForm(), 'showLoginProgress'); | ||
217 | deferredResult.addCallback(MochiKit.Async.wait, 0.1); | ||
218 | deferredResult.addMethod(Clipperz.Crypto.PRNG.defaultRandomGenerator(), 'deferredEntropyCollection'); | ||
219 | deferredResult.addMethod(user, 'login'); | ||
220 | deferredResult.addMethod(this, 'setUser', user); | ||
221 | deferredResult.addMethod(user, 'getRecords'); | ||
222 | deferredResult.addMethod(this, 'removeLoginForm'); | ||
223 | deferredResult.addMethod(this.cardList(), 'render'); | ||
224 | deferredResult.addMethod(this, 'displaySelectedRecords', ''); | ||
225 | deferredResult.addErrback(MochiKit.Base.method(this.loginForm(), 'showLoginError')); | ||
226 | deferredResult.callback(); | ||
227 | |||
228 | return deferredResult; | ||
229 | }, | ||
230 | |||
231 | //========================================================================= | ||
232 | |||
233 | 'searchEventHandler': function (aValue) { | ||
234 | //console.log("searching for ... " + aValue); | ||
235 | return this.displaySelectedRecords(aValue); | ||
236 | }, | ||
237 | |||
238 | //========================================================================= | ||
239 | |||
240 | '_displaySelectedRows': function (aFilter, someRows) { | ||
241 | var result; | ||
242 | |||
243 | result = someRows; | ||
244 | |||
245 | if (aFilter != null) { | ||
246 | var filter; | ||
247 | varfilterRegExp; | ||
248 | |||
249 | filter = aFilter.replace(/[^A-Za-z0-9]/g, "\\$&"); | ||
250 | filterRegExp = new RegExp(filter, "i"); | ||
251 | result = MochiKit.Base.filter(function (aCachedResult) { return filterRegExp.test(aCachedResult['_searchableContent'])}, result); | ||
252 | } | ||
253 | |||
254 | |||
255 | result.sort(MochiKit.Base.partial(function (aKey, aComparator, aObject, bObject) { | ||
256 | return aComparator(aObject[aKey], bObject[aKey]); | ||
257 | }, 'label', Clipperz.Base.caseInsensitiveCompare)); | ||
258 | |||
259 | this.cardList().update(result); | ||
260 | }, | ||
261 | |||
262 | //------------------------------------------------------------------------- | ||
263 | |||
264 | 'displaySelectedRecords': function (aFilter) { | ||
265 | return Clipperz.Async.callbacks("MainController.displaySelectedrows", [ | ||
266 | MochiKit.Base.method(this, 'getCachedValues'), | ||
267 | MochiKit.Base.method(this, '_displaySelectedRows', aFilter) | ||
268 | ], {trace:false}); | ||
269 | }, | ||
270 | |||
271 | //========================================================================= | ||
272 | |||
273 | 'selecetedCardHandler': function (aRecordReference) { | ||
274 | vardeferredResult; | ||
275 | varrecordData; | ||
276 | |||
277 | recordData = {}; | ||
278 | //console.log("Showing detail for card with reference", aRecordReference); | ||
279 | deferredResult = new Clipperz.Async.Deferred("MainController.selectedCardHandler", {trace:false}); | ||
280 | deferredResult.addMethod(this.user(), 'getRecord', aRecordReference); | ||
281 | deferredResult.collectResults({ | ||
282 | '_reference':MochiKit.Base.methodcaller('reference'), | ||
283 | 'title': MochiKit.Base.methodcaller('label'), | ||
284 | 'favicon': MochiKit.Base.methodcaller('favicon') | ||
285 | }); | ||
286 | deferredResult.addCallback(function (someData) { | ||
287 | MochiKit.Base.update(recordData, someData); | ||
288 | }) | ||
289 | deferredResult.addMethod(this.cardList(), 'showCard', recordData); | ||
290 | |||
291 | deferredResult.addMethod(this.user(), 'getRecord', aRecordReference); | ||
292 | deferredResult.addMethodcaller('notes'); | ||
293 | deferredResult.addCallback(function (someNotes) { | ||
294 | recordData['notes'] = someNotes; | ||
295 | }) | ||
296 | |||
297 | deferredResult.addMethod(this.user(), 'getRecord', aRecordReference); | ||
298 | deferredResult.addMethodcaller('getCurrentRecordVersion'); | ||
299 | deferredResult.addMethodcaller('fields'); | ||
300 | deferredResult.addCallback(MochiKit.Base.values); | ||
301 | deferredResult.addCallback(MochiKit.Base.map, Clipperz.Async.collectResults("MainController.selectedCardHandler - fields", { | ||
302 | 'label':MochiKit.Base.methodcaller('label'), | ||
303 | 'value':MochiKit.Base.methodcaller('value'), | ||
304 | 'isHidden':MochiKit.Base.methodcaller('isHidden') | ||
305 | }, {trace:false})); | ||
306 | deferredResult.addCallback(Clipperz.Async.collectAll); | ||
307 | deferredResult.addCallback(function (someData) { | ||
308 | recordData['fields'] = someData; | ||
309 | }); | ||
310 | |||
311 | deferredResult.addMethod(this.user(), 'getRecord', aRecordReference); | ||
312 | deferredResult.addMethodcaller('directLogins'); | ||
313 | deferredResult.addCallback(MochiKit.Base.values); | ||
314 | deferredResult.addCallback(MochiKit.Base.map, Clipperz.Async.collectResults("MainController.selectedCardHandler - directLogins", { | ||
315 | 'label': MochiKit.Base.methodcaller('label'), | ||
316 | 'favicon': MochiKit.Base.methodcaller('favicon'), | ||
317 | '_reference':MochiKit.Base.methodcaller('reference') | ||
318 | }, {trace:false})); | ||
319 | deferredResult.addCallback(Clipperz.Async.collectAll); | ||
320 | deferredResult.addCallback(function (someData) { | ||
321 | recordData['directLogins'] = someData; | ||
322 | }); | ||
323 | |||
324 | deferredResult.addMethod(this.cardList(), 'showCardDetails', recordData); | ||
325 | deferredResult.callback(); | ||
326 | |||
327 | return deferredResult; | ||
328 | }, | ||
329 | |||
330 | //========================================================================= | ||
331 | |||
332 | 'selectedDirectLoginHandler': function (someData) { | ||
333 | vardeferredResult; | ||
334 | |||
335 | //console.log("<<< signal - directLogin"); | ||
336 | deferredResult = new Clipperz.Async.Deferred("MainController.selectedDirectLoginHandler", {trace:false}); | ||
337 | deferredResult.addMethod(this.user(), 'getRecord', someData['cardReference']); | ||
338 | deferredResult.addMethodcaller('directLogins'); | ||
339 | deferredResult.addCallback(MochiKit.Base.itemgetter(someData['directLoginReference'])); | ||
340 | // deferredResult.addMethodcaller('runDirectLogin'); | ||
341 | deferredResult.addCallback(Clipperz.PM.UI.Common.Controllers.DirectLoginRunner.openDirectLogin); | ||
342 | deferredResult.callback(); | ||
343 | |||
344 | return deferredResult; | ||
345 | }, | ||
346 | |||
347 | //========================================================================= | ||
348 | |||
349 | 'addMetaTag': function (aName, aContent) { | ||
350 | varmetaTag; | ||
351 | |||
352 | metaTag = document.createElement('meta'); | ||
353 | metaTag.name = aName; | ||
354 | metaTag.content = aContent; | ||
355 | document.getElementsByTagName('head')[0].appendChild(metaTag); | ||
356 | }, | ||
357 | |||
358 | 'addLinkTag': function (aRel, anHref) { | ||
359 | var linkTag; | ||
360 | |||
361 | linkTag = document.createElement('link'); | ||
362 | linkTag.rel = aRel; | ||
363 | linkTag.href = anHref; | ||
364 | document.getElementsByTagName('head')[0].appendChild(linkTag); | ||
365 | }, | ||
366 | |||
367 | //========================================================================= | ||
368 | __syntaxFix__: "syntax fix" | ||
369 | }); \ No newline at end of file | ||