summaryrefslogtreecommitdiff
path: root/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers
Unidiff
Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/UI/Web/Controllers') (more/less context) (ignore whitespace changes)
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/AppController.js23
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardDialogController.js23
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardsController.js22
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/DirectLoginWizardController.js25
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/DirectLoginsController.js22
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/FilterController.js22
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/GridController.js22
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/LoginController.js28
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/MainController.js28
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/NewUserWizardController.js28
10 files changed, 102 insertions, 141 deletions
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 1ab2e69..3d9d6d3 100644
--- a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/AppController.js
+++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/AppController.js
@@ -1,118 +1,116 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2013 Clipperz Srl
4 4
5This file is part of Clipperz Community Edition. 5This file is part of Clipperz, the online password manager.
6Clipperz Community Edition is an online password manager.
7For further information about its features and functionalities please 6For further information about its features and functionalities please
8refer to http://www.clipperz.com. 7refer to http://www.clipperz.com.
9 8
10* Clipperz Community Edition is free software: you can redistribute 9* Clipperz is free software: you can redistribute it and/or modify it
11 it and/or modify it under the terms of the GNU Affero General Public 10 under the terms of the GNU Affero General Public License as published
12 License as published by the Free Software Foundation, either version 11 by the Free Software Foundation, either version 3 of the License, or
13 3 of the License, or (at your option) any later version. 12 (at your option) any later version.
14 13
15* Clipperz Community Edition is distributed in the hope that it will 14* Clipperz is distributed in the hope that it will be useful, but
16 be useful, but WITHOUT ANY WARRANTY; without even the implied 15 WITHOUT ANY WARRANTY; without even the implied warranty of
17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU Affero General Public License for more details. 17 See the GNU Affero General Public License for more details.
19 18
20* You should have received a copy of the GNU Affero General Public 19* You should have received a copy of the GNU Affero General Public
21 License along with Clipperz Community Edition. If not, see 20 License along with Clipperz. If not, see http://www.gnu.org/licenses/.
22 <http://www.gnu.org/licenses/>.
23 21
24*/ 22*/
25 23
26Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers'); 24Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers');
27 25
28Clipperz.PM.UI.Web.Controllers.AppController = function(args) { 26Clipperz.PM.UI.Web.Controllers.AppController = function(args) {
29 27
30 this._user = null; 28 this._user = null;
31 this._tabSlotNames = { 29 this._tabSlotNames = {
32 //tabName: slotName 30 //tabName: slotName
33 'cards': 'cardGrid', 31 'cards': 'cardGrid',
34 // 'directLogins':'directLoginGrid', 32 // 'directLogins':'directLoginGrid',
35 'account': 'accountPanel', 33 'account': 'accountPanel',
36 'data': 'dataPanel', 34 'data': 'dataPanel',
37 'tools': 'toolsPanel' 35 'tools': 'toolsPanel'
38 }; 36 };
39 37
40 //controllers 38 //controllers
41 this._cardsController= null; 39 this._cardsController= null;
42 //this._directLoginsController = null; 40 //this._directLoginsController = null;
43 this._filterController = null; //new Clipperz.PM.UI.Web.Controllers.FilterController(); 41 this._filterController = null; //new Clipperz.PM.UI.Web.Controllers.FilterController();
44 42
45 //components 43 //components
46 this._appPage = null; 44 this._appPage = null;
47 this._userInfoBox = null; 45 this._userInfoBox = null;
48 this._tabSidePanel = null; 46 this._tabSidePanel = null;
49 47
50 // MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'editCard', this, 'handleEditCard'); 48 // MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'editCard', this, 'handleEditCard');
51 // MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'deleteCard',this, 'handleDeleteCard'); 49 // MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'deleteCard',this, 'handleDeleteCard');
52 50
53 MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'userDataSuccessfullySaved',this, 'userDataSuccessfullySavedHandler'); 51 MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'userDataSuccessfullySaved',this, 'userDataSuccessfullySavedHandler');
54 52
55 return this; 53 return this;
56} 54}
57 55
58MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.AppController.prototype, { 56MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.AppController.prototype, {
59 57
60 'toString': function() { 58 'toString': function() {
61 return "Clipperz.PM.UI.Web.Controllers.AppController"; 59 return "Clipperz.PM.UI.Web.Controllers.AppController";
62 }, 60 },
63 61
64 //----------------------------------------------------------------------------- 62 //-----------------------------------------------------------------------------
65 63
66 'setUser': function(anUser) { 64 'setUser': function(anUser) {
67 this._user = anUser; 65 this._user = anUser;
68 }, 66 },
69 67
70 'user': function() { 68 'user': function() {
71 return this._user; 69 return this._user;
72 }, 70 },
73 71
74 //----------------------------------------------------------------------------- 72 //-----------------------------------------------------------------------------
75 /* 73 /*
76 'tabSlotNames': function() { 74 'tabSlotNames': function() {
77 return this._tabSlotNames; 75 return this._tabSlotNames;
78 }, 76 },
79*/ 77*/
80 'slotNameForTab': function(aTabName) { 78 'slotNameForTab': function(aTabName) {
81 return this._tabSlotNames[aTabName]; 79 return this._tabSlotNames[aTabName];
82 }, 80 },
83 81
84 'hideAllAppPageTabSlots': function() { 82 'hideAllAppPageTabSlots': function() {
85 var aTabName; 83 var aTabName;
86 84
87 for (aTabName in this._tabSlotNames) { 85 for (aTabName in this._tabSlotNames) {
88 this.appPage().hideSlot(this.slotNameForTab(aTabName)); 86 this.appPage().hideSlot(this.slotNameForTab(aTabName));
89 } 87 }
90 }, 88 },
91 89
92 //----------------------------------------------------------------------------- 90 //-----------------------------------------------------------------------------
93 91
94 'appPage': function() { 92 'appPage': function() {
95 if (this._appPage == null) { 93 if (this._appPage == null) {
96 this._appPage = new Clipperz.PM.UI.Web.Components.AppPage(); 94 this._appPage = new Clipperz.PM.UI.Web.Components.AppPage();
97 } 95 }
98 96
99 return this._appPage; 97 return this._appPage;
100 }, 98 },
101 99
102 //----------------------------------------------------------------------------- 100 //-----------------------------------------------------------------------------
103 101
104 'tabSidePanel': function() { 102 'tabSidePanel': function() {
105 if (this._tabSidePanel == null) { 103 if (this._tabSidePanel == null) {
106 this._tabSidePanel = new Clipperz.PM.UI.Web.Components.TabSidePanel(); 104 this._tabSidePanel = new Clipperz.PM.UI.Web.Components.TabSidePanel();
107 } 105 }
108 106
109 return this._tabSidePanel; 107 return this._tabSidePanel;
110 }, 108 },
111 109
112 //----------------------------------------------------------------------------- 110 //-----------------------------------------------------------------------------
113 111
114 'userInfoBox': function() { 112 'userInfoBox': function() {
115 if (this._userInfoBox == null) { 113 if (this._userInfoBox == null) {
116 this._userInfoBox = new Clipperz.PM.UI.Web.Components.UserInfoBox(); 114 this._userInfoBox = new Clipperz.PM.UI.Web.Components.UserInfoBox();
117 115
118 MochiKit.Signal.connect(this._userInfoBox, 'logout',this, 'handleLogout'); 116 MochiKit.Signal.connect(this._userInfoBox, 'logout',this, 'handleLogout');
@@ -231,121 +229,120 @@ MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.AppController.prototype, {
231 this.hideAllAppPageTabSlots(); 229 this.hideAllAppPageTabSlots();
232 this.appPage().showSlot(this.slotNameForTab('cards')); 230 this.appPage().showSlot(this.slotNameForTab('cards'));
233 231
234 MochiKit.Signal.connect(this.tabSidePanel(), 'tabSelected', this, 'handleTabSelected'); 232 MochiKit.Signal.connect(this.tabSidePanel(), 'tabSelected', this, 'handleTabSelected');
235 MochiKit.Signal.connect(this.tabSidePanel(), 'addCard', this, 'handleAddCard'); 233 MochiKit.Signal.connect(this.tabSidePanel(), 'addCard', this, 'handleAddCard');
236 MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'addCard', this, 'handleAddCard'); 234 MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'addCard', this, 'handleAddCard');
237 235
238 MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'downloadOfflineCopy',this, 'handleDownloadOfflineCopy'); 236 MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'downloadOfflineCopy',this, 'handleDownloadOfflineCopy');
239 237
240 deferredResult = new Clipperz.Async.Deferred("AppController.run", {trace:false}); 238 deferredResult = new Clipperz.Async.Deferred("AppController.run", {trace:false});
241 239
242 deferredResult.addMethod(this.cardsController(), 'run', {slot:this.appPage().slotNamed('cardGrid'), user:user}); 240 deferredResult.addMethod(this.cardsController(), 'run', {slot:this.appPage().slotNamed('cardGrid'), user:user});
243 // deferredResult.addMethod(this.directLoginsController(), 'run', {slot:this.appPage().slotNamed('directLoginGrid'), user:user}); 241 // deferredResult.addMethod(this.directLoginsController(), 'run', {slot:this.appPage().slotNamed('directLoginGrid'), user:user});
244 deferredResult.addMethod(this, 'populateUserInfo'); 242 deferredResult.addMethod(this, 'populateUserInfo');
245 243
246 deferredResult.addCallback(MochiKit.Visual.ScrollTo, 'miscLinks', {duration:0}); 244 deferredResult.addCallback(MochiKit.Visual.ScrollTo, 'miscLinks', {duration:0});
247 deferredResult.addCallback(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'CARDS_CONTROLLER_DID_RUN'); 245 deferredResult.addCallback(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'CARDS_CONTROLLER_DID_RUN');
248 deferredResult.addMethod(this.tabSidePanel(), 'selectTab', 'cards'); 246 deferredResult.addMethod(this.tabSidePanel(), 'selectTab', 'cards');
249 deferredResult.callback(); 247 deferredResult.callback();
250 }, 248 },
251 249
252 //----------------------------------------------------------------------------- 250 //-----------------------------------------------------------------------------
253 251
254 'handleTabSelected': function (selectedTabName) { 252 'handleTabSelected': function (selectedTabName) {
255 var aTabName; 253 var aTabName;
256 var aSlotName; 254 var aSlotName;
257 255
258//Clipperz.log(">>> AppController.handleTabSelected", selectedTabName); 256//Clipperz.log(">>> AppController.handleTabSelected", selectedTabName);
259 this.hideAllAppPageTabSlots(); 257 this.hideAllAppPageTabSlots();
260 this.appPage().showSlot(this.slotNameForTab(selectedTabName)); 258 this.appPage().showSlot(this.slotNameForTab(selectedTabName));
261 259
262 switch (selectedTabName) { 260 switch (selectedTabName) {
263 case 'cards': 261 case 'cards':
264 this.cardsController().focus(); 262 this.cardsController().focus();
265 break; 263 break;
266 // case 'directLogins': 264 // case 'directLogins':
267 // this.directLoginsController().focus(); 265 // this.directLoginsController().focus();
268 // break; 266 // break;
269 case 'data': 267 case 'data':
270 break; 268 break;
271 case 'account': 269 case 'account':
272 break; 270 break;
273 case 'tools': 271 case 'tools':
274 break; 272 break;
275 } 273 }
276//Clipperz.log("<-- AppController.handleTabSelected", aTabName); 274//Clipperz.log("<-- AppController.handleTabSelected", aTabName);
277 }, 275 },
278 276
279 //============================================================================= 277 //=============================================================================
280 278
281 'handleAddCard': function (aSourceElement) { 279 'handleAddCard': function (aSourceElement) {
282//Clipperz.log("=== AppController.addCard", aSourceElement); 280//Clipperz.log("=== AppController.addCard", aSourceElement);
283 this.cardsController().addCard(aSourceElement); 281 this.cardsController().addCard(aSourceElement);
284 }, 282 },
285 283
286 //============================================================================= 284 //=============================================================================
287 285
288 'userDataSuccessfullySavedHandler': function (anEvent) { 286 'userDataSuccessfullySavedHandler': function (anEvent) {
289 this.populateUserInfo(); 287 this.populateUserInfo();
290 }, 288 },
291 289
292 //============================================================================= 290 //=============================================================================
293 291
294 'handleLogout': function(anEvent) { 292 'handleLogout': function(anEvent) {
295 var deferredResult; 293 var deferredResult;
296 294
297 deferredResult = new Clipperz.Async.Deferred("AppController.handleLogout", {trace:false}); 295 deferredResult = new Clipperz.Async.Deferred("AppController.handleLogout", {trace:false});
298 deferredResult.addMethod(this.user(), 'logout'); 296 deferredResult.addMethod(this.user(), 'logout');
299 deferredResult.addCallback(MochiKit.Signal.signal, this, 'logout'); 297 deferredResult.addCallback(MochiKit.Signal.signal, this, 'logout');
300 deferredResult.callback(); 298 deferredResult.callback();
301 299
302 return deferredResult; 300 return deferredResult;
303 }, 301 },
304 302
305 //----------------------------------------------------------------------------- 303 //-----------------------------------------------------------------------------
306 304
307 'handleLock': function (anEvent) { 305 'handleLock': function (anEvent) {
308 return Clipperz.Async.callbacks("AppController.handleLock", [ 306 return Clipperz.Async.callbacks("AppController.handleLock", [
309 MochiKit.Base.method(this.cardsController(), 'deleteAllCleanTextData'), 307 MochiKit.Base.method(this.cardsController(), 'deleteAllCleanTextData'),
310 MochiKit.Base.method(this.user(), 'lock') 308 MochiKit.Base.method(this.user(), 'lock')
311 ], {trace:false}); 309 ], {trace:false});
312 }, 310 },
313 311
314 //............................................................................. 312 //.............................................................................
315 313
316 'handleUnlock': function (anEvent) { 314 'handleUnlock': function (anEvent) {
317 return Clipperz.Async.callbacks("AppController.handleUnock", [ 315 return Clipperz.Async.callbacks("AppController.handleUnock", [
318 MochiKit.Base.partial(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'initProgress'), 316 MochiKit.Base.partial(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'initProgress'),
319 MochiKit.Base.method(this.user(), 'login'), 317 MochiKit.Base.method(this.user(), 'login'),
320 MochiKit.Base.method(this.cardsController(), 'focus'), 318 MochiKit.Base.method(this.cardsController(), 'focus'),
321 MochiKit.Base.partial(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'progressDone'), 319 MochiKit.Base.partial(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'progressDone'),
322 MochiKit.Base.method(this.userInfoBox(), 'unlock') 320 MochiKit.Base.method(this.userInfoBox(), 'unlock')
323 ], {trace:false}); 321 ], {trace:false});
324 }, 322 },
325 323
326 'handleDownloadOfflineCopy': function (anEvent) { 324 'handleDownloadOfflineCopy': function (anEvent) {
327console.log("AppController.handleDownloadOfflineCopy");
328 var downloadHref; 325 var downloadHref;
329 326
330 downloadHref = window.location.href.replace(/\/[^\/]*$/,'') + Clipperz_dumpUrl; 327 downloadHref = window.location.href.replace(/\/[^\/]*$/,'') + Clipperz_dumpUrl;
331 328
332 if (Clipperz_IEisBroken == true) { 329 if (Clipperz_IEisBroken == true) {
333 window.open(downloadHref, ""); 330 window.open(downloadHref, "");
334 } else { 331 } else {
335 vardeferredResult; 332 vardeferredResult;
336 var newWindow; 333 var newWindow;
337 334
338 newWindow = window.open("", ""); 335 newWindow = window.open("", "");
339 336
340 deferredResult = new Clipperz.Async.Deferred("AppController.handleDownloadOfflineCopy", {trace:true}); 337 deferredResult = new Clipperz.Async.Deferred("AppController.handleDownloadOfflineCopy", {trace:true});
341 deferredResult.addCallback(MochiKit.Base.method(this.user().connection(), 'message'), 'echo', {'echo':"echo"}); 338 deferredResult.addCallback(MochiKit.Base.method(this.user().connection(), 'message'), 'echo', {'echo':"echo"});
342 deferredResult.addCallback(function(aWindow) { 339 deferredResult.addCallback(function(aWindow) {
343 aWindow.location.href = downloadHref; 340 aWindow.location.href = downloadHref;
344 }, newWindow); 341 }, newWindow);
345 deferredResult.callback(); 342 deferredResult.callback();
346 } 343 }
347 }, 344 },
348 345
349 //============================================================================= 346 //=============================================================================
350 __syntaxFix__: "syntax fix" 347 __syntaxFix__: "syntax fix"
351}); 348});
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardDialogController.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardDialogController.js
index effde31..b1ff81f 100644
--- a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardDialogController.js
+++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardDialogController.js
@@ -1,118 +1,116 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2013 Clipperz Srl
4 4
5This file is part of Clipperz Community Edition. 5This file is part of Clipperz, the online password manager.
6Clipperz Community Edition is an online password manager.
7For further information about its features and functionalities please 6For further information about its features and functionalities please
8refer to http://www.clipperz.com. 7refer to http://www.clipperz.com.
9 8
10* Clipperz Community Edition is free software: you can redistribute 9* Clipperz is free software: you can redistribute it and/or modify it
11 it and/or modify it under the terms of the GNU Affero General Public 10 under the terms of the GNU Affero General Public License as published
12 License as published by the Free Software Foundation, either version 11 by the Free Software Foundation, either version 3 of the License, or
13 3 of the License, or (at your option) any later version. 12 (at your option) any later version.
14 13
15* Clipperz Community Edition is distributed in the hope that it will 14* Clipperz is distributed in the hope that it will be useful, but
16 be useful, but WITHOUT ANY WARRANTY; without even the implied 15 WITHOUT ANY WARRANTY; without even the implied warranty of
17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU Affero General Public License for more details. 17 See the GNU Affero General Public License for more details.
19 18
20* You should have received a copy of the GNU Affero General Public 19* You should have received a copy of the GNU Affero General Public
21 License along with Clipperz Community Edition. If not, see 20 License along with Clipperz. If not, see http://www.gnu.org/licenses/.
22 <http://www.gnu.org/licenses/>.
23 21
24*/ 22*/
25 23
26Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers'); 24Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers');
27 25
28Clipperz.PM.UI.Web.Controllers.CardDialogController = function(args) { 26Clipperz.PM.UI.Web.Controllers.CardDialogController = function(args) {
29 args = args || {}; 27 args = args || {};
30 28
31 Clipperz.PM.UI.Web.Controllers.CardDialogController.superclass.constructor.call(this, args); 29 Clipperz.PM.UI.Web.Controllers.CardDialogController.superclass.constructor.call(this, args);
32 30
33 this._record = args.record || Clipperz.Base.exception.raise('MandatoryParameter'); 31 this._record = args.record || Clipperz.Base.exception.raise('MandatoryParameter');
34 this._delegate = args.delegate || Clipperz.Base.exception.raise('MandatoryParameter'); 32 this._delegate = args.delegate || Clipperz.Base.exception.raise('MandatoryParameter');
35 33
36 this._referenceElement = null; 34 this._referenceElement = null;
37 this._cardDialogComponent = null; 35 this._cardDialogComponent = null;
38 36
39 this._fieldsReferences = {}; 37 this._fieldsReferences = {};
40 this._directLoginReferences = {}; 38 this._directLoginReferences = {};
41 39
42 this._directLoginWizardController = null; 40 this._directLoginWizardController = null;
43 this._directLoginEditingComponent = null; 41 this._directLoginEditingComponent = null;
44 this._isDirectLoginEditingComponentVisible = false; 42 this._isDirectLoginEditingComponentVisible = false;
45 43
46 return this; 44 return this;
47}; 45};
48 46
49Clipperz.Base.extend(Clipperz.PM.UI.Web.Controllers.CardDialogController, Object, { 47Clipperz.Base.extend(Clipperz.PM.UI.Web.Controllers.CardDialogController, Object, {
50 48
51 'toString': function() { 49 'toString': function() {
52 return "Clipperz.PM.UI.Web.Controllers.CardDialogController"; 50 return "Clipperz.PM.UI.Web.Controllers.CardDialogController";
53 }, 51 },
54 52
55 //------------------------------------------------------------------------- 53 //-------------------------------------------------------------------------
56 54
57 'record': function () { 55 'record': function () {
58 return this._record; 56 return this._record;
59 }, 57 },
60 58
61 'delegate': function () { 59 'delegate': function () {
62 return this._delegate; 60 return this._delegate;
63 }, 61 },
64 62
65 //------------------------------------------------------------------------- 63 //-------------------------------------------------------------------------
66 64
67 'fieldsReferences': function () { 65 'fieldsReferences': function () {
68 return this._fieldsReferences; 66 return this._fieldsReferences;
69 }, 67 },
70 68
71 'directLoginReferences': function () { 69 'directLoginReferences': function () {
72 return this._directLoginReferences; 70 return this._directLoginReferences;
73 }, 71 },
74 72
75 //------------------------------------------------------------------------- 73 //-------------------------------------------------------------------------
76 74
77 'referenceElement': function () { 75 'referenceElement': function () {
78 return this._referenceElement; 76 return this._referenceElement;
79 }, 77 },
80 78
81 'setReferenceElement': function (anElement) { 79 'setReferenceElement': function (anElement) {
82 this._referenceElement = anElement; 80 this._referenceElement = anElement;
83 }, 81 },
84 82
85 //------------------------------------------------------------------------- 83 //-------------------------------------------------------------------------
86 84
87 'cardDialogComponent': function () { 85 'cardDialogComponent': function () {
88 if (this._cardDialogComponent == null) { 86 if (this._cardDialogComponent == null) {
89 this._cardDialogComponent = new Clipperz.PM.UI.Web.Components.CardDialogComponent(); 87 this._cardDialogComponent = new Clipperz.PM.UI.Web.Components.CardDialogComponent();
90 88
91 MochiKit.Signal.connect(this._cardDialogComponent, 'cancel', this, 'handleCancel'); 89 MochiKit.Signal.connect(this._cardDialogComponent, 'cancel', this, 'handleCancel');
92 MochiKit.Signal.connect(this._cardDialogComponent, 'save', this, 'handleSave'); 90 MochiKit.Signal.connect(this._cardDialogComponent, 'save', this, 'handleSave');
93 91
94 MochiKit.Signal.connect(this._cardDialogComponent, 'addField', this, 'handleAddField'); 92 MochiKit.Signal.connect(this._cardDialogComponent, 'addField', this, 'handleAddField');
95 MochiKit.Signal.connect(this._cardDialogComponent, 'changedValue',this, 'handleChangedValue'); 93 MochiKit.Signal.connect(this._cardDialogComponent, 'changedValue',this, 'handleChangedValue');
96 94
97 MochiKit.Signal.connect(this._cardDialogComponent, 'addDirectLogin',this, 'handleAddDirectLogin'); 95 MochiKit.Signal.connect(this._cardDialogComponent, 'addDirectLogin',this, 'handleAddDirectLogin');
98 MochiKit.Signal.connect(this._cardDialogComponent, 'keyPressed',this, 'handleCardDialogComponentKeyPressed'); 96 MochiKit.Signal.connect(this._cardDialogComponent, 'keyPressed',this, 'handleCardDialogComponentKeyPressed');
99 } 97 }
100 98
101 return this._cardDialogComponent; 99 return this._cardDialogComponent;
102 }, 100 },
103 101
104 //========================================================================= 102 //=========================================================================
105 103
106 'directLoginWizardController': function () { 104 'directLoginWizardController': function () {
107 if (this._directLoginWizardController == null) { 105 if (this._directLoginWizardController == null) {
108 this._directLoginWizardController = new Clipperz.PM.UI.Web.Controllers.DirectLoginWizardController({ 106 this._directLoginWizardController = new Clipperz.PM.UI.Web.Controllers.DirectLoginWizardController({
109 'cardLabel': this.cardDialogComponent().title(), 107 'cardLabel': this.cardDialogComponent().title(),
110 'directLoginEditingComponent': this.directLoginEditingComponent() 108 'directLoginEditingComponent': this.directLoginEditingComponent()
111 }) 109 })
112 110
113 MochiKit.Signal.connect(this._directLoginWizardController, 'exit',this, 'handleHideDirectLoginEditingComponent'); 111 MochiKit.Signal.connect(this._directLoginWizardController, 'exit',this, 'handleHideDirectLoginEditingComponent');
114 MochiKit.Signal.connect(this._directLoginWizardController, 'done',this, 'handleCompleteDirectLoginEditingComponent'); 112 MochiKit.Signal.connect(this._directLoginWizardController, 'done',this, 'handleCompleteDirectLoginEditingComponent');
115 } 113 }
116 114
117 return this._directLoginWizardController; 115 return this._directLoginWizardController;
118 }, 116 },
@@ -281,193 +279,192 @@ Clipperz.Base.extend(Clipperz.PM.UI.Web.Controllers.CardDialogController, Object
281 279
282 MochiKit.Base.method(this, 'fieldsReferences'), 280 MochiKit.Base.method(this, 'fieldsReferences'),
283 MochiKit.Base.values, 281 MochiKit.Base.values,
284 MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.method(this, 'updateRecordFieldValues')), 282 MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.method(this, 'updateRecordFieldValues')),
285 283
286 MochiKit.Base.method(this, 'directLoginReferences'), 284 MochiKit.Base.method(this, 'directLoginReferences'),
287 MochiKit.Base.values, 285 MochiKit.Base.values,
288 MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.method(this, 'updateRecordDirectLoginValues')), 286 MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.method(this, 'updateRecordDirectLoginValues')),
289 287
290 MochiKit.Base.method(this.directLoginEditingComponent(), 'directLoginReference'), 288 MochiKit.Base.method(this.directLoginEditingComponent(), 'directLoginReference'),
291 MochiKit.Base.method(this.record(), 'directLoginWithReference'), 289 MochiKit.Base.method(this.record(), 'directLoginWithReference'),
292 MochiKit.Base.method(this, 'updateRecordDirectLoginDetails'), 290 MochiKit.Base.method(this, 'updateRecordDirectLoginDetails'),
293 291
294 MochiKit.Base.noop 292 MochiKit.Base.noop
295 ], {trace:false}); 293 ], {trace:false});
296 }, 294 },
297 295
298 //------------------------------------------------------------------------- 296 //-------------------------------------------------------------------------
299 297
300 'updateRecordFieldValues': function (aFieldReference) { 298 'updateRecordFieldValues': function (aFieldReference) {
301 var deferredResult; 299 var deferredResult;
302 300
303 deferredResult = Clipperz.Async.callbacks('CardDialogController.updateRecordFieldValues', [ 301 deferredResult = Clipperz.Async.callbacks('CardDialogController.updateRecordFieldValues', [
304 MochiKit.Base.method(aFieldReference['component'],'label'), 302 MochiKit.Base.method(aFieldReference['component'],'label'),
305 MochiKit.Base.method(aFieldReference['field'], 'setLabel'), 303 MochiKit.Base.method(aFieldReference['field'], 'setLabel'),
306 304
307 MochiKit.Base.method(aFieldReference['component'],'value'), 305 MochiKit.Base.method(aFieldReference['component'],'value'),
308 MochiKit.Base.method(aFieldReference['field'], 'setValue'), 306 MochiKit.Base.method(aFieldReference['field'], 'setValue'),
309 307
310 MochiKit.Base.method(aFieldReference['component'],'isHidden'), 308 MochiKit.Base.method(aFieldReference['component'],'isHidden'),
311 MochiKit.Base.method(aFieldReference['field'], 'setIsHidden'), 309 MochiKit.Base.method(aFieldReference['field'], 'setIsHidden'),
312 310
313 MochiKit.Base.method(aFieldReference['field'], 'actionType'), 311 MochiKit.Base.method(aFieldReference['field'], 'actionType'),
314 MochiKit.Base.method(aFieldReference['component'],'setActionType') 312 MochiKit.Base.method(aFieldReference['component'],'setActionType')
315 ], {trace:false}); 313 ], {trace:false});
316 314
317 return deferredResult; 315 return deferredResult;
318 }, 316 },
319 317
320 //------------------------------------------------------------------------- 318 //-------------------------------------------------------------------------
321 319
322 'updateRecordDirectLoginValues': function (aDirectLoginReference) { 320 'updateRecordDirectLoginValues': function (aDirectLoginReference) {
323 var deferredResult; 321 var deferredResult;
324 322
325 deferredResult = Clipperz.Async.callbacks('CardDialogController.updateRecordDirectLoginValues', [ 323 deferredResult = Clipperz.Async.callbacks('CardDialogController.updateRecordDirectLoginValues', [
326 MochiKit.Base.method(aDirectLoginReference['component'], 'label'), 324 MochiKit.Base.method(aDirectLoginReference['component'], 'label'),
327 MochiKit.Base.method(aDirectLoginReference['directLogin'], 'setLabel') 325 MochiKit.Base.method(aDirectLoginReference['directLogin'], 'setLabel')
328 ], {trace:false}); 326 ], {trace:false});
329 327
330 return deferredResult; 328 return deferredResult;
331 }, 329 },
332 330
333 //------------------------------------------------------------------------- 331 //-------------------------------------------------------------------------
334 332
335 'updateRecordDirectLoginDetails': function (aDirectLogin) { 333 'updateRecordDirectLoginDetails': function (aDirectLogin) {
336 var result; 334 var result;
337 335
338 if (MochiKit.Base.isUndefinedOrNull(aDirectLogin)) { 336 if (MochiKit.Base.isUndefinedOrNull(aDirectLogin)) {
339 result = MochiKit.Async.succeed(); 337 result = MochiKit.Async.succeed();
340 } else { 338 } else {
341 result = Clipperz.Async.callbacks("CardDialogController.updateRecordDirectLoginDetails", [ 339 result = Clipperz.Async.callbacks("CardDialogController.updateRecordDirectLoginDetails", [
342 MochiKit.Base.method(this.directLoginEditingComponent(), 'label'), 340 MochiKit.Base.method(this.directLoginEditingComponent(), 'label'),
343 MochiKit.Base.method(aDirectLogin, 'setLabel'), 341 MochiKit.Base.method(aDirectLogin, 'setLabel'),
344 MochiKit.Base.method(this.directLoginEditingComponent(), 'favicon'), 342 MochiKit.Base.method(this.directLoginEditingComponent(), 'favicon'),
345 MochiKit.Base.method(aDirectLogin, 'setFavicon') 343 MochiKit.Base.method(aDirectLogin, 'setFavicon')
346 ], {trace:false}); 344 ], {trace:false});
347 } 345 }
348 346
349 return result; 347 return result;
350 }, 348 },
351 349
352 //========================================================================= 350 //=========================================================================
353 351
354 'addField': function () { 352 'addField': function () {
355 return this.record().addField({ 353 return this.record().addField({
356 'label':this.cardDialogComponent().newFieldLabel(), 354 'label':this.cardDialogComponent().newFieldLabel(),
357 'value':this.cardDialogComponent().newFieldValue(), 355 'value':this.cardDialogComponent().newFieldValue(),
358 'isHidden':this.cardDialogComponent().newFieldIsHidden() 356 'isHidden':this.cardDialogComponent().newFieldIsHidden()
359 }); 357 });
360 }, 358 },
361 359
362 'handleAddField': function () { 360 'handleAddField': function () {
363 return Clipperz.Async.callbacks("CardDialogController.handleAddField", [ 361 return Clipperz.Async.callbacks("CardDialogController.handleAddField", [
364 MochiKit.Base.method(this, 'addField'), 362 MochiKit.Base.method(this, 'addField'),
365 363
366 MochiKit.Base.method(this, 'addCardDialogComponentWithField'), 364 MochiKit.Base.method(this, 'addCardDialogComponentWithField'),
367 MochiKit.Base.method(this.cardDialogComponent(), 'resetNewFieldInputs'), 365 MochiKit.Base.method(this.cardDialogComponent(), 'resetNewFieldInputs'),
368 366
369 MochiKit.Base.method(this.cardDialogComponent(), 'fixRendering'), 367 MochiKit.Base.method(this.cardDialogComponent(), 'fixRendering'),
370 MochiKit.Base.method(this, 'handleChangedValue') 368 MochiKit.Base.method(this, 'handleChangedValue')
371 ], {trace:false}) 369 ], {trace:false})
372 }, 370 },
373 371
374 //------------------------------------------------------------------------- 372 //-------------------------------------------------------------------------
375 373
376 'handlePerformFieldAction': function (aFieldID, aTargetElement) { 374 'handlePerformFieldAction': function (aFieldID, aTargetElement) {
377//console.log("### targetElement", aTargetElement);
378 return Clipperz.Async.callbacks("CardDialogController.handleDeleteField", [ 375 return Clipperz.Async.callbacks("CardDialogController.handleDeleteField", [
379 MochiKit.Base.method(this.record(), 'fields'), 376 MochiKit.Base.method(this.record(), 'fields'),
380 MochiKit.Base.itemgetter(aFieldID), 377 MochiKit.Base.itemgetter(aFieldID),
381 Clipperz.Async.collectResults("CardDialogController.handleDeleteField <collect results>", { 378 Clipperz.Async.collectResults("CardDialogController.handleDeleteField <collect results>", {
382 'value':MochiKit.Base.methodcaller('value'), 379 'value':MochiKit.Base.methodcaller('value'),
383 'type': MochiKit.Base.methodcaller('actionType') 380 'type': MochiKit.Base.methodcaller('actionType')
384 }, {trace:false}), 381 }, {trace:false}),
385 MochiKit.Base.bind(function (someValues) { 382 MochiKit.Base.bind(function (someValues) {
386 switch (someValues['type']) { 383 switch (someValues['type']) {
387 case 'NONE': 384 case 'NONE':
388 throw "this event handler should not be triggered for fields with type 'NONE'"; 385 throw "this event handler should not be triggered for fields with type 'NONE'";
389 break; 386 break;
390 case 'URL': 387 case 'URL':
391 var url; 388 var url;
392 389
393 url = someValues['value']; 390 url = someValues['value'];
394 if (/^https?\:\/\//.test(url) == false) { 391 if (/^https?\:\/\//.test(url) == false) {
395 url = 'http://' + url; 392 url = 'http://' + url;
396 } 393 }
397 394
398 window.open(url); 395 window.open(url);
399 break; 396 break;
400 case 'EMAIL': 397 case 'EMAIL':
401 var url; 398 var url;
402 399
403 url = 'mailto:' + someValues['value']; 400 url = 'mailto:' + someValues['value'];
404 401
405 MochiKit.DOM.currentWindow().location = url; 402 MochiKit.DOM.currentWindow().location = url;
406 break; 403 break;
407 case 'PASSWORD': 404 case 'PASSWORD':
408//Clipperz.log("SHOW PASSWORD " + someValues['value']); 405//Clipperz.log("SHOW PASSWORD " + someValues['value']);
409 this.showPasswordTooltip(someValues['value'], aTargetElement); 406 this.showPasswordTooltip(someValues['value'], aTargetElement);
410 break; 407 break;
411 } 408 }
412 }, this) 409 }, this)
413 ], {trace:false}); 410 ], {trace:false});
414 }, 411 },
415 412
416 //------------------------------------------------------------------------- 413 //-------------------------------------------------------------------------
417 414
418 'handleDeleteField': function (aFieldID) { 415 'handleDeleteField': function (aFieldID) {
419 return Clipperz.Async.callbacks("CardDialogController.handleDeleteField", [ 416 return Clipperz.Async.callbacks("CardDialogController.handleDeleteField", [
420 MochiKit.Base.method(this.record(), 'fields'), 417 MochiKit.Base.method(this.record(), 'fields'),
421 MochiKit.Base.itemgetter(aFieldID), 418 MochiKit.Base.itemgetter(aFieldID),
422 MochiKit.Base.method(this.record(), 'removeField'), 419 MochiKit.Base.method(this.record(), 'removeField'),
423 420
424 MochiKit.Base.method(this, 'fieldsReferences'), 421 MochiKit.Base.method(this, 'fieldsReferences'),
425 MochiKit.Base.itemgetter(aFieldID), 422 MochiKit.Base.itemgetter(aFieldID),
426 MochiKit.Base.itemgetter('component'), 423 MochiKit.Base.itemgetter('component'),
427 424
428 function (aComponent) { 425 function (aComponent) {
429 return Clipperz.Async.callbacks("CardDialogController.handleDeleteField [fade and remove]", [ 426 return Clipperz.Async.callbacks("CardDialogController.handleDeleteField [fade and remove]", [
430 MochiKit.Base.partial(Clipperz.Visual.deferredAnimation, MochiKit.Visual.fade, aComponent.element(), {from:1.0, to:0.0, duration:0.5}), 427 MochiKit.Base.partial(Clipperz.Visual.deferredAnimation, MochiKit.Visual.fade, aComponent.element(), {from:1.0, to:0.0, duration:0.5}),
431 // Clipperz.Visual.deferredAnimation(MochiKit.Visual.fade, aComponent.element(), {from:1.0, to:0.0, duration:0.5}), 428 // Clipperz.Visual.deferredAnimation(MochiKit.Visual.fade, aComponent.element(), {from:1.0, to:0.0, duration:0.5}),
432 MochiKit.Base.method(aComponent, 'remove') 429 MochiKit.Base.method(aComponent, 'remove')
433 ], {trace:false}); 430 ], {trace:false});
434 }, 431 },
435 432
436 MochiKit.Base.bind(function () { 433 MochiKit.Base.bind(function () {
437 delete this.fieldsReferences()[aFieldID]; 434 delete this.fieldsReferences()[aFieldID];
438 }, this), 435 }, this),
439 436
440 MochiKit.Base.method(this.cardDialogComponent(), 'fixRendering'), 437 MochiKit.Base.method(this.cardDialogComponent(), 'fixRendering'),
441 MochiKit.Base.method(this, 'handleChangedValue') 438 MochiKit.Base.method(this, 'handleChangedValue')
442 ], {trace:false}); 439 ], {trace:false});
443 }, 440 },
444 441
445 //========================================================================= 442 //=========================================================================
446 443
447 'handleDeleteDirectLogin': function(aDirectLoginReference) { 444 'handleDeleteDirectLogin': function(aDirectLoginReference) {
448 var cardDialogComponent; 445 var cardDialogComponent;
449 446
450 cardDialogComponent = this.cardDialogComponent(); 447 cardDialogComponent = this.cardDialogComponent();
451 448
452 return Clipperz.Async.callbacks("CardDialogController.handleDeleteDirectLogin", [ 449 return Clipperz.Async.callbacks("CardDialogController.handleDeleteDirectLogin", [
453 MochiKit.Base.method(this.record(), 'directLogins'), 450 MochiKit.Base.method(this.record(), 'directLogins'),
454 MochiKit.Base.itemgetter(aDirectLoginReference), 451 MochiKit.Base.itemgetter(aDirectLoginReference),
455 MochiKit.Base.methodcaller('remove'), 452 MochiKit.Base.methodcaller('remove'),
456 453
457 MochiKit.Base.method(this, 'directLoginReferences'), 454 MochiKit.Base.method(this, 'directLoginReferences'),
458 MochiKit.Base.itemgetter(aDirectLoginReference), 455 MochiKit.Base.itemgetter(aDirectLoginReference),
459 MochiKit.Base.itemgetter('component'), 456 MochiKit.Base.itemgetter('component'),
460 457
461 function (aComponent) { 458 function (aComponent) {
462 return Clipperz.Async.callbacks("CardDialogController.handleDeleteDirectLogin [fade and remove]", [ 459 return Clipperz.Async.callbacks("CardDialogController.handleDeleteDirectLogin [fade and remove]", [
463 MochiKit.Base.partial(Clipperz.Visual.deferredAnimation, MochiKit.Visual.fade, aComponent.element(), {from:1.0, to:0.0, duration:0.5}),// Clipperz.Visual.deferredAnimation(MochiKit.Visual.fade, aComponent.element(), {from:1.0, to:0.0, duration:0.5}), 460 MochiKit.Base.partial(Clipperz.Visual.deferredAnimation, MochiKit.Visual.fade, aComponent.element(), {from:1.0, to:0.0, duration:0.5}),// Clipperz.Visual.deferredAnimation(MochiKit.Visual.fade, aComponent.element(), {from:1.0, to:0.0, duration:0.5}),
464 /// MochiKit.Base.method(aComponent, 'remove') 461 /// MochiKit.Base.method(aComponent, 'remove')
465 MochiKit.Base.method(cardDialogComponent, 'removeDirectLoginComponent', aComponent) 462 MochiKit.Base.method(cardDialogComponent, 'removeDirectLoginComponent', aComponent)
466 ], {trace:false}); 463 ], {trace:false});
467 }, 464 },
468 465
469 MochiKit.Base.bind(function () { 466 MochiKit.Base.bind(function () {
470 delete this.directLoginReferences()[aDirectLoginReference]; 467 delete this.directLoginReferences()[aDirectLoginReference];
471 }, this), 468 }, this),
472 469
473 MochiKit.Base.method(this.cardDialogComponent(), 'fixRendering'), 470 MochiKit.Base.method(this.cardDialogComponent(), 'fixRendering'),
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardsController.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardsController.js
index f58f0b8..68b5b9f 100644
--- a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardsController.js
+++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardsController.js
@@ -1,118 +1,116 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2013 Clipperz Srl
4 4
5This file is part of Clipperz Community Edition. 5This file is part of Clipperz, the online password manager.
6Clipperz Community Edition is an online password manager.
7For further information about its features and functionalities please 6For further information about its features and functionalities please
8refer to http://www.clipperz.com. 7refer to http://www.clipperz.com.
9 8
10* Clipperz Community Edition is free software: you can redistribute 9* Clipperz is free software: you can redistribute it and/or modify it
11 it and/or modify it under the terms of the GNU Affero General Public 10 under the terms of the GNU Affero General Public License as published
12 License as published by the Free Software Foundation, either version 11 by the Free Software Foundation, either version 3 of the License, or
13 3 of the License, or (at your option) any later version. 12 (at your option) any later version.
14 13
15* Clipperz Community Edition is distributed in the hope that it will 14* Clipperz is distributed in the hope that it will be useful, but
16 be useful, but WITHOUT ANY WARRANTY; without even the implied 15 WITHOUT ANY WARRANTY; without even the implied warranty of
17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU Affero General Public License for more details. 17 See the GNU Affero General Public License for more details.
19 18
20* You should have received a copy of the GNU Affero General Public 19* You should have received a copy of the GNU Affero General Public
21 License along with Clipperz Community Edition. If not, see 20 License along with Clipperz. If not, see http://www.gnu.org/licenses/.
22 <http://www.gnu.org/licenses/>.
23 21
24*/ 22*/
25 23
26Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers'); 24Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers');
27 25
28Clipperz.PM.UI.Web.Controllers.CardsController = function() { 26Clipperz.PM.UI.Web.Controllers.CardsController = function() {
29 Clipperz.PM.UI.Web.Controllers.CardsController.superclass.constructor.apply(this, arguments); 27 Clipperz.PM.UI.Web.Controllers.CardsController.superclass.constructor.apply(this, arguments);
30 28
31 MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'cardDialogComponentClosed', this, 'handleHideCard'); 29 MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'cardDialogComponentClosed', this, 'handleHideCard');
32 30
33 return this; 31 return this;
34} 32}
35 33
36Clipperz.Base.extend(Clipperz.PM.UI.Web.Controllers.CardsController, Clipperz.PM.UI.Web.Controllers.GridController, { 34Clipperz.Base.extend(Clipperz.PM.UI.Web.Controllers.CardsController, Clipperz.PM.UI.Web.Controllers.GridController, {
37 35
38 'toString': function() { 36 'toString': function() {
39 return "Clipperz.PM.UI.Web.Controllers.CardsController"; 37 return "Clipperz.PM.UI.Web.Controllers.CardsController";
40 }, 38 },
41 39
42 'createGrid': function () { 40 'createGrid': function () {
43 var grid; 41 var grid;
44 42
45 grid = new Clipperz.PM.UI.Web.Components.GridComponent({columnsManagers: [ 43 grid = new Clipperz.PM.UI.Web.Components.GridComponent({columnsManagers: [
46 new Clipperz.PM.UI.Web.Components.FaviconColumnManager({ 44 new Clipperz.PM.UI.Web.Components.FaviconColumnManager({
47 'name': 'Cards.favicon', 45 'name': 'Cards.favicon',
48 'selector': MochiKit.Base.methodcaller('favicon'), 46 'selector': MochiKit.Base.methodcaller('favicon'),
49 'cssClass': 'favicon' 47 'cssClass': 'favicon'
50 }), 48 }),
51 new Clipperz.PM.UI.Web.Components.LinkColumnManager({ 49 new Clipperz.PM.UI.Web.Components.LinkColumnManager({
52 'name': 'Cards.title', 50 'name': 'Cards.title',
53 'selector': MochiKit.Base.methodcaller('label'), 51 'selector': MochiKit.Base.methodcaller('label'),
54 'label': 'title', 52 'label': 'title',
55 'cssClass': 'title', 53 'cssClass': 'title',
56 'comparator': Clipperz.Base.caseInsensitiveCompare, 54 'comparator': Clipperz.Base.caseInsensitiveCompare,
57 'sortable': true, 55 'sortable': true,
58 'sorted': 'ASCENDING', 56 'sorted': 'ASCENDING',
59 // 'actionMethod': function(anObject, anEvent) { MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'editCard', {objectData:anObject, element:anEvent.src()})} 57 // 'actionMethod': function(anObject, anEvent) { MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'editCard', {objectData:anObject, element:anEvent.src()})}
60 'actionMethod': MochiKit.Base.method(this, 'handleShowCard') 58 'actionMethod': MochiKit.Base.method(this, 'handleShowCard')
61 }), 59 }),
62 new Clipperz.PM.UI.Web.Components.DirectLoginsColumnManager({ 60 new Clipperz.PM.UI.Web.Components.DirectLoginsColumnManager({
63 'name': 'Cards.directLogins', 61 'name': 'Cards.directLogins',
64 'selector': MochiKit.Base.methodcaller('directLoginReferences'), 62 'selector': MochiKit.Base.methodcaller('directLoginReferences'),
65 'label': 'direct logins', 63 'label': 'direct logins',
66 'cssClass': 'directLogin' 64 'cssClass': 'directLogin'
67 }), 65 }),
68 new Clipperz.PM.UI.Web.Components.DateColumnManager({ 66 new Clipperz.PM.UI.Web.Components.DateColumnManager({
69 'name': 'Cards.latestUpdate', 67 'name': 'Cards.latestUpdate',
70 'selector': MochiKit.Base.methodcaller('updateDate'), 68 'selector': MochiKit.Base.methodcaller('updateDate'),
71 'label': 'latest update', 69 'label': 'latest update',
72 'cssClass': 'latestUpdate', 70 'cssClass': 'latestUpdate',
73 'format': 'd-m-Y', 71 'format': 'd-m-Y',
74 'comparator': MochiKit.Base.compare, 72 'comparator': MochiKit.Base.compare,
75 'sortable': true, 73 'sortable': true,
76 'sorted': 'UNSORTED' 74 'sorted': 'UNSORTED'
77 }), 75 }),
78 new Clipperz.PM.UI.Web.Components.DeleteObjectColumnManager({ 76 new Clipperz.PM.UI.Web.Components.DeleteObjectColumnManager({
79 'name': 'Cards.delete', 77 'name': 'Cards.delete',
80 'selector': MochiKit.Base.noop, 78 'selector': MochiKit.Base.noop,
81 'cssClass': 'delete', 79 'cssClass': 'delete',
82 // 'actionMethod': function(anObject, anEvent) { MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'deleteCard', {objectData:anObject, element:anEvent.src()})} 80 // 'actionMethod': function(anObject, anEvent) { MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'deleteCard', {objectData:anObject, element:anEvent.src()})}
83 'actionMethod': MochiKit.Base.method(this, 'handleDeleteCard') 81 'actionMethod': MochiKit.Base.method(this, 'handleDeleteCard')
84 }) 82 })
85 ]}); 83 ]});
86 84
87 grid.setComponentForSlotNamed(new Clipperz.PM.UI.Web.Components.BookmarkletComponent(), 'headerSlot'); 85 grid.setComponentForSlotNamed(new Clipperz.PM.UI.Web.Components.BookmarkletComponent(), 'headerSlot');
88 86
89 return grid; 87 return grid;
90 }, 88 },
91 89
92 //----------------------------------------------------------------------------- 90 //-----------------------------------------------------------------------------
93 91
94 'getRows': function () { 92 'getRows': function () {
95 //TODO relying on user() in GridController, bad code smell :| 93 //TODO relying on user() in GridController, bad code smell :|
96 return this.user().getRecords(); 94 return this.user().getRecords();
97 }, 95 },
98 96
99 //============================================================================= 97 //=============================================================================
100 98
101 'displayEmptyContent': function () { 99 'displayEmptyContent': function () {
102 varemptyGridComponent; 100 varemptyGridComponent;
103 101
104 emptyGridComponent = new Clipperz.PM.UI.Web.Components.CreateNewCardSplashComponent(); 102 emptyGridComponent = new Clipperz.PM.UI.Web.Components.CreateNewCardSplashComponent();
105 103
106 return Clipperz.Async.callbacks("CardsController.displayEmptyContent", [ 104 return Clipperz.Async.callbacks("CardsController.displayEmptyContent", [
107 MochiKit.Base.method(this.grid(), 'setNoRowsGridComponent', emptyGridComponent), 105 MochiKit.Base.method(this.grid(), 'setNoRowsGridComponent', emptyGridComponent),
108 MochiKit.Base.bind(Clipperz.PM.UI.Web.Controllers.CardsController.superclass.displayEmptyContent, this) 106 MochiKit.Base.bind(Clipperz.PM.UI.Web.Controllers.CardsController.superclass.displayEmptyContent, this)
109 ], {trace:false}); 107 ], {trace:false});
110 }, 108 },
111 109
112 'displaySelectedRows': function (aFilter) { 110 'displaySelectedRows': function (aFilter) {
113 this.columnManagerWithName('Cards.directLogins').hideDirectLoginListPopup(); 111 this.columnManagerWithName('Cards.directLogins').hideDirectLoginListPopup();
114 112
115 return Clipperz.PM.UI.Web.Controllers.CardsController.superclass.displaySelectedRows.apply(this, arguments); 113 return Clipperz.PM.UI.Web.Controllers.CardsController.superclass.displaySelectedRows.apply(this, arguments);
116 }, 114 },
117 115
118 //============================================================================= 116 //=============================================================================
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/DirectLoginWizardController.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/DirectLoginWizardController.js
index c025a51..92ed6e3 100644
--- a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/DirectLoginWizardController.js
+++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/DirectLoginWizardController.js
@@ -1,262 +1,259 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2013 Clipperz Srl
4 4
5This file is part of Clipperz Community Edition. 5This file is part of Clipperz, the online password manager.
6Clipperz Community Edition is an online password manager.
7For further information about its features and functionalities please 6For further information about its features and functionalities please
8refer to http://www.clipperz.com. 7refer to http://www.clipperz.com.
9 8
10* Clipperz Community Edition is free software: you can redistribute 9* Clipperz is free software: you can redistribute it and/or modify it
11 it and/or modify it under the terms of the GNU Affero General Public 10 under the terms of the GNU Affero General Public License as published
12 License as published by the Free Software Foundation, either version 11 by the Free Software Foundation, either version 3 of the License, or
13 3 of the License, or (at your option) any later version. 12 (at your option) any later version.
14 13
15* Clipperz Community Edition is distributed in the hope that it will 14* Clipperz is distributed in the hope that it will be useful, but
16 be useful, but WITHOUT ANY WARRANTY; without even the implied 15 WITHOUT ANY WARRANTY; without even the implied warranty of
17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU Affero General Public License for more details. 17 See the GNU Affero General Public License for more details.
19 18
20* You should have received a copy of the GNU Affero General Public 19* You should have received a copy of the GNU Affero General Public
21 License along with Clipperz Community Edition. If not, see 20 License along with Clipperz. If not, see http://www.gnu.org/licenses/.
22 <http://www.gnu.org/licenses/>.
23 21
24*/ 22*/
25 23
26Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers'); 24Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers');
27 25
28Clipperz.PM.UI.Web.Controllers.DirectLoginWizardController = function(args) { 26Clipperz.PM.UI.Web.Controllers.DirectLoginWizardController = function(args) {
29 this._directLoginEditingComponent = args.directLoginEditingComponent|| Clipperz.Base.exception.raise('MandatoryParameter'); 27 this._directLoginEditingComponent = args.directLoginEditingComponent|| Clipperz.Base.exception.raise('MandatoryParameter');
30 this._cardLabel = args.cardLabel || Clipperz.Base.exception.raise('MandatoryParameter'); 28 this._cardLabel = args.cardLabel || Clipperz.Base.exception.raise('MandatoryParameter');
31 29
32 MochiKit.Signal.connect(this._directLoginEditingComponent, 'changedValue',this, 'handleChangedValue'); 30 MochiKit.Signal.connect(this._directLoginEditingComponent, 'changedValue',this, 'handleChangedValue');
33 MochiKit.Signal.connect(this._directLoginEditingComponent, 'moveForward',this, 'handleMoveForward'); 31 MochiKit.Signal.connect(this._directLoginEditingComponent, 'moveForward',this, 'handleMoveForward');
34 MochiKit.Signal.connect(this._directLoginEditingComponent, 'keyPressed',this, 'handleDirectLoginEditingComponentKeyPressed'); 32 MochiKit.Signal.connect(this._directLoginEditingComponent, 'keyPressed',this, 'handleDirectLoginEditingComponentKeyPressed');
35 33
36 this._directLogin = null; 34 this._directLogin = null;
37 this._directLoginHasJustBeenAdded = false; 35 this._directLoginHasJustBeenAdded = false;
38 36
39 this._rulerComponent = null; 37 this._rulerComponent = null;
40 38
41 this._steps = null; 39 this._steps = null;
42 this._currentStepIndex = 0; 40 this._currentStepIndex = 0;
43 this._isNextEnabled = false; 41 this._isNextEnabled = false;
44 42
45 this._recordFields = null; 43 this._recordFields = null;
46 this._originalBindings = null; 44 this._originalBindings = null;
47 45
48 this._bindingComponents = []; 46 this._bindingComponents = [];
49 this._formValueComponents = []; 47 this._formValueComponents = [];
50 48
51 return this; 49 return this;
52} 50}
53 51
54MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.DirectLoginWizardController.prototype, { 52MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.DirectLoginWizardController.prototype, {
55 53
56 'toString': function() { 54 'toString': function() {
57 return "Clipperz.PM.UI.Web.Controllers.DirectLoginWizardController"; 55 return "Clipperz.PM.UI.Web.Controllers.DirectLoginWizardController";
58 }, 56 },
59 57
60 //------------------------------------------------------------------------- 58 //-------------------------------------------------------------------------
61 59
62 'directLogin': function () { 60 'directLogin': function () {
63 return this._directLogin; 61 return this._directLogin;
64 }, 62 },
65 63
66 //------------------------------------------------------------------------- 64 //-------------------------------------------------------------------------
67 65
68 'directLoginHasJustBeenAdded': function () { 66 'directLoginHasJustBeenAdded': function () {
69 return this._directLoginHasJustBeenAdded; 67 return this._directLoginHasJustBeenAdded;
70 }, 68 },
71 69
72 'setDirectLoginHasJustBeenAdded': function (aValue) { 70 'setDirectLoginHasJustBeenAdded': function (aValue) {
73 this._directLoginHasJustBeenAdded = aValue; 71 this._directLoginHasJustBeenAdded = aValue;
74 }, 72 },
75 73
76 //------------------------------------------------------------------------- 74 //-------------------------------------------------------------------------
77 75
78 'directLoginEditingComponent': function () { 76 'directLoginEditingComponent': function () {
79 return this._directLoginEditingComponent; 77 return this._directLoginEditingComponent;
80 }, 78 },
81 79
82 //============================================================================= 80 //=============================================================================
83 81
84 'cardLabel': function () { 82 'cardLabel': function () {
85 return this._cardLabel; 83 return this._cardLabel;
86 }, 84 },
87 85
88 //============================================================================= 86 //=============================================================================
89 87
90 'resetCurrentStepIndex': function () { 88 'resetCurrentStepIndex': function () {
91 this._currentStepIndex = 0; 89 this._currentStepIndex = 0;
92 this.rulerComponent().resetStatus(); 90 this.rulerComponent().resetStatus();
93 }, 91 },
94 92
95 //----------------------------------------------------------------------------- 93 //-----------------------------------------------------------------------------
96 94
97 'enableNext': function (aValue) { 95 'enableNext': function (aValue) {
98 this.rulerComponent().enableNext(aValue); 96 this.rulerComponent().enableNext(aValue);
99 this._isNextEnabled = aValue; 97 this._isNextEnabled = aValue;
100 }, 98 },
101 99
102 'isNextEnabled': function () { 100 'isNextEnabled': function () {
103 return this._isNextEnabled; 101 return this._isNextEnabled;
104 }, 102 },
105 103
106 //----------------------------------------------------------------------------- 104 //-----------------------------------------------------------------------------
107 105
108 'enablePrevious': function (aValue) { 106 'enablePrevious': function (aValue) {
109 this.rulerComponent().enablePrevious(aValue); 107 this.rulerComponent().enablePrevious(aValue);
110 }, 108 },
111 109
112 //============================================================================= 110 //=============================================================================
113 111
114 'bindingComponents': function () { 112 'bindingComponents': function () {
115 return this._bindingComponents; 113 return this._bindingComponents;
116 }, 114 },
117 115
118 'resetBindingComponents': function () { 116 'resetBindingComponents': function () {
119 this.directLoginEditingComponent().clearAllBindingsComponents(); 117 this.directLoginEditingComponent().clearAllBindingsComponents();
120 this._bindingComponents = []; 118 this._bindingComponents = [];
121 }, 119 },
122 120
123 //============================================================================= 121 //=============================================================================
124 122
125 'formValueComponents': function () { 123 'formValueComponents': function () {
126 return this._formValueComponents; 124 return this._formValueComponents;
127 }, 125 },
128 126
129 'resetFormValueComponents': function () { 127 'resetFormValueComponents': function () {
130 this.directLoginEditingComponent().clearAllFormValueComponents(); 128 this.directLoginEditingComponent().clearAllFormValueComponents();
131 this._formValueComponents = []; 129 this._formValueComponents = [];
132 }, 130 },
133 131
134 //============================================================================= 132 //=============================================================================
135 133
136 'recordFields': function () { 134 'recordFields': function () {
137 return this._recordFields; 135 return this._recordFields;
138 }, 136 },
139 137
140 'setRecordFields': function (aValue) { 138 'setRecordFields': function (aValue) {
141 this._recordFields = aValue; 139 this._recordFields = aValue;
142 }, 140 },
143 141
144 'recordFieldWithReference': function (aReference) { 142 'recordFieldWithReference': function (aReference) {
145 var matchingValues; 143 var matchingValues;
146 var result; 144 var result;
147 145
148 matchingValues = MochiKit.Base.filter(function (aField) { return aField['reference'] == aReference; }, this.recordFields()); 146 matchingValues = MochiKit.Base.filter(function (aField) { return aField['reference'] == aReference; }, this.recordFields());
149 147
150 if (matchingValues.length == 0) { 148 if (matchingValues.length == 0) {
151 result = null; 149 result = null;
152 } else { 150 } else {
153 result = matchingValues[0]; 151 result = matchingValues[0];
154 } 152 }
155 153
156 return result; 154 return result;
157 }, 155 },
158 156
159 //----------------------------------------------------------------------------- 157 //-----------------------------------------------------------------------------
160 158
161 'originalBindings': function () { 159 'originalBindings': function () {
162 return this._originalBindings; 160 return this._originalBindings;
163 }, 161 },
164 162
165 'setOriginalBindings': function (aValue) { 163 'setOriginalBindings': function (aValue) {
166//console.log("BINDINGS", aValue);
167 this._originalBindings = aValue; 164 this._originalBindings = aValue;
168 }, 165 },
169 166
170 //============================================================================= 167 //=============================================================================
171 168
172 'rulerComponent': function () { 169 'rulerComponent': function () {
173 if (this._rulerComponent == null) { 170 if (this._rulerComponent == null) {
174 this._rulerComponent = new Clipperz.PM.UI.Web.Components.RulerComponent({ 171 this._rulerComponent = new Clipperz.PM.UI.Web.Components.RulerComponent({
175 translationContext:'Wizards.DirectLoginWizard' 172 translationContext:'Wizards.DirectLoginWizard'
176 }); 173 });
177 this._rulerComponent.render(); 174 this._rulerComponent.render();
178 175
179 MochiKit.Signal.connect(this._rulerComponent, 'exit', this, 'handleExit'); 176 MochiKit.Signal.connect(this._rulerComponent, 'exit', this, 'handleExit');
180 MochiKit.Signal.connect(this._rulerComponent, 'done', this, 'done'); 177 MochiKit.Signal.connect(this._rulerComponent, 'done', this, 'done');
181 MochiKit.Signal.connect(this._rulerComponent, 'moveForward',this, 'handleMoveForward'); 178 MochiKit.Signal.connect(this._rulerComponent, 'moveForward',this, 'handleMoveForward');
182 MochiKit.Signal.connect(this._rulerComponent, 'moveBackward',this, 'handleMoveBackward'); 179 MochiKit.Signal.connect(this._rulerComponent, 'moveBackward',this, 'handleMoveBackward');
183 MochiKit.Signal.connect(this._rulerComponent, 'cursorMoved',this, 'handleCursorMoved'); 180 MochiKit.Signal.connect(this._rulerComponent, 'cursorMoved',this, 'handleCursorMoved');
184 } 181 }
185 182
186 return this._rulerComponent; 183 return this._rulerComponent;
187 }, 184 },
188 185
189 //----------------------------------------------------------------------------- 186 //-----------------------------------------------------------------------------
190 187
191 'showRuler': function (someSteps) { 188 'showRuler': function (someSteps) {
192 var rulerElement; 189 var rulerElement;
193 190
194 this.setSteps(someSteps); 191 this.setSteps(someSteps);
195 192
196 rulerElement = this.rulerComponent().element(); 193 rulerElement = this.rulerComponent().element();
197 this.directLoginEditingComponent().disableAllPanels(); 194 this.directLoginEditingComponent().disableAllPanels();
198 195
199 MochiKit.Style.showElement(rulerElement); 196 MochiKit.Style.showElement(rulerElement);
200 MochiKit.Style.setElementPosition(rulerElement, {x:-1000, y:this.directLoginEditingComponent().bottomMargin()}); 197 MochiKit.Style.setElementPosition(rulerElement, {x:-1000, y:this.directLoginEditingComponent().bottomMargin()});
201 new MochiKit.Visual.Move(rulerElement, { 198 new MochiKit.Visual.Move(rulerElement, {
202 x:0, y:this.directLoginEditingComponent().bottomMargin(), 199 x:0, y:this.directLoginEditingComponent().bottomMargin(),
203 mode:'absolute', 200 mode:'absolute',
204 duration:1, 201 duration:1,
205 afterFinish:MochiKit.Base.method(this, 'handleCursorMoved') 202 afterFinish:MochiKit.Base.method(this, 'handleCursorMoved')
206 }); 203 });
207 }, 204 },
208 205
209 'fixRulerRendering': function (aValue) { 206 'fixRulerRendering': function (aValue) {
210 this.rulerComponent().setDisplayMode(aValue); 207 this.rulerComponent().setDisplayMode(aValue);
211 }, 208 },
212 209
213 //----------------------------------------------------------------------------- 210 //-----------------------------------------------------------------------------
214 211
215 'hideRuler': function () { 212 'hideRuler': function () {
216 new MochiKit.Visual.Move(this.rulerComponent().element(), {x:-1000, mode:'relative', duration:1}); 213 new MochiKit.Visual.Move(this.rulerComponent().element(), {x:-1000, mode:'relative', duration:1});
217 }, 214 },
218 215
219 'doneWithRuler': function () { 216 'doneWithRuler': function () {
220 var rulerComponentElement; 217 var rulerComponentElement;
221 218
222 rulerComponentElement = this.rulerComponent().element(); 219 rulerComponentElement = this.rulerComponent().element();
223 new MochiKit.Visual.Move(this.rulerComponent().element(), { 220 new MochiKit.Visual.Move(this.rulerComponent().element(), {
224 x:1000, 221 x:1000,
225 mode:'relative', 222 mode:'relative',
226 duration:1, 223 duration:1,
227 // afterFinish:MochiKit.Base.partial(MochiKit.Style.hideElement, rulerComponentElement) 224 // afterFinish:MochiKit.Base.partial(MochiKit.Style.hideElement, rulerComponentElement)
228 afterFinish:function () { MochiKit.Style.hideElement(rulerComponentElement); } 225 afterFinish:function () { MochiKit.Style.hideElement(rulerComponentElement); }
229 }); 226 });
230 }, 227 },
231 228
232 //============================================================================= 229 //=============================================================================
233 230
234 'addNewDirectLoginRulerSteps': function () { 231 'addNewDirectLoginRulerSteps': function () {
235 return MochiKit.Base.concat([ 'LABEL'], this.editDirectLoginRulerSteps()); 232 return MochiKit.Base.concat([ 'LABEL'], this.editDirectLoginRulerSteps());
236 233
237 }, 234 },
238 235
239 'editDirectLoginRulerSteps': function () { 236 'editDirectLoginRulerSteps': function () {
240 return [ /*'TYPE',*/ 'CONFIGURATION', 'BINDINGS','FAVICON', 'DONE']; 237 return [ /*'TYPE',*/ 'CONFIGURATION', 'BINDINGS','FAVICON', 'DONE'];
241 }, 238 },
242 239
243 //------------------------------------------------------------------------- 240 //-------------------------------------------------------------------------
244 241
245 'runWithDirectLogin': function (aDirectLogin, hasJustBeenAdded) { 242 'runWithDirectLogin': function (aDirectLogin, hasJustBeenAdded) {
246 this._directLogin = aDirectLogin; 243 this._directLogin = aDirectLogin;
247 this.setDirectLoginHasJustBeenAdded(hasJustBeenAdded); 244 this.setDirectLoginHasJustBeenAdded(hasJustBeenAdded);
248 245
249 return Clipperz.Async.callbacks("DirectLoginWizardController.runWithDirectLogin", [ 246 return Clipperz.Async.callbacks("DirectLoginWizardController.runWithDirectLogin", [
250 MochiKit.Base.method(aDirectLogin, 'label'), 247 MochiKit.Base.method(aDirectLogin, 'label'),
251 MochiKit.Base.method(this.directLoginEditingComponent(), 'setLabel'), 248 MochiKit.Base.method(this.directLoginEditingComponent(), 'setLabel'),
252 249
253 MochiKit.Base.method(aDirectLogin, 'favicon'), 250 MochiKit.Base.method(aDirectLogin, 'favicon'),
254 MochiKit.Base.method(this.directLoginEditingComponent(), 'setDirectLoginFavicon'), 251 MochiKit.Base.method(this.directLoginEditingComponent(), 'setDirectLoginFavicon'),
255 252
256 MochiKit.Base.method(aDirectLogin, 'bookmarkletConfiguration'), 253 MochiKit.Base.method(aDirectLogin, 'bookmarkletConfiguration'),
257 MochiKit.Base.method(this.directLoginEditingComponent(), 'setBookmarkletConfiguration'), 254 MochiKit.Base.method(this.directLoginEditingComponent(), 'setBookmarkletConfiguration'),
258 255
259 MochiKit.Base.method(aDirectLogin, 'bindings'), 256 MochiKit.Base.method(aDirectLogin, 'bindings'),
260 MochiKit.Base.method(this, 'setOriginalBindings'), 257 MochiKit.Base.method(this, 'setOriginalBindings'),
261 258
262 MochiKit.Base.method(aDirectLogin, 'record'), 259 MochiKit.Base.method(aDirectLogin, 'record'),
@@ -314,194 +311,192 @@ MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.DirectLoginWizardController.
314 if (enableNext == true) { 311 if (enableNext == true) {
315 try { 312 try {
316 Clipperz.PM.DataModel.DirectLogin.checkBookmarkletConfiguration(this.directLoginEditingComponent().bookmarkletConfiguration()); 313 Clipperz.PM.DataModel.DirectLogin.checkBookmarkletConfiguration(this.directLoginEditingComponent().bookmarkletConfiguration());
317 this.directLoginEditingComponent().removeHighlightConfigurationSyntaxError(); 314 this.directLoginEditingComponent().removeHighlightConfigurationSyntaxError();
318 } catch (e) { 315 } catch (e) {
319 this.directLoginEditingComponent().highlightConfigurationSyntaxError(); 316 this.directLoginEditingComponent().highlightConfigurationSyntaxError();
320 enableNext = false; 317 enableNext = false;
321 } 318 }
322 } 319 }
323 break; 320 break;
324 case 'BINDINGS': 321 case 'BINDINGS':
325 enableNext = MochiKit.Iter.every(this.bindingComponents(), function (aBindingComponent) { return aBindingComponent.selectedValue() != null; }) 322 enableNext = MochiKit.Iter.every(this.bindingComponents(), function (aBindingComponent) { return aBindingComponent.selectedValue() != null; })
326 this.directLoginEditingComponent().enableBindingFields(); 323 this.directLoginEditingComponent().enableBindingFields();
327 break; 324 break;
328 case 'FAVICON': 325 case 'FAVICON':
329 enableNext = true; 326 enableNext = true;
330 this.directLoginEditingComponent().enableFaviconField(); 327 this.directLoginEditingComponent().enableFaviconField();
331 break; 328 break;
332 case 'DONE': 329 case 'DONE':
333 enableNext = true; 330 enableNext = true;
334 this.directLoginEditingComponent().enableDonePanel(); 331 this.directLoginEditingComponent().enableDonePanel();
335 break; 332 break;
336 } 333 }
337 334
338 if (this.currentStepIndex() > 0) { 335 if (this.currentStepIndex() > 0) {
339 this.enablePrevious(enablePrevious); 336 this.enablePrevious(enablePrevious);
340 } else { 337 } else {
341 this.enablePrevious(false); 338 this.enablePrevious(false);
342 } 339 }
343 this.enableNext(enableNext); 340 this.enableNext(enableNext);
344 }, 341 },
345 342
346 //----------------------------------------------------------------------------- 343 //-----------------------------------------------------------------------------
347 344
348 'setFocus': function () { 345 'setFocus': function () {
349 switch(this.currentStep()) { 346 switch(this.currentStep()) {
350 case 'LABEL': 347 case 'LABEL':
351 this.directLoginEditingComponent().focusOnLabelElement(); 348 this.directLoginEditingComponent().focusOnLabelElement();
352 break; 349 break;
353 case 'TYPE': 350 case 'TYPE':
354 break; 351 break;
355 case 'CONFIGURATION': 352 case 'CONFIGURATION':
356 this.directLoginEditingComponent().focusOnBookmarkletConfigurationElement(); 353 this.directLoginEditingComponent().focusOnBookmarkletConfigurationElement();
357 break; 354 break;
358 case 'BINDINGS': 355 case 'BINDINGS':
359 // this.directLoginEditingComponent().getElement('???').focus(); 356 // this.directLoginEditingComponent().getElement('???').focus();
360 break; 357 break;
361 case 'FAVICON': 358 case 'FAVICON':
362 this.directLoginEditingComponent().focusOnFaviconElement(); 359 this.directLoginEditingComponent().focusOnFaviconElement();
363 break; 360 break;
364 case 'DONE': 361 case 'DONE':
365 break; 362 break;
366 } 363 }
367 }, 364 },
368 365
369 //============================================================================= 366 //=============================================================================
370 367
371 'steps': function () { 368 'steps': function () {
372 return this._steps; 369 return this._steps;
373 }, 370 },
374 371
375 'setSteps': function (aValue) { 372 'setSteps': function (aValue) {
376 this._steps = aValue; 373 this._steps = aValue;
377 374
378 this.rulerComponent().setSteps(aValue); 375 this.rulerComponent().setSteps(aValue);
379 this.resetCurrentStepIndex(); 376 this.resetCurrentStepIndex();
380 }, 377 },
381 378
382 'currentStepIndex': function () { 379 'currentStepIndex': function () {
383 return this._currentStepIndex; 380 return this._currentStepIndex;
384 }, 381 },
385 382
386 'currentStep': function () { 383 'currentStep': function () {
387 return this.steps()[this.currentStepIndex()]; 384 return this.steps()[this.currentStepIndex()];
388 }, 385 },
389 386
390 //============================================================================= 387 //=============================================================================
391 388
392 'handleExit': function () { 389 'handleExit': function () {
393 MochiKit.Signal.signal(this, 'exit'); 390 MochiKit.Signal.signal(this, 'exit');
394 }, 391 },
395 392
396 'done': function () { 393 'done': function () {
397 this.doneWithRuler(); 394 this.doneWithRuler();
398 395
399 Clipperz.Async.callbacks("DirectLoginWizardController.done", [ 396 Clipperz.Async.callbacks("DirectLoginWizardController.done", [
400 MochiKit.Base.method(this.directLoginEditingComponent(), 'label'), 397 MochiKit.Base.method(this.directLoginEditingComponent(), 'label'),
401 MochiKit.Base.method(this.directLogin(), 'setLabel'), 398 MochiKit.Base.method(this.directLogin(), 'setLabel'),
402 399
403 MochiKit.Base.method(this.directLoginEditingComponent(), 'bookmarkletConfiguration'), 400 MochiKit.Base.method(this.directLoginEditingComponent(), 'bookmarkletConfiguration'),
404 MochiKit.Base.method(this.directLogin(), 'setBookmarkletConfiguration'), 401 MochiKit.Base.method(this.directLogin(), 'setBookmarkletConfiguration'),
405 402
406 //Bindings 403 //Bindings
407 MochiKit.Base.method(this.directLoginEditingComponent(), 'bindingComponents'), 404 MochiKit.Base.method(this.directLoginEditingComponent(), 'bindingComponents'),
408 // MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.bind(function (aBindingComponent) { 405 // MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.bind(function (aBindingComponent) {
409 Clipperz.Async.forEach(MochiKit.Base.bind(function (aBindingComponent) { 406 Clipperz.Async.forEach(MochiKit.Base.bind(function (aBindingComponent) {
410//console.log("aBindingComponent", aBindingComponent);
411 // this.directLogin().
412 return Clipperz.Async.callbacks("DirectLoginWizardController.done - update directLogin bindings", [ 407 return Clipperz.Async.callbacks("DirectLoginWizardController.done - update directLogin bindings", [
413 MochiKit.Base.method(this.directLogin(), 'bindings'), 408 MochiKit.Base.method(this.directLogin(), 'bindings'),
414 MochiKit.Base.itemgetter(aBindingComponent.formFieldName()), 409 MochiKit.Base.itemgetter(aBindingComponent.formFieldName()),
415 MochiKit.Base.methodcaller('setFieldKey', aBindingComponent.selectedValue()) 410 MochiKit.Base.methodcaller('setFieldKey', aBindingComponent.selectedValue())
416 ], {trace:false}); 411 ], {trace:false});
417 }, this)), 412 }, this)),
418 413
419 MochiKit.Base.method(this.directLoginEditingComponent(), 'favicon'), 414 MochiKit.Base.method(this.directLoginEditingComponent(), 'favicon'),
420 MochiKit.Base.method(this.directLogin(), 'setFavicon'), 415 MochiKit.Base.method(this.directLogin(), 'setFavicon'),
421 416
422 MochiKit.Base.partial(MochiKit.Signal.signal, this, 'done', { 417 MochiKit.Base.partial(MochiKit.Signal.signal, this, 'done', {
423 'directLogin': this.directLogin(), 418 'directLogin': this.directLogin(),
424 'hasJustBeenAdded':this.directLoginHasJustBeenAdded() 419 'hasJustBeenAdded':this.directLoginHasJustBeenAdded()
425 }) 420 })
426 ], {trace:false}); 421 ], {trace:false});
427 }, 422 },
428 423
429 //============================================================================= 424 //=============================================================================
430 425
431 'handleMoveBackward': function () { 426 'handleMoveBackward': function () {
432 if (this._currentStepIndex > 0) { 427 if (this._currentStepIndex > 0) {
433 varafterMoveAction; 428 varafterMoveAction;
434 429
435 this._currentStepIndex --; 430 this._currentStepIndex --;
436 afterMoveAction = MochiKit.Base.noop; 431 afterMoveAction = MochiKit.Base.noop;
437 432
438 switch(this.currentStep()) { 433 switch(this.currentStep()) {
439 case 'LABEL': 434 case 'LABEL':
440 break; 435 break;
441 case 'TYPE': 436 case 'TYPE':
442 break; 437 break;
443 case 'CONFIGURATION': 438 case 'CONFIGURATION':
444 break; 439 break;
445 case 'BINDINGS': 440 case 'BINDINGS':
446 break; 441 break;
447 case 'FAVICON': 442 case 'FAVICON':
448 break; 443 break;
449 case 'DONE': 444 case 'DONE':
450 break; 445 break;
451 }; 446 };
452 447
453 this.rulerComponent().moveBackward(afterMoveAction); 448 this.rulerComponent().moveBackward(afterMoveAction);
454 } 449 }
455 450
456 if (this._currentStepIndex == 0) { 451 if (this._currentStepIndex == 0) {
457 this.enablePrevious(false); 452 this.enablePrevious(false);
458 } 453 }
459 }, 454 },
460 455
461 'handleMoveForward': function () { 456 'handleMoveForward': function () {
462 if (this.isNextEnabled()) { 457 if (this.isNextEnabled()) {
463 varafterMoveAction; 458 varafterMoveAction;
464 459
465 this._currentStepIndex ++; 460 this._currentStepIndex ++;
466 afterMoveAction = MochiKit.Base.noop; 461 afterMoveAction = MochiKit.Base.noop;
467 462
468 switch(this.currentStep()) { 463 switch(this.currentStep()) {
469 case 'LABEL': 464 case 'LABEL':
470 break; 465 break;
471 case 'TYPE': 466 case 'TYPE':
472 break; 467 break;
473 case 'CONFIGURATION': 468 case 'CONFIGURATION':
474 break; 469 break;
475 case 'BINDINGS': 470 case 'BINDINGS':
476 this.resetBindingComponents(); 471 this.resetBindingComponents();
477 this.resetFormValueComponents(); 472 this.resetFormValueComponents();
478 473
479 afterMoveAction = MochiKit.Base.partial(Clipperz.Async.callbacks, "DirectLoginWizardController.handleMoveForward - BINDINGS", [ 474 afterMoveAction = MochiKit.Base.partial(Clipperz.Async.callbacks, "DirectLoginWizardController.handleMoveForward - BINDINGS", [
480 MochiKit.Base.method(this.directLogin(), 'setBookmarkletConfiguration', this.directLoginEditingComponent().bookmarkletConfiguration()), 475 MochiKit.Base.method(this.directLogin(), 'setBookmarkletConfiguration', this.directLoginEditingComponent().bookmarkletConfiguration()),
481 476
482 MochiKit.Base.method(this.directLogin(), 'favicon'), 477 MochiKit.Base.method(this.directLogin(), 'favicon'),
483 MochiKit.Base.method(this.directLoginEditingComponent(), 'setDirectLoginFavicon'), 478 MochiKit.Base.method(this.directLoginEditingComponent(), 'setDirectLoginFavicon'),
484 479
485 MochiKit.Base.method(this.directLogin(), 'bindings'), 480 MochiKit.Base.method(this.directLogin(), 'bindings'),
486 MochiKit.Base.values, 481 MochiKit.Base.values,
487 Clipperz.Async.forEach(MochiKit.Base.bind(function (aBinding) { 482 Clipperz.Async.forEach(MochiKit.Base.bind(function (aBinding) {
488 var bindingComponent; 483 var bindingComponent;
489 484
490 bindingComponent = new Clipperz.PM.UI.Web.Components.DirectLoginEditingBindingComponent({ 485 bindingComponent = new Clipperz.PM.UI.Web.Components.DirectLoginEditingBindingComponent({
491 formFieldName: aBinding.key(), 486 formFieldName: aBinding.key(),
492 fields: this.recordFields(), 487 fields: this.recordFields(),
493 selectedFieldKey: aBinding.fieldKey() 488 selectedFieldKey: aBinding.fieldKey()
494 }); 489 });
495 490
496 this.bindingComponents().push(bindingComponent); 491 this.bindingComponents().push(bindingComponent);
497 492
498 MochiKit.Signal.connect(bindingComponent, 'bindChange', this, 'handleBindChange', bindingComponent); 493 MochiKit.Signal.connect(bindingComponent, 'bindChange', this, 'handleBindChange', bindingComponent);
499 this.directLoginEditingComponent().addBindingComponent(bindingComponent); 494 this.directLoginEditingComponent().addBindingComponent(bindingComponent);
500 495
501 }, this)), 496 }, this)),
502 497
503 MochiKit.Base.method(this.directLogin(), 'formValues'), 498 MochiKit.Base.method(this.directLogin(), 'formValues'),
504 MochiKit.Base.values, 499 MochiKit.Base.values,
505 Clipperz.Async.forEach(MochiKit.Base.bind(function (aFormValue) { 500 Clipperz.Async.forEach(MochiKit.Base.bind(function (aFormValue) {
506 var formValueComponent; 501 var formValueComponent;
507 502
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/DirectLoginsController.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/DirectLoginsController.js
index 6ca3be4..7ab512a 100644
--- a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/DirectLoginsController.js
+++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/DirectLoginsController.js
@@ -1,118 +1,116 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2013 Clipperz Srl
4 4
5This file is part of Clipperz Community Edition. 5This file is part of Clipperz, the online password manager.
6Clipperz Community Edition is an online password manager.
7For further information about its features and functionalities please 6For further information about its features and functionalities please
8refer to http://www.clipperz.com. 7refer to http://www.clipperz.com.
9 8
10* Clipperz Community Edition is free software: you can redistribute 9* Clipperz is free software: you can redistribute it and/or modify it
11 it and/or modify it under the terms of the GNU Affero General Public 10 under the terms of the GNU Affero General Public License as published
12 License as published by the Free Software Foundation, either version 11 by the Free Software Foundation, either version 3 of the License, or
13 3 of the License, or (at your option) any later version. 12 (at your option) any later version.
14 13
15* Clipperz Community Edition is distributed in the hope that it will 14* Clipperz is distributed in the hope that it will be useful, but
16 be useful, but WITHOUT ANY WARRANTY; without even the implied 15 WITHOUT ANY WARRANTY; without even the implied warranty of
17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU Affero General Public License for more details. 17 See the GNU Affero General Public License for more details.
19 18
20* You should have received a copy of the GNU Affero General Public 19* You should have received a copy of the GNU Affero General Public
21 License along with Clipperz Community Edition. If not, see 20 License along with Clipperz. If not, see http://www.gnu.org/licenses/.
22 <http://www.gnu.org/licenses/>.
23 21
24*/ 22*/
25 23
26/* 24/*
27Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers'); 25Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers');
28 26
29Clipperz.PM.UI.Web.Controllers.DirectLoginsController = function() { 27Clipperz.PM.UI.Web.Controllers.DirectLoginsController = function() {
30 Clipperz.PM.UI.Web.Controllers.DirectLoginsController.superclass.constructor.apply(this, arguments); 28 Clipperz.PM.UI.Web.Controllers.DirectLoginsController.superclass.constructor.apply(this, arguments);
31 29
32 return this; 30 return this;
33}; 31};
34 32
35Clipperz.Base.extend(Clipperz.PM.UI.Web.Controllers.DirectLoginsController, Clipperz.PM.UI.Web.Controllers.GridController, { 33Clipperz.Base.extend(Clipperz.PM.UI.Web.Controllers.DirectLoginsController, Clipperz.PM.UI.Web.Controllers.GridController, {
36 34
37 'createGrid': function () { 35 'createGrid': function () {
38 return new Clipperz.PM.UI.Web.Components.GridComponent({columnsManagers: [ 36 return new Clipperz.PM.UI.Web.Components.GridComponent({columnsManagers: [
39 new Clipperz.PM.UI.Web.Components.FaviconColumnManager({ 37 new Clipperz.PM.UI.Web.Components.FaviconColumnManager({
40 'name': 'DirectLogins.favicon', 38 'name': 'DirectLogins.favicon',
41 'selector': MochiKit.Base.methodcaller('favicon'), 39 'selector': MochiKit.Base.methodcaller('favicon'),
42 'cssClass': 'favicon' 40 'cssClass': 'favicon'
43 }), 41 }),
44 // new Clipperz.PM.UI.Web.Components.LinkColumnManager({ 42 // new Clipperz.PM.UI.Web.Components.LinkColumnManager({
45 new Clipperz.PM.UI.Web.Components.DirectLoginColumnManager({ 43 new Clipperz.PM.UI.Web.Components.DirectLoginColumnManager({
46 'name': 'DirectLogins.title', 44 'name': 'DirectLogins.title',
47 'selector': MochiKit.Base.methodcaller('label'), 45 'selector': MochiKit.Base.methodcaller('label'),
48 'label': 'title', 46 'label': 'title',
49 'cssClass': 'title', 47 'cssClass': 'title',
50 'comparator': Clipperz.Base.caseInsensitiveCompare, 48 'comparator': Clipperz.Base.caseInsensitiveCompare,
51 'sortable': true, 49 'sortable': true,
52 'sorted': 'ASCENDING', 50 'sorted': 'ASCENDING',
53 'actionMethod': MochiKit.Base.methodcaller('runDirectLogin') 51 'actionMethod': MochiKit.Base.methodcaller('runDirectLogin')
54 }), 52 }),
55 // new Clipperz.PM.UI.Web.Components.TextColumnManager({ //should be StrengthColumnManager 53 // new Clipperz.PM.UI.Web.Components.TextColumnManager({ //should be StrengthColumnManager
56 // 'label':'strength', 54 // 'label':'strength',
57 // 'cssClass':'title', 55 // 'cssClass':'title',
58 // 'selector': MochiKit.Base.methodcaller('label') //should be 'strength' or a strenght evaluation function 56 // 'selector': MochiKit.Base.methodcaller('label') //should be 'strength' or a strenght evaluation function
59 // }), 57 // }),
60 new Clipperz.PM.UI.Web.Components.LinkColumnManager({ 58 new Clipperz.PM.UI.Web.Components.LinkColumnManager({
61 'name': 'DirectLogins.cardTitle', 59 'name': 'DirectLogins.cardTitle',
62 'selector': MochiKit.Base.compose(MochiKit.Base.methodcaller('label'), MochiKit.Base.methodcaller('record')), 60 'selector': MochiKit.Base.compose(MochiKit.Base.methodcaller('label'), MochiKit.Base.methodcaller('record')),
63 'label': 'card', 61 'label': 'card',
64 'cssClass': 'cardTitle', 62 'cssClass': 'cardTitle',
65 'comparator': Clipperz.Base.caseInsensitiveCompare, 63 'comparator': Clipperz.Base.caseInsensitiveCompare,
66 'sortable': true, 64 'sortable': true,
67 'sorted': 'UNSORTED', 65 'sorted': 'UNSORTED',
68 'actionMethod': MochiKit.Base.method(this, 'handleShowCard') 66 'actionMethod': MochiKit.Base.method(this, 'handleShowCard')
69 }), 67 }),
70 // new Clipperz.PM.UI.Web.Components.TextColumnManager({ //should be StrengthColumnManager 68 // new Clipperz.PM.UI.Web.Components.TextColumnManager({ //should be StrengthColumnManager
71 // 'label':'last access', 69 // 'label':'last access',
72 // 'cssClass':'title', 70 // 'cssClass':'title',
73 // 'selector': MochiKit.Base.methodcaller('label') 71 // 'selector': MochiKit.Base.methodcaller('label')
74 // // 'sortable': true, 72 // // 'sortable': true,
75 // // 'sorted': 'UNSORTED' 73 // // 'sorted': 'UNSORTED'
76 // }), 74 // }),
77 // new Clipperz.PM.UI.Web.Components.TextColumnManager({ 75 // new Clipperz.PM.UI.Web.Components.TextColumnManager({
78 // 'label':'commands', 76 // 'label':'commands',
79 // 'cssClass':'title', 77 // 'cssClass':'title',
80 // 'selector': MochiKit.Base.methodcaller('label'), //should be a function for commands display 78 // 'selector': MochiKit.Base.methodcaller('label'), //should be a function for commands display
81 // }), 79 // }),
82 new Clipperz.PM.UI.Web.Components.DeleteObjectColumnManager({ 80 new Clipperz.PM.UI.Web.Components.DeleteObjectColumnManager({
83 'name': 'DirectLogins.delete', 81 'name': 'DirectLogins.delete',
84 'selector': MochiKit.Base.noop, 82 'selector': MochiKit.Base.noop,
85 'cssClass': 'delete', 83 'cssClass': 'delete',
86 // 'actionMethod': function(anObject, anEvent) { MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'deleteDirectLogin', {objectData:anObject, element:anEvent.src()})} 84 // 'actionMethod': function(anObject, anEvent) { MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'deleteDirectLogin', {objectData:anObject, element:anEvent.src()})}
87 'actionMethod': MochiKit.Base.method(this, 'handleDeleteDirectLogin') 85 'actionMethod': MochiKit.Base.method(this, 'handleDeleteDirectLogin')
88 }) 86 })
89 ]}); 87 ]});
90 88
91 }, 89 },
92 90
93 //----------------------------------------------------------------------------- 91 //-----------------------------------------------------------------------------
94 92
95 'getRows': function () { 93 'getRows': function () {
96 //TODO: relying on user() in GridController, bad code smell :| 94 //TODO: relying on user() in GridController, bad code smell :|
97 return this.user().getDirectLogins(); 95 return this.user().getDirectLogins();
98 }, 96 },
99 97
100 //----------------------------------------------------------------------------- 98 //-----------------------------------------------------------------------------
101 99
102 'handleShowCard': function (anObject, anEvent) { 100 'handleShowCard': function (anObject, anEvent) {
103 var cardDialogController; 101 var cardDialogController;
104 102
105 cardDialogController = new Clipperz.PM.UI.Web.Controllers.CardDialogController({record:anObject.record()}) 103 cardDialogController = new Clipperz.PM.UI.Web.Controllers.CardDialogController({record:anObject.record()})
106 cardDialogController.run(anEvent.src()); 104 cardDialogController.run(anEvent.src());
107 }, 105 },
108 106
109 //----------------------------------------------------------------------------- 107 //-----------------------------------------------------------------------------
110 108
111 'handleDeleteDirectLogin': function (anObject, anEvent) { 109 'handleDeleteDirectLogin': function (anObject, anEvent) {
112 var deferredResult; 110 var deferredResult;
113 var confirmationDialog; 111 var confirmationDialog;
114 112
115 confirmationDialog = new Clipperz.PM.UI.Common.Components.SimpleMessagePanel({ 113 confirmationDialog = new Clipperz.PM.UI.Common.Components.SimpleMessagePanel({
116 title:"Delete DirectLogin", 114 title:"Delete DirectLogin",
117 text:"Do you want to delete …", 115 text:"Do you want to delete …",
118 type:'ALERT', 116 type:'ALERT',
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/FilterController.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/FilterController.js
index bfc093a..de59ec3 100644
--- a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/FilterController.js
+++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/FilterController.js
@@ -1,118 +1,116 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2013 Clipperz Srl
4 4
5This file is part of Clipperz Community Edition. 5This file is part of Clipperz, the online password manager.
6Clipperz Community Edition is an online password manager.
7For further information about its features and functionalities please 6For further information about its features and functionalities please
8refer to http://www.clipperz.com. 7refer to http://www.clipperz.com.
9 8
10* Clipperz Community Edition is free software: you can redistribute 9* Clipperz is free software: you can redistribute it and/or modify it
11 it and/or modify it under the terms of the GNU Affero General Public 10 under the terms of the GNU Affero General Public License as published
12 License as published by the Free Software Foundation, either version 11 by the Free Software Foundation, either version 3 of the License, or
13 3 of the License, or (at your option) any later version. 12 (at your option) any later version.
14 13
15* Clipperz Community Edition is distributed in the hope that it will 14* Clipperz is distributed in the hope that it will be useful, but
16 be useful, but WITHOUT ANY WARRANTY; without even the implied 15 WITHOUT ANY WARRANTY; without even the implied warranty of
17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU Affero General Public License for more details. 17 See the GNU Affero General Public License for more details.
19 18
20* You should have received a copy of the GNU Affero General Public 19* You should have received a copy of the GNU Affero General Public
21 License along with Clipperz Community Edition. If not, see 20 License along with Clipperz. If not, see http://www.gnu.org/licenses/.
22 <http://www.gnu.org/licenses/>.
23 21
24*/ 22*/
25 23
26Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers'); 24Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers');
27 25
28Clipperz.PM.UI.Web.Controllers.FilterController = function(args) { 26Clipperz.PM.UI.Web.Controllers.FilterController = function(args) {
29 args = args || {}; 27 args = args || {};
30 28
31 Clipperz.PM.UI.Web.Controllers.FilterController.superclass.constructor.call(this, args); 29 Clipperz.PM.UI.Web.Controllers.FilterController.superclass.constructor.call(this, args);
32 30
33 this._filterElements = []; 31 this._filterElements = [];
34 this._filter = ""; 32 this._filter = "";
35 33
36 this._pendingSearchClicks = 0; 34 this._pendingSearchClicks = 0;
37 35
38 return this; 36 return this;
39}; 37};
40 38
41 39
42Clipperz.Base.extend(Clipperz.PM.UI.Web.Controllers.FilterController, Object, { 40Clipperz.Base.extend(Clipperz.PM.UI.Web.Controllers.FilterController, Object, {
43 41
44 //----------------------------------------------------------------------------- 42 //-----------------------------------------------------------------------------
45 43
46 'getFilter': function () { 44 'getFilter': function () {
47 return this._filter; 45 return this._filter;
48 }, 46 },
49 47
50 '_setFilter': function (aFilterElement, aFilter) { 48 '_setFilter': function (aFilterElement, aFilter) {
51 if (aFilter != this._filter) { 49 if (aFilter != this._filter) {
52 this._filter = aFilter; 50 this._filter = aFilter;
53 MochiKit.Signal.signal(this, 'filterUpdated', aFilter); 51 MochiKit.Signal.signal(this, 'filterUpdated', aFilter);
54 this.updateFilterElements(aFilterElement, aFilter); 52 this.updateFilterElements(aFilterElement, aFilter);
55 } 53 }
56 }, 54 },
57 55
58 'setFilter': function (aFilter) { 56 'setFilter': function (aFilter) {
59 this._setFilter(null, aFilter); 57 this._setFilter(null, aFilter);
60 }, 58 },
61 59
62 //----------------------------------------------------------------------------- 60 //-----------------------------------------------------------------------------
63 61
64 'filterElements': function () { 62 'filterElements': function () {
65 return this._filterElements; 63 return this._filterElements;
66 }, 64 },
67 65
68 'registerFilterElement': function (aFilterElement) { 66 'registerFilterElement': function (aFilterElement) {
69//Clipperz.log("=== FilterController.registerFilterElement", aFilterElement); 67//Clipperz.log("=== FilterController.registerFilterElement", aFilterElement);
70 this._filterElements.push(aFilterElement); 68 this._filterElements.push(aFilterElement);
71 MochiKit.Signal.connect(aFilterElement, 'onkeydown', this, 'searchClickHandler'); 69 MochiKit.Signal.connect(aFilterElement, 'onkeydown', this, 'searchClickHandler');
72 MochiKit.Signal.connect(aFilterElement, 'onfocus', this, 'searchClickHandler'); 70 MochiKit.Signal.connect(aFilterElement, 'onfocus', this, 'searchClickHandler');
73 }, 71 },
74 72
75 'removeFilterElement': function (aFilterElement) { 73 'removeFilterElement': function (aFilterElement) {
76 var i; 74 var i;
77 var filterElements; 75 var filterElements;
78 for (i=0; i < filterElements; i++) { 76 for (i=0; i < filterElements; i++) {
79 if (filterElements[i] == aFilterElement); 77 if (filterElements[i] == aFilterElement);
80 filterElements.splice(i, 1); 78 filterElements.splice(i, 1);
81 // TODO unregister/disconnect filterElement ??MochiKit.Signal.disconnect(this.grid().filterElement(), 'updateFilter', this.filterController(), 'handleUpdateFilter'); 79 // TODO unregister/disconnect filterElement ??MochiKit.Signal.disconnect(this.grid().filterElement(), 'updateFilter', this.filterController(), 'handleUpdateFilter');
82 } 80 }
83 }, 81 },
84 82
85 'updateFilterElements': function (aSourceElement, aFilterString) { 83 'updateFilterElements': function (aSourceElement, aFilterString) {
86 MochiKit.Iter.forEach(this.filterElements(), 84 MochiKit.Iter.forEach(this.filterElements(),
87 function (aFilterElement) { 85 function (aFilterElement) {
88 if (aFilterElement != aSourceElement) { 86 if (aFilterElement != aSourceElement) {
89 aFilterElement.value = aFilterString; 87 aFilterElement.value = aFilterString;
90 } 88 }
91 } 89 }
92 ); 90 );
93 91
94 if (aSourceElement != null) { 92 if (aSourceElement != null) {
95 aSourceElement.focus(); 93 aSourceElement.focus();
96 } 94 }
97 }, 95 },
98 96
99 //----------------------------------------------------------------------------- 97 //-----------------------------------------------------------------------------
100 98
101 'run': function () { 99 'run': function () {
102//Clipperz.log("=== FilterController.run"); 100//Clipperz.log("=== FilterController.run");
103 }, 101 },
104 102
105 //----------------------------------------------------------------------------- 103 //-----------------------------------------------------------------------------
106 104
107 'pendingSearchClicks': function () { 105 'pendingSearchClicks': function () {
108 return this._pendingSearchClicks; 106 return this._pendingSearchClicks;
109 }, 107 },
110 108
111 'incrementPendingSearchClicks': function () { 109 'incrementPendingSearchClicks': function () {
112 this._pendingSearchClicks++; 110 this._pendingSearchClicks++;
113 }, 111 },
114 112
115 'decrementPendingSearchClicks': function () { 113 'decrementPendingSearchClicks': function () {
116 this._pendingSearchClicks--; 114 this._pendingSearchClicks--;
117 }, 115 },
118 116
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/GridController.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/GridController.js
index 8bb3016..44fbdef 100644
--- a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/GridController.js
+++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/GridController.js
@@ -1,118 +1,116 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2013 Clipperz Srl
4 4
5This file is part of Clipperz Community Edition. 5This file is part of Clipperz, the online password manager.
6Clipperz Community Edition is an online password manager.
7For further information about its features and functionalities please 6For further information about its features and functionalities please
8refer to http://www.clipperz.com. 7refer to http://www.clipperz.com.
9 8
10* Clipperz Community Edition is free software: you can redistribute 9* Clipperz is free software: you can redistribute it and/or modify it
11 it and/or modify it under the terms of the GNU Affero General Public 10 under the terms of the GNU Affero General Public License as published
12 License as published by the Free Software Foundation, either version 11 by the Free Software Foundation, either version 3 of the License, or
13 3 of the License, or (at your option) any later version. 12 (at your option) any later version.
14 13
15* Clipperz Community Edition is distributed in the hope that it will 14* Clipperz is distributed in the hope that it will be useful, but
16 be useful, but WITHOUT ANY WARRANTY; without even the implied 15 WITHOUT ANY WARRANTY; without even the implied warranty of
17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU Affero General Public License for more details. 17 See the GNU Affero General Public License for more details.
19 18
20* You should have received a copy of the GNU Affero General Public 19* You should have received a copy of the GNU Affero General Public
21 License along with Clipperz Community Edition. If not, see 20 License along with Clipperz. If not, see http://www.gnu.org/licenses/.
22 <http://www.gnu.org/licenses/>.
23 21
24*/ 22*/
25 23
26Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers'); 24Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers');
27 25
28Clipperz.PM.UI.Web.Controllers.GridController = function(args) { 26Clipperz.PM.UI.Web.Controllers.GridController = function(args) {
29 args = args || {}; 27 args = args || {};
30 28
31 Clipperz.PM.UI.Web.Controllers.GridController.superclass.constructor.call(this, args); 29 Clipperz.PM.UI.Web.Controllers.GridController.superclass.constructor.call(this, args);
32 30
33 this._grid = null; 31 this._grid = null;
34 this._user = null; 32 this._user = null;
35 this._sortedColumnManager = null; 33 this._sortedColumnManager = null;
36 this._cachedObjects = null; 34 this._cachedObjects = null;
37 this._filterController = args.filterController || null; 35 this._filterController = args.filterController || null;
38 36
39 this._deferredDisplaySelectedRowsInvocation = null; 37 this._deferredDisplaySelectedRowsInvocation = null;
40 38
41 return this; 39 return this;
42}; 40};
43 41
44Clipperz.Base.extend(Clipperz.PM.UI.Web.Controllers.GridController, Object, { 42Clipperz.Base.extend(Clipperz.PM.UI.Web.Controllers.GridController, Object, {
45 43
46 'toString': function() { 44 'toString': function() {
47 return "Clipperz.PM.UI.Web.Controllers.GridController"; 45 return "Clipperz.PM.UI.Web.Controllers.GridController";
48 }, 46 },
49 47
50 //----------------------------------------------------------------------------- 48 //-----------------------------------------------------------------------------
51 49
52 'createGrid': function () { 50 'createGrid': function () {
53 throw Clipperz.Base.exception.AbstractMethod; 51 throw Clipperz.Base.exception.AbstractMethod;
54 }, 52 },
55 53
56 'setupWithGrid': function (aGrid) { 54 'setupWithGrid': function (aGrid) {
57 this._grid = aGrid; 55 this._grid = aGrid;
58 56
59 if (this._grid != null) { 57 if (this._grid != null) {
60 MochiKit.Iter.forEach(this.columnsManagers(), function (aColumnManager) { 58 MochiKit.Iter.forEach(this.columnsManagers(), function (aColumnManager) {
61 if (aColumnManager.isSortable()) { 59 if (aColumnManager.isSortable()) {
62 if (aColumnManager.isSorted()) { 60 if (aColumnManager.isSorted()) {
63 this.setSortedColumnManager(aColumnManager); 61 this.setSortedColumnManager(aColumnManager);
64 } 62 }
65 MochiKit.Signal.connect(aColumnManager, 'sort', this, 'handleColumnManagerSort'); 63 MochiKit.Signal.connect(aColumnManager, 'sort', this, 'handleColumnManagerSort');
66 } 64 }
67 MochiKit.Signal.connect(aColumnManager, 'selectRow', this, 'handleColumnManagerSelectRow'); 65 MochiKit.Signal.connect(aColumnManager, 'selectRow', this, 'handleColumnManagerSelectRow');
68 MochiKit.Signal.connect(aColumnManager, 'unselectRow', this, 'handleColumnManagerUnselectRow'); 66 MochiKit.Signal.connect(aColumnManager, 'unselectRow', this, 'handleColumnManagerUnselectRow');
69 }, this); 67 }, this);
70 } 68 }
71 }, 69 },
72 70
73 'grid': function() { 71 'grid': function() {
74 if (this._grid == null) { 72 if (this._grid == null) {
75 this.setupWithGrid(this.createGrid()); 73 this.setupWithGrid(this.createGrid());
76 } 74 }
77 75
78 return this._grid; 76 return this._grid;
79 }, 77 },
80 78
81 'filterController': function () { 79 'filterController': function () {
82//Clipperz.log('GridController.filterController >>>', this._filterController); 80//Clipperz.log('GridController.filterController >>>', this._filterController);
83 if (this._filterController == null) { 81 if (this._filterController == null) {
84 this._filterController = new Clipperz.PM.UI.Web.Controllers.FilterController(); 82 this._filterController = new Clipperz.PM.UI.Web.Controllers.FilterController();
85 } 83 }
86//Clipperz.log('GridController.filterController <<<', this._filterController); 84//Clipperz.log('GridController.filterController <<<', this._filterController);
87 return this._filterController; 85 return this._filterController;
88 }, 86 },
89 87
90 //----------------------------------------------------------------------------- 88 //-----------------------------------------------------------------------------
91 89
92 'columnsManagers': function () { 90 'columnsManagers': function () {
93 return this.grid().columnsManagers(); 91 return this.grid().columnsManagers();
94 }, 92 },
95 93
96 'columnManagerWithName': function (aName) { 94 'columnManagerWithName': function (aName) {
97 varmanagers; 95 varmanagers;
98 var result; 96 var result;
99 97
100 managers = MochiKit.Base.filter(function (aManager) { return aManager.name() == aName; } , this.columnsManagers()); 98 managers = MochiKit.Base.filter(function (aManager) { return aManager.name() == aName; } , this.columnsManagers());
101 99
102 if (managers.length == 1) { 100 if (managers.length == 1) {
103 result = managers[0]; 101 result = managers[0];
104 } else if (managers.length == 0) { 102 } else if (managers.length == 0) {
105 result = null; 103 result = null;
106 } else { 104 } else {
107 throw "WTF!!!"; 105 throw "WTF!!!";
108 } 106 }
109 107
110 return result; 108 return result;
111 }, 109 },
112 110
113 'sortedColumnManager': function () { 111 'sortedColumnManager': function () {
114 return this._sortedColumnManager; 112 return this._sortedColumnManager;
115 }, 113 },
116 114
117 'setSortedColumnManager': function(aValue) { 115 'setSortedColumnManager': function(aValue) {
118 if (aValue.sorted() != 'UNSORTED') { 116 if (aValue.sorted() != 'UNSORTED') {
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/LoginController.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/LoginController.js
index a57152d..ac85d36 100644
--- a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/LoginController.js
+++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/LoginController.js
@@ -1,250 +1,246 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2013 Clipperz Srl
4 4
5This file is part of Clipperz Community Edition. 5This file is part of Clipperz, the online password manager.
6Clipperz Community Edition is an online password manager.
7For further information about its features and functionalities please 6For further information about its features and functionalities please
8refer to http://www.clipperz.com. 7refer to http://www.clipperz.com.
9 8
10* Clipperz Community Edition is free software: you can redistribute 9* Clipperz is free software: you can redistribute it and/or modify it
11 it and/or modify it under the terms of the GNU Affero General Public 10 under the terms of the GNU Affero General Public License as published
12 License as published by the Free Software Foundation, either version 11 by the Free Software Foundation, either version 3 of the License, or
13 3 of the License, or (at your option) any later version. 12 (at your option) any later version.
14 13
15* Clipperz Community Edition is distributed in the hope that it will 14* Clipperz is distributed in the hope that it will be useful, but
16 be useful, but WITHOUT ANY WARRANTY; without even the implied 15 WITHOUT ANY WARRANTY; without even the implied warranty of
17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU Affero General Public License for more details. 17 See the GNU Affero General Public License for more details.
19 18
20* You should have received a copy of the GNU Affero General Public 19* You should have received a copy of the GNU Affero General Public
21 License along with Clipperz Community Edition. If not, see 20 License along with Clipperz. If not, see http://www.gnu.org/licenses/.
22 <http://www.gnu.org/licenses/>.
23 21
24*/ 22*/
25 23
26Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers'); 24Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers');
27 25
28Clipperz.PM.UI.Web.Controllers.LoginController = function(args) { 26Clipperz.PM.UI.Web.Controllers.LoginController = function(args) {
29 this._args = args || {}; 27 this._args = args || {};
30 28
31 this._loginPage = null; 29 this._loginPage = null;
32 30
33 this._newUserWizardController = null; 31 this._newUserWizardController = null;
34 this._newUserCreationComponent = null; 32 this._newUserCreationComponent = null;
35 33
36 return this; 34 return this;
37} 35}
38 36
39MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.LoginController.prototype, { 37MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.LoginController.prototype, {
40 38
41 'toString': function() { 39 'toString': function() {
42 return "Clipperz.PM.UI.Web.Controllers.LoginController"; 40 return "Clipperz.PM.UI.Web.Controllers.LoginController";
43 }, 41 },
44 42
45 'args': function () { 43 'args': function () {
46 return this._args; 44 return this._args;
47 }, 45 },
48 46
49 //----------------------------------------------------------------------------- 47 //-----------------------------------------------------------------------------
50 48
51 'loginPage': function() { 49 'loginPage': function() {
52 if (this._loginPage == null) { 50 if (this._loginPage == null) {
53 this._loginPage = new Clipperz.PM.UI.Web.Components.LoginPage(); 51 this._loginPage = new Clipperz.PM.UI.Web.Components.LoginPage();
54 52
55 MochiKit.Signal.connect(this._loginPage, 'createNewAccountClick', this, 'handleCreateNewAccountClick') 53 MochiKit.Signal.connect(this._loginPage, 'createNewAccountClick', this, 'handleCreateNewAccountClick')
56 } 54 }
57 55
58 return this._loginPage; 56 return this._loginPage;
59 }, 57 },
60 58
61 //----------------------------------------------------------------------------- 59 //-----------------------------------------------------------------------------
62 60
63 'run': function(args) { 61 'run': function(args) {
64 varslot; 62 varslot;
65 varloginPage; 63 varloginPage;
66 varloginForm; 64 varloginForm;
67 65
68 slot = args.slot; 66 slot = args.slot;
69 67
70 loginForm =new Clipperz.PM.UI.Web.Components.LoginForm({'autocomplete': this.args()['autocomplete']}); 68 loginForm =new Clipperz.PM.UI.Web.Components.LoginForm({'autocomplete': this.args()['autocomplete']});
71 69
72 slot.setContent(this.loginPage()); 70 slot.setContent(this.loginPage());
73 this.loginPage().slotNamed('loginForm').setContent(loginForm); 71 this.loginPage().slotNamed('loginForm').setContent(loginForm);
74 72
75 MochiKit.Signal.connect(loginForm, 'doLogin', MochiKit.Base.method(this, 'doLogin', loginForm)); 73 MochiKit.Signal.connect(loginForm, 'doLogin', MochiKit.Base.method(this, 'doLogin', loginForm));
76 MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'doLogin', MochiKit.Base.method(this, 'doLogin', loginForm)); 74 MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'doLogin', MochiKit.Base.method(this, 'doLogin', loginForm));
77 }, 75 },
78 76
79 //----------------------------------------------------------------------------- 77 //-----------------------------------------------------------------------------
80 78
81 'doLogin': function(aLoginForm, anEvent) { 79 'doLogin': function(aLoginForm, anEvent) {
82 var deferredResult; 80 var deferredResult;
83 varparameters; 81 varparameters;
84 var loginProgress; 82 var loginProgress;
85 varuser; 83 varuser;
86 var getPassphraseDelegate; 84 var getPassphraseDelegate;
87 85
88 parameters = anEvent; 86 parameters = anEvent;
89 87
90 getPassphraseDelegate = MochiKit.Base.partial(MochiKit.Async.succeed, parameters.passphrase); 88 getPassphraseDelegate = MochiKit.Base.partial(MochiKit.Async.succeed, parameters.passphrase);
91 user = new Clipperz.PM.DataModel.User({'username':parameters.username, 'getPassphraseFunction':MochiKit.Base.method(Clipperz.PM.RunTime.mainController, 'getPassphrase')}); 89 user = new Clipperz.PM.DataModel.User({'username':parameters.username, 'getPassphraseFunction':MochiKit.Base.method(Clipperz.PM.RunTime.mainController, 'getPassphrase')});
92 90
93 loginProgress = new Clipperz.PM.UI.Web.Components.LoginProgress(); 91 loginProgress = new Clipperz.PM.UI.Web.Components.LoginProgress();
94 92
95 deferredResult = new Clipperz.Async.Deferred("LoginController.doLogin", {trace:false}); 93 deferredResult = new Clipperz.Async.Deferred("LoginController.doLogin", {trace:false});
96 deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'initProgress', {'steps':4}); 94 deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'initProgress', {'steps':4});
97 deferredResult.addMethod(Clipperz.PM.RunTime.mainController, 'setPassphraseDelegate', getPassphraseDelegate); 95 deferredResult.addMethod(Clipperz.PM.RunTime.mainController, 'setPassphraseDelegate', getPassphraseDelegate);
98 deferredResult.addMethod(loginProgress, 'deferredShowModal', {deferredObject:deferredResult, openFromElement:aLoginForm.submitButtonElement()}); 96 deferredResult.addMethod(loginProgress, 'deferredShowModal', {deferredObject:deferredResult, openFromElement:aLoginForm.submitButtonElement()});
99 deferredResult.addMethod(Clipperz.Crypto.PRNG.defaultRandomGenerator(), 'deferredEntropyCollection'); 97 deferredResult.addMethod(Clipperz.Crypto.PRNG.defaultRandomGenerator(), 'deferredEntropyCollection');
100 deferredResult.addMethod(user, 'login'); 98 deferredResult.addMethod(user, 'login');
101 deferredResult.addCallback(function(aLoginProgress, res) { 99 deferredResult.addCallback(function(aLoginProgress, res) {
102 aLoginProgress.disableCancel(); 100 aLoginProgress.disableCancel();
103 return res; 101 return res;
104 }, loginProgress); 102 }, loginProgress);
105 deferredResult.addCallback(function () { 103 deferredResult.addCallback(function () {
106 MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'CARDS_CONTROLLER_DID_RUN',MochiKit.Base.method(loginProgress, 'deferredHideModalAndRemove', {closeToElement:MochiKit.DOM.currentDocument().body})); 104 MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'CARDS_CONTROLLER_DID_RUN',MochiKit.Base.method(loginProgress, 'deferredHideModalAndRemove', {closeToElement:MochiKit.DOM.currentDocument().body}));
107 }) 105 })
108 deferredResult.addMethod(this, 'userLoggedIn', user, loginProgress, aLoginForm); 106 deferredResult.addMethod(this, 'userLoggedIn', user, loginProgress, aLoginForm);
109 deferredResult.addErrback (MochiKit.Base.method(this, 'handleFailedLogin', loginProgress)); 107 deferredResult.addErrback (MochiKit.Base.method(this, 'handleFailedLogin', loginProgress));
110 108
111 deferredResult.addErrback (MochiKit.Base.method(loginProgress, 'deferredHideModalAndRemove', {closeToElement:aLoginForm.submitButtonElement()})); 109 deferredResult.addErrback (MochiKit.Base.method(loginProgress, 'deferredHideModalAndRemove', {closeToElement:aLoginForm.submitButtonElement()}));
112 deferredResult.addErrbackPass (MochiKit.Base.method(aLoginForm, 'focusOnPassphraseField')); 110 deferredResult.addErrbackPass (MochiKit.Base.method(aLoginForm, 'focusOnPassphraseField'));
113 deferredResult.addBoth(MochiKit.Base.method(Clipperz.PM.RunTime.mainController, 'removePassphraseDelegate', getPassphraseDelegate)); 111 deferredResult.addBoth(MochiKit.Base.method(Clipperz.PM.RunTime.mainController, 'removePassphraseDelegate', getPassphraseDelegate));
114 deferredResult.callback(); 112 deferredResult.callback();
115 113
116 MochiKit.Signal.connect(loginProgress, 'cancelEvent', deferredResult, 'cancel'); 114 MochiKit.Signal.connect(loginProgress, 'cancelEvent', deferredResult, 'cancel');
117 115
118 return deferredResult; 116 return deferredResult;
119 }, 117 },
120 118
121 //----------------------------------------------------------------------------- 119 //-----------------------------------------------------------------------------
122 120
123 'userLoggedIn': function(aUser) { 121 'userLoggedIn': function(aUser) {
124//Clipperz.log(">>> LoginController.userLoggedIn"); 122//Clipperz.log(">>> LoginController.userLoggedIn");
125 MochiKit.Signal.signal(this, 'userLoggedIn', {user: aUser}); 123 MochiKit.Signal.signal(this, 'userLoggedIn', {user: aUser});
126//Clipperz.log("<<< LoginController.userLoggedIn"); 124//Clipperz.log("<<< LoginController.userLoggedIn");
127 }, 125 },
128 126
129 //========================================================================= 127 //=========================================================================
130 128
131 'handleCreateNewAccountClick': function (aComponent) { 129 'handleCreateNewAccountClick': function (aComponent) {
132 // return Clipperz.PM.DataModel.User.registerNewAccount("new", "user"); 130 // return Clipperz.PM.DataModel.User.registerNewAccount("new", "user");
133 return Clipperz.Async.callbacks("LoginController.handleCreateNewAccountClick", [ 131 return Clipperz.Async.callbacks("LoginController.handleCreateNewAccountClick", [
134 //' MochiKit.Base.method(this, 'newUserCreationComponent'), 132 //' MochiKit.Base.method(this, 'newUserCreationComponent'),
135 // MochiKit.Base.methodcaller('deferredShowModal', {openFromElement:aComponent}), 133 // MochiKit.Base.methodcaller('deferredShowModal', {openFromElement:aComponent}),
136 // MochiKit.Base.method(this.newUserWizardController(), 'run') 134 // MochiKit.Base.method(this.newUserWizardController(), 'run')
137 135
138 136
139 MochiKit.Base.method(this, 'newUserCreationComponent'), 137 MochiKit.Base.method(this, 'newUserCreationComponent'),
140 Clipperz.Async.forkAndJoin("Async.test succeedingForkedAndWaitDeferrer", [ 138 Clipperz.Async.forkAndJoin("Async.test succeedingForkedAndWaitDeferrer", [
141 MochiKit.Base.method(this.newUserCreationComponent(), 'deferredShowModal', {openFromElement:aComponent, duration:0.5}), 139 MochiKit.Base.method(this.newUserCreationComponent(), 'deferredShowModal', {openFromElement:aComponent, duration:0.5}),
142 MochiKit.Base.method(this.newUserWizardController(), 'run') 140 MochiKit.Base.method(this.newUserWizardController(), 'run')
143 ], {trace:false}), 141 ], {trace:false}),
144 // MochiKit.Base.method(this.newUserCreationComponent(), 'enableCredentialsField') 142 // MochiKit.Base.method(this.newUserCreationComponent(), 'enableCredentialsField')
145 ], {trace:false}); 143 ], {trace:false});
146 }, 144 },
147 145
148 //----------------------------------------------------------------------------- 146 //-----------------------------------------------------------------------------
149 147
150 'newUserWizardController': function () { 148 'newUserWizardController': function () {
151 if (this._newUserWizardController == null) { 149 if (this._newUserWizardController == null) {
152 this._newUserWizardController = new Clipperz.PM.UI.Web.Controllers.NewUserWizardController({ 150 this._newUserWizardController = new Clipperz.PM.UI.Web.Controllers.NewUserWizardController({
153 'newUserCreationComponent': this.newUserCreationComponent() 151 'newUserCreationComponent': this.newUserCreationComponent()
154 }) 152 })
155 153
156 // MochiKit.Signal.connect(this._newUserWizardController, 'exit',this, 'handleHideNewUserCreationComponent'); 154 // MochiKit.Signal.connect(this._newUserWizardController, 'exit',this, 'handleHideNewUserCreationComponent');
157 MochiKit.Signal.connect(this._newUserWizardController, 'done',this, 'handleCompleteNewUserCreationComponent'); 155 MochiKit.Signal.connect(this._newUserWizardController, 'done',this, 'handleCompleteNewUserCreationComponent');
158 } 156 }
159 157
160 return this._newUserWizardController; 158 return this._newUserWizardController;
161 }, 159 },
162 160
163 //------------------------------------------------------------------------- 161 //-------------------------------------------------------------------------
164 162
165 'newUserCreationComponent': function () { 163 'newUserCreationComponent': function () {
166 if (this._newUserCreationComponent == null) { 164 if (this._newUserCreationComponent == null) {
167 this._newUserCreationComponent = new Clipperz.PM.UI.Web.Components.NewUserCreationComponent(); 165 this._newUserCreationComponent = new Clipperz.PM.UI.Web.Components.NewUserCreationComponent();
168 } 166 }
169 167
170 return this._newUserCreationComponent; 168 return this._newUserCreationComponent;
171 }, 169 },
172 170
173 'clearNewUserCreationComponent': function () { 171 'clearNewUserCreationComponent': function () {
174 if (this._newUserCreationComponent != null) { 172 if (this._newUserCreationComponent != null) {
175 this._newUserCreationComponent.clear(); 173 this._newUserCreationComponent.clear();
176 } 174 }
177 this._newUserCreationComponent = null; 175 this._newUserCreationComponent = null;
178 }, 176 },
179 177
180 //------------------------------------------------------------------------- 178 //-------------------------------------------------------------------------
181 179
182 'handleHideNewUserCreationComponent': function () { 180 'handleHideNewUserCreationComponent': function () {
183 this.clearNewUserCreationComponent(); 181 this.clearNewUserCreationComponent();
184 }, 182 },
185 183
186 'handleCompleteNewUserCreationComponent': function (someParameters) { 184 'handleCompleteNewUserCreationComponent': function (someParameters) {
187 vardeferredResult; 185 vardeferredResult;
188 varuser; 186 varuser;
189 varnewUserCreationComponent; 187 varnewUserCreationComponent;
190 188
191 user = someParameters.user; 189 user = someParameters.user;
192 newUserCreationComponent = this.newUserCreationComponent(); 190 newUserCreationComponent = this.newUserCreationComponent();
193 MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'CARDS_CONTROLLER_DID_RUN',MochiKit.Base.method(newUserCreationComponent, 'deferredHideModal', {closeToElement:MochiKit.DOM.currentDocument().body})), 191 MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'CARDS_CONTROLLER_DID_RUN',MochiKit.Base.method(newUserCreationComponent, 'deferredHideModal', {closeToElement:MochiKit.DOM.currentDocument().body})),
194 192
195 deferredResult = new Clipperz.Async.Deferred("LoginController.handleCompleteNewUserCreationComponent", {trace:false}); 193 deferredResult = new Clipperz.Async.Deferred("LoginController.handleCompleteNewUserCreationComponent", {trace:false});
196 194
197 deferredResult.addCallbackList([ 195 deferredResult.addCallbackList([
198 MochiKit.Base.method(Clipperz.Crypto.PRNG.defaultRandomGenerator(), 'deferredEntropyCollection'), 196 MochiKit.Base.method(Clipperz.Crypto.PRNG.defaultRandomGenerator(), 'deferredEntropyCollection'),
199 MochiKit.Base.method(user, 'login'), 197 MochiKit.Base.method(user, 'login'),
200 MochiKit.Base.method(this, 'userLoggedIn', user), 198 MochiKit.Base.method(this, 'userLoggedIn', user),
201 MochiKit.Base.method(this, 'clearNewUserCreationComponent') 199 MochiKit.Base.method(this, 'clearNewUserCreationComponent')
202 ]); 200 ]);
203 deferredResult.addErrback(function (aValue) { Clipperz.log("WTF!! Error doing the login after creating a new user" + aValue)}); 201 deferredResult.addErrback(function (aValue) { Clipperz.log("WTF!! Error doing the login after creating a new user" + aValue)});
204 deferredResult.callback(); 202 deferredResult.callback();
205 203
206 return deferredResult; 204 return deferredResult;
207 }, 205 },
208 206
209 207
210 //========================================================================= 208 //=========================================================================
211 209
212 'handleFailedLogin': function(aLoginProgress, anError) { 210 'handleFailedLogin': function(aLoginProgress, anError) {
213 var result; 211 var result;
214 212
215//console.log("anError", anError);
216 if (anError instanceof MochiKit.Async.CancelledError) { 213 if (anError instanceof MochiKit.Async.CancelledError) {
217 result = anError; 214 result = anError;
218 } else { 215 } else {
219 var deferredResult; 216 var deferredResult;
220 217
221MochiKit.Logging.logError("## MainController - FAILED LOGIN: " + anError); 218Clipperz.logError("## MainController - FAILED LOGIN: " + anError);
222 deferredResult = new MochiKit.Async.Deferred(); 219 deferredResult = new MochiKit.Async.Deferred();
223 220
224 aLoginProgress.showErrorMessage("failed login"); 221 aLoginProgress.showErrorMessage("failed login");
225 // Clipperz.NotificationCenter.register(loginProgress, 'cancelEvent', deferredResult, 'callback'); 222 // Clipperz.NotificationCenter.register(loginProgress, 'cancelEvent', deferredResult, 'callback');
226 MochiKit.Signal.connect(aLoginProgress, 'cancelEvent', deferredResult, 'callback'); 223 MochiKit.Signal.connect(aLoginProgress, 'cancelEvent', deferredResult, 'callback');
227 deferredResult.addCallback(MochiKit.Async.fail, anError) 224 deferredResult.addCallback(MochiKit.Async.fail, anError)
228 result = deferredResult; 225 result = deferredResult;
229 } 226 }
230 227
231 return result; 228 return result;
232 }, 229 },
233 230
234 'handleGenericError': function(anError) { 231 'handleGenericError': function(anError) {
235 var result; 232 var result;
236 233
237 if (anError instanceof MochiKit.Async.CancelledError) { 234 if (anError instanceof MochiKit.Async.CancelledError) {
238 result = anError; 235 result = anError;
239 } else { 236 } else {
240MochiKit.Logging.logError("## MainController - GENERIC ERROR" + "\n" + "==>> " + anError + " <<==\n" + anError.stack); 237Clipperz.logError("## MainController - GENERIC ERROR" + "\n" + "==>> " + anError + " <<==\n" + anError.stack);
241//console.log(anError);
242 result = new MochiKit.Async.CancelledError(anError); 238 result = new MochiKit.Async.CancelledError(anError);
243 } 239 }
244 240
245 return result; 241 return result;
246 }, 242 },
247 243
248 //----------------------------------------------------------------------------- 244 //-----------------------------------------------------------------------------
249 __syntaxFix__: "syntax fix" 245 __syntaxFix__: "syntax fix"
250}); 246});
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/MainController.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/MainController.js
index c83e3c0..9194125 100644
--- a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/MainController.js
+++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/MainController.js
@@ -1,215 +1,207 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2013 Clipperz Srl
4 4
5This file is part of Clipperz Community Edition. 5This file is part of Clipperz, the online password manager.
6Clipperz Community Edition is an online password manager.
7For further information about its features and functionalities please 6For further information about its features and functionalities please
8refer to http://www.clipperz.com. 7refer to http://www.clipperz.com.
9 8
10* Clipperz Community Edition is free software: you can redistribute 9* Clipperz is free software: you can redistribute it and/or modify it
11 it and/or modify it under the terms of the GNU Affero General Public 10 under the terms of the GNU Affero General Public License as published
12 License as published by the Free Software Foundation, either version 11 by the Free Software Foundation, either version 3 of the License, or
13 3 of the License, or (at your option) any later version. 12 (at your option) any later version.
14 13
15* Clipperz Community Edition is distributed in the hope that it will 14* Clipperz is distributed in the hope that it will be useful, but
16 be useful, but WITHOUT ANY WARRANTY; without even the implied 15 WITHOUT ANY WARRANTY; without even the implied warranty of
17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU Affero General Public License for more details. 17 See the GNU Affero General Public License for more details.
19 18
20* You should have received a copy of the GNU Affero General Public 19* You should have received a copy of the GNU Affero General Public
21 License along with Clipperz Community Edition. If not, see 20 License along with Clipperz. If not, see http://www.gnu.org/licenses/.
22 <http://www.gnu.org/licenses/>.
23 21
24*/ 22*/
25 23
26Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers'); 24Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers');
27 25
28Clipperz.PM.UI.Web.Controllers.MainController = function(args) { 26Clipperz.PM.UI.Web.Controllers.MainController = function(args) {
29 this._args = args; 27 this._args = args;
30 28
31 //controllers 29 //controllers
32 this._loginController =null; 30 this._loginController =null;
33 this._appController =null; 31 this._appController =null;
34 32
35 //components 33 //components
36 this._headerComponent = null; 34 this._headerComponent = null;
37 this._pageComponent =null; 35 this._pageComponent =null;
38 this._footerComponent = null; 36 this._footerComponent = null;
39 37
40 this._passphraseDelegateLock = new MochiKit.Async.DeferredLock(); 38 this._passphraseDelegateLock = new MochiKit.Async.DeferredLock();
41 this._passphraseDelegateLock.acquire(); 39 this._passphraseDelegateLock.acquire();
42//Clipperz.log('MainController init _passphraseDelegateLock', this._passphraseDelegateLock); 40//Clipperz.log('MainController init _passphraseDelegateLock', this._passphraseDelegateLock);
43 this._passphraseDelegate = null; 41 this._passphraseDelegate = null;
44 42
45 MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'remoteRequestSent', this, 'handleRemoteRequestSent'); 43 MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'remoteRequestSent', this, 'handleRemoteRequestSent');
46 MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'remoteRequestReceived',this, 'handleRemoteRequestReceived'); 44 MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'remoteRequestReceived',this, 'handleRemoteRequestReceived');
47 45
48 return this; 46 return this;
49} 47}
50 48
51MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.MainController.prototype, { 49MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.MainController.prototype, {
52 50
53 'toString': function() { 51 'toString': function() {
54 return "Clipperz.PM.UI.Web.Controllers.MainController"; 52 return "Clipperz.PM.UI.Web.Controllers.MainController";
55 }, 53 },
56 54
57 'args': function () { 55 'args': function () {
58 return this._args; 56 return this._args;
59 }, 57 },
60 58
61 //----------------------------------------------------------------------------- 59 //-----------------------------------------------------------------------------
62 60
63 'headerComponent': function() { 61 'headerComponent': function() {
64 if (this._headerComponent == null) { 62 if (this._headerComponent == null) {
65 this._headerComponent = new Clipperz.PM.UI.Web.Components.PageHeader(); 63 this._headerComponent = new Clipperz.PM.UI.Web.Components.PageHeader();
66 } 64 }
67 65
68 return this._headerComponent; 66 return this._headerComponent;
69 }, 67 },
70 68
71 'footerComponent': function() { 69 'footerComponent': function() {
72 if (this._footerComponent == null) { 70 if (this._footerComponent == null) {
73 this._footerComponent = new Clipperz.PM.UI.Web.Components.PageFooter(); 71 this._footerComponent = new Clipperz.PM.UI.Web.Components.PageFooter();
74 } 72 }
75 73
76 return this._footerComponent; 74 return this._footerComponent;
77 }, 75 },
78 76
79 //----------------------------------------------------------------------------- 77 //-----------------------------------------------------------------------------
80 78
81 'pageComponent': function() { 79 'pageComponent': function() {
82 if (this._pageComponent == null) { 80 if (this._pageComponent == null) {
83 this._pageComponent = new Clipperz.PM.UI.Web.Components.Page({element:MochiKit.DOM.getElement('mainDiv')}); 81 this._pageComponent = new Clipperz.PM.UI.Web.Components.Page({element:MochiKit.DOM.getElement('mainDiv')});
84 } 82 }
85 83
86 return this._pageComponent; 84 return this._pageComponent;
87 }, 85 },
88 86
89 //----------------------------------------------------------------------------- 87 //-----------------------------------------------------------------------------
90 88
91 'loginController': function() { 89 'loginController': function() {
92 if (this._loginController == null) { 90 if (this._loginController == null) {
93 this._loginController = new Clipperz.PM.UI.Web.Controllers.LoginController(this.args()); 91 this._loginController = new Clipperz.PM.UI.Web.Controllers.LoginController(this.args());
94 92
95 MochiKit.Signal.connect(this._loginController, 'userLoggedIn', this, 'loginControllerUserLoggedInCallback'); 93 MochiKit.Signal.connect(this._loginController, 'userLoggedIn', this, 'loginControllerUserLoggedInCallback');
96 } 94 }
97 95
98 return this._loginController; 96 return this._loginController;
99 }, 97 },
100 98
101 'appController': function() { 99 'appController': function() {
102 if (this._appController == null) { 100 if (this._appController == null) {
103 this._appController = new Clipperz.PM.UI.Web.Controllers.AppController(); 101 this._appController = new Clipperz.PM.UI.Web.Controllers.AppController();
104 102
105 MochiKit.Signal.connect(this._appController, 'logout', this, 'handleLogout'); 103 MochiKit.Signal.connect(this._appController, 'logout', this, 'handleLogout');
106 } 104 }
107 105
108 return this._appController; 106 return this._appController;
109 }, 107 },
110 108
111 //----------------------------------------------------------------------------- 109 //-----------------------------------------------------------------------------
112 110
113 'run': function(shoudShowRegistrationForm) { 111 'run': function(shoudShowRegistrationForm) {
114 this.pageComponent().slotNamed('header').setContent(this.headerComponent()); 112 this.pageComponent().slotNamed('header').setContent(this.headerComponent());
115 this.pageComponent().slotNamed('footer').setContent(this.footerComponent()); 113 this.pageComponent().slotNamed('footer').setContent(this.footerComponent());
116 114
117 this.pageComponent().render(); 115 this.pageComponent().render();
118 116
119 this.loginController().run({slot:this.pageComponent().slotNamed('body')}); 117 this.loginController().run({slot:this.pageComponent().slotNamed('body')});
120 118
121 if (shoudShowRegistrationForm) { 119 if (shoudShowRegistrationForm) {
122 MochiKit.Signal.signal(this.loginController().loginPage(), 'createNewAccountClick'); 120 MochiKit.Signal.signal(this.loginController().loginPage(), 'createNewAccountClick');
123 // this.loginController().handleCreateNewAccountClick(); 121 // this.loginController().handleCreateNewAccountClick();
124 } 122 }
125 }, 123 },
126 124
127 //----------------------------------------------------------------------------- 125 //-----------------------------------------------------------------------------
128 126
129 'getPassphrase': function () { 127 'getPassphrase': function () {
130 var deferredResult; 128 var deferredResult;
131 129
132 deferredResult = new Clipperz.Async.Deferred("MainController.getPassphrase", {trace:false}); 130 deferredResult = new Clipperz.Async.Deferred("MainController.getPassphrase", {trace:false});
133 131
134 deferredResult.acquireLock(this._passphraseDelegateLock); 132 deferredResult.acquireLock(this._passphraseDelegateLock);
135 deferredResult.addMethod(this, 'invokePassphraseDelegate'); 133 deferredResult.addMethod(this, 'invokePassphraseDelegate');
136 deferredResult.releaseLock(this._passphraseDelegateLock); 134 deferredResult.releaseLock(this._passphraseDelegateLock);
137 deferredResult.callback(); 135 deferredResult.callback();
138 136
139 return deferredResult; 137 return deferredResult;
140 }, 138 },
141 139
142 //......................................................................... 140 //.........................................................................
143 141
144 'invokePassphraseDelegate': function () { 142 'invokePassphraseDelegate': function () {
145 return this._passphraseDelegate(); 143 return this._passphraseDelegate();
146 }, 144 },
147 145
148 'passphraseDelegateLock': function () { 146 'passphraseDelegateLock': function () {
149 return this._passphraseDelegateLock; 147 return this._passphraseDelegateLock;
150 }, 148 },
151 149
152 //......................................................................... 150 //.........................................................................
153 151
154 'setPassphraseDelegate': function (aDelegate) { 152 'setPassphraseDelegate': function (aDelegate) {
155 var shouldReleaseLock; 153 var shouldReleaseLock;
156 154
157 shouldReleaseLock = (this._passphraseDelegate == null); 155 shouldReleaseLock = (this._passphraseDelegate == null);
158 156
159 this._passphraseDelegate = aDelegate; 157 this._passphraseDelegate = aDelegate;
160 158
161 if (shouldReleaseLock) { 159 if (shouldReleaseLock) {
162 this._passphraseDelegateLock.release(); 160 this._passphraseDelegateLock.release();
163 } 161 }
164 }, 162 },
165 163
166 //......................................................................... 164 //.........................................................................
167 165
168 'removePassphraseDelegate': function (aDelegate) { 166 'removePassphraseDelegate': function (aDelegate) {
169 if (this._passphraseDelegate == aDelegate) { 167 if (this._passphraseDelegate == aDelegate) {
170 this._passphraseDelegate = null; 168 this._passphraseDelegate = null;
171 this._passphraseDelegateLock.acquire(); 169 this._passphraseDelegateLock.acquire();
172 } 170 }
173 }, 171 },
174 172
175 //------------------------------------------------------------------------- 173 //-------------------------------------------------------------------------
176 174
177 'loginControllerUserLoggedInCallback': function(anEvent) { 175 'loginControllerUserLoggedInCallback': function(anEvent) {
178//Clipperz.log(">>> loginControllerUserLoggedInCallback", anEvent);
179 // this.setUser(anEvent.parameters()['user']);
180//console.log("--- loginControllerUserLoggedInCallback - 1");
181
182//console.log("--- loginControllerUserLoggedInCallback - 2");
183 this.headerComponent().switchToLoggedMode(); 176 this.headerComponent().switchToLoggedMode();
184 this.appController().run({slot:this.pageComponent().slotNamed('body'), user:anEvent['user']}); 177 this.appController().run({slot:this.pageComponent().slotNamed('body'), user:anEvent['user']});
185//Clipperz.log("<<< loginControllerUserLoggedInCallback");
186 }, 178 },
187 179
188 //----------------------------------------------------------------------------- 180 //-----------------------------------------------------------------------------
189 181
190 'handleRemoteRequestSent': function () { 182 'handleRemoteRequestSent': function () {
191//Clipperz.log("REMOTE REQUEST sent >>>"); 183//Clipperz.log("REMOTE REQUEST sent >>>");
192 }, 184 },
193 185
194 'handleRemoteRequestReceived': function () { 186 'handleRemoteRequestReceived': function () {
195//Clipperz.log("REMOTE REQUEST received <<<"); 187//Clipperz.log("REMOTE REQUEST received <<<");
196 }, 188 },
197 189
198 //----------------------------------------------------------------------------- 190 //-----------------------------------------------------------------------------
199 191
200 'handleLogout': function(anEvent) { 192 'handleLogout': function(anEvent) {
201 this.exit('logout.html'); 193 this.exit('logout.html');
202 }, 194 },
203 195
204 //----------------------------------------------------------------------------- 196 //-----------------------------------------------------------------------------
205 197
206 'exit': function(aPageName) { 198 'exit': function(aPageName) {
207//Clipperz.log("### exit " + aPageName); 199//Clipperz.log("### exit " + aPageName);
208 MochiKit.Async.wait(0).addCallback(function() { 200 MochiKit.Async.wait(0).addCallback(function() {
209 window.location.href = "./" + aPageName + "?ln=" + Clipperz.PM.Strings.selectedLanguage; 201 window.location.href = "./" + aPageName + "?ln=" + Clipperz.PM.Strings.selectedLanguage;
210 }); 202 });
211 }, 203 },
212 204
213 //----------------------------------------------------------------------------- 205 //-----------------------------------------------------------------------------
214 __syntaxFix__: "syntax fix" 206 __syntaxFix__: "syntax fix"
215}); 207});
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/NewUserWizardController.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/NewUserWizardController.js
index 7db6888..b70aa17 100644
--- a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/NewUserWizardController.js
+++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/NewUserWizardController.js
@@ -1,466 +1,458 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2013 Clipperz Srl
4 4
5This file is part of Clipperz Community Edition. 5This file is part of Clipperz, the online password manager.
6Clipperz Community Edition is an online password manager.
7For further information about its features and functionalities please 6For further information about its features and functionalities please
8refer to http://www.clipperz.com. 7refer to http://www.clipperz.com.
9 8
10* Clipperz Community Edition is free software: you can redistribute 9* Clipperz is free software: you can redistribute it and/or modify it
11 it and/or modify it under the terms of the GNU Affero General Public 10 under the terms of the GNU Affero General Public License as published
12 License as published by the Free Software Foundation, either version 11 by the Free Software Foundation, either version 3 of the License, or
13 3 of the License, or (at your option) any later version. 12 (at your option) any later version.
14 13
15* Clipperz Community Edition is distributed in the hope that it will 14* Clipperz is distributed in the hope that it will be useful, but
16 be useful, but WITHOUT ANY WARRANTY; without even the implied 15 WITHOUT ANY WARRANTY; without even the implied warranty of
17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU Affero General Public License for more details. 17 See the GNU Affero General Public License for more details.
19 18
20* You should have received a copy of the GNU Affero General Public 19* You should have received a copy of the GNU Affero General Public
21 License along with Clipperz Community Edition. If not, see 20 License along with Clipperz. If not, see http://www.gnu.org/licenses/.
22 <http://www.gnu.org/licenses/>.
23 21
24*/ 22*/
25 23
26Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers'); 24Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers');
27 25
28Clipperz.PM.UI.Web.Controllers.NewUserWizardController = function(args) { 26Clipperz.PM.UI.Web.Controllers.NewUserWizardController = function(args) {
29 this._newUserCreationComponent = args.newUserCreationComponent|| Clipperz.Base.exception.raise('MandatoryParameter'); 27 this._newUserCreationComponent = args.newUserCreationComponent|| Clipperz.Base.exception.raise('MandatoryParameter');
30 28
31 MochiKit.Signal.connect(this._newUserCreationComponent, 'changedValue',this, 'handleChangedValue'); 29 MochiKit.Signal.connect(this._newUserCreationComponent, 'changedValue',this, 'handleChangedValue');
32 MochiKit.Signal.connect(this._newUserCreationComponent, 'moveForward',this, 'handleMoveForward'); 30 MochiKit.Signal.connect(this._newUserCreationComponent, 'moveForward',this, 'handleMoveForward');
33 MochiKit.Signal.connect(this._newUserCreationComponent, 'keyPressed',this, 'handleNewUserCreationComponentKeyPressed'); 31 MochiKit.Signal.connect(this._newUserCreationComponent, 'keyPressed',this, 'handleNewUserCreationComponentKeyPressed');
34 32
35 this._rulerComponent = null; 33 this._rulerComponent = null;
36 34
37 this._steps = null; 35 this._steps = null;
38 this._currentStepIndex = 0; 36 this._currentStepIndex = 0;
39 this._isNextEnabled = false; 37 this._isNextEnabled = false;
40 38
41 this._userCreationState = 'IDLE'; //'IN PROGRESS', 'DONE', 'FAILED' 39 this._userCreationState = 'IDLE'; //'IN PROGRESS', 'DONE', 'FAILED'
42 this._user = null; 40 this._user = null;
43 return this; 41 return this;
44} 42}
45 43
46MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.NewUserWizardController.prototype, { 44MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.NewUserWizardController.prototype, {
47 45
48 'toString': function() { 46 'toString': function() {
49 return "Clipperz.PM.UI.Web.Controllers.NewUserWizardController"; 47 return "Clipperz.PM.UI.Web.Controllers.NewUserWizardController";
50 }, 48 },
51 49
52 //------------------------------------------------------------------------- 50 //-------------------------------------------------------------------------
53 51
54 'newUserCreationComponent': function () { 52 'newUserCreationComponent': function () {
55 return this._newUserCreationComponent; 53 return this._newUserCreationComponent;
56 }, 54 },
57 55
58 //============================================================================= 56 //=============================================================================
59 57
60 'user': function () { 58 'user': function () {
61 return this._user; 59 return this._user;
62 }, 60 },
63 61
64 'setUser': function (aValue) { 62 'setUser': function (aValue) {
65 this._user = aValue; 63 this._user = aValue;
66 }, 64 },
67 65
68 //----------------------------------------------------------------------------- 66 //-----------------------------------------------------------------------------
69 67
70 'userCreationState': function () { 68 'userCreationState': function () {
71 return this._userCreationState; 69 return this._userCreationState;
72 }, 70 },
73 71
74 'setUserCreationState': function (aValue) { 72 'setUserCreationState': function (aValue) {
75//console.log("+++ NewUserWizardController.setUserCreationState", aValue);
76 this._userCreationState = aValue; 73 this._userCreationState = aValue;
77 this.checkState(); 74 this.checkState();
78 }, 75 },
79 76
80 //============================================================================= 77 //=============================================================================
81 78
82 'resetCurrentStepIndex': function () { 79 'resetCurrentStepIndex': function () {
83 this._currentStepIndex = 0; 80 this._currentStepIndex = 0;
84 this.rulerComponent().resetStatus({animateTransition:true}); 81 this.rulerComponent().resetStatus({animateTransition:true});
85 }, 82 },
86 83
87 //----------------------------------------------------------------------------- 84 //-----------------------------------------------------------------------------
88 85
89 'enableNext': function (aValue) { 86 'enableNext': function (aValue) {
90 this.rulerComponent().enableNext(aValue); 87 this.rulerComponent().enableNext(aValue);
91 this._isNextEnabled = aValue; 88 this._isNextEnabled = aValue;
92 }, 89 },
93 90
94 'isNextEnabled': function () { 91 'isNextEnabled': function () {
95 return this._isNextEnabled; 92 return this._isNextEnabled;
96 }, 93 },
97 94
98 //----------------------------------------------------------------------------- 95 //-----------------------------------------------------------------------------
99 96
100 'enablePrevious': function (aValue) { 97 'enablePrevious': function (aValue) {
101 this.rulerComponent().enablePrevious(aValue); 98 this.rulerComponent().enablePrevious(aValue);
102 }, 99 },
103 100
104 //============================================================================= 101 //=============================================================================
105 102
106 'rulerComponent': function () { 103 'rulerComponent': function () {
107 if (this._rulerComponent == null) { 104 if (this._rulerComponent == null) {
108 this._rulerComponent = new Clipperz.PM.UI.Web.Components.RulerComponent({ 105 this._rulerComponent = new Clipperz.PM.UI.Web.Components.RulerComponent({
109 translationContext:'Wizards.NewUserWizard' 106 translationContext:'Wizards.NewUserWizard'
110 }); 107 });
111 this._rulerComponent.render(); 108 this._rulerComponent.render();
112 109
113 MochiKit.Signal.connect(this._rulerComponent, 'exit', this, 'handleExit'); 110 MochiKit.Signal.connect(this._rulerComponent, 'exit', this, 'handleExit');
114 MochiKit.Signal.connect(this._rulerComponent, 'done', this, 'done'); 111 MochiKit.Signal.connect(this._rulerComponent, 'done', this, 'done');
115 MochiKit.Signal.connect(this._rulerComponent, 'moveForward',this, 'handleMoveForward'); 112 MochiKit.Signal.connect(this._rulerComponent, 'moveForward',this, 'handleMoveForward');
116 MochiKit.Signal.connect(this._rulerComponent, 'moveBackward',this, 'handleMoveBackward'); 113 MochiKit.Signal.connect(this._rulerComponent, 'moveBackward',this, 'handleMoveBackward');
117 MochiKit.Signal.connect(this._rulerComponent, 'cursorMoved',this, 'handleCursorMoved'); 114 MochiKit.Signal.connect(this._rulerComponent, 'cursorMoved',this, 'handleCursorMoved');
118 } 115 }
119 116
120 return this._rulerComponent; 117 return this._rulerComponent;
121 }, 118 },
122 119
123 'resetRuler': function () { 120 'resetRuler': function () {
124 // if (this._rulerComponent != null) { 121 // if (this._rulerComponent != null) {
125 // this._rulerComponent.clear(); 122 // this._rulerComponent.clear();
126 // } 123 // }
127 // this._rulerComponent = null; 124 // this._rulerComponent = null;
128 }, 125 },
129 126
130 //----------------------------------------------------------------------------- 127 //-----------------------------------------------------------------------------
131 128
132 'showRuler': function (someSteps) { 129 'showRuler': function (someSteps) {
133 var rulerElement; 130 var rulerElement;
134 131
135 this.setSteps(someSteps); 132 this.setSteps(someSteps);
136 133
137 rulerElement = this.rulerComponent().element(); 134 rulerElement = this.rulerComponent().element();
138 this.newUserCreationComponent().disableAllPanels(); 135 this.newUserCreationComponent().disableAllPanels();
139 136
140 MochiKit.Style.showElement(rulerElement); 137 MochiKit.Style.showElement(rulerElement);
141 MochiKit.Style.setElementPosition(rulerElement, {x:-1000, y:this.newUserCreationComponent().bottomMargin()}); 138 MochiKit.Style.setElementPosition(rulerElement, {x:-1000, y:this.newUserCreationComponent().bottomMargin()});
142 new MochiKit.Visual.Move(rulerElement, { 139 new MochiKit.Visual.Move(rulerElement, {
143 x:0, y:this.newUserCreationComponent().bottomMargin(), 140 x:0, y:this.newUserCreationComponent().bottomMargin(),
144 mode:'absolute', 141 mode:'absolute',
145 duration:0.5, 142 duration:0.5,
146 // afterFinish:MochiKit.Base.method(this, 'handleCursorMoved') 143 // afterFinish:MochiKit.Base.method(this, 'handleCursorMoved')
147 afterFinish:MochiKit.Base.method(this, 'handleRulerShowed') 144 afterFinish:MochiKit.Base.method(this, 'handleRulerShowed')
148 }); 145 });
149 }, 146 },
150 147
151 //----------------------------------------------------------------------------- 148 //-----------------------------------------------------------------------------
152 149
153 'handleRulerShowed':function () { 150 'handleRulerShowed':function () {
154 return Clipperz.Async.callbacks("NewUserWizardController.handlerRulerShowed", [ 151 return Clipperz.Async.callbacks("NewUserWizardController.handlerRulerShowed", [
155 MochiKit.Base.method(this.newUserCreationComponent(), 'waitUntilFullyRendered'), 152 MochiKit.Base.method(this.newUserCreationComponent(), 'waitUntilFullyRendered'),
156 MochiKit.Base.method(this, 'handleCursorMoved') 153 MochiKit.Base.method(this, 'handleCursorMoved')
157 ], {trace:false}); 154 ], {trace:false});
158 }, 155 },
159 156
160 //----------------------------------------------------------------------------- 157 //-----------------------------------------------------------------------------
161 158
162 'hideRuler': function () { 159 'hideRuler': function () {
163 new MochiKit.Visual.Move(this.rulerComponent().element(), {x:-1000, mode:'relative', duration:0.5}); 160 new MochiKit.Visual.Move(this.rulerComponent().element(), {x:-1000, mode:'relative', duration:0.5});
164 }, 161 },
165 162
166 'doneWithRuler': function () { 163 'doneWithRuler': function () {
167 var rulerComponentElement; 164 var rulerComponentElement;
168 165
169 rulerComponentElement = this.rulerComponent().element(); 166 rulerComponentElement = this.rulerComponent().element();
170 new MochiKit.Visual.Move(this.rulerComponent().element(), { 167 new MochiKit.Visual.Move(this.rulerComponent().element(), {
171 x:1000, 168 x:1000,
172 mode:'relative', 169 mode:'relative',
173 duration:1, 170 duration:1,
174 // afterFinish:MochiKit.Base.partial(MochiKit.Style.hideElement, rulerComponentElement) 171 // afterFinish:MochiKit.Base.partial(MochiKit.Style.hideElement, rulerComponentElement)
175 afterFinish:function () { MochiKit.Style.hideElement(rulerComponentElement); } 172 afterFinish:function () { MochiKit.Style.hideElement(rulerComponentElement); }
176 }); 173 });
177 }, 174 },
178 175
179 //============================================================================= 176 //=============================================================================
180 177
181 'createNewUserRulerSteps': function () { 178 'createNewUserRulerSteps': function () {
182 return [ 'CREDENTIALS', 'CHECK_CREDENTIALS', 'TERMS_OF_SERVICE', 'CREATE_USER'/*, 'LOGIN' */]; 179 return [ 'CREDENTIALS', 'CHECK_CREDENTIALS', 'TERMS_OF_SERVICE', 'CREATE_USER'/*, 'LOGIN' */];
183 }, 180 },
184 181
185 //------------------------------------------------------------------------- 182 //-------------------------------------------------------------------------
186 183
187 'run': function () { 184 'run': function () {
188 return Clipperz.Async.callbacks("NewUserWizardController.run", [ 185 return Clipperz.Async.callbacks("NewUserWizardController.run", [
189 MochiKit.Base.method(this, 'createNewUserRulerSteps'), 186 MochiKit.Base.method(this, 'createNewUserRulerSteps'),
190 MochiKit.Base.method(this, 'showRuler') 187 MochiKit.Base.method(this, 'showRuler')
191 ], {trace:false}); 188 ], {trace:false});
192 }, 189 },
193 190
194 //----------------------------------------------------------------------------- 191 //-----------------------------------------------------------------------------
195 192
196 'checkState': function () { 193 'checkState': function () {
197 var enablePrevious; 194 var enablePrevious;
198 var enableNext; 195 var enableNext;
199 196
200 enablePrevious = true; 197 enablePrevious = true;
201 enableNext = false; 198 enableNext = false;
202 199
203 this.newUserCreationComponent().disableAllPanels(); 200 this.newUserCreationComponent().disableAllPanels();
204 201
205 switch(this.currentStep()) { 202 switch(this.currentStep()) {
206 case 'CREDENTIALS': 203 case 'CREDENTIALS':
207 this.newUserCreationComponent().enableCredentialsPanel(); 204 this.newUserCreationComponent().enableCredentialsPanel();
208 205
209 enableNext = ( 206 enableNext = (
210 (this.newUserCreationComponent().username() != '') 207 (this.newUserCreationComponent().username() != '')
211 && 208 &&
212 (this.newUserCreationComponent().passphrase() != '') 209 (this.newUserCreationComponent().passphrase() != '')
213 ); 210 );
214 // enablePrevious = false; 211 // enablePrevious = false;
215 break; 212 break;
216 case 'CHECK_CREDENTIALS': 213 case 'CHECK_CREDENTIALS':
217 this.newUserCreationComponent().enableCheckCredentialsPanel(); 214 this.newUserCreationComponent().enableCheckCredentialsPanel();
218 215
219 enableNext = (this.newUserCreationComponent().passphrase() == this.newUserCreationComponent().rePassphrase()); 216 enableNext = (this.newUserCreationComponent().passphrase() == this.newUserCreationComponent().rePassphrase());
220 // enablePrevious = true; 217 // enablePrevious = true;
221 break 218 break
222 case 'TERMS_OF_SERVICE': 219 case 'TERMS_OF_SERVICE':
223 this.newUserCreationComponent().enableTermsOfServicePanel(); 220 this.newUserCreationComponent().enableTermsOfServicePanel();
224 221
225//console.log("awareOfUnrecoverablePassphrase", this.newUserCreationComponent().awareOfUnrecoverablePassphrase());
226//console.log("readTermsOfService", this.newUserCreationComponent().readTermsOfService());
227 enableNext = ( 222 enableNext = (
228 (this.newUserCreationComponent().awareOfUnrecoverablePassphrase() == 'on') 223 (this.newUserCreationComponent().awareOfUnrecoverablePassphrase() == 'on')
229 && 224 &&
230 (this.newUserCreationComponent().readTermsOfService() == 'on') 225 (this.newUserCreationComponent().readTermsOfService() == 'on')
231 ) 226 )
232 break; 227 break;
233 case 'CREATE_USER': 228 case 'CREATE_USER':
234//console.log(">>> CREATE_USER", this.userCreationState());
235 this.newUserCreationComponent().enableCreateUserPanel(); 229 this.newUserCreationComponent().enableCreateUserPanel();
236 230
237 switch (this.userCreationState()) { 231 switch (this.userCreationState()) {
238 case 'IDLE': 232 case 'IDLE':
239 this.setUserCreationState('IN PROGRESS'); 233 this.setUserCreationState('IN PROGRESS');
240 this.preformActualUserRegistration(); 234 this.preformActualUserRegistration();
241 235
242 enablePrevious = false; 236 enablePrevious = false;
243 enableNext = false; 237 enableNext = false;
244 break; 238 break;
245 case 'IN PROGRESS': 239 case 'IN PROGRESS':
246 enablePrevious = false; 240 enablePrevious = false;
247 enableNext = false; 241 enableNext = false;
248 break; 242 break;
249 case 'DONE': 243 case 'DONE':
250 enablePrevious = false; 244 enablePrevious = false;
251 enableNext = true; 245 enableNext = true;
252 break; 246 break;
253 case 'FAILED': 247 case 'FAILED':
254 enablePrevious = true; 248 enablePrevious = true;
255 enableNext = false; 249 enableNext = false;
256 break; 250 break;
257 }; 251 };
258 break; 252 break;
259 // case 'LOGIN': 253 // case 'LOGIN':
260 // this.newUserCreationComponent().enableLoginPanel(); 254 // this.newUserCreationComponent().enableLoginPanel();
261 // break; 255 // break;
262 } 256 }
263 257
264 if (this.currentStepIndex() > 0) { 258 if (this.currentStepIndex() > 0) {
265 this.enablePrevious(enablePrevious); 259 this.enablePrevious(enablePrevious);
266 } else { 260 } else {
267 this.enablePrevious(false); 261 this.enablePrevious(false);
268 } 262 }
269 this.enableNext(enableNext); 263 this.enableNext(enableNext);
270 }, 264 },
271 265
272 //----------------------------------------------------------------------------- 266 //-----------------------------------------------------------------------------
273 267
274 'setFocus': function () { 268 'setFocus': function () {
275 switch(this.currentStep()) { 269 switch(this.currentStep()) {
276 case 'CREDENTIALS': 270 case 'CREDENTIALS':
277 this.newUserCreationComponent().focusOnUsernameElement(); 271 this.newUserCreationComponent().focusOnUsernameElement();
278 break; 272 break;
279 case 'CHECK_CREDENTIALS': 273 case 'CHECK_CREDENTIALS':
280 this.newUserCreationComponent().focusOnRePassphraseElement(); 274 this.newUserCreationComponent().focusOnRePassphraseElement();
281 break 275 break
282 case 'TERMS_OF_SERVICE': 276 case 'TERMS_OF_SERVICE':
283 break; 277 break;
284 case 'CREATE_USER': 278 case 'CREATE_USER':
285 break; 279 break;
286 // case 'LOGIN': 280 // case 'LOGIN':
287 // break; 281 // break;
288 } 282 }
289 }, 283 },
290 284
291 //============================================================================= 285 //=============================================================================
292 286
293 'steps': function () { 287 'steps': function () {
294 return this._steps; 288 return this._steps;
295 }, 289 },
296 290
297 'setSteps': function (aValue) { 291 'setSteps': function (aValue) {
298 this._steps = aValue; 292 this._steps = aValue;
299 293
300 this.rulerComponent().setSteps(aValue); 294 this.rulerComponent().setSteps(aValue);
301 this.resetCurrentStepIndex(); 295 this.resetCurrentStepIndex();
302 }, 296 },
303 297
304 'currentStepIndex': function () { 298 'currentStepIndex': function () {
305 return this._currentStepIndex; 299 return this._currentStepIndex;
306 }, 300 },
307 301
308 'currentStep': function () { 302 'currentStep': function () {
309 return this.steps()[this.currentStepIndex()]; 303 return this.steps()[this.currentStepIndex()];
310 }, 304 },
311 305
312 //============================================================================= 306 //=============================================================================
313 307
314 'handleExit': function () { 308 'handleExit': function () {
315 return Clipperz.Async.callbacks("NewUserWizardController.handleExit", [ 309 return Clipperz.Async.callbacks("NewUserWizardController.handleExit", [
316 // MochiKit.Base.method(this.newUserCreationComponent(), 'resetContent'), 310 // MochiKit.Base.method(this.newUserCreationComponent(), 'resetContent'),
317 Clipperz.Async.forkAndJoin("NewUserWizardController.handleExit - fork and join", [ 311 Clipperz.Async.forkAndJoin("NewUserWizardController.handleExit - fork and join", [
318 MochiKit.Base.method(this, 'hideRuler'), 312 MochiKit.Base.method(this, 'hideRuler'),
319 MochiKit.Base.method(this.newUserCreationComponent(), 'deferredHideModal') 313 MochiKit.Base.method(this.newUserCreationComponent(), 'deferredHideModal')
320 ], {trace:false}), 314 ], {trace:false}),
321 MochiKit.Base.method(this, 'resetRuler'), 315 MochiKit.Base.method(this, 'resetRuler'),
322 // MochiKit.Base.method(this.newUserCreationComponent(), 'reset'), 316 // MochiKit.Base.method(this.newUserCreationComponent(), 'reset'),
323 MochiKit.Base.partial(MochiKit.Signal.signal, this, 'exit') 317 MochiKit.Base.partial(MochiKit.Signal.signal, this, 'exit')
324 ], {trace:false}) 318 ], {trace:false})
325 }, 319 },
326 320
327 'done': function () { 321 'done': function () {
328 this.doneWithRuler(); 322 this.doneWithRuler();
329 MochiKit.Signal.signal(this, 'done', {'user': this.user()}); 323 MochiKit.Signal.signal(this, 'done', {'user': this.user()});
330 }, 324 },
331 325
332 //============================================================================= 326 //=============================================================================
333 327
334 'handleMoveBackward': function () { 328 'handleMoveBackward': function () {
335 if (this._currentStepIndex > 0) { 329 if (this._currentStepIndex > 0) {
336 varafterMoveAction; 330 varafterMoveAction;
337 331
338 afterMoveAction = MochiKit.Base.noop; 332 afterMoveAction = MochiKit.Base.noop;
339 333
340//console.log("<-- backward", this.currentStep());
341 switch(this.currentStep()) { 334 switch(this.currentStep()) {
342 case 'CREDENTIALS': 335 case 'CREDENTIALS':
343 case 'CHECK_CREDENTIALS': 336 case 'CHECK_CREDENTIALS':
344 case 'TERMS_OF_SERVICE': 337 case 'TERMS_OF_SERVICE':
345 this._currentStepIndex --; 338 this._currentStepIndex --;
346 this.rulerComponent().moveBackward(afterMoveAction); 339 this.rulerComponent().moveBackward(afterMoveAction);
347 break; 340 break;
348 case 'CREATE_USER': 341 case 'CREATE_USER':
349 this.setUser(null); 342 this.setUser(null);
350 this.newUserCreationComponent().hideAllProgeressStates(); 343 this.newUserCreationComponent().hideAllProgeressStates();
351 this.resetCurrentStepIndex(); 344 this.resetCurrentStepIndex();
352 this.setUserCreationState('IDLE'); 345 this.setUserCreationState('IDLE');
353 break; 346 break;
354 // case 'LOGIN': 347 // case 'LOGIN':
355 // break; 348 // break;
356 }; 349 };
357 350
358 } 351 }
359 352
360 if (this._currentStepIndex == 0) { 353 if (this._currentStepIndex == 0) {
361 this.enablePrevious(false); 354 this.enablePrevious(false);
362 } 355 }
363 }, 356 },
364 357
365 'handleMoveForward': function () { 358 'handleMoveForward': function () {
366 if (this.isNextEnabled()) { 359 if (this.isNextEnabled()) {
367 varafterMoveAction; 360 varafterMoveAction;
368 361
369 this._currentStepIndex ++; 362 this._currentStepIndex ++;
370 afterMoveAction = MochiKit.Base.noop; 363 afterMoveAction = MochiKit.Base.noop;
371 364
372 switch(this.currentStep()) { 365 switch(this.currentStep()) {
373 case 'CREDENTIALS': 366 case 'CREDENTIALS':
374 break; 367 break;
375 case 'CHECK_CREDENTIALS': 368 case 'CHECK_CREDENTIALS':
376 break 369 break
377 case 'TERMS_OF_SERVICE': 370 case 'TERMS_OF_SERVICE':
378 break; 371 break;
379 case 'CREATE_USER': 372 case 'CREATE_USER':
380 break; 373 break;
381 // case 'LOGIN': 374 // case 'LOGIN':
382 // break; 375 // break;
383 }; 376 };
384 377
385 this.rulerComponent().moveForward(afterMoveAction); 378 this.rulerComponent().moveForward(afterMoveAction);
386 }; 379 };
387 }, 380 },
388 381
389 'handleCursorMoved': function () { 382 'handleCursorMoved': function () {
390 // this.checkState(); 383 // this.checkState();
391 // this.setFocus(); 384 // this.setFocus();
392 385
393 return Clipperz.Async.callbacks("NewUserWizardController.handleCursorMoved", [ 386 return Clipperz.Async.callbacks("NewUserWizardController.handleCursorMoved", [
394 MochiKit.Base.method(this.newUserCreationComponent(), 'waitUntilFullyRendered'), 387 MochiKit.Base.method(this.newUserCreationComponent(), 'waitUntilFullyRendered'),
395 MochiKit.Base.method(this, 'checkState'), 388 MochiKit.Base.method(this, 'checkState'),
396 MochiKit.Base.method(this, 'setFocus') 389 MochiKit.Base.method(this, 'setFocus')
397 ], {trace:false}); 390 ], {trace:false});
398 }, 391 },
399 392
400 //------------------------------------------------------------------------- 393 //-------------------------------------------------------------------------
401 394
402 'handleChangedValue': function (anEvent) { 395 'handleChangedValue': function (anEvent) {
403 this.checkState(); 396 this.checkState();
404 }, 397 },
405 398
406 //------------------------------------------------------------------------- 399 //-------------------------------------------------------------------------
407 400
408 'handleNewUserCreationComponentKeyPressed': function (anEvent) { 401 'handleNewUserCreationComponentKeyPressed': function (anEvent) {
409//console.log(">>> handleNewUserCreationComponentKeyPressed", anEvent.key().string);
410 if (anEvent.key().string == 'KEY_ENTER') { 402 if (anEvent.key().string == 'KEY_ENTER') {
411 if (anEvent.target().nodeName != 'TEXTAREA') { 403 if (anEvent.target().nodeName != 'TEXTAREA') {
412 anEvent.preventDefault(); 404 anEvent.preventDefault();
413 this.handleMoveForward(); 405 this.handleMoveForward();
414 } 406 }
415 } else if (anEvent.key().string == 'KEY_TAB') { 407 } else if (anEvent.key().string == 'KEY_TAB') {
416 if (anEvent.target() == this.newUserCreationComponent().usernameElement()) { 408 if (anEvent.target() == this.newUserCreationComponent().usernameElement()) {
417 } else { 409 } else {
418 this.handleMoveForward(); 410 this.handleMoveForward();
419 if ((anEvent.target().nodeName == 'INPUT') || (anEvent.target().nodeName == 'TEXTAREA')) { 411 if ((anEvent.target().nodeName == 'INPUT') || (anEvent.target().nodeName == 'TEXTAREA')) {
420 anEvent.preventDefault(); 412 anEvent.preventDefault();
421 } 413 }
422 } 414 }
423 } else if ((anEvent.key().string == 'KEY_ARROW_RIGHT') && (anEvent.modifier().meta == true)) { 415 } else if ((anEvent.key().string == 'KEY_ARROW_RIGHT') && (anEvent.modifier().meta == true)) {
424 this.handleMoveForward(); 416 this.handleMoveForward();
425 } else if ((anEvent.key().string == 'KEY_ARROW_LEFT') && (anEvent.modifier().meta == true)) { 417 } else if ((anEvent.key().string == 'KEY_ARROW_LEFT') && (anEvent.modifier().meta == true)) {
426 this.handleMoveBackward(); 418 this.handleMoveBackward();
427 } else if (anEvent.key().string == 'KEY_ESCAPE') { 419 } else if (anEvent.key().string == 'KEY_ESCAPE') {
428 anEvent.stop(); 420 anEvent.stop();
429 this.handleExit(); 421 this.handleExit();
430 } else { 422 } else {
431 MochiKit.Async.callLater(0.1, MochiKit.Base.method(this, 'checkState')); 423 MochiKit.Async.callLater(0.1, MochiKit.Base.method(this, 'checkState'));
432 } 424 }
433 }, 425 },
434 426
435 //============================================================================= 427 //=============================================================================
436 428
437 'preformActualUserRegistration': function () { 429 'preformActualUserRegistration': function () {
438 vardeferredResult; 430 vardeferredResult;
439 431
440 deferredResult = new Clipperz.Async.Deferred("NewUSerWizardController.preformActualUserRegistration", {trace:false}); 432 deferredResult = new Clipperz.Async.Deferred("NewUSerWizardController.preformActualUserRegistration", {trace:false});
441 deferredResult.addMethod(this.newUserCreationComponent(), 'showProgressOnUserCreation'); 433 deferredResult.addMethod(this.newUserCreationComponent(), 'showProgressOnUserCreation');
442 deferredResult.addMethod(Clipperz.PM.RunTime.mainController, 'setPassphraseDelegate', MochiKit.Base.method(this.newUserCreationComponent(), 'passphrase')); 434 deferredResult.addMethod(Clipperz.PM.RunTime.mainController, 'setPassphraseDelegate', MochiKit.Base.method(this.newUserCreationComponent(), 'passphrase'));
443 deferredResult.addCallback(Clipperz.PM.DataModel.User.registerNewAccount, 435 deferredResult.addCallback(Clipperz.PM.DataModel.User.registerNewAccount,
444 this.newUserCreationComponent().username(), 436 this.newUserCreationComponent().username(),
445 MochiKit.Base.method(Clipperz.PM.RunTime.mainController, 'getPassphrase') 437 MochiKit.Base.method(Clipperz.PM.RunTime.mainController, 'getPassphrase')
446 ); 438 );
447 deferredResult.addMethod(this, 'setUser'); 439 deferredResult.addMethod(this, 'setUser');
448 deferredResult.addMethod(this.newUserCreationComponent(), 'showUserCreationDone'); 440 deferredResult.addMethod(this.newUserCreationComponent(), 'showUserCreationDone');
449 deferredResult.addMethod(this, 'setUserCreationState', 'DONE'); 441 deferredResult.addMethod(this, 'setUserCreationState', 'DONE');
450 442
451 // deferredResult.addErrback(MochiKit.Base.method(this.newUserCreationComponent(), 'showUserCreationFailed')); 443 // deferredResult.addErrback(MochiKit.Base.method(this.newUserCreationComponent(), 'showUserCreationFailed'));
452 // deferredResult.addErrback(MochiKit.Base.method(this, 'setUser', null)); 444 // deferredResult.addErrback(MochiKit.Base.method(this, 'setUser', null));
453 // deferredResult.addErrback(MochiKit.Base.method(this, 'setUserCreationState', 'FAILED')); 445 // deferredResult.addErrback(MochiKit.Base.method(this, 'setUserCreationState', 'FAILED'));
454 deferredResult.addErrback(MochiKit.Base.bind(function (aValue) { 446 deferredResult.addErrback(MochiKit.Base.bind(function (aValue) {
455 this.newUserCreationComponent().showUserCreationFailed(); 447 this.newUserCreationComponent().showUserCreationFailed();
456 this.setUser(null); 448 this.setUser(null);
457 this.setUserCreationState('FAILED'); 449 this.setUserCreationState('FAILED');
458 }, this)); 450 }, this));
459 deferredResult.callback(); 451 deferredResult.callback();
460 452
461 return deferredResult; 453 return deferredResult;
462 }, 454 },
463 455
464 //============================================================================= 456 //=============================================================================
465 __syntaxFix__: "syntax fix" 457 __syntaxFix__: "syntax fix"
466}); 458});