summaryrefslogtreecommitdiff
path: root/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/DirectLoginWizardController.js
Unidiff
Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/DirectLoginWizardController.js') (more/less context) (show whitespace changes)
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/DirectLoginWizardController.js25
1 files changed, 10 insertions, 15 deletions
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,46 +1,44 @@
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;
@@ -142,49 +140,48 @@ MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.DirectLoginWizardController.
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
@@ -386,50 +383,48 @@ MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.DirectLoginWizardController.
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 --;