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.js | 15 |
1 files changed, 6 insertions, 9 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 38fdc08..c025a51 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/DirectLoginWizardController.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/DirectLoginWizardController.js | |||
@@ -1,408 +1,405 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2011 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz's Javascript Crypto Library. | 5 | This file is part of Clipperz Community Edition. |
6 | Javascript Crypto Library provides web developers with an extensive | 6 | Clipperz Community Edition is an online password manager. |
7 | and efficient set of cryptographic functions. The library aims to | ||
8 | obtain maximum execution speed while preserving modularity and | ||
9 | reusability. | ||
10 | For further information about its features and functionalities please | 7 | For further information about its features and functionalities please |
11 | refer to http://www.clipperz.com | 8 | refer to http://www.clipperz.com. |
12 | 9 | ||
13 | * Javascript Crypto Library is free software: you can redistribute | 10 | * Clipperz Community Edition is free software: you can redistribute |
14 | it and/or modify it under the terms of the GNU Affero General Public | 11 | it and/or modify it under the terms of the GNU Affero General Public |
15 | License as published by the Free Software Foundation, either version | 12 | License as published by the Free Software Foundation, either version |
16 | 3 of the License, or (at your option) any later version. | 13 | 3 of the License, or (at your option) any later version. |
17 | 14 | ||
18 | * Javascript Crypto Library is distributed in the hope that it will | 15 | * Clipperz Community Edition is distributed in the hope that it will |
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 16 | be useful, but WITHOUT ANY WARRANTY; without even the implied |
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
21 | See the GNU Affero General Public License for more details. | 18 | See the GNU Affero General Public License for more details. |
22 | 19 | ||
23 | * You should have received a copy of the GNU Affero General Public | 20 | * You should have received a copy of the GNU Affero General Public |
24 | License along with Javascript Crypto Library. If not, see | 21 | License along with Clipperz Community Edition. If not, see |
25 | <http://www.gnu.org/licenses/>. | 22 | <http://www.gnu.org/licenses/>. |
26 | 23 | ||
27 | */ | 24 | */ |
28 | 25 | ||
29 | Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers'); | 26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers'); |
30 | 27 | ||
31 | Clipperz.PM.UI.Web.Controllers.DirectLoginWizardController = function(args) { | 28 | Clipperz.PM.UI.Web.Controllers.DirectLoginWizardController = function(args) { |
32 | this._directLoginEditingComponent = args.directLoginEditingComponent|| Clipperz.Base.exception.raise('MandatoryParameter'); | 29 | this._directLoginEditingComponent = args.directLoginEditingComponent|| Clipperz.Base.exception.raise('MandatoryParameter'); |
33 | this._cardLabel = args.cardLabel || Clipperz.Base.exception.raise('MandatoryParameter'); | 30 | this._cardLabel = args.cardLabel || Clipperz.Base.exception.raise('MandatoryParameter'); |
34 | 31 | ||
35 | MochiKit.Signal.connect(this._directLoginEditingComponent, 'changedValue',this, 'handleChangedValue'); | 32 | MochiKit.Signal.connect(this._directLoginEditingComponent, 'changedValue',this, 'handleChangedValue'); |
36 | MochiKit.Signal.connect(this._directLoginEditingComponent, 'moveForward',this, 'handleMoveForward'); | 33 | MochiKit.Signal.connect(this._directLoginEditingComponent, 'moveForward',this, 'handleMoveForward'); |
37 | MochiKit.Signal.connect(this._directLoginEditingComponent, 'keyPressed',this, 'handleDirectLoginEditingComponentKeyPressed'); | 34 | MochiKit.Signal.connect(this._directLoginEditingComponent, 'keyPressed',this, 'handleDirectLoginEditingComponentKeyPressed'); |
38 | 35 | ||
39 | this._directLogin = null; | 36 | this._directLogin = null; |
40 | this._directLoginHasJustBeenAdded = false; | 37 | this._directLoginHasJustBeenAdded = false; |
41 | 38 | ||
42 | this._rulerComponent = null; | 39 | this._rulerComponent = null; |
43 | 40 | ||
44 | this._steps = null; | 41 | this._steps = null; |
45 | this._currentStepIndex = 0; | 42 | this._currentStepIndex = 0; |
46 | this._isNextEnabled = false; | 43 | this._isNextEnabled = false; |
47 | 44 | ||
48 | this._recordFields = null; | 45 | this._recordFields = null; |
49 | this._originalBindings = null; | 46 | this._originalBindings = null; |
50 | 47 | ||
51 | this._bindingComponents = []; | 48 | this._bindingComponents = []; |
52 | this._formValueComponents = []; | 49 | this._formValueComponents = []; |
53 | 50 | ||
54 | return this; | 51 | return this; |
55 | } | 52 | } |
56 | 53 | ||
57 | MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.DirectLoginWizardController.prototype, { | 54 | MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.DirectLoginWizardController.prototype, { |
58 | 55 | ||
59 | 'toString': function() { | 56 | 'toString': function() { |
60 | return "Clipperz.PM.UI.Web.Controllers.DirectLoginWizardController"; | 57 | return "Clipperz.PM.UI.Web.Controllers.DirectLoginWizardController"; |
61 | }, | 58 | }, |
62 | 59 | ||
63 | //------------------------------------------------------------------------- | 60 | //------------------------------------------------------------------------- |
64 | 61 | ||
65 | 'directLogin': function () { | 62 | 'directLogin': function () { |
66 | return this._directLogin; | 63 | return this._directLogin; |
67 | }, | 64 | }, |
68 | 65 | ||
69 | //------------------------------------------------------------------------- | 66 | //------------------------------------------------------------------------- |
70 | 67 | ||
71 | 'directLoginHasJustBeenAdded': function () { | 68 | 'directLoginHasJustBeenAdded': function () { |
72 | return this._directLoginHasJustBeenAdded; | 69 | return this._directLoginHasJustBeenAdded; |
73 | }, | 70 | }, |
74 | 71 | ||
75 | 'setDirectLoginHasJustBeenAdded': function (aValue) { | 72 | 'setDirectLoginHasJustBeenAdded': function (aValue) { |
76 | this._directLoginHasJustBeenAdded = aValue; | 73 | this._directLoginHasJustBeenAdded = aValue; |
77 | }, | 74 | }, |
78 | 75 | ||
79 | //------------------------------------------------------------------------- | 76 | //------------------------------------------------------------------------- |
80 | 77 | ||
81 | 'directLoginEditingComponent': function () { | 78 | 'directLoginEditingComponent': function () { |
82 | return this._directLoginEditingComponent; | 79 | return this._directLoginEditingComponent; |
83 | }, | 80 | }, |
84 | 81 | ||
85 | //============================================================================= | 82 | //============================================================================= |
86 | 83 | ||
87 | 'cardLabel': function () { | 84 | 'cardLabel': function () { |
88 | return this._cardLabel; | 85 | return this._cardLabel; |
89 | }, | 86 | }, |
90 | 87 | ||
91 | //============================================================================= | 88 | //============================================================================= |
92 | 89 | ||
93 | 'resetCurrentStepIndex': function () { | 90 | 'resetCurrentStepIndex': function () { |
94 | this._currentStepIndex = 0; | 91 | this._currentStepIndex = 0; |
95 | this.rulerComponent().resetStatus(); | 92 | this.rulerComponent().resetStatus(); |
96 | }, | 93 | }, |
97 | 94 | ||
98 | //----------------------------------------------------------------------------- | 95 | //----------------------------------------------------------------------------- |
99 | 96 | ||
100 | 'enableNext': function (aValue) { | 97 | 'enableNext': function (aValue) { |
101 | this.rulerComponent().enableNext(aValue); | 98 | this.rulerComponent().enableNext(aValue); |
102 | this._isNextEnabled = aValue; | 99 | this._isNextEnabled = aValue; |
103 | }, | 100 | }, |
104 | 101 | ||
105 | 'isNextEnabled': function () { | 102 | 'isNextEnabled': function () { |
106 | return this._isNextEnabled; | 103 | return this._isNextEnabled; |
107 | }, | 104 | }, |
108 | 105 | ||
109 | //----------------------------------------------------------------------------- | 106 | //----------------------------------------------------------------------------- |
110 | 107 | ||
111 | 'enablePrevious': function (aValue) { | 108 | 'enablePrevious': function (aValue) { |
112 | this.rulerComponent().enablePrevious(aValue); | 109 | this.rulerComponent().enablePrevious(aValue); |
113 | }, | 110 | }, |
114 | 111 | ||
115 | //============================================================================= | 112 | //============================================================================= |
116 | 113 | ||
117 | 'bindingComponents': function () { | 114 | 'bindingComponents': function () { |
118 | return this._bindingComponents; | 115 | return this._bindingComponents; |
119 | }, | 116 | }, |
120 | 117 | ||
121 | 'resetBindingComponents': function () { | 118 | 'resetBindingComponents': function () { |
122 | this.directLoginEditingComponent().clearAllBindingsComponents(); | 119 | this.directLoginEditingComponent().clearAllBindingsComponents(); |
123 | this._bindingComponents = []; | 120 | this._bindingComponents = []; |
124 | }, | 121 | }, |
125 | 122 | ||
126 | //============================================================================= | 123 | //============================================================================= |
127 | 124 | ||
128 | 'formValueComponents': function () { | 125 | 'formValueComponents': function () { |
129 | return this._formValueComponents; | 126 | return this._formValueComponents; |
130 | }, | 127 | }, |
131 | 128 | ||
132 | 'resetFormValueComponents': function () { | 129 | 'resetFormValueComponents': function () { |
133 | this.directLoginEditingComponent().clearAllFormValueComponents(); | 130 | this.directLoginEditingComponent().clearAllFormValueComponents(); |
134 | this._formValueComponents = []; | 131 | this._formValueComponents = []; |
135 | }, | 132 | }, |
136 | 133 | ||
137 | //============================================================================= | 134 | //============================================================================= |
138 | 135 | ||
139 | 'recordFields': function () { | 136 | 'recordFields': function () { |
140 | return this._recordFields; | 137 | return this._recordFields; |
141 | }, | 138 | }, |
142 | 139 | ||
143 | 'setRecordFields': function (aValue) { | 140 | 'setRecordFields': function (aValue) { |
144 | this._recordFields = aValue; | 141 | this._recordFields = aValue; |
145 | }, | 142 | }, |
146 | 143 | ||
147 | 'recordFieldWithReference': function (aReference) { | 144 | 'recordFieldWithReference': function (aReference) { |
148 | var matchingValues; | 145 | var matchingValues; |
149 | var result; | 146 | var result; |
150 | 147 | ||
151 | matchingValues = MochiKit.Base.filter(function (aField) { return aField['reference'] == aReference; }, this.recordFields()); | 148 | matchingValues = MochiKit.Base.filter(function (aField) { return aField['reference'] == aReference; }, this.recordFields()); |
152 | 149 | ||
153 | if (matchingValues.length == 0) { | 150 | if (matchingValues.length == 0) { |
154 | result = null; | 151 | result = null; |
155 | } else { | 152 | } else { |
156 | result = matchingValues[0]; | 153 | result = matchingValues[0]; |
157 | } | 154 | } |
158 | 155 | ||
159 | return result; | 156 | return result; |
160 | }, | 157 | }, |
161 | 158 | ||
162 | //----------------------------------------------------------------------------- | 159 | //----------------------------------------------------------------------------- |
163 | 160 | ||
164 | 'originalBindings': function () { | 161 | 'originalBindings': function () { |
165 | return this._originalBindings; | 162 | return this._originalBindings; |
166 | }, | 163 | }, |
167 | 164 | ||
168 | 'setOriginalBindings': function (aValue) { | 165 | 'setOriginalBindings': function (aValue) { |
169 | //console.log("BINDINGS", aValue); | 166 | //console.log("BINDINGS", aValue); |
170 | this._originalBindings = aValue; | 167 | this._originalBindings = aValue; |
171 | }, | 168 | }, |
172 | 169 | ||
173 | //============================================================================= | 170 | //============================================================================= |
174 | 171 | ||
175 | 'rulerComponent': function () { | 172 | 'rulerComponent': function () { |
176 | if (this._rulerComponent == null) { | 173 | if (this._rulerComponent == null) { |
177 | this._rulerComponent = new Clipperz.PM.UI.Web.Components.RulerComponent({ | 174 | this._rulerComponent = new Clipperz.PM.UI.Web.Components.RulerComponent({ |
178 | translationContext:'Wizards.DirectLoginWizard' | 175 | translationContext:'Wizards.DirectLoginWizard' |
179 | }); | 176 | }); |
180 | this._rulerComponent.render(); | 177 | this._rulerComponent.render(); |
181 | 178 | ||
182 | MochiKit.Signal.connect(this._rulerComponent, 'exit', this, 'handleExit'); | 179 | MochiKit.Signal.connect(this._rulerComponent, 'exit', this, 'handleExit'); |
183 | MochiKit.Signal.connect(this._rulerComponent, 'done', this, 'done'); | 180 | MochiKit.Signal.connect(this._rulerComponent, 'done', this, 'done'); |
184 | MochiKit.Signal.connect(this._rulerComponent, 'moveForward',this, 'handleMoveForward'); | 181 | MochiKit.Signal.connect(this._rulerComponent, 'moveForward',this, 'handleMoveForward'); |
185 | MochiKit.Signal.connect(this._rulerComponent, 'moveBackward',this, 'handleMoveBackward'); | 182 | MochiKit.Signal.connect(this._rulerComponent, 'moveBackward',this, 'handleMoveBackward'); |
186 | MochiKit.Signal.connect(this._rulerComponent, 'cursorMoved',this, 'handleCursorMoved'); | 183 | MochiKit.Signal.connect(this._rulerComponent, 'cursorMoved',this, 'handleCursorMoved'); |
187 | } | 184 | } |
188 | 185 | ||
189 | return this._rulerComponent; | 186 | return this._rulerComponent; |
190 | }, | 187 | }, |
191 | 188 | ||
192 | //----------------------------------------------------------------------------- | 189 | //----------------------------------------------------------------------------- |
193 | 190 | ||
194 | 'showRuler': function (someSteps) { | 191 | 'showRuler': function (someSteps) { |
195 | var rulerElement; | 192 | var rulerElement; |
196 | 193 | ||
197 | this.setSteps(someSteps); | 194 | this.setSteps(someSteps); |
198 | 195 | ||
199 | rulerElement = this.rulerComponent().element(); | 196 | rulerElement = this.rulerComponent().element(); |
200 | this.directLoginEditingComponent().disableAllPanels(); | 197 | this.directLoginEditingComponent().disableAllPanels(); |
201 | 198 | ||
202 | MochiKit.Style.showElement(rulerElement); | 199 | MochiKit.Style.showElement(rulerElement); |
203 | MochiKit.Style.setElementPosition(rulerElement, {x:-1000, y:this.directLoginEditingComponent().bottomMargin()}); | 200 | MochiKit.Style.setElementPosition(rulerElement, {x:-1000, y:this.directLoginEditingComponent().bottomMargin()}); |
204 | new MochiKit.Visual.Move(rulerElement, { | 201 | new MochiKit.Visual.Move(rulerElement, { |
205 | x:0, y:this.directLoginEditingComponent().bottomMargin(), | 202 | x:0, y:this.directLoginEditingComponent().bottomMargin(), |
206 | mode:'absolute', | 203 | mode:'absolute', |
207 | duration:1, | 204 | duration:1, |
208 | afterFinish:MochiKit.Base.method(this, 'handleCursorMoved') | 205 | afterFinish:MochiKit.Base.method(this, 'handleCursorMoved') |
209 | }); | 206 | }); |
210 | }, | 207 | }, |
211 | 208 | ||
212 | 'fixRulerRendering': function (aValue) { | 209 | 'fixRulerRendering': function (aValue) { |
213 | this.rulerComponent().setDisplayMode(aValue); | 210 | this.rulerComponent().setDisplayMode(aValue); |
214 | }, | 211 | }, |
215 | 212 | ||
216 | //----------------------------------------------------------------------------- | 213 | //----------------------------------------------------------------------------- |
217 | 214 | ||
218 | 'hideRuler': function () { | 215 | 'hideRuler': function () { |
219 | new MochiKit.Visual.Move(this.rulerComponent().element(), {x:-1000, mode:'relative', duration:1}); | 216 | new MochiKit.Visual.Move(this.rulerComponent().element(), {x:-1000, mode:'relative', duration:1}); |
220 | }, | 217 | }, |
221 | 218 | ||
222 | 'doneWithRuler': function () { | 219 | 'doneWithRuler': function () { |
223 | var rulerComponentElement; | 220 | var rulerComponentElement; |
224 | 221 | ||
225 | rulerComponentElement = this.rulerComponent().element(); | 222 | rulerComponentElement = this.rulerComponent().element(); |
226 | new MochiKit.Visual.Move(this.rulerComponent().element(), { | 223 | new MochiKit.Visual.Move(this.rulerComponent().element(), { |
227 | x:1000, | 224 | x:1000, |
228 | mode:'relative', | 225 | mode:'relative', |
229 | duration:1, | 226 | duration:1, |
230 | // afterFinish:MochiKit.Base.partial(MochiKit.Style.hideElement, rulerComponentElement) | 227 | // afterFinish:MochiKit.Base.partial(MochiKit.Style.hideElement, rulerComponentElement) |
231 | afterFinish:function () { MochiKit.Style.hideElement(rulerComponentElement); } | 228 | afterFinish:function () { MochiKit.Style.hideElement(rulerComponentElement); } |
232 | }); | 229 | }); |
233 | }, | 230 | }, |
234 | 231 | ||
235 | //============================================================================= | 232 | //============================================================================= |
236 | 233 | ||
237 | 'addNewDirectLoginRulerSteps': function () { | 234 | 'addNewDirectLoginRulerSteps': function () { |
238 | return MochiKit.Base.concat([ 'LABEL'], this.editDirectLoginRulerSteps()); | 235 | return MochiKit.Base.concat([ 'LABEL'], this.editDirectLoginRulerSteps()); |
239 | 236 | ||
240 | }, | 237 | }, |
241 | 238 | ||
242 | 'editDirectLoginRulerSteps': function () { | 239 | 'editDirectLoginRulerSteps': function () { |
243 | return [ /*'TYPE',*/ 'CONFIGURATION', 'BINDINGS','FAVICON', 'DONE']; | 240 | return [ /*'TYPE',*/ 'CONFIGURATION', 'BINDINGS','FAVICON', 'DONE']; |
244 | }, | 241 | }, |
245 | 242 | ||
246 | //------------------------------------------------------------------------- | 243 | //------------------------------------------------------------------------- |
247 | 244 | ||
248 | 'runWithDirectLogin': function (aDirectLogin, hasJustBeenAdded) { | 245 | 'runWithDirectLogin': function (aDirectLogin, hasJustBeenAdded) { |
249 | this._directLogin = aDirectLogin; | 246 | this._directLogin = aDirectLogin; |
250 | this.setDirectLoginHasJustBeenAdded(hasJustBeenAdded); | 247 | this.setDirectLoginHasJustBeenAdded(hasJustBeenAdded); |
251 | 248 | ||
252 | return Clipperz.Async.callbacks("DirectLoginWizardController.runWithDirectLogin", [ | 249 | return Clipperz.Async.callbacks("DirectLoginWizardController.runWithDirectLogin", [ |
253 | MochiKit.Base.method(aDirectLogin, 'label'), | 250 | MochiKit.Base.method(aDirectLogin, 'label'), |
254 | MochiKit.Base.method(this.directLoginEditingComponent(), 'setLabel'), | 251 | MochiKit.Base.method(this.directLoginEditingComponent(), 'setLabel'), |
255 | 252 | ||
256 | MochiKit.Base.method(aDirectLogin, 'favicon'), | 253 | MochiKit.Base.method(aDirectLogin, 'favicon'), |
257 | MochiKit.Base.method(this.directLoginEditingComponent(), 'setDirectLoginFavicon'), | 254 | MochiKit.Base.method(this.directLoginEditingComponent(), 'setDirectLoginFavicon'), |
258 | 255 | ||
259 | MochiKit.Base.method(aDirectLogin, 'bookmarkletConfiguration'), | 256 | MochiKit.Base.method(aDirectLogin, 'bookmarkletConfiguration'), |
260 | MochiKit.Base.method(this.directLoginEditingComponent(), 'setBookmarkletConfiguration'), | 257 | MochiKit.Base.method(this.directLoginEditingComponent(), 'setBookmarkletConfiguration'), |
261 | 258 | ||
262 | MochiKit.Base.method(aDirectLogin, 'bindings'), | 259 | MochiKit.Base.method(aDirectLogin, 'bindings'), |
263 | MochiKit.Base.method(this, 'setOriginalBindings'), | 260 | MochiKit.Base.method(this, 'setOriginalBindings'), |
264 | 261 | ||
265 | MochiKit.Base.method(aDirectLogin, 'record'), | 262 | MochiKit.Base.method(aDirectLogin, 'record'), |
266 | MochiKit.Base.methodcaller('fields'), | 263 | MochiKit.Base.methodcaller('fields'), |
267 | MochiKit.Base.values, | 264 | MochiKit.Base.values, |
268 | MochiKit.Base.partial(MochiKit.Base.map, Clipperz.Async.collectResults("Record.directLoginReferences - collectResults", { | 265 | MochiKit.Base.partial(MochiKit.Base.map, Clipperz.Async.collectResults("Record.directLoginReferences - collectResults", { |
269 | 'reference': MochiKit.Base.methodcaller('reference'), | 266 | 'reference': MochiKit.Base.methodcaller('reference'), |
270 | 'label': MochiKit.Base.methodcaller('label'), | 267 | 'label': MochiKit.Base.methodcaller('label'), |
271 | 'isHidden': MochiKit.Base.methodcaller('isHidden'), | 268 | 'isHidden': MochiKit.Base.methodcaller('isHidden'), |
272 | 'value': MochiKit.Base.methodcaller('value') | 269 | 'value': MochiKit.Base.methodcaller('value') |
273 | }, {trace:false})), | 270 | }, {trace:false})), |
274 | Clipperz.Async.collectAll, | 271 | Clipperz.Async.collectAll, |
275 | 272 | ||
276 | MochiKit.Base.method(this, 'setRecordFields'), | 273 | MochiKit.Base.method(this, 'setRecordFields'), |
277 | 274 | ||
278 | MochiKit.Base.partial(MochiKit.Async.succeed, hasJustBeenAdded), | 275 | MochiKit.Base.partial(MochiKit.Async.succeed, hasJustBeenAdded), |
279 | Clipperz.Async.deferredIf("Direct login has just been added", [ | 276 | Clipperz.Async.deferredIf("Direct login has just been added", [ |
280 | MochiKit.Base.method(this, 'addNewDirectLoginRulerSteps') | 277 | MochiKit.Base.method(this, 'addNewDirectLoginRulerSteps') |
281 | ], [ | 278 | ], [ |
282 | MochiKit.Base.method(this, 'editDirectLoginRulerSteps') | 279 | MochiKit.Base.method(this, 'editDirectLoginRulerSteps') |
283 | ]), | 280 | ]), |
284 | MochiKit.Base.method(this, 'showRuler') | 281 | MochiKit.Base.method(this, 'showRuler') |
285 | ], {trace:false}); | 282 | ], {trace:false}); |
286 | }, | 283 | }, |
287 | 284 | ||
288 | //----------------------------------------------------------------------------- | 285 | //----------------------------------------------------------------------------- |
289 | 286 | ||
290 | 'checkState': function () { | 287 | 'checkState': function () { |
291 | var enablePrevious; | 288 | var enablePrevious; |
292 | var enableNext; | 289 | var enableNext; |
293 | 290 | ||
294 | enablePrevious = true; | 291 | enablePrevious = true; |
295 | enableNext = false; | 292 | enableNext = false; |
296 | 293 | ||
297 | this.directLoginEditingComponent().disableAllPanels(); | 294 | this.directLoginEditingComponent().disableAllPanels(); |
298 | 295 | ||
299 | switch(this.currentStep()) { | 296 | switch(this.currentStep()) { |
300 | case 'LABEL': | 297 | case 'LABEL': |
301 | this.directLoginEditingComponent().enableLabelField(); | 298 | this.directLoginEditingComponent().enableLabelField(); |
302 | 299 | ||
303 | enableNext = (this.directLoginEditingComponent().label() != ''); | 300 | enableNext = (this.directLoginEditingComponent().label() != ''); |
304 | enablePrevious = false; | 301 | enablePrevious = false; |
305 | break; | 302 | break; |
306 | case 'TYPE': | 303 | case 'TYPE': |
307 | this.directLoginEditingComponent().enableTypeField(); | 304 | this.directLoginEditingComponent().enableTypeField(); |
308 | 305 | ||
309 | enableNext = true; | 306 | enableNext = true; |
310 | enablePrevious = true; | 307 | enablePrevious = true; |
311 | break | 308 | break |
312 | case 'CONFIGURATION': | 309 | case 'CONFIGURATION': |
313 | this.directLoginEditingComponent().enableConfigurationField(); | 310 | this.directLoginEditingComponent().enableConfigurationField(); |
314 | 311 | ||
315 | enableNext = (this.directLoginEditingComponent().bookmarkletConfiguration() != ''); | 312 | enableNext = (this.directLoginEditingComponent().bookmarkletConfiguration() != ''); |
316 | 313 | ||
317 | if (enableNext == true) { | 314 | if (enableNext == true) { |
318 | try { | 315 | try { |
319 | Clipperz.PM.DataModel.DirectLogin.checkBookmarkletConfiguration(this.directLoginEditingComponent().bookmarkletConfiguration()); | 316 | Clipperz.PM.DataModel.DirectLogin.checkBookmarkletConfiguration(this.directLoginEditingComponent().bookmarkletConfiguration()); |
320 | this.directLoginEditingComponent().removeHighlightConfigurationSyntaxError(); | 317 | this.directLoginEditingComponent().removeHighlightConfigurationSyntaxError(); |
321 | } catch (e) { | 318 | } catch (e) { |
322 | this.directLoginEditingComponent().highlightConfigurationSyntaxError(); | 319 | this.directLoginEditingComponent().highlightConfigurationSyntaxError(); |
323 | enableNext = false; | 320 | enableNext = false; |
324 | } | 321 | } |
325 | } | 322 | } |
326 | break; | 323 | break; |
327 | case 'BINDINGS': | 324 | case 'BINDINGS': |
328 | enableNext = MochiKit.Iter.every(this.bindingComponents(), function (aBindingComponent) { return aBindingComponent.selectedValue() != null; }) | 325 | enableNext = MochiKit.Iter.every(this.bindingComponents(), function (aBindingComponent) { return aBindingComponent.selectedValue() != null; }) |
329 | this.directLoginEditingComponent().enableBindingFields(); | 326 | this.directLoginEditingComponent().enableBindingFields(); |
330 | break; | 327 | break; |
331 | case 'FAVICON': | 328 | case 'FAVICON': |
332 | enableNext = true; | 329 | enableNext = true; |
333 | this.directLoginEditingComponent().enableFaviconField(); | 330 | this.directLoginEditingComponent().enableFaviconField(); |
334 | break; | 331 | break; |
335 | case 'DONE': | 332 | case 'DONE': |
336 | enableNext = true; | 333 | enableNext = true; |
337 | this.directLoginEditingComponent().enableDonePanel(); | 334 | this.directLoginEditingComponent().enableDonePanel(); |
338 | break; | 335 | break; |
339 | } | 336 | } |
340 | 337 | ||
341 | if (this.currentStepIndex() > 0) { | 338 | if (this.currentStepIndex() > 0) { |
342 | this.enablePrevious(enablePrevious); | 339 | this.enablePrevious(enablePrevious); |
343 | } else { | 340 | } else { |
344 | this.enablePrevious(false); | 341 | this.enablePrevious(false); |
345 | } | 342 | } |
346 | this.enableNext(enableNext); | 343 | this.enableNext(enableNext); |
347 | }, | 344 | }, |
348 | 345 | ||
349 | //----------------------------------------------------------------------------- | 346 | //----------------------------------------------------------------------------- |
350 | 347 | ||
351 | 'setFocus': function () { | 348 | 'setFocus': function () { |
352 | switch(this.currentStep()) { | 349 | switch(this.currentStep()) { |
353 | case 'LABEL': | 350 | case 'LABEL': |
354 | this.directLoginEditingComponent().focusOnLabelElement(); | 351 | this.directLoginEditingComponent().focusOnLabelElement(); |
355 | break; | 352 | break; |
356 | case 'TYPE': | 353 | case 'TYPE': |
357 | break; | 354 | break; |
358 | case 'CONFIGURATION': | 355 | case 'CONFIGURATION': |
359 | this.directLoginEditingComponent().focusOnBookmarkletConfigurationElement(); | 356 | this.directLoginEditingComponent().focusOnBookmarkletConfigurationElement(); |
360 | break; | 357 | break; |
361 | case 'BINDINGS': | 358 | case 'BINDINGS': |
362 | // this.directLoginEditingComponent().getElement('???').focus(); | 359 | // this.directLoginEditingComponent().getElement('???').focus(); |
363 | break; | 360 | break; |
364 | case 'FAVICON': | 361 | case 'FAVICON': |
365 | this.directLoginEditingComponent().focusOnFaviconElement(); | 362 | this.directLoginEditingComponent().focusOnFaviconElement(); |
366 | break; | 363 | break; |
367 | case 'DONE': | 364 | case 'DONE': |
368 | break; | 365 | break; |
369 | } | 366 | } |
370 | }, | 367 | }, |
371 | 368 | ||
372 | //============================================================================= | 369 | //============================================================================= |
373 | 370 | ||
374 | 'steps': function () { | 371 | 'steps': function () { |
375 | return this._steps; | 372 | return this._steps; |
376 | }, | 373 | }, |
377 | 374 | ||
378 | 'setSteps': function (aValue) { | 375 | 'setSteps': function (aValue) { |
379 | this._steps = aValue; | 376 | this._steps = aValue; |
380 | 377 | ||
381 | this.rulerComponent().setSteps(aValue); | 378 | this.rulerComponent().setSteps(aValue); |
382 | this.resetCurrentStepIndex(); | 379 | this.resetCurrentStepIndex(); |
383 | }, | 380 | }, |
384 | 381 | ||
385 | 'currentStepIndex': function () { | 382 | 'currentStepIndex': function () { |
386 | return this._currentStepIndex; | 383 | return this._currentStepIndex; |
387 | }, | 384 | }, |
388 | 385 | ||
389 | 'currentStep': function () { | 386 | 'currentStep': function () { |
390 | return this.steps()[this.currentStepIndex()]; | 387 | return this.steps()[this.currentStepIndex()]; |
391 | }, | 388 | }, |
392 | 389 | ||
393 | //============================================================================= | 390 | //============================================================================= |
394 | 391 | ||
395 | 'handleExit': function () { | 392 | 'handleExit': function () { |
396 | MochiKit.Signal.signal(this, 'exit'); | 393 | MochiKit.Signal.signal(this, 'exit'); |
397 | }, | 394 | }, |
398 | 395 | ||
399 | 'done': function () { | 396 | 'done': function () { |
400 | this.doneWithRuler(); | 397 | this.doneWithRuler(); |
401 | 398 | ||
402 | Clipperz.Async.callbacks("DirectLoginWizardController.done", [ | 399 | Clipperz.Async.callbacks("DirectLoginWizardController.done", [ |
403 | MochiKit.Base.method(this.directLoginEditingComponent(), 'label'), | 400 | MochiKit.Base.method(this.directLoginEditingComponent(), 'label'), |
404 | MochiKit.Base.method(this.directLogin(), 'setLabel'), | 401 | MochiKit.Base.method(this.directLogin(), 'setLabel'), |
405 | 402 | ||
406 | MochiKit.Base.method(this.directLoginEditingComponent(), 'bookmarkletConfiguration'), | 403 | MochiKit.Base.method(this.directLoginEditingComponent(), 'bookmarkletConfiguration'), |
407 | MochiKit.Base.method(this.directLogin(), 'setBookmarkletConfiguration'), | 404 | MochiKit.Base.method(this.directLogin(), 'setBookmarkletConfiguration'), |
408 | 405 | ||