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) (ignore 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,70 +1,68 @@
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 },
@@ -118,97 +116,96 @@ MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.DirectLoginWizardController.
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
@@ -362,98 +359,96 @@ MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.DirectLoginWizardController.
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 },