Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/UI/Common/Controllers') (more/less context) (ignore whitespace changes)
4 files changed, 40 insertions, 54 deletions
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/DirectLoginRunner.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/DirectLoginRunner.js index 5fd10f9..77d59a5 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/DirectLoginRunner.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/DirectLoginRunner.js | |||
@@ -1,264 +1,256 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer 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 | Clipperz.Base.module('Clipperz.PM.UI.Common.Controllers'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Common.Controllers'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Common.Controllers.DirectLoginRunner = function(args) { | 26 | Clipperz.PM.UI.Common.Controllers.DirectLoginRunner = function(args) { |
29 | this._directLogin = args['directLogin'] || Clipperz.Base.exception.raise('MandatoryParameter'); | 27 | this._directLogin = args['directLogin'] || Clipperz.Base.exception.raise('MandatoryParameter'); |
30 | this._target = Clipperz.PM.Crypto.randomKey(); | 28 | this._target = Clipperz.PM.Crypto.randomKey(); |
31 | 29 | ||
32 | return this; | 30 | return this; |
33 | } | 31 | } |
34 | 32 | ||
35 | MochiKit.Base.update(Clipperz.PM.UI.Common.Controllers.DirectLoginRunner.prototype, { | 33 | MochiKit.Base.update(Clipperz.PM.UI.Common.Controllers.DirectLoginRunner.prototype, { |
36 | 34 | ||
37 | 'toString': function() { | 35 | 'toString': function() { |
38 | return "Clipperz.PM.UI.Common.Controllers.DirectLoginRunner"; | 36 | return "Clipperz.PM.UI.Common.Controllers.DirectLoginRunner"; |
39 | }, | 37 | }, |
40 | 38 | ||
41 | //----------------------------------------------------------------------------- | 39 | //----------------------------------------------------------------------------- |
42 | 40 | ||
43 | 'directLogin': function () { | 41 | 'directLogin': function () { |
44 | return this._directLogin; | 42 | return this._directLogin; |
45 | }, | 43 | }, |
46 | 44 | ||
47 | //----------------------------------------------------------------------------- | 45 | //----------------------------------------------------------------------------- |
48 | 46 | ||
49 | 'target': function () { | 47 | 'target': function () { |
50 | return this._target; | 48 | return this._target; |
51 | }, | 49 | }, |
52 | 50 | ||
53 | //============================================================================= | 51 | //============================================================================= |
54 | 52 | ||
55 | 'setWindowTitle': function (aWindow, aTitle) { | 53 | 'setWindowTitle': function (aWindow, aTitle) { |
56 | aWindow.document.title = aTitle; | 54 | aWindow.document.title = aTitle; |
57 | }, | 55 | }, |
58 | 56 | ||
59 | 'setWindowBody': function (aWindow, anHTML) { | 57 | 'setWindowBody': function (aWindow, anHTML) { |
60 | aWindow.document.body.innerHTML = anHTML; | 58 | aWindow.document.body.innerHTML = anHTML; |
61 | }, | 59 | }, |
62 | 60 | ||
63 | //============================================================================= | 61 | //============================================================================= |
64 | 62 | ||
65 | 'initialWindowSetup': function (aWindow) { | 63 | 'initialWindowSetup': function (aWindow) { |
66 | this.setWindowTitle(aWindow, "Loading Clipperz Direct Login"); | 64 | this.setWindowTitle(aWindow, "Loading Clipperz Direct Login"); |
67 | this.setWindowBody (aWindow, MochiKit.DOM.toHTML(MochiKit.DOM.H3("Loading Clipperz Direct Login ..."))); | 65 | this.setWindowBody (aWindow, MochiKit.DOM.toHTML(MochiKit.DOM.H3("Loading Clipperz Direct Login ..."))); |
68 | }, | 66 | }, |
69 | 67 | ||
70 | //----------------------------------------------------------------------------- | 68 | //----------------------------------------------------------------------------- |
71 | 69 | ||
72 | 'updateWindowWithDirectLoginLabel': function (aWindow, aLabel) { | 70 | 'updateWindowWithDirectLoginLabel': function (aWindow, aLabel) { |
73 | var titleText; | 71 | var titleText; |
74 | var bodyText; | 72 | var bodyText; |
75 | 73 | ||
76 | titleText = "Loading '__label__' Direct Login".replace(/__label__/, aLabel) | 74 | titleText = "Loading '__label__' Direct Login".replace(/__label__/, aLabel) |
77 | bodyText = "Loading '__label__' Direct Login... ".replace(/__label__/, aLabel) | 75 | bodyText = "Loading '__label__' Direct Login... ".replace(/__label__/, aLabel) |
78 | 76 | ||
79 | this.setWindowTitle(aWindow, titleText); | 77 | this.setWindowTitle(aWindow, titleText); |
80 | this.setWindowBody (aWindow, MochiKit.DOM.toHTML(MochiKit.DOM.H3(bodyText))); | 78 | this.setWindowBody (aWindow, MochiKit.DOM.toHTML(MochiKit.DOM.H3(bodyText))); |
81 | }, | 79 | }, |
82 | 80 | ||
83 | //----------------------------------------------------------------------------- | 81 | //----------------------------------------------------------------------------- |
84 | 82 | ||
85 | 'updateWindowWithHTMLContent': function (aWindow, anHtml) { | 83 | 'updateWindowWithHTMLContent': function (aWindow, anHtml) { |
86 | this.setWindowBody(aWindow, anHtml); | 84 | this.setWindowBody(aWindow, anHtml); |
87 | }, | 85 | }, |
88 | 86 | ||
89 | //============================================================================= | 87 | //============================================================================= |
90 | 88 | ||
91 | 'submitLoginForm': function(aWindow, aSubmitFunction) { | 89 | 'submitLoginForm': function(aWindow, aSubmitFunction) { |
92 | MochiKit.DOM.withWindow(aWindow, MochiKit.Base.bind(function () { | 90 | MochiKit.DOM.withWindow(aWindow, MochiKit.Base.bind(function () { |
93 | var formElement; | 91 | var formElement; |
94 | var submitButtons; | 92 | var submitButtons; |
95 | 93 | ||
96 | formElement = MochiKit.DOM.getElement('directLoginForm'); | 94 | formElement = MochiKit.DOM.getElement('directLoginForm'); |
97 | 95 | ||
98 | submitButtons = MochiKit.Base.filter(function(anInputElement) { | 96 | submitButtons = MochiKit.Base.filter(function(anInputElement) { |
99 | return ((anInputElement.tagName.toLowerCase() == 'input') && (anInputElement.getAttribute('type').toLowerCase() == 'submit')); | 97 | return ((anInputElement.tagName.toLowerCase() == 'input') && (anInputElement.getAttribute('type').toLowerCase() == 'submit')); |
100 | }, formElement.elements); | 98 | }, formElement.elements); |
101 | 99 | ||
102 | if (submitButtons.length == 0) { | 100 | if (submitButtons.length == 0) { |
103 | if (typeof(formElement.submit) == 'function') { | 101 | if (typeof(formElement.submit) == 'function') { |
104 | formElement.submit(); | 102 | formElement.submit(); |
105 | } else { | 103 | } else { |
106 | aSubmitFunction.apply(formElement); | 104 | aSubmitFunction.apply(formElement); |
107 | } | 105 | } |
108 | /* | 106 | /* |
109 | varformSubmitFunction; | 107 | varformSubmitFunction; |
110 | 108 | ||
111 | formSubmitFunction = MochiKit.Base.method(formElement, 'submit'); | 109 | formSubmitFunction = MochiKit.Base.method(formElement, 'submit'); |
112 | if (Clipperz_IEisBroken == true) { | 110 | if (Clipperz_IEisBroken == true) { |
113 | formElement.submit(); | 111 | formElement.submit(); |
114 | } else { | 112 | } else { |
115 | formSubmitFunction(); | 113 | formSubmitFunction(); |
116 | } | 114 | } |
117 | */ | 115 | */ |
118 | } else { | 116 | } else { |
119 | submitButtons[0].click(); | 117 | submitButtons[0].click(); |
120 | } | 118 | } |
121 | }, this)); | 119 | }, this)); |
122 | }, | 120 | }, |
123 | 121 | ||
124 | //------------------------------------------------------------------------- | 122 | //------------------------------------------------------------------------- |
125 | 123 | ||
126 | 'runSubmitFormDirectLogin': function (aWindow, someAttributes) { | 124 | 'runSubmitFormDirectLogin': function (aWindow, someAttributes) { |
127 | var html; | 125 | var html; |
128 | var formElement; | 126 | var formElement; |
129 | var submitFunction; | 127 | var submitFunction; |
130 | 128 | ||
131 | formElement = MochiKit.DOM.FORM({ | 129 | formElement = MochiKit.DOM.FORM({ |
132 | 'id':'directLoginForm', | 130 | 'id':'directLoginForm', |
133 | 'method':someAttributes['formAttributes']['method'], | 131 | 'method':someAttributes['formAttributes']['method'], |
134 | 'action':someAttributes['formAttributes']['action'] | 132 | 'action':someAttributes['formAttributes']['action'] |
135 | }); | 133 | }); |
136 | 134 | ||
137 | submitFunction = formElement.submit; | 135 | submitFunction = formElement.submit; |
138 | 136 | ||
139 | MochiKit.DOM.appendChildNodes(formElement, MochiKit.Base.map(function (anInputAttributes) { | 137 | MochiKit.DOM.appendChildNodes(formElement, MochiKit.Base.map(function (anInputAttributes) { |
140 | return MochiKit.DOM.INPUT({'type':'hidden', 'name':anInputAttributes[0], 'value':anInputAttributes[1]}); | 138 | return MochiKit.DOM.INPUT({'type':'hidden', 'name':anInputAttributes[0], 'value':anInputAttributes[1]}); |
141 | }, MochiKit.Base.items(someAttributes['inputValues']))); | 139 | }, MochiKit.Base.items(someAttributes['inputValues']))); |
142 | 140 | ||
143 | html =''; | 141 | html =''; |
144 | html += '<h3>Loading ' + someAttributes['label'] + ' ...</h3>'; | 142 | html += '<h3>Loading ' + someAttributes['label'] + ' ...</h3>'; |
145 | html +=MochiKit.DOM.appendChildNodes(MochiKit.DOM.DIV(), MochiKit.DOM.appendChildNodes(MochiKit.DOM.DIV({style:'display:none; visibility:hidden;'}), formElement)).innerHTML; | 143 | html +=MochiKit.DOM.appendChildNodes(MochiKit.DOM.DIV(), MochiKit.DOM.appendChildNodes(MochiKit.DOM.DIV({style:'display:none; visibility:hidden;'}), formElement)).innerHTML; |
146 | 144 | ||
147 | this.updateWindowWithHTMLContent(aWindow, html); | 145 | this.updateWindowWithHTMLContent(aWindow, html); |
148 | this.submitLoginForm(aWindow, submitFunction); | 146 | this.submitLoginForm(aWindow, submitFunction); |
149 | }, | 147 | }, |
150 | 148 | ||
151 | //------------------------------------------------------------------------- | 149 | //------------------------------------------------------------------------- |
152 | 150 | ||
153 | 'runHttpAuthDirectLogin': function(aWindow, someAttributes) { | 151 | 'runHttpAuthDirectLogin': function(aWindow, someAttributes) { |
154 | var completeUrl; | 152 | var completeUrl; |
155 | var url; | 153 | var url; |
156 | 154 | ||
157 | //console.log("runHttpAuthDirectLogin", someAttributes); | ||
158 | url = someAttributes['inputValues']['url']; | 155 | url = someAttributes['inputValues']['url']; |
159 | 156 | ||
160 | if (/^https?\:\/\//.test(url) == false) { | 157 | if (/^https?\:\/\//.test(url) == false) { |
161 | url = 'http://' + url; | 158 | url = 'http://' + url; |
162 | } | 159 | } |
163 | 160 | ||
164 | if (Clipperz_IEisBroken === true) { | 161 | if (Clipperz_IEisBroken === true) { |
165 | completeUrl = url; | 162 | completeUrl = url; |
166 | } else { | 163 | } else { |
167 | var username; | 164 | var username; |
168 | var password; | 165 | var password; |
169 | 166 | ||
170 | username = someAttributes['inputValues']['username']; | 167 | username = someAttributes['inputValues']['username']; |
171 | password = someAttributes['inputValues']['password']; | 168 | password = someAttributes['inputValues']['password']; |
172 | /(^https?\:\/\/)?(.*)/.test(url); | 169 | /(^https?\:\/\/)?(.*)/.test(url); |
173 | 170 | ||
174 | completeUrl = RegExp.$1 + username + ':' + password + '@' + RegExp.$2; | 171 | completeUrl = RegExp.$1 + username + ':' + password + '@' + RegExp.$2; |
175 | } | 172 | } |
176 | 173 | ||
177 | window.open(completeUrl, this.target()); | 174 | window.open(completeUrl, this.target()); |
178 | }, | 175 | }, |
179 | 176 | ||
180 | //============================================================================= | 177 | //============================================================================= |
181 | 178 | ||
182 | 'runDirectLogin': function (aWindow) { | 179 | 'runDirectLogin': function (aWindow) { |
183 | var deferredResult; | 180 | var deferredResult; |
184 | 181 | ||
185 | //console.log(">>> runDirectLogin"); | ||
186 | deferredResult = new Clipperz.Async.Deferred("DirectLoginRunner.openDirectLogin", {trace:false}); | 182 | deferredResult = new Clipperz.Async.Deferred("DirectLoginRunner.openDirectLogin", {trace:false}); |
187 | deferredResult.addMethod(this, 'initialWindowSetup', aWindow); | 183 | deferredResult.addMethod(this, 'initialWindowSetup', aWindow); |
188 | deferredResult.addMethod(this.directLogin(), 'label'); | 184 | deferredResult.addMethod(this.directLogin(), 'label'); |
189 | deferredResult.addMethod(this, 'updateWindowWithDirectLoginLabel', aWindow); | 185 | deferredResult.addMethod(this, 'updateWindowWithDirectLoginLabel', aWindow); |
190 | deferredResult.collectResults({ | 186 | deferredResult.collectResults({ |
191 | 'type': MochiKit.Base.method(this.directLogin(), 'type'), | 187 | 'type': MochiKit.Base.method(this.directLogin(), 'type'), |
192 | 'label': MochiKit.Base.method(this.directLogin(), 'label'), | 188 | 'label': MochiKit.Base.method(this.directLogin(), 'label'), |
193 | 'formAttributes':MochiKit.Base.method(this.directLogin(), 'formAttributes'), | 189 | 'formAttributes':MochiKit.Base.method(this.directLogin(), 'formAttributes'), |
194 | 'inputValues': MochiKit.Base.method(this.directLogin(), 'inputValues') | 190 | 'inputValues': MochiKit.Base.method(this.directLogin(), 'inputValues') |
195 | }); | 191 | }); |
196 | //deferredResult.addCallback(function (aValue) { console.log("SOME ATTRIBUTES", aValue); return aValue; }); | ||
197 | deferredResult.addCallback(MochiKit.Base.bind(function (someAttributes) { | 192 | deferredResult.addCallback(MochiKit.Base.bind(function (someAttributes) { |
198 | //console.log("SOME ATTRIBUTES", someAttributes); | ||
199 | switch (someAttributes['type']) { | 193 | switch (someAttributes['type']) { |
200 | case 'http_auth': | 194 | case 'http_auth': |
201 | this.runHttpAuthDirectLogin(aWindow, someAttributes); | 195 | this.runHttpAuthDirectLogin(aWindow, someAttributes); |
202 | break; | 196 | break; |
203 | case 'simple_url': | 197 | case 'simple_url': |
204 | this.runSimpleUrlDirectLogin(aWindow, someAttributes); | 198 | this.runSimpleUrlDirectLogin(aWindow, someAttributes); |
205 | break; | 199 | break; |
206 | default: | 200 | default: |
207 | this.runSubmitFormDirectLogin(aWindow, someAttributes); | 201 | this.runSubmitFormDirectLogin(aWindow, someAttributes); |
208 | break; | 202 | break; |
209 | } | 203 | } |
210 | }, this)); | 204 | }, this)); |
211 | deferredResult.callback(); | 205 | deferredResult.callback(); |
212 | //console.log("<<< runDirectLogin"); | ||
213 | 206 | ||
214 | return deferredResult; | 207 | return deferredResult; |
215 | }, | 208 | }, |
216 | 209 | ||
217 | //============================================================================= | 210 | //============================================================================= |
218 | 211 | ||
219 | 'run': function () { | 212 | 'run': function () { |
220 | var newWindow; | 213 | var newWindow; |
221 | 214 | ||
222 | newWindow = window.open(Clipperz.PM.Strings.getValue('directLoginJumpPageUrl'), this.target()); | 215 | newWindow = window.open(Clipperz.PM.Strings.getValue('directLoginJumpPageUrl'), this.target()); |
223 | 216 | ||
224 | return this.runDirectLogin(newWindow); | 217 | return this.runDirectLogin(newWindow); |
225 | }, | 218 | }, |
226 | 219 | ||
227 | //============================================================================= | 220 | //============================================================================= |
228 | 221 | ||
229 | 'test': function () { | 222 | 'test': function () { |
230 | var iFrame; | 223 | var iFrame; |
231 | var newWindow; | 224 | var newWindow; |
232 | 225 | ||
233 | iFrame = MochiKit.DOM.createDOM('iframe'); | 226 | iFrame = MochiKit.DOM.createDOM('iframe'); |
234 | MochiKit.DOM.appendChildNodes(MochiKit.DOM.currentDocument().body, iFrame); | 227 | MochiKit.DOM.appendChildNodes(MochiKit.DOM.currentDocument().body, iFrame); |
235 | 228 | ||
236 | newWindow = iFrame.contentWindow; | 229 | newWindow = iFrame.contentWindow; |
237 | 230 | ||
238 | return this.runDirectLogin(newWindow); | 231 | return this.runDirectLogin(newWindow); |
239 | }, | 232 | }, |
240 | 233 | ||
241 | //============================================================================= | 234 | //============================================================================= |
242 | __syntaxFix__: "syntax fix" | 235 | __syntaxFix__: "syntax fix" |
243 | }); | 236 | }); |
244 | 237 | ||
245 | //----------------------------------------------------------------------------- | 238 | //----------------------------------------------------------------------------- |
246 | 239 | ||
247 | Clipperz.PM.UI.Common.Controllers.DirectLoginRunner.openDirectLogin = function (aDirectLogin) { | 240 | Clipperz.PM.UI.Common.Controllers.DirectLoginRunner.openDirectLogin = function (aDirectLogin) { |
248 | varrunner; | 241 | varrunner; |
249 | 242 | ||
250 | runner = new Clipperz.PM.UI.Common.Controllers.DirectLoginRunner({directLogin:aDirectLogin}); | 243 | runner = new Clipperz.PM.UI.Common.Controllers.DirectLoginRunner({directLogin:aDirectLogin}); |
251 | return runner.run(); | 244 | return runner.run(); |
252 | }; | 245 | }; |
253 | 246 | ||
254 | //----------------------------------------------------------------------------- | 247 | //----------------------------------------------------------------------------- |
255 | 248 | ||
256 | Clipperz.PM.UI.Common.Controllers.DirectLoginRunner.testDirectLogin = function (aDirectLogin) { | 249 | Clipperz.PM.UI.Common.Controllers.DirectLoginRunner.testDirectLogin = function (aDirectLogin) { |
257 | varrunner; | 250 | varrunner; |
258 | 251 | ||
259 | //console.log(">>>>>> TESTING DIRECT LOGIN"); | ||
260 | runner = new Clipperz.PM.UI.Common.Controllers.DirectLoginRunner({directLogin:aDirectLogin}); | 252 | runner = new Clipperz.PM.UI.Common.Controllers.DirectLoginRunner({directLogin:aDirectLogin}); |
261 | return runner.test(); | 253 | return runner.test(); |
262 | }; | 254 | }; |
263 | 255 | ||
264 | //----------------------------------------------------------------------------- | 256 | //----------------------------------------------------------------------------- |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/ProgressBarController.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/ProgressBarController.js index 41fe17f..52d81d4 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/ProgressBarController.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/ProgressBarController.js | |||
@@ -1,118 +1,116 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer 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 | Clipperz.Base.module('Clipperz.PM.UI.Common.Controllers'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Common.Controllers'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Common.Controllers.ProgressBarController = function(args) { | 26 | Clipperz.PM.UI.Common.Controllers.ProgressBarController = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
31 | this._numberOfSteps= 0; | 29 | this._numberOfSteps= 0; |
32 | this._currentStep= 0; | 30 | this._currentStep= 0; |
33 | 31 | ||
34 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'initProgress', this, 'initProgressHandle'); | 32 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'initProgress', this, 'initProgressHandle'); |
35 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'updateProgress',this, 'updateProgressHandle'); | 33 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'updateProgress',this, 'updateProgressHandle'); |
36 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'advanceProgress',this, 'advanceProgressHandle'); | 34 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'advanceProgress',this, 'advanceProgressHandle'); |
37 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'progressDone', this, 'progressDoneHandle'); | 35 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'progressDone', this, 'progressDoneHandle'); |
38 | 36 | ||
39 | return this; | 37 | return this; |
40 | } | 38 | } |
41 | 39 | ||
42 | MochiKit.Base.update(Clipperz.PM.UI.Common.Controllers.ProgressBarController.prototype, { | 40 | MochiKit.Base.update(Clipperz.PM.UI.Common.Controllers.ProgressBarController.prototype, { |
43 | 41 | ||
44 | 'toString': function() { | 42 | 'toString': function() { |
45 | return "Clipperz.PM.UI.Common.Controllers.ProgressBarController"; | 43 | return "Clipperz.PM.UI.Common.Controllers.ProgressBarController"; |
46 | }, | 44 | }, |
47 | 45 | ||
48 | //----------------------------------------------------------------------------- | 46 | //----------------------------------------------------------------------------- |
49 | 47 | ||
50 | 'numberOfSteps': function() { | 48 | 'numberOfSteps': function() { |
51 | return this._numberOfSteps; | 49 | return this._numberOfSteps; |
52 | }, | 50 | }, |
53 | 51 | ||
54 | 'setNumberOfSteps': function (aValue) { | 52 | 'setNumberOfSteps': function (aValue) { |
55 | this._numberOfSteps = aValue; | 53 | this._numberOfSteps = aValue; |
56 | }, | 54 | }, |
57 | 55 | ||
58 | 'updateNumberOfSteps': function (aValue) { | 56 | 'updateNumberOfSteps': function (aValue) { |
59 | this._numberOfSteps += aValue; | 57 | this._numberOfSteps += aValue; |
60 | }, | 58 | }, |
61 | 59 | ||
62 | //----------------------------------------------------------------------------- | 60 | //----------------------------------------------------------------------------- |
63 | 61 | ||
64 | 'currentStep': function() { | 62 | 'currentStep': function() { |
65 | return this._currentStep; | 63 | return this._currentStep; |
66 | }, | 64 | }, |
67 | 65 | ||
68 | 'advanceCurrentStep': function () { | 66 | 'advanceCurrentStep': function () { |
69 | this._currentStep ++; | 67 | this._currentStep ++; |
70 | }, | 68 | }, |
71 | 69 | ||
72 | //----------------------------------------------------------------------------- | 70 | //----------------------------------------------------------------------------- |
73 | 71 | ||
74 | 'completedPercentage': function () { | 72 | 'completedPercentage': function () { |
75 | var result; | 73 | var result; |
76 | //Clipperz.log(">>> completedPercentage" + this.currentStep() + "/" + this.numberOfSteps(), this.currentStep() / this.numberOfSteps()); | 74 | //Clipperz.log(">>> completedPercentage" + this.currentStep() + "/" + this.numberOfSteps(), this.currentStep() / this.numberOfSteps()); |
77 | if (this.numberOfSteps() == 0) { | 75 | if (this.numberOfSteps() == 0) { |
78 | result = 0; | 76 | result = 0; |
79 | } else { | 77 | } else { |
80 | result = (Math.min(100, 100 * (this.currentStep() / this.numberOfSteps()))); | 78 | result = (Math.min(100, 100 * (this.currentStep() / this.numberOfSteps()))); |
81 | } | 79 | } |
82 | //Clipperz.log("<<< completedPercentage", result); | 80 | //Clipperz.log("<<< completedPercentage", result); |
83 | return result; | 81 | return result; |
84 | }, | 82 | }, |
85 | 83 | ||
86 | //----------------------------------------------------------------------------- | 84 | //----------------------------------------------------------------------------- |
87 | 85 | ||
88 | 'resetStatus': function () { | 86 | 'resetStatus': function () { |
89 | this._numberOfSteps= 0; | 87 | this._numberOfSteps= 0; |
90 | this._currentStep= 0; | 88 | this._currentStep= 0; |
91 | }, | 89 | }, |
92 | 90 | ||
93 | //----------------------------------------------------------------------------- | 91 | //----------------------------------------------------------------------------- |
94 | 92 | ||
95 | 'updateProgress': function () { | 93 | 'updateProgress': function () { |
96 | //Clipperz.log(">>> updateProgress: " + this.completedPercentage() + "%"); | 94 | //Clipperz.log(">>> updateProgress: " + this.completedPercentage() + "%"); |
97 | MochiKit.Signal.signal(this, 'updateProgress', this.completedPercentage()); | 95 | MochiKit.Signal.signal(this, 'updateProgress', this.completedPercentage()); |
98 | }, | 96 | }, |
99 | 97 | ||
100 | //============================================================================= | 98 | //============================================================================= |
101 | 99 | ||
102 | 'initProgressHandle': function (anEvent) { | 100 | 'initProgressHandle': function (anEvent) { |
103 | //Clipperz.log(">>> initProgressHandle - steps: " + (anEvent != null ? anEvent['steps'] : 0)); | 101 | //Clipperz.log(">>> initProgressHandle - steps: " + (anEvent != null ? anEvent['steps'] : 0)); |
104 | this.resetStatus(); | 102 | this.resetStatus(); |
105 | if (anEvent != null) { | 103 | if (anEvent != null) { |
106 | this.setNumberOfSteps(anEvent['steps']); | 104 | this.setNumberOfSteps(anEvent['steps']); |
107 | } | 105 | } |
108 | MochiKit.Signal.signal(this, 'initProgress'); | 106 | MochiKit.Signal.signal(this, 'initProgress'); |
109 | this.updateProgress(); | 107 | this.updateProgress(); |
110 | }, | 108 | }, |
111 | 109 | ||
112 | //............................................................................. | 110 | //............................................................................. |
113 | 111 | ||
114 | 'updateProgressHandle': function (anEvent) { | 112 | 'updateProgressHandle': function (anEvent) { |
115 | this.updateNumberOfSteps(anEvent['extraSteps']); | 113 | this.updateNumberOfSteps(anEvent['extraSteps']); |
116 | //Clipperz.log("=== updateProgressHandle - steps: " + this.numberOfSteps() + " (extra " + anEvent['extraSteps'] + ")"); | 114 | //Clipperz.log("=== updateProgressHandle - steps: " + this.numberOfSteps() + " (extra " + anEvent['extraSteps'] + ")"); |
117 | this.updateProgress(); | 115 | this.updateProgress(); |
118 | }, | 116 | }, |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/TabPanelController.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/TabPanelController.js index 341fde9..d3e86de 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/TabPanelController.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/TabPanelController.js | |||
@@ -1,118 +1,116 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer 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 | Clipperz.Base.module('Clipperz.PM.UI.Common.Controllers'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Common.Controllers'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Common.Controllers.TabPanelController = function(args) { | 26 | Clipperz.PM.UI.Common.Controllers.TabPanelController = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
31 | this._component = args.component; | 29 | this._component = args.component; |
32 | this._configuration = args.configuration; | 30 | this._configuration = args.configuration; |
33 | this._isEnabled = args.enabled || true; | 31 | this._isEnabled = args.enabled || true; |
34 | 32 | ||
35 | this._selectedTab = null; | 33 | this._selectedTab = null; |
36 | return this; | 34 | return this; |
37 | } | 35 | } |
38 | 36 | ||
39 | MochiKit.Base.update(Clipperz.PM.UI.Common.Controllers.TabPanelController.prototype, { | 37 | MochiKit.Base.update(Clipperz.PM.UI.Common.Controllers.TabPanelController.prototype, { |
40 | 38 | ||
41 | 'toString': function() { | 39 | 'toString': function() { |
42 | return "Clipperz.PM.UI.Common.Controllers.TabPanelController"; | 40 | return "Clipperz.PM.UI.Common.Controllers.TabPanelController"; |
43 | }, | 41 | }, |
44 | 42 | ||
45 | //----------------------------------------------------------------------------- | 43 | //----------------------------------------------------------------------------- |
46 | 44 | ||
47 | 'component': function() { | 45 | 'component': function() { |
48 | return this._component; | 46 | return this._component; |
49 | }, | 47 | }, |
50 | 48 | ||
51 | 'configuration': function() { | 49 | 'configuration': function() { |
52 | return this._configuration; | 50 | return this._configuration; |
53 | }, | 51 | }, |
54 | 52 | ||
55 | //----------------------------------------------------------------------------- | 53 | //----------------------------------------------------------------------------- |
56 | 54 | ||
57 | 'getElement': function(anElementID) { | 55 | 'getElement': function(anElementID) { |
58 | return this.component().getElement(anElementID); | 56 | return this.component().getElement(anElementID); |
59 | }, | 57 | }, |
60 | 58 | ||
61 | 'tabForTabElement': function(anElement) { | 59 | 'tabForTabElement': function(anElement) { |
62 | varresult; | 60 | varresult; |
63 | 61 | ||
64 | for (result in this.configuration()) { | 62 | for (result in this.configuration()) { |
65 | if (this.getElement(this.configuration()[result]['tab']) == anElement) { | 63 | if (this.getElement(this.configuration()[result]['tab']) == anElement) { |
66 | break; | 64 | break; |
67 | } | 65 | } |
68 | } | 66 | } |
69 | 67 | ||
70 | return result; | 68 | return result; |
71 | }, | 69 | }, |
72 | 70 | ||
73 | //----------------------------------------------------------------------------- | 71 | //----------------------------------------------------------------------------- |
74 | 72 | ||
75 | 'setupTab': function(aConfiguration) { | 73 | 'setupTab': function(aConfiguration) { |
76 | vartabElement; | 74 | vartabElement; |
77 | 75 | ||
78 | tabElement = this.getElement(aConfiguration['tab']); | 76 | tabElement = this.getElement(aConfiguration['tab']); |
79 | 77 | ||
80 | MochiKit.DOM.removeElementClass(tabElement, 'selected'); | 78 | MochiKit.DOM.removeElementClass(tabElement, 'selected'); |
81 | MochiKit.Signal.connect(tabElement, 'onclick', this, 'handleTabClick') | 79 | MochiKit.Signal.connect(tabElement, 'onclick', this, 'handleTabClick') |
82 | }, | 80 | }, |
83 | 81 | ||
84 | 'setupPanel': function(aConfiguration) { | 82 | 'setupPanel': function(aConfiguration) { |
85 | this.hidePanel(aConfiguration['panel']); | 83 | this.hidePanel(aConfiguration['panel']); |
86 | }, | 84 | }, |
87 | 85 | ||
88 | 'setup': function(args) { | 86 | 'setup': function(args) { |
89 | args = args || {}; | 87 | args = args || {}; |
90 | 88 | ||
91 | MochiKit.Base.map(MochiKit.Base.method(this, 'setupTab'),MochiKit.Base.values(this.configuration())); | 89 | MochiKit.Base.map(MochiKit.Base.method(this, 'setupTab'),MochiKit.Base.values(this.configuration())); |
92 | MochiKit.Base.map(MochiKit.Base.method(this, 'setupPanel'),MochiKit.Base.values(this.configuration())); | 90 | MochiKit.Base.map(MochiKit.Base.method(this, 'setupPanel'),MochiKit.Base.values(this.configuration())); |
93 | this.selectTab(args.selected); | 91 | this.selectTab(args.selected); |
94 | }, | 92 | }, |
95 | 93 | ||
96 | //----------------------------------------------------------------------------- | 94 | //----------------------------------------------------------------------------- |
97 | 95 | ||
98 | 'hidePanel': function(aPanel) { | 96 | 'hidePanel': function(aPanel) { |
99 | MochiKit.DOM.removeElementClass(this.getElement(aPanel), 'selected'); | 97 | MochiKit.DOM.removeElementClass(this.getElement(aPanel), 'selected'); |
100 | }, | 98 | }, |
101 | 99 | ||
102 | 'selectTab': function(aTab) { | 100 | 'selectTab': function(aTab) { |
103 | if ((aTab != this.selectedTab()) && (this.isEnabled())) { | 101 | if ((aTab != this.selectedTab()) && (this.isEnabled())) { |
104 | if (this.selectedTab() != null) { | 102 | if (this.selectedTab() != null) { |
105 | MochiKit.DOM.removeElementClass(this.getElement(this.configuration()[this.selectedTab()]['tab']),'selected'); | 103 | MochiKit.DOM.removeElementClass(this.getElement(this.configuration()[this.selectedTab()]['tab']),'selected'); |
106 | MochiKit.DOM.removeElementClass(this.getElement(this.configuration()[this.selectedTab()]['panel']),'selected'); | 104 | MochiKit.DOM.removeElementClass(this.getElement(this.configuration()[this.selectedTab()]['panel']),'selected'); |
107 | } | 105 | } |
108 | 106 | ||
109 | if (aTab != null) { | 107 | if (aTab != null) { |
110 | MochiKit.DOM.addElementClass(this.getElement(this.configuration()[aTab]['tab']),'selected'); | 108 | MochiKit.DOM.addElementClass(this.getElement(this.configuration()[aTab]['tab']),'selected'); |
111 | MochiKit.DOM.addElementClass(this.getElement(this.configuration()[aTab]['panel']),'selected'); | 109 | MochiKit.DOM.addElementClass(this.getElement(this.configuration()[aTab]['panel']),'selected'); |
112 | } | 110 | } |
113 | 111 | ||
114 | this.setSelectedTab(aTab); | 112 | this.setSelectedTab(aTab); |
115 | MochiKit.Signal.signal(this, 'tabSelected', aTab); | 113 | MochiKit.Signal.signal(this, 'tabSelected', aTab); |
116 | } | 114 | } |
117 | }, | 115 | }, |
118 | 116 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/WizardController.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/WizardController.js index ef38bc6..c13d96a 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/WizardController.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/WizardController.js | |||
@@ -1,28 +1,26 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer 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 | //Still empty, but here it should be reasonable to factor in code duplicated between | 24 | //Still empty, but here it should be reasonable to factor in code duplicated between |
27 | //- DirectLoginWizardController | 25 | //- DirectLoginWizardController |
28 | //- NewUserWizardController \ No newline at end of file | 26 | //- NewUserWizardController \ No newline at end of file |