author | Giulio Cesare Solaroli <giulio.cesare@clipperz.com> | 2011-10-02 23:56:18 (UTC) |
---|---|---|
committer | Giulio Cesare Solaroli <giulio.cesare@clipperz.com> | 2011-10-02 23:56:18 (UTC) |
commit | ef68436ac04da078ffdcacd7e1f785473a303d45 (patch) (unidiff) | |
tree | c403752d66a2c4775f00affd4fa8431b29c5b68c /frontend/beta/js/Clipperz/PM/Components/Panels | |
parent | 597ecfbc0249d83e1b856cbd558340c01237a360 (diff) | |
download | clipperz-ef68436ac04da078ffdcacd7e1f785473a303d45.zip clipperz-ef68436ac04da078ffdcacd7e1f785473a303d45.tar.gz clipperz-ef68436ac04da078ffdcacd7e1f785473a303d45.tar.bz2 |
First version of the newly restructured repository
Diffstat (limited to 'frontend/beta/js/Clipperz/PM/Components/Panels') (more/less context) (ignore whitespace changes)
8 files changed, 3869 insertions, 0 deletions
diff --git a/frontend/beta/js/Clipperz/PM/Components/Panels/AccountPanel.js b/frontend/beta/js/Clipperz/PM/Components/Panels/AccountPanel.js new file mode 100644 index 0000000..6b467d0 --- a/dev/null +++ b/frontend/beta/js/Clipperz/PM/Components/Panels/AccountPanel.js | |||
@@ -0,0 +1,784 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
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 | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | 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 | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | ||
30 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | ||
31 | if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; } | ||
32 | if (typeof(Clipperz.PM.Components.Panels) == 'undefined') { Clipperz.PM.Components.Panels = {}; } | ||
33 | |||
34 | //############################################################################# | ||
35 | |||
36 | Clipperz.PM.Components.Panels.AccountPanel = function(anElement, args) { | ||
37 | //MochiKit.Logging.logDebug(">>> new AccountPanel"); | ||
38 | args = args || {}; | ||
39 | |||
40 | Clipperz.PM.Components.Panels.AccountPanel.superclass.constructor.call(this, anElement, args); | ||
41 | |||
42 | Clipperz.NotificationCenter.register(null, 'setupDone', this, 'render'); | ||
43 | |||
44 | this._shouldLoadLoginHistory = true; | ||
45 | |||
46 | //this.render(); | ||
47 | //MochiKit.Logging.logDebug("<<< new AccountPanel"); | ||
48 | |||
49 | return this; | ||
50 | } | ||
51 | |||
52 | //============================================================================= | ||
53 | |||
54 | YAHOO.extendX(Clipperz.PM.Components.Panels.AccountPanel, Clipperz.PM.Components.Panels.BasePanel, { | ||
55 | |||
56 | 'toString': function() { | ||
57 | return "Clipperz.PM.Components.AccountPanel component"; | ||
58 | }, | ||
59 | |||
60 | //------------------------------------------------------------------------- | ||
61 | |||
62 | 'render': function() { | ||
63 | var errorMessageActor; | ||
64 | varchangePasswordButton; | ||
65 | var deleteAccountButton; | ||
66 | |||
67 | try { | ||
68 | //MochiKit.Logging.logDebug(">>> AccountPanel.render"); | ||
69 | Clipperz.NotificationCenter.unregister(this); | ||
70 | MochiKit.Signal.disconnectAllTo(this); | ||
71 | |||
72 | this.element().update(""); | ||
73 | Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'table', border:'0', cellspacing:'0', cellpadding:'0', children:[ | ||
74 | {tag:'tbody', children:[ | ||
75 | {tag:'tr', children:[ | ||
76 | {tag:'td', valign:'top', width:'200', children:[ | ||
77 | {tag:'ul', id:"accountSubMenu", cls:'subMenu', children:[ | ||
78 | {tag:'li', id:'changePassphraseTab', htmlString:Clipperz.PM.Strings['changePasswordTabLabel']}, | ||
79 | {tag:'li', id:'manageOTPTab', htmlString:Clipperz.PM.Strings['manageOTPTabLabel']}, | ||
80 | {tag:'li', id:'accountPreferencesTab', htmlString:Clipperz.PM.Strings['accountPreferencesLabel']}, | ||
81 | {tag:'li', id:'loginHistoryTab', htmlString:Clipperz.PM.Strings['accountLoginHistoryLabel']}, | ||
82 | {tag:'li', id:'deleteAccountTab', htmlString:Clipperz.PM.Strings['deleteAccountTabLabel']} | ||
83 | // {tag:'li', id:'paidAccountTab'), htmlString:Clipperz.PM.Strings['paidAccountTabLabel']} | ||
84 | ]} | ||
85 | ]}, | ||
86 | {tag:'td', valign:'top', children:[ | ||
87 | {tag:'ul', cls:'clipperzTabPanels', children:[ | ||
88 | {tag:'li', id:this.getId('changePassphrasePanel'), children:[ | ||
89 | {tag:'div', cls:'clipperzSubPanel', children:[ | ||
90 | {tag:'h5', htmlString:Clipperz.PM.Strings['changePasswordTabTitle']}, | ||
91 | {tag:'div', cls:'panelBody', id:'changePassphraseBlock', children:[ | ||
92 | {tag:'form', id:this.getId('changePassphraseForm'), children:[ | ||
93 | {tag:'h5', cls:'errorMessage', id:this.getId('changePassphrase_errorMessage')}, | ||
94 | {tag:'table', cls:'panelBody', children:[ | ||
95 | {tag:'tr', children:[ | ||
96 | {tag:'td', children:[ | ||
97 | {tag:'span', cls:'formLabel', htmlString:Clipperz.PM.Strings['changePasswordFormUsernameLabel']} | ||
98 | ]}, | ||
99 | {tag:'td', children:[ | ||
100 | {tag:'input', type:'text', name:'username', id:this.getId('changePassphrase_username')} | ||
101 | ]} | ||
102 | ]}, | ||
103 | {tag:'tr', children:[ | ||
104 | {tag:'td', children:[ | ||
105 | {tag:'span', cls:'formLabel', htmlString:Clipperz.PM.Strings['changePasswordFormOldPassphraseLabel']} | ||
106 | ]}, | ||
107 | {tag:'td', children:[ | ||
108 | {tag:'input', type:'password', name:'oldPassphrase', id:this.getId('changePassphrase_oldPassphrase')} | ||
109 | ]} | ||
110 | ]}, | ||
111 | {tag:'tr', children:[ | ||
112 | {tag:'td', children:[ | ||
113 | {tag:'span', cls:'formLabel', htmlString:Clipperz.PM.Strings['changePasswordFormNewPassphraseLabel']} | ||
114 | ]}, | ||
115 | {tag:'td', children:[ | ||
116 | {tag:'input', type:'password', name:'newPassphrase', id:this.getId('changePassphrase_newPassphrase')} | ||
117 | ]} | ||
118 | ]}, | ||
119 | {tag:'tr', children:[ | ||
120 | {tag:'td', children:[ | ||
121 | {tag:'span', cls:'formLabel', htmlString:Clipperz.PM.Strings['changePasswordFormRetypePassphraseLabel']} | ||
122 | ]}, | ||
123 | {tag:'td', children:[ | ||
124 | {tag:'input', type:'password', name:'renewPassphrase', id:this.getId('changePassphrase_renewPassphrase')} | ||
125 | ]} | ||
126 | ]}, | ||
127 | {tag:'tr', children:[ | ||
128 | {tag:'td', align:'right', children:[ | ||
129 | {tag:'input', type:'checkbox', id:this.getId('changePassphrase_safetyCheck')} | ||
130 | ]}, | ||
131 | {tag:'td', children:[ | ||
132 | {tag:'span', htmlString:Clipperz.PM.Strings['changePasswordFormSafetyCheckboxLabel']} | ||
133 | ]} | ||
134 | ]} | ||
135 | ]}, | ||
136 | {tag:'div', cls:'clipperzSubPanelButtonBox', children:[ | ||
137 | {tag:'div', id:this.getId('changePassphraseButton')} | ||
138 | ]} | ||
139 | ]} | ||
140 | ]} | ||
141 | ]} | ||
142 | ]}, | ||
143 | {tag:'li', id:this.getId('manageOTPPanel'), children:[ | ||
144 | {tag:'div', cls:'clipperzSubPanel', children:[ | ||
145 | {tag:'h5', htmlString:Clipperz.PM.Strings['manageOTPTabTitle']}, | ||
146 | {tag:'div', cls:'panelDescription', htmlString:Clipperz.PM.Strings['manageOTPTabDescription']}, | ||
147 | {tag:'div', id:'OTPComponent'} | ||
148 | ]} | ||
149 | ]}, | ||
150 | {tag:'li', id:this.getId('accountPreferencesPanel'), children:[ | ||
151 | {tag:'div', cls:'clipperzSubPanel', children:[ | ||
152 | {tag:'h5', htmlString:Clipperz.PM.Strings['accountPreferencesTabTitle']}, | ||
153 | {tag:'div', cls:'panelBody', id:this.getId('preferencesPanelBody')} | ||
154 | ]} | ||
155 | ]}, | ||
156 | {tag:'li', id:this.getId('loginHistoryAccountPanel'), children:[ | ||
157 | {tag:'div', cls:'clipperzSubPanel', children:[ | ||
158 | {tag:'h5', htmlString:Clipperz.PM.Strings['loginHistoryTabTitle']}, | ||
159 | {tag:'div', cls:'panelBody', id:'loginHistoryAccountBlock'} | ||
160 | ]} | ||
161 | ]}, | ||
162 | {tag:'li', id:this.getId('deleteAccountPanel'), children:[ | ||
163 | {tag:'div', cls:'clipperzSubPanel', children:[ | ||
164 | {tag:'h5', htmlString:Clipperz.PM.Strings['deleteAccountTabTitle']}, | ||
165 | |||
166 | {tag:'div', cls:'panelBody', id:'deleteAccountBlock', children:[ | ||
167 | {tag:'form', id:this.getId('deleteAccountForm'), children:[ | ||
168 | {tag:'h5', cls:'errorMessage', id:this.getId('deleteAccount_errorMessage')}, | ||
169 | {tag:'table', cls:'panelBody', children:[ | ||
170 | {tag:'tr', children:[ | ||
171 | {tag:'td', children:[ | ||
172 | {tag:'span', cls:'formLabel', htmlString:Clipperz.PM.Strings['deleteAccountFormUsernameLabel']} | ||
173 | ]}, | ||
174 | {tag:'td', children:[ | ||
175 | {tag:'input', type:'text', name:'username', id:this.getId('deleteAccount_username')} | ||
176 | ]} | ||
177 | ]}, | ||
178 | {tag:'tr', children:[ | ||
179 | {tag:'td', children:[ | ||
180 | {tag:'span', cls:'formLabel', htmlString:Clipperz.PM.Strings['deleteAccountFormPassphraseLabel']} | ||
181 | ]}, | ||
182 | {tag:'td', children:[ | ||
183 | {tag:'input', type:'password', name:'passphrase', id:this.getId('deleteAccount_passphrase')} | ||
184 | ]} | ||
185 | ]}, | ||
186 | {tag:'tr', children:[ | ||
187 | {tag:'td', align:'right', children:[ | ||
188 | {tag:'input', type:'checkbox', id:this.getId('deleteAccount_safetyCheck')} | ||
189 | ]}, | ||
190 | {tag:'td', children:[ | ||
191 | {tag:'span', htmlString:Clipperz.PM.Strings['deleteAccountFormSafetyCheckboxLabel']} | ||
192 | ]} | ||
193 | ]} | ||
194 | ]}, | ||
195 | {tag:'div', cls:'clipperzSubPanelButtonBox', children:[ | ||
196 | {tag:'div', id:this.getId('deleteAccountButton')} | ||
197 | ]} | ||
198 | ]} | ||
199 | ]} | ||
200 | ]} | ||
201 | ]} | ||
202 | /* | ||
203 | {tag:'li', id:this.getId('paidAccountPanel'), children:[ | ||
204 | {tag:'div', cls:'clipperzSubPanel', children:[ | ||
205 | {tag:'h5', htmlString:Clipperz.PM.Strings['upgradeAccountTabTitle']}, | ||
206 | {tag:'div', htmlString:Clipperz.PM.Strings['comingSoon']} | ||
207 | ]} | ||
208 | ]} | ||
209 | */ | ||
210 | ]} | ||
211 | ]} | ||
212 | ]} | ||
213 | ]} | ||
214 | ]}); | ||
215 | |||
216 | //MochiKit.Logging.logDebug("--- AccountPanel.render - 1"); | ||
217 | MochiKit.Signal.connect(this.getId('changePassphraseForm'), 'onkeydown', this, 'onkeydown'); | ||
218 | errorMessageActor = this.getActor('changePassphrase_errorMessage'); | ||
219 | errorMessageActor.setVisibilityMode(YAHOO.ext.Element.DISPLAY); | ||
220 | errorMessageActor.update("---"); | ||
221 | errorMessageActor.hide(); | ||
222 | changePasswordButton = new YAHOO.ext.Button(this.getDom('changePassphraseButton'), {text:Clipperz.PM.Strings['changePasswordFormSubmitLabel'], handler:this.doChangePassphrase, scope:this}); | ||
223 | |||
224 | //MochiKit.Logging.logDebug("--- AccountPanel.render - 2"); | ||
225 | |||
226 | MochiKit.Signal.connect(this.getId('deleteAccountForm'), 'onkeydown', this, 'onkeydown'); | ||
227 | errorMessageActor = this.getActor('deleteAccount_errorMessage'); | ||
228 | errorMessageActor.setVisibilityMode(YAHOO.ext.Element.DISPLAY); | ||
229 | errorMessageActor.update(Clipperz.PM.Strings['deleteAccountFormEmptyErrorMessage']); | ||
230 | errorMessageActor.hide(); | ||
231 | deleteAccountButton = new YAHOO.ext.Button(this.getDom('deleteAccountButton'), {text:Clipperz.PM.Strings['deleteAccountFormSubmitLabel'], handler:this.doDeleteAccount, scope:this}); | ||
232 | //MochiKit.Logging.logDebug("--- AccountPanel.render - 5"); | ||
233 | |||
234 | if (Clipperz.PM.Proxy.defaultProxy.isReadOnly()) { | ||
235 | this.getElement('changePassphraseForm').addClass('read-only'); | ||
236 | // this.getElement('accountPreferencesForm').addClass('read-only'); | ||
237 | this.getElement('deleteAccountForm').addClass('read-only'); | ||
238 | changePasswordButton.disable(); | ||
239 | deleteAccountButton.disable(); | ||
240 | } | ||
241 | //MochiKit.Logging.logDebug("--- AccountPanel.render - 6"); | ||
242 | |||
243 | new Clipperz.PM.Components.PasswordEntropyDisplay(this.getElement('changePassphrase_oldPassphrase')); | ||
244 | new Clipperz.PM.Components.PasswordEntropyDisplay(this.getElement('changePassphrase_newPassphrase')); | ||
245 | |||
246 | new Clipperz.PM.Components.OTP.MainComponent(YAHOO.ext.Element.get('OTPComponent'), {user:this.user()}); | ||
247 | |||
248 | this.tabPanelController().setUp(); | ||
249 | Clipperz.NotificationCenter.register(null, 'tabSelected', this, 'tabSelectedHandler'); | ||
250 | Clipperz.NotificationCenter.register(null, 'updatedPreferences', this, 'renderPreferences'); | ||
251 | Clipperz.NotificationCenter.register(null, 'switchLanguage', this, 'switchLanguageHandler'); | ||
252 | //MochiKit.Logging.logDebug("<<< AccountPanel.render"); | ||
253 | |||
254 | } catch(exception) { | ||
255 | MochiKit.Logging.logError("### " + exception); | ||
256 | throw exception; | ||
257 | } | ||
258 | }, | ||
259 | |||
260 | //------------------------------------------------------------------------- | ||
261 | |||
262 | 'tabPanelController': function() { | ||
263 | if (this._tabPanelController == null) { | ||
264 | var tabPanelControllerConfig; | ||
265 | |||
266 | tabPanelControllerConfig = {} | ||
267 | tabPanelControllerConfig['changePassphraseTab'] = this.getId('changePassphrasePanel'); | ||
268 | tabPanelControllerConfig['manageOTPTab'] = this.getId('manageOTPPanel'); | ||
269 | tabPanelControllerConfig['accountPreferencesTab'] = this.getId('accountPreferencesPanel'); | ||
270 | tabPanelControllerConfig['loginHistoryTab'] = this.getId('loginHistoryAccountPanel'); | ||
271 | tabPanelControllerConfig['deleteAccountTab'] = this.getId('deleteAccountPanel'); | ||
272 | // tabPanelControllerConfig['paidAccountTab'] = this.getId('paidAccountPanel'); | ||
273 | |||
274 | this._tabPanelController = new Clipperz.PM.Components.TabPanel.TabPanelController({ | ||
275 | name:'accountTabPanel', | ||
276 | config:tabPanelControllerConfig, | ||
277 | selectedTab:'changePassphraseTab' | ||
278 | }); | ||
279 | } | ||
280 | |||
281 | return this._tabPanelController; | ||
282 | }, | ||
283 | |||
284 | //------------------------------------------------------------------------- | ||
285 | |||
286 | 'doChangePassphrase': function() { | ||
287 | if (Clipperz.PM.Proxy.defaultProxy.isReadOnly() == false) { | ||
288 | varusername; | ||
289 | varoldPassphrase; | ||
290 | var newPassphrase; | ||
291 | var renewPassphrase; | ||
292 | var safetyCheck; | ||
293 | varareThereAnyErrors; | ||
294 | var errorMessageActor; | ||
295 | |||
296 | errorMessageActor = this.getActor('changePassphrase_errorMessage'); | ||
297 | |||
298 | areThereAnyErrors = false; | ||
299 | username = this.getDom('changePassphrase_username').value; | ||
300 | oldPassphrase= this.getDom('changePassphrase_oldPassphrase').value; | ||
301 | newPassphrase= this.getDom('changePassphrase_newPassphrase').value; | ||
302 | renewPassphrase= this.getDom('changePassphrase_renewPassphrase').value; | ||
303 | safetyCheck = this.getDom('changePassphrase_safetyCheck').checked; | ||
304 | |||
305 | if (this.user().username() != username) { | ||
306 | this.showFormErrorMessageAnimation(errorMessageActor, Clipperz.PM.Strings['changePasswordFormWrongUsernameWarning']); | ||
307 | this.getElement('changePassphrase_username').focus().dom.select(); | ||
308 | areThereAnyErrors = true; | ||
309 | } else if (this.user().passphrase() != oldPassphrase) { | ||
310 | this.showFormErrorMessageAnimation(errorMessageActor, Clipperz.PM.Strings['changePasswordFormWrongPassphraseWarning']); | ||
311 | this.getElement('changePassphrase_oldPassphrase').focus().dom.select(); | ||
312 | areThereAnyErrors = true; | ||
313 | } else if (newPassphrase != renewPassphrase) { | ||
314 | this.showFormErrorMessageAnimation(errorMessageActor, Clipperz.PM.Strings['changePasswordFormWrongRetypePassphraseWarning']); | ||
315 | this.getElement('changePassphrase_renewPassphrase').focus().dom.select(); | ||
316 | areThereAnyErrors = true; | ||
317 | } else if (safetyCheck != true) { | ||
318 | this.showFormErrorMessageAnimation(errorMessageActor, Clipperz.PM.Strings['changePasswordFormSafetyCheckWarning']); | ||
319 | this.getElement('changePassphrase_safetyCheck').focus(); | ||
320 | areThereAnyErrors = true; | ||
321 | } | ||
322 | |||
323 | if (areThereAnyErrors == false) { | ||
324 | errorMessageActor.hide(); | ||
325 | this.doChangePassphraseWithUsernameAndPassphrase(username, newPassphrase); | ||
326 | } | ||
327 | } | ||
328 | }, | ||
329 | |||
330 | //------------------------------------------------------------------------- | ||
331 | |||
332 | 'doChangePassphraseWithUsernameAndPassphrase': function(anUsername, aPassphrase) { | ||
333 | var deferredResult; | ||
334 | |||
335 | //MochiKit.Logging.logDebug(">>> AccountPanel.doChangePassphraseWithUsernameAndPassphrase - this.user: " + this.user()); | ||
336 | deferredResult = new MochiKit.Async.Deferred(); | ||
337 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug(" AccountPanel.doChangePassphraseWithUsernameAndPassphrase 1: " + res); return res;}); | ||
338 | deferredResult.addCallback(MochiKit.Base.method(Clipperz.PM.Components.MessageBox(), 'deferredShow'), | ||
339 | { | ||
340 | title:Clipperz.PM.Strings['changePasswordFormProgressDialogTitle'], | ||
341 | text:Clipperz.PM.Strings['changePasswordFormProgressDialogEmptyText'], | ||
342 | width:240, | ||
343 | showProgressBar:true, | ||
344 | showCloseButton:false, | ||
345 | steps:4 | ||
346 | }, | ||
347 | this.getDom('changePassphraseButton') | ||
348 | ); | ||
349 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug(" AccountPanel.doChangePassphraseWithUsernameAndPassphrase 2: " + res); return res;}); | ||
350 | deferredResult.addCallback(MochiKit.Base.method(this.user(), 'changeCredentials'), anUsername, aPassphrase); | ||
351 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug(" AccountPanel.doChangePassphraseWithUsernameAndPassphrase 3: " + res); return res;}); | ||
352 | deferredResult.addCallback(function() { | ||
353 | Clipperz.PM.Components.MessageBox().update({ | ||
354 | title:Clipperz.PM.Strings['changePasswordFormProgressDialogConnectedMessageTitle'], | ||
355 | text:Clipperz.PM.Strings['changePasswordFormProgressDialogConnectedMessageText'], | ||
356 | /*showProgressBar:false,*/ | ||
357 | step:'next' | ||
358 | }); | ||
359 | }); | ||
360 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug(" AccountPanel.doChangePassphraseWithUsernameAndPassphrase 4: " + res); return res;}); | ||
361 | deferredResult.addCallback(MochiKit.Async.wait, 1); | ||
362 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug(" AccountPanel.doChangePassphraseWithUsernameAndPassphrase 5: " + res); return res;}); | ||
363 | deferredResult.addCallback(function(anAccountPanel, res) { | ||
364 | Clipperz.PM.Components.MessageBox().hide(YAHOO.ext.Element.get('main')); | ||
365 | |||
366 | anAccountPanel.getDom('changePassphrase_username').value = ""; | ||
367 | anAccountPanel.getDom('changePassphrase_oldPassphrase').value = ""; | ||
368 | anAccountPanel.getElement('changePassphrase_oldPassphrase').focus(); | ||
369 | anAccountPanel.getDom('changePassphrase_newPassphrase').value = ""; | ||
370 | anAccountPanel.getElement('changePassphrase_newPassphrase').focus(); | ||
371 | anAccountPanel.getDom('changePassphrase_renewPassphrase').value = ""; | ||
372 | anAccountPanel.getDom('changePassphrase_safetyCheck').checked = false; | ||
373 | |||
374 | anAccountPanel.getElement('changePassphrase_username').focus(); | ||
375 | return res; | ||
376 | }, this); | ||
377 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug(" AccountPanel.doChangePassphraseWithUsernameAndPassphrase 6: " + res); return res;}); | ||
378 | deferredResult.addErrback(function() { | ||
379 | Clipperz.PM.Components.MessageBox().update({ | ||
380 | title:Clipperz.PM.Strings['changePasswordFormProgressDialogErrorMessageTitle'], | ||
381 | text:Clipperz.PM.Strings['changePasswordFormProgressDialogErrorMessageText'], | ||
382 | buttons:{'ok':"close"} | ||
383 | }); | ||
384 | }); | ||
385 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug(" AccountPanel.doChangePassphraseWithUsernameAndPassphrase 7: " + res); return res;}); | ||
386 | deferredResult.callback(); | ||
387 | |||
388 | //MochiKit.Logging.logDebug("<<< AccountPanel.doChangePassphraseWithUsernameAndPassphrase"); | ||
389 | }, | ||
390 | |||
391 | //------------------------------------------------------------------------- | ||
392 | |||
393 | 'doDeleteAccount': function() { | ||
394 | if (Clipperz.PM.Proxy.defaultProxy.isReadOnly() == false) { | ||
395 | varusername; | ||
396 | varpassphrase; | ||
397 | var safetyCheck; | ||
398 | varareThereAnyErrors; | ||
399 | var errorMessageActor; | ||
400 | |||
401 | errorMessageActor = this.getActor('deleteAccount_errorMessage'); | ||
402 | |||
403 | areThereAnyErrors = false; | ||
404 | username = this.getDom('deleteAccount_username').value; | ||
405 | passphrase= this.getDom('deleteAccount_passphrase').value; | ||
406 | safetyCheck = this.getDom('deleteAccount_safetyCheck').checked; | ||
407 | |||
408 | if (this.user().username() != username) { | ||
409 | this.showFormErrorMessageAnimation(errorMessageActor, Clipperz.PM.Strings['deleteAccountFormWrongUsernameWarning']); | ||
410 | this.getElement('deleteAccount_username').focus().dom.select(); | ||
411 | areThereAnyErrors = true; | ||
412 | } else if (this.user().passphrase() != passphrase) { | ||
413 | this.showFormErrorMessageAnimation(errorMessageActor, Clipperz.PM.Strings['deleteAccountFormWrongPassphraseWarning']); | ||
414 | this.getElement('deleteAccount_passphrase').focus().dom.select(); | ||
415 | areThereAnyErrors = true; | ||
416 | } else if (safetyCheck != true) { | ||
417 | this.showFormErrorMessageAnimation(errorMessageActor, Clipperz.PM.Strings['deleteAccountFormSafetyCheckWarning']); | ||
418 | this.getElement('deleteAccount_safetyCheck').focus(); | ||
419 | areThereAnyErrors = true; | ||
420 | } | ||
421 | |||
422 | if (areThereAnyErrors == false) { | ||
423 | var deferred; | ||
424 | |||
425 | deferred = new MochiKit.Async.Deferred(); | ||
426 | errorMessageActor.hide(); | ||
427 | |||
428 | deferred.addCallback(function() { | ||
429 | var deferredResult; | ||
430 | |||
431 | //TODO: if the form is submitted with the return key, the confirmation dialog is skipped!? | ||
432 | deferredResult = new MochiKit.Async.Deferred(); | ||
433 | Clipperz.PM.Components.MessageBox().deferredShow({ | ||
434 | title:Clipperz.PM.Strings['accountPanelDeletingAccountPanelConfirmationTitle'], | ||
435 | text:Clipperz.PM.Strings['accountPanelDeleteAccountPanelConfirmationText'], | ||
436 | width:240, | ||
437 | showProgressBar:false, | ||
438 | showCloseButton:false, | ||
439 | buttons:{ | ||
440 | 'yes':Clipperz.PM.Strings['accountPanelDeleteAccountPanelConfirmButtonLabel'], | ||
441 | 'no':Clipperz.PM.Strings['accountPanelDeleteAccountPanelDenyButtonLabel'] | ||
442 | }, | ||
443 | fn:MochiKit.Base.partial(function(aDeferred, aResult) { | ||
444 | if (aResult == 'yes') { | ||
445 | aDeferred.callback(aResult); | ||
446 | } else { | ||
447 | aDeferred.errback(aResult); | ||
448 | } | ||
449 | }, deferredResult) | ||
450 | }); | ||
451 | |||
452 | return deferredResult; | ||
453 | }); | ||
454 | deferred.addCallback(MochiKit.Base.method(Clipperz.PM.Components.MessageBox(), 'deferredShow'), | ||
455 | { | ||
456 | title:Clipperz.PM.Strings['accountPanelDeletingAccountPanelProgressTitle'], | ||
457 | text:Clipperz.PM.Strings['accountPanelDeletingAccountPanelProgressText'], | ||
458 | width:240, | ||
459 | showProgressBar:true, | ||
460 | showCloseButton:false | ||
461 | } | ||
462 | ); | ||
463 | deferred.addCallback(MochiKit.Base.method(this.user(), 'deleteAccountAction')); | ||
464 | deferred.addCallback(Clipperz.PM.exit, 'accountDeleted.html'); | ||
465 | deferred.addErrback(function(res) { | ||
466 | alert(res); | ||
467 | }) | ||
468 | deferred.callback(); | ||
469 | } | ||
470 | } | ||
471 | }, | ||
472 | |||
473 | //------------------------------------------------------------------------- | ||
474 | |||
475 | 'showFormErrorMessageAnimation': function(anActor, anErrorMessage, aCallback) { | ||
476 | anActor.update(anErrorMessage); | ||
477 | anActor.show(true); | ||
478 | anActor.play(aCallback); | ||
479 | }, | ||
480 | |||
481 | //------------------------------------------------------------------------- | ||
482 | |||
483 | 'onkeydown': function(anEvent) { | ||
484 | //MochiKit.Logging.logDebug(">>> onkeydown - " + anEvent.src().id); | ||
485 | if (anEvent.key().code == 13) { | ||
486 | anEvent.stop(); | ||
487 | |||
488 | if (anEvent.src() == this.getDom('changePassphraseForm')) { | ||
489 | this.doChangePassphrase(); | ||
490 | } else if (anEvent.src() == this.getDom('deleteAccountForm')) { | ||
491 | this.doDeleteAccount(); | ||
492 | } else { | ||
493 | } | ||
494 | |||
495 | } | ||
496 | }, | ||
497 | |||
498 | //------------------------------------------------------------------------- | ||
499 | |||
500 | 'selectSelectedLanguageOption': function() { | ||
501 | varuserSelectedLanguage; | ||
502 | |||
503 | userSelectedLanguage = this.user().preferences().preferredLanguage() || "default"; | ||
504 | MochiKit.Base.filter(function(anOption) {return (anOption.value == userSelectedLanguage)}, this.getDom('languageSelector').childNodes)[0].selected = true; | ||
505 | }, | ||
506 | |||
507 | //------------------------------------------------------------------------- | ||
508 | |||
509 | 'doSaveUserPreferences': function() { | ||
510 | var selectedLanguage; | ||
511 | var showDonationReminderDialog; | ||
512 | // var disableUnsecureFaviconLoadingForIE; | ||
513 | |||
514 | //MochiKit.Logging.logDebug(">>> AccountPanel.doSaveUserPreferences"); | ||
515 | selectedLanguage = this.getDom('languageSelector').value; | ||
516 | if (selectedLanguage == "default") { | ||
517 | selectedLanguage = null; | ||
518 | } | ||
519 | this.user().preferences().setPreferredLanguage(selectedLanguage); | ||
520 | |||
521 | showDonationReminderDialog = this.getDom('showDonationReminderCheckbox').checked; | ||
522 | this.user().preferences().setShouldShowDonationPanel(showDonationReminderDialog); | ||
523 | |||
524 | // disableUnsecureFaviconLoadingForIE = this.getDom('disableFaviconForIECheckbox').checked; | ||
525 | // this.user().preferences().setDisableUnsecureFaviconLoadingForIE(disableUnsecureFaviconLoadingForIE); | ||
526 | |||
527 | this.user().preferences().saveChanges(this.getDom('saveUserPreferences')); | ||
528 | }, | ||
529 | |||
530 | 'doCancelUserPreferences': function() { | ||
531 | this.renderPreferences(); | ||
532 | }, | ||
533 | |||
534 | //'switchLanguage': function(anEvent) { | ||
535 | // Clipperz.PM.Strings.Languages.setSelectedLanguage(anEvent.src().value); | ||
536 | //}, | ||
537 | |||
538 | //------------------------------------------------------------------------- | ||
539 | |||
540 | 'renderLoginHistory': function() { | ||
541 | var element; | ||
542 | |||
543 | //MochiKit.Logging.logDebug(">>> AccountPanel.renderLoginHistory"); | ||
544 | element = YAHOO.ext.Element.get('loginHistoryAccountBlock'); | ||
545 | |||
546 | if (Clipperz.PM.Proxy.defaultProxy.isReadOnly()) { | ||
547 | element.update(""); | ||
548 | this.domHelper().append(element, {tag:'div', cls:'loginHistoryReadOnlyMessage', htmlString:Clipperz.PM.Strings['loginHistoryReadOnlyMessage']}); | ||
549 | } else { | ||
550 | var deferredResult; | ||
551 | |||
552 | deferredResult = new MochiKit.Async.Deferred(); | ||
553 | deferredResult.addCallback(MochiKit.Base.bind(function(anElement) { | ||
554 | anElement.update(""); | ||
555 | Clipperz.YUI.DomHelper.append(anElement, {tag:'div', cls:'loadingMessage', htmlString:Clipperz.PM.Strings['loginHistoryLoadingMessage']}); | ||
556 | }, this), element); | ||
557 | deferredResult.addCallback(MochiKit.Base.method(this.user(), 'loadLoginHistory')); | ||
558 | deferredResult.addCallback(MochiKit.Base.bind(function(anElement, aResult) { | ||
559 | var loginListItems; | ||
560 | var tBodyElement; | ||
561 | var imageExtension; | ||
562 | var now; | ||
563 | var i, c; | ||
564 | |||
565 | loginListItems = aResult; | ||
566 | //MochiKit.Logging.logDebug("=== loginListItems: " + Clipperz.Base.serializeJSON(loginListItems)); | ||
567 | imageExtension = (Clipperz_IEisBroken == true) ? 'gif': 'png'; | ||
568 | |||
569 | now = new Date(); | ||
570 | anElement.update(""); | ||
571 | Clipperz.YUI.DomHelper.append(anElement, {tag:'div', cls:'panelDescription', htmlString:Clipperz.PM.Strings['loginHistoryLoadedMessage']}); | ||
572 | Clipperz.YUI.DomHelper.append(anElement, {tag:'table', id:'loginHistoryTable', cellspacing:'0', cellpadding:'2', border:'0', children:[ | ||
573 | {tag:'tbody', id:this.getId('loginHistoryTBody'), children:[]} | ||
574 | ]}); | ||
575 | //# Clipperz.YUI.DomHelper.append(anElement, {tag:'div', id:'loginHistoryFooter', children:[ | ||
576 | Clipperz.YUI.DomHelper.append(anElement, {tag:'div', cls:'clipperzSubPanelButtonBox', children:[ | ||
577 | {tag:'div', id:this.getId('reloadHistoryButton')} | ||
578 | ]}); | ||
579 | |||
580 | new YAHOO.ext.Button(this.getDom('reloadHistoryButton'), {text:Clipperz.PM.Strings['loginHistoryReloadButtonLabel'], handler:this.reloadHistory, scope:this}); | ||
581 | |||
582 | tBodyElement = this.getElement('loginHistoryTBody'); | ||
583 | c = loginListItems.length; | ||
584 | for (i=0; i<c; i++) { | ||
585 | var ip; | ||
586 | var date; | ||
587 | var mainText; | ||
588 | |||
589 | date = Clipperz.PM.Date.parseDateWithUTCFormat(loginListItems[i]['date']); | ||
590 | |||
591 | if (loginListItems[i]['isCurrent'] === true) { | ||
592 | mainText ={tag:'div', cls:'currentSession', htmlString:Clipperz.PM.Strings['loginHistoryCurrentSessionText']} | ||
593 | } else { | ||
594 | mainText = {tag:'div', cls:'elapsedTime', html:Clipperz.PM.Date.getElapsedTimeDescription(date)} | ||
595 | } | ||
596 | |||
597 | if (loginListItems[i]['connectionType'] == "ONE_TIME_PASSPHRASE") { | ||
598 | optionalInfo = [ | ||
599 | {tag:'span', html:"OTP"} | ||
600 | ]; | ||
601 | } else { | ||
602 | optionalInfo = []; | ||
603 | } | ||
604 | |||
605 | ip = (loginListItems[i]['ip'].match(/^\d{1,3}(.\d{1,3}){3}$/)) ? loginListItems[i]['ip'] : Clipperz.PM.Strings['unknown_ip']; | ||
606 | Clipperz.YUI.DomHelper.append(tBodyElement, {tag:'tr', children:[ | ||
607 | {tag:'td', cls:'loginHistoryValues', valign:'top', children:[ | ||
608 | mainText, | ||
609 | {tag:'div', cls:'fullDate', html:Clipperz.PM.Date.formatDateWithTemplate(date, Clipperz.PM.Strings['fullDate_format'])}, | ||
610 | {tag:'div', cls:'loginHistoryIP', children:[ | ||
611 | {tag:'span', cls:'loginHistoryIPLabel', htmlString:Clipperz.PM.Strings['loginHistoryIPLabel']}, | ||
612 | {tag:'span', cls:'loginHistoryIPValue', html:ip} | ||
613 | ]} | ||
614 | ]}, | ||
615 | {tag:'td', cls:'loginHistoryCountry', valign:'top', children:optionalInfo}, | ||
616 | {tag:'td', cls:'loginHistoryCountry', valign:'top', align:'center', children:[ | ||
617 | {tag:'img', title:Clipperz.PM.Strings['countries'][loginListItems[i]['country']], cls:'flag', src:Clipperz.PM.Strings['icons_baseUrl'] + "/flags/" + loginListItems[i]['country'].toLowerCase() + "." + imageExtension, width:'32', height:'32'} | ||
618 | // {tag:'span', cls:'label', htmlString:Clipperz.PM.Strings['countries'][loginListItems[i]['country']]} | ||
619 | ]}, | ||
620 | {tag:'td', cls:'loginHistoryBrowser', valign:'top', align:'center', children:[ | ||
621 | {tag:'img', title:Clipperz.PM.Strings['browsers'][loginListItems[i]['browser']], cls:'browser', src:Clipperz.PM.Strings['icons_baseUrl'] + "/browsers/" + loginListItems[i]['browser'].toLowerCase() + "." + imageExtension, width:'32', height:'32'} | ||
622 | // {tag:'span', cls:'label', htmlString:Clipperz.PM.Strings['browsers'][loginListItems[i]['browser']]} | ||
623 | ]}, | ||
624 | {tag:'td', cls:'loginHistoryOperatingSystem', valign:'top', align:'center', children:[ | ||
625 | {tag:'img', title:Clipperz.PM.Strings['operatingSystems'][loginListItems[i]['operatingSystem']], cls:'operatingSystem', src:Clipperz.PM.Strings['icons_baseUrl'] + "/operatingSystems/" + loginListItems[i]['operatingSystem'].toLowerCase() + "." + imageExtension, width:'32', height:'32'} | ||
626 | // {tag:'span', cls:'label', htmlString:Clipperz.PM.Strings['operatingSystems'][loginListItems[i]['operatingSystem']]} | ||
627 | ]} | ||
628 | ]}); | ||
629 | } | ||
630 | |||
631 | Clipperz.Style.applyZebraStylesToTable('loginHistoryTable'); | ||
632 | }, this), element); | ||
633 | |||
634 | deferredResult.callback(); | ||
635 | } | ||
636 | //MochiKit.Logging.logDebug("<<< AccountPanel.renderLoginHistory"); | ||
637 | }, | ||
638 | |||
639 | //------------------------------------------------------------------------- | ||
640 | |||
641 | 'renderPreferences': function() { | ||
642 | var saveUserPreferencesButton; | ||
643 | var cancelUserPreferencesButton; | ||
644 | var preferencedPanelBodyElement; | ||
645 | |||
646 | preferencedPanelBodyElement = this.getElement('preferencesPanelBody'); | ||
647 | |||
648 | preferencedPanelBodyElement.update(""); | ||
649 | Clipperz.YUI.DomHelper.append(preferencedPanelBodyElement, | ||
650 | {tag:'form', id:this.getId('accountPreferencesForm'), children:[ | ||
651 | {tag:'table', cls:'panelBody', children:[ | ||
652 | {tag:'tr', cls:'openPreferenceBlock', children:[ | ||
653 | {tag:'td', children:[ | ||
654 | {tag:'div', cls:'preferenceBlockTitle', htmlString:Clipperz.PM.Strings['accountPreferencesLanguageTitle']}, | ||
655 | {tag:'div', cls:'panelDescription', htmlString:Clipperz.PM.Strings['accountPreferencesLanguageDescription']}, | ||
656 | {tag:'div', cls:'panelDescription', children:[ | ||
657 | {tag:'select', | ||
658 | id:this.getId('languageSelector'), | ||
659 | children:MochiKit.Base.concat([{tag:'option', value:"default", html:"---"}], Clipperz.PM.Strings['loginPanelSwitchLanguageSelectOptions']) | ||
660 | } | ||
661 | ]} | ||
662 | ]} | ||
663 | ]}, | ||
664 | {tag:'tr', cls:'openPreferenceBlock', children:[ | ||
665 | {tag:'td', children:[ | ||
666 | {tag:'div', cls:'preferenceBlockTitle', htmlString:Clipperz.PM.Strings['showDonationReminderPanelTitle']}, | ||
667 | {tag:'table', cellpadding:'0', cellspacing:'0', children:[ | ||
668 | {tag:'tbody', children:[ | ||
669 | {tag:'tr', children:[ | ||
670 | {tag:'td', valign:'top', children:[ | ||
671 | {tag:'div', cls:'panelDescription', children:[ | ||
672 | {tag:'input', type:'checkbox', id:this.getId('showDonationReminderCheckbox')} | ||
673 | ]} | ||
674 | ]}, | ||
675 | {tag:'td', valign:'top', children:[ | ||
676 | {tag:'div', cls:'panelDescription', htmlString:Clipperz.PM.Strings['showDonationReminderPanelDescription']} | ||
677 | ]} | ||
678 | ]} | ||
679 | ]} | ||
680 | ]} | ||
681 | ]} | ||
682 | ]}//, | ||
683 | /* | ||
684 | {tag:'tr', cls:'openPreferenceBlock', children:[ | ||
685 | {tag:'td', children:[ | ||
686 | {tag:'div', cls:'preferenceBlockTitle', htmlString:Clipperz.PM.Strings['disableFaviconForIETitle']}, | ||
687 | {tag:'table', cellpadding:'0', cellspacing:'0', children:[ | ||
688 | {tag:'tbody', children:[ | ||
689 | {tag:'tr', children:[ | ||
690 | {tag:'td', valign:'top', children:[ | ||
691 | {tag:'div', cls:'panelDescription', children:[ | ||
692 | {tag:'input', type:'checkbox', id:this.getId('disableFaviconForIECheckbox')} | ||
693 | ]} | ||
694 | ]}, | ||
695 | {tag:'td', valign:'top', children:[ | ||
696 | {tag:'div', cls:'panelDescription', children:Clipperz.PM.Strings['disableFaviconForIEDescriptionConfig']} | ||
697 | ]} | ||
698 | ]} | ||
699 | ]} | ||
700 | ]} | ||
701 | ]} | ||
702 | ]}, | ||
703 | */ | ||
704 | // {tag:'tr', cls:'openPreferenceBlock', children:[ | ||
705 | // {tag:'td', children:[ | ||
706 | // {tag:'div', cls:'preferenceBlockTitle', htmlString:Clipperz.PM.Strings['accountPreferencesInterfaceTitle']}, | ||
707 | // {tag:'div', cls:'panelDescription', children:Clipperz.PM.Strings['accountPreferencesInterfaceDescriptionConfig']} | ||
708 | // ]} | ||
709 | // ]} | ||
710 | ]}, | ||
711 | {tag:'div', cls:'clipperzSubPanelButtonBox', children:[ | ||
712 | {tag:'table', border:'0', cellspacing:'0', cellpadding:'0', children:[ | ||
713 | {tag:'tbody', children:[ | ||
714 | {tag:'tr', children:[ | ||
715 | {tag:'td', width:'100', align:'right', cls:'newRecordPanelButtonTD', children:[ | ||
716 | {tag:'div', id:this.getId('saveUserPreferences')} | ||
717 | ]}, | ||
718 | {tag:'td', width:'10', html:" "}, | ||
719 | {tag:'td', cls:'newRecordPanelButtonTD', children:[ | ||
720 | {tag:'div', id:this.getId('cancelUserPreferences')} | ||
721 | ]} | ||
722 | ]} | ||
723 | ]} | ||
724 | ]} | ||
725 | ]} | ||
726 | ]} | ||
727 | ); | ||
728 | |||
729 | this.selectSelectedLanguageOption(); | ||
730 | if (this.user().preferences().shouldShowDonationPanel()) { | ||
731 | this.getDom('showDonationReminderCheckbox').checked = true; | ||
732 | } | ||
733 | // if (this.user().preferences().disableUnsecureFaviconLoadingForIE()) { | ||
734 | // this.getDom('disableFaviconForIECheckbox').checked = true; | ||
735 | // } | ||
736 | |||
737 | //MochiKit.Logging.logDebug("--- AccountPanel.render - 3"); | ||
738 | //# saveUserPreferencesButton = new YAHOO.ext.Button(this.getDom('saveUserPreferences'), {text:Clipperz.PM.Strings['saveUserPreferencesFormSubmitLabel'], handler:this.doSaveUserPreferences, scope:this}); | ||
739 | saveUserPreferencesButton = new YAHOO.ext.Button(this.getDom('saveUserPreferences'), {text:'-----------------', handler:this.doSaveUserPreferences, scope:this}); | ||
740 | saveUserPreferencesButton.setText(Clipperz.PM.Strings['saveUserPreferencesFormSubmitLabel']); | ||
741 | //# cancelUserPreferencesButton = new YAHOO.ext.Button(this.getDom('cancelUserPreferences'), {text:Clipperz.PM.Strings['cancelUserPreferencesFormSubmitLabel'], handler:this.doCancelUserPreferences, scope:this}); | ||
742 | cancelUserPreferencesButton = new YAHOO.ext.Button(this.getDom('cancelUserPreferences'), {text:'-----------------', handler:this.doCancelUserPreferences, scope:this}); | ||
743 | cancelUserPreferencesButton.setText(Clipperz.PM.Strings['cancelUserPreferencesFormSubmitLabel']); | ||
744 | //MochiKit.Logging.logDebug("--- AccountPanel.render - 4"); | ||
745 | |||
746 | if (Clipperz.PM.Proxy.defaultProxy.isReadOnly()) { | ||
747 | this.getElement('accountPreferencesForm').addClass('read-only'); | ||
748 | saveUserPreferencesButton.disable(); | ||
749 | cancelUserPreferencesButton.disable(); | ||
750 | } | ||
751 | |||
752 | }, | ||
753 | |||
754 | //------------------------------------------------------------------------- | ||
755 | |||
756 | 'reloadHistory': function() { | ||
757 | this.setShouldLoadLoginHistory(true); | ||
758 | this.renderLoginHistory(); | ||
759 | }, | ||
760 | |||
761 | 'shouldLoadLoginHistory': function() { | ||
762 | return this._shouldLoadLoginHistory; | ||
763 | }, | ||
764 | |||
765 | 'setShouldLoadLoginHistory': function(aValue) { | ||
766 | this._shouldLoadLoginHistory = aValue; | ||
767 | }, | ||
768 | |||
769 | 'tabSelectedHandler': function(anEvent) { | ||
770 | if (anEvent.parameters() == 'accountPreferencesTab') { | ||
771 | this.renderPreferences(); | ||
772 | } | ||
773 | |||
774 | if ((this.shouldLoadLoginHistory()) && (anEvent.parameters() == 'loginHistoryTab')) { | ||
775 | this.renderLoginHistory(); | ||
776 | this.setShouldLoadLoginHistory(false); | ||
777 | } | ||
778 | }, | ||
779 | |||
780 | //------------------------------------------------------------------------- | ||
781 | __syntaxFix__: "syntax fix" | ||
782 | |||
783 | }); | ||
784 | |||
diff --git a/frontend/beta/js/Clipperz/PM/Components/Panels/BasePanel.js b/frontend/beta/js/Clipperz/PM/Components/Panels/BasePanel.js new file mode 100644 index 0000000..bf60f45 --- a/dev/null +++ b/frontend/beta/js/Clipperz/PM/Components/Panels/BasePanel.js | |||
@@ -0,0 +1,96 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
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 | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | 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 | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | ||
30 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | ||
31 | if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; } | ||
32 | if (typeof(Clipperz.PM.Components.Panels) == 'undefined') { Clipperz.PM.Components.Panels = {}; } | ||
33 | |||
34 | //var _Clipperz_PM_Components_Panels_base_id_ = 0; | ||
35 | |||
36 | //############################################################################# | ||
37 | |||
38 | Clipperz.PM.Components.Panels.BasePanel = function(anElement, args) { | ||
39 | args = args || {}; | ||
40 | |||
41 | Clipperz.PM.Components.Panels.BasePanel.superclass.constructor.call(this, anElement, args); | ||
42 | |||
43 | this._user = args.user || null; | ||
44 | this._delegate = args.delegate || null; | ||
45 | this._tabPanelController = null; | ||
46 | //Clipperz.NotificationCenter.register(null, 'switchLanguage', this, 'switchLanguageHandler'); | ||
47 | |||
48 | //this._ids = {}; | ||
49 | |||
50 | return this; | ||
51 | } | ||
52 | |||
53 | //============================================================================= | ||
54 | |||
55 | YAHOO.extendX(Clipperz.PM.Components.Panels.BasePanel, Clipperz.PM.Components.BaseComponent, { | ||
56 | |||
57 | 'toString': function() { | ||
58 | return "Clipperz.PM.Components.Panels.BasePanel component"; | ||
59 | }, | ||
60 | |||
61 | //------------------------------------------------------------------------- | ||
62 | |||
63 | 'user': function() { | ||
64 | return this._user; | ||
65 | }, | ||
66 | |||
67 | 'setUser': function(aValue) { | ||
68 | this._user = aValue; | ||
69 | }, | ||
70 | |||
71 | //------------------------------------------------------------------------- | ||
72 | |||
73 | 'delegate': function() { | ||
74 | return this._delegate; | ||
75 | }, | ||
76 | |||
77 | 'setDelegate': function(aValue) { | ||
78 | this._delegate = aValue; | ||
79 | }, | ||
80 | |||
81 | //------------------------------------------------------------------------- | ||
82 | |||
83 | 'tabPanelController': function() { | ||
84 | return this._tabPanelController; | ||
85 | }, | ||
86 | |||
87 | 'switchLanguageHandler': function() { | ||
88 | //MochiKit.Logging.logDebug(">>> BasePanel.switchLanguageHandler [" + this.toString() + "]"); | ||
89 | this.render(); | ||
90 | //MochiKit.Logging.logDebug("<<< BasePanel.switchLanguageHandler [" + this.toString() + "]"); | ||
91 | }, | ||
92 | |||
93 | //------------------------------------------------------------------------- | ||
94 | __syntaxFix__: "syntax fix" | ||
95 | |||
96 | }); | ||
diff --git a/frontend/beta/js/Clipperz/PM/Components/Panels/ContactsPanel.js b/frontend/beta/js/Clipperz/PM/Components/Panels/ContactsPanel.js new file mode 100644 index 0000000..f0eb9c8 --- a/dev/null +++ b/frontend/beta/js/Clipperz/PM/Components/Panels/ContactsPanel.js | |||
@@ -0,0 +1,105 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
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 | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | 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 | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | ||
30 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | ||
31 | if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; } | ||
32 | if (typeof(Clipperz.PM.Components.Panels) == 'undefined') { Clipperz.PM.Components.Panels = {}; } | ||
33 | |||
34 | //############################################################################# | ||
35 | |||
36 | Clipperz.PM.Components.Panels.ContactsPanel = function(anElement, args) { | ||
37 | args = args || {}; | ||
38 | |||
39 | Clipperz.PM.Components.Panels.ContactsPanel.superclass.constructor.call(this, anElement, args); | ||
40 | |||
41 | this.render(); | ||
42 | |||
43 | return this; | ||
44 | } | ||
45 | |||
46 | //============================================================================= | ||
47 | |||
48 | YAHOO.extendX(Clipperz.PM.Components.Panels.ContactsPanel, Clipperz.PM.Components.Panels.BasePanel, { | ||
49 | |||
50 | 'toString': function() { | ||
51 | return "Clipperz.PM.Components.ContactsPanel component"; | ||
52 | }, | ||
53 | |||
54 | //------------------------------------------------------------------------- | ||
55 | |||
56 | 'render': function() { | ||
57 | // var tabPanelControllerConfig; | ||
58 | |||
59 | Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'table', border:'0', cellspacing:'0', cellpadding:'0', children:[ | ||
60 | {tag:'tbody', children:[ | ||
61 | {tag:'tr', children:[ | ||
62 | {tag:'td', valign:'top', width:'200', children:[ | ||
63 | {tag:'ul', id:"dataSubMenu", cls:'subMenu', children:[ | ||
64 | {tag:'li', id:this.getId('contacts'), htmlString:Clipperz.PM.Strings['contactsTabLabel']}, | ||
65 | ]} | ||
66 | ]}, | ||
67 | {tag:'td', valign:'top', children:[ | ||
68 | {tag:'ul', cls:'clipperzTabPanels', children:[ | ||
69 | {tag:'li', id:this.getId('contactsPanel'), children:[ | ||
70 | {tag:'div', cls:'clipperzSubPanel', children:[ | ||
71 | {tag:'h5', htmlString:Clipperz.PM.Strings['contactsTabTitle']}, | ||
72 | {tag:'div', htmlString:Clipperz.PM.Strings['comingSoon']} | ||
73 | ]} | ||
74 | ]} | ||
75 | ]} | ||
76 | ]} | ||
77 | ]} | ||
78 | ]} | ||
79 | ]}); | ||
80 | |||
81 | // tabPanelControllerConfig = {} | ||
82 | // tabPanelControllerConfig[this.getId('contacts')] = this.getId('contactsPanel'); | ||
83 | // new Clipperz.PM.Components.TabPanel.TabPanelController({ config:tabPanelControllerConfig, selectedTab:this.getId('contacts') }); | ||
84 | this.tabPanelController().setUp(); | ||
85 | }, | ||
86 | |||
87 | //------------------------------------------------------------------------- | ||
88 | |||
89 | 'tabPanelController': function() { | ||
90 | if (this._tabPanelController == null) { | ||
91 | var tabPanelControllerConfig; | ||
92 | |||
93 | tabPanelControllerConfig = {} | ||
94 | tabPanelControllerConfig[this.getId('contacts')] = this.getId('contactsPanel'); | ||
95 | this._tabPanelController = new Clipperz.PM.Components.TabPanel.TabPanelController({ config:tabPanelControllerConfig, selectedTab:this.getId('contacts') }); | ||
96 | } | ||
97 | |||
98 | return this._tabPanelController; | ||
99 | }, | ||
100 | |||
101 | //------------------------------------------------------------------------- | ||
102 | __syntaxFix__: "syntax fix" | ||
103 | |||
104 | }); | ||
105 | |||
diff --git a/frontend/beta/js/Clipperz/PM/Components/Panels/DataPanel.js b/frontend/beta/js/Clipperz/PM/Components/Panels/DataPanel.js new file mode 100644 index 0000000..759903f --- a/dev/null +++ b/frontend/beta/js/Clipperz/PM/Components/Panels/DataPanel.js | |||
@@ -0,0 +1,486 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
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 | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | 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 | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | ||
30 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | ||
31 | if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; } | ||
32 | if (typeof(Clipperz.PM.Components.Panels) == 'undefined') { Clipperz.PM.Components.Panels = {}; } | ||
33 | |||
34 | //############################################################################# | ||
35 | |||
36 | Clipperz.PM.Components.Panels.DataPanel = function(anElement, args) { | ||
37 | args = args || {}; | ||
38 | |||
39 | Clipperz.PM.Components.Panels.DataPanel.superclass.constructor.call(this, anElement, args); | ||
40 | |||
41 | this._progressWidth = 400; | ||
42 | |||
43 | |||
44 | this.render(); | ||
45 | |||
46 | return this; | ||
47 | } | ||
48 | |||
49 | //============================================================================= | ||
50 | |||
51 | YAHOO.extendX(Clipperz.PM.Components.Panels.DataPanel, Clipperz.PM.Components.Panels.BasePanel, { | ||
52 | |||
53 | 'toString': function() { | ||
54 | return "Clipperz.PM.Components.DataPanel component"; | ||
55 | }, | ||
56 | |||
57 | //------------------------------------------------------------------------- | ||
58 | |||
59 | 'render': function() { | ||
60 | MochiKit.Signal.disconnectAllTo(this); | ||
61 | Clipperz.NotificationCenter.unregister(this); | ||
62 | this.element().update(""); | ||
63 | |||
64 | Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'table', border:'0', cellspacing:'0', cellpadding:'0', children:[ | ||
65 | {tag:'tbody', children:[ | ||
66 | {tag:'tr', children:[ | ||
67 | {tag:'td', valign:'top', width:'200', children:[ | ||
68 | {tag:'ul', id:"dataSubMenu", cls:'subMenu', children:[ | ||
69 | {tag:'li', id:'offlineCopyTab', htmlString:Clipperz.PM.Strings['offlineCopyTabLabel']}, | ||
70 | {tag:'li', id:'sharingTab', htmlString:Clipperz.PM.Strings['sharingTabLabel']}, | ||
71 | {tag:'li', id:'importTab', htmlString:Clipperz.PM.Strings['importTabLabel']}, | ||
72 | {tag:'li', id:'printingTab', htmlString:Clipperz.PM.Strings['printingTabLabel']} | ||
73 | ]} | ||
74 | ]}, | ||
75 | {tag:'td', valign:'top', children:[ | ||
76 | {tag:'ul', cls:'clipperzTabPanels', children:[ | ||
77 | {tag:'li', id:this.getId('offlineCopyPanel'), children:[ | ||
78 | {tag:'div', cls:'clipperzSubPanel', children:[ | ||
79 | {tag:'h5', htmlString:Clipperz.PM.Strings['offlineCopyTabTitle']}, | ||
80 | {tag:'div', cls:'panelDescription', htmlString:Clipperz.PM.Strings['offlineCopyTabDescription']}, | ||
81 | {tag:'div', id:this.getId('offlineCopyLinkBox'), children:[ | ||
82 | {tag:'a', id:'offlineCopyLink', href:'#', htmlString:Clipperz.PM.Strings['offlineCopyDownloadLinkLabel']} | ||
83 | ]}, | ||
84 | {tag:'div', id:this.getId('offlineCopyLinkBox_read-only'), children:[ | ||
85 | {tag:'span', cls:'read-only', htmlString:Clipperz.PM.Strings['offlineCopyDownloadLinkLabel']} | ||
86 | ]} | ||
87 | ]} | ||
88 | ]}, | ||
89 | {tag:'li', id:this.getId('sharingPanel'), children:[ | ||
90 | {tag:'div', cls:'clipperzSubPanel', children:[ | ||
91 | {tag:'h5', htmlString:Clipperz.PM.Strings['sharingTabTitle']}, | ||
92 | {tag:'div', cls:'panelDescription', htmlString:Clipperz.PM.Strings['sharingTabDescription']} | ||
93 | ]} | ||
94 | ]}, | ||
95 | {tag:'li', id:this.getId('importPanel'), children:[ | ||
96 | {tag:'div', cls:'clipperzSubPanel', children:[ | ||
97 | {tag:'div', id:this.getId('importPanelMainComponent')} | ||
98 | ]} | ||
99 | ]}, | ||
100 | {tag:'li', id:this.getId('printingPanel'), children:[ | ||
101 | {tag:'div', cls:'clipperzSubPanel', children:[ | ||
102 | {tag:'h5', htmlString:Clipperz.PM.Strings['printingTabTitle']}, | ||
103 | |||
104 | {tag:'div', cls:'panelDescription', htmlString:Clipperz.PM.Strings['printingTabDescription']}, | ||
105 | {tag:'div', id:this.getId('printingLinkBox'), children:[ | ||
106 | {tag:'a', id:'printingLink', href:'#', htmlString:Clipperz.PM.Strings['printingLinkLabel']} | ||
107 | ]}, | ||
108 | |||
109 | {tag:'hr'}, | ||
110 | |||
111 | {tag:'div', cls:'panelDescription', htmlString:Clipperz.PM.Strings['exportTabDescription']}, | ||
112 | {tag:'div', id:this.getId('exportLinkBox'), children:[ | ||
113 | {tag:'a', id:'exportLink', href:'#', htmlString:Clipperz.PM.Strings['exportLinkLabel']} | ||
114 | ]} | ||
115 | ]} | ||
116 | ]} | ||
117 | ]} | ||
118 | ]} | ||
119 | ]} | ||
120 | ]} | ||
121 | ]}); | ||
122 | |||
123 | this.tabPanelController().setUp(); | ||
124 | |||
125 | if (Clipperz.PM.Proxy.defaultProxy.isReadOnly()) { | ||
126 | this.getElement('offlineCopyLinkBox').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide(); | ||
127 | } else { | ||
128 | this.getElement('offlineCopyLinkBox_read-only').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide(); | ||
129 | MochiKit.Signal.connect('offlineCopyLink', 'onclick', this, 'downloadOfflineCopy'); | ||
130 | } | ||
131 | |||
132 | new Clipperz.PM.Components.Import.MainComponent(this.getElement('importPanelMainComponent'), {user:this.user()}); | ||
133 | |||
134 | MochiKit.Signal.connect('printingLink', 'onclick', this, 'printAllData'); | ||
135 | MochiKit.Signal.connect('exportLink', 'onclick', this, 'exportAllData'); | ||
136 | |||
137 | Clipperz.NotificationCenter.register(null, 'switchLanguage', this, 'switchLanguageHandler'); | ||
138 | }, | ||
139 | |||
140 | //------------------------------------------------------------------------- | ||
141 | |||
142 | 'tabPanelController': function() { | ||
143 | if (this._tabPanelController == null) { | ||
144 | var tabPanelControllerConfig; | ||
145 | |||
146 | tabPanelControllerConfig = {} | ||
147 | tabPanelControllerConfig['offlineCopyTab'] = this.getId('offlineCopyPanel'); | ||
148 | tabPanelControllerConfig['sharingTab'] = this.getId('sharingPanel'); | ||
149 | tabPanelControllerConfig['importTab'] = this.getId('importPanel'); | ||
150 | tabPanelControllerConfig['printingTab'] = this.getId('printingPanel'); | ||
151 | this._tabPanelController = new Clipperz.PM.Components.TabPanel.TabPanelController({ | ||
152 | name: 'dataTabPanel', | ||
153 | config:tabPanelControllerConfig, | ||
154 | selectedTab:'offlineCopyTab' | ||
155 | }); | ||
156 | } | ||
157 | |||
158 | return this._tabPanelController; | ||
159 | }, | ||
160 | |||
161 | //------------------------------------------------------------------------- | ||
162 | |||
163 | 'downloadOfflineCopy': function(anEvent) { | ||
164 | var downloadHref; | ||
165 | |||
166 | downloadHref = window.location.href.replace(/\/[^\/]*$/,'') + Clipperz_dumpUrl; | ||
167 | |||
168 | if (Clipperz_IEisBroken == true) { | ||
169 | window.open(downloadHref, ""); | ||
170 | } else { | ||
171 | vardeferredResult; | ||
172 | var newWindow; | ||
173 | |||
174 | newWindow = window.open("", ""); | ||
175 | |||
176 | anEvent.preventDefault(); | ||
177 | |||
178 | deferredResult = new MochiKit.Async.Deferred(); | ||
179 | deferredResult.addCallback(MochiKit.Base.method(this.user().connection(), 'message'), 'echo', {'echo':"echo"}); | ||
180 | deferredResult.addCallback(function(aWindow) { | ||
181 | aWindow.location.href = downloadHref; | ||
182 | }, newWindow); | ||
183 | deferredResult.callback(); | ||
184 | } | ||
185 | }, | ||
186 | |||
187 | //------------------------------------------------------------------------- | ||
188 | |||
189 | 'compareRecords': function(a, b) { | ||
190 | return MochiKit.Base.compare(a.label().toLowerCase(), b.label().toLowerCase()); | ||
191 | }, | ||
192 | |||
193 | 'logo': function() { | ||
194 | var result; | ||
195 | |||
196 | if (Clipperz_IEisBroken == true) { | ||
197 | if (Clipperz.PM.Proxy.defaultProxy.isReadOnly()) { | ||
198 | result = "<span><span class=\"clipperzLogoSpan\">clipper</span><span class=\"clipperzLoggoZSpan\">z</span></span>"; | ||
199 | } else { | ||
200 | result = "<img src=\"./images/exportLogo.png\" />"; | ||
201 | } | ||
202 | } else { | ||
203 | result = "<img src=\"data:image/png;charset=utf-8;base64,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\" />"; | ||
204 | } | ||
205 | |||
206 | return result; | ||
207 | }, | ||
208 | |||
209 | 'progressWidth': function() { | ||
210 | return this._progressWidth; | ||
211 | }, | ||
212 | |||
213 | 'updateProgress': function(aProgressComponent, aPercentage) { | ||
214 | |||
215 | |||
216 | }, | ||
217 | |||
218 | //------------------------------------------------------------------------- | ||
219 | |||
220 | 'printAllData': function(anEvent) { | ||
221 | var newWindow; | ||
222 | var allRecords; | ||
223 | |||
224 | //MochiKit.Logging.logDebug(">>> printAllData"); | ||
225 | newWindow = window.open("", ""); | ||
226 | newWindow.document.write( | ||
227 | "<html>" + | ||
228 | "<header>" + | ||
229 | "<title>Clipperz export data</title>" + | ||
230 | "<style>" + | ||
231 | "#exportedData {" + | ||
232 | " width: 600px;"+ | ||
233 | "}" + | ||
234 | ".ext-mb-progress-wrap {" + | ||
235 | "border:1px solid #6593cf;" + | ||
236 | "margin-bottom: 10px;" + | ||
237 | "width: " + this.progressWidth() + "px;" + | ||
238 | "}" + | ||
239 | ".ext-mb-progress {" + | ||
240 | "height:18px;" + | ||
241 | "background:transparent url(./images/default/basic-dialog/progress2.gif) repeat-x 1px 1px;" + | ||
242 | "}" + | ||
243 | ".ext-mb-progress-bar {" + | ||
244 | "height:18px;" + | ||
245 | "overflow:hidden;" + | ||
246 | "width:0;" + | ||
247 | "background:#8bb8f3;" + | ||
248 | "}" + | ||
249 | "body {" + | ||
250 | "font-family: sans-serif;" + | ||
251 | "}" + | ||
252 | "div#logo {" + | ||
253 | "border-bottom: 1px dotted #aaaaaa;" + | ||
254 | "margin-bottom: 15px;" + | ||
255 | "}" + | ||
256 | "div.recordBlock h2 {" + | ||
257 | "font-size: 14pt;" + | ||
258 | "margin: 0px;" + | ||
259 | "padding: 0px;" + | ||
260 | "border: 0px;" + | ||
261 | "color: #666666;" + | ||
262 | "}" + | ||
263 | "div.recordBlock div.recordNotes p {" + | ||
264 | "margin: 0px;" + | ||
265 | "padding: 0px;" + | ||
266 | "border: 0px;" + | ||
267 | "color: #aaaaaa;" + | ||
268 | "font-size: 10pt;" + | ||
269 | "line-height: 18pt;" + | ||
270 | "border-left: 1px solid #aaaaaa;" + | ||
271 | "padding-left: 10px;" + | ||
272 | "}" + | ||
273 | "div.recordBlock dl {" + | ||
274 | "margin: 0px;" + | ||
275 | "padding: 0px;" + | ||
276 | "border: 0px;" + | ||
277 | "color: #999999;" + | ||
278 | "padding-bottom: 10px;" + | ||
279 | "border-bottom: 1px dotted #aaaaaa;" + | ||
280 | "margin-top: 10px;" + | ||
281 | "margin-bottom: 15px;" + | ||
282 | "}" + | ||
283 | "div.recordBlock dl dt {" + | ||
284 | "display: block;" + | ||
285 | "float: left;" + | ||
286 | "min-width: 100px;" + | ||
287 | "white-space: nowrap;" + | ||
288 | "overflow: hidden;" + | ||
289 | "margin-right: 10px;" + | ||
290 | "font-size: 10pt;" + | ||
291 | "line-height: 18pt;" + | ||
292 | "}" + | ||
293 | "div.recordBlock dl dd {" + | ||
294 | "color: #666666;" + | ||
295 | "font-size: 10pt;" + | ||
296 | "line-height: 18pt;" + | ||
297 | "}" + | ||
298 | "" + | ||
299 | "</style>" + | ||
300 | "" + | ||
301 | "<!--[if IE]>" + | ||
302 | "<style>" + | ||
303 | "div.recordBlock dl dt {" + | ||
304 | "width: 100px;" + | ||
305 | "}" + | ||
306 | "</style>" + | ||
307 | "<![endif]-->" + | ||
308 | "" + | ||
309 | "</header>" + | ||
310 | "<body>" + | ||
311 | "<div id=\"logo\">" + this.logo() + | ||
312 | "<div id=\"progressWrapper\"><div class=\"ext-mb-progress-wrap\"><div class=\"ext-mb-progress\"><div id=\"progress\" class=\"ext-mb-progress-bar\"> </div></div></div></div>" + | ||
313 | " </div>" + | ||
314 | "</body>" + | ||
315 | "</html>" | ||
316 | ); | ||
317 | |||
318 | anEvent.preventDefault(); | ||
319 | |||
320 | allRecords = MochiKit.Base.values(this.user().records()); | ||
321 | allRecords.sort(this.compareRecords); | ||
322 | |||
323 | /* | ||
324 | deferredResult = new MochiKit.Async.Deferred(); | ||
325 | MochiKit.Iter.forEach(allRecords, MochiKit.Base.partial(function(aDeferredResult, aWindow, aRecord) { | ||
326 | var printerRecord; | ||
327 | |||
328 | printerRecord = new Clipperz.PM.Components.Printing.Record({record:aRecord}); | ||
329 | aDeferredResult.addCallback(MochiKit.Base.method(printerRecord, 'deferredDrawToWindow', aWindow)); | ||
330 | }, deferredResult, newWindow)); | ||
331 | deferredResult.callback(); | ||
332 | |||
333 | return deferredResult; | ||
334 | */ | ||
335 | |||
336 | MochiKit.DOM.withWindow(newWindow, MochiKit.Base.bind(function(someRecords) { | ||
337 | var currentWindow; | ||
338 | vardeferredResult; | ||
339 | var progressBar; | ||
340 | var progressWrapper; | ||
341 | var i, c; | ||
342 | |||
343 | currentWindow = MochiKit.DOM.currentWindow(); | ||
344 | progressBar = MochiKit.DOM.getElement('progress'); | ||
345 | progressWrapper = MochiKit.DOM.getElement('progressWrapper'); | ||
346 | |||
347 | deferredResult = new MochiKit.Async.Deferred(); | ||
348 | c = someRecords.length; | ||
349 | for (i=0; i<c; i++) { | ||
350 | deferredResult.addCallback(function(aWindow, aRecord) { | ||
351 | var printerRecord; | ||
352 | |||
353 | printerRecord = new Clipperz.PM.Components.Printing.Record({record:aRecord}); | ||
354 | return printerRecord.deferredDrawToWindow(aWindow); | ||
355 | }, currentWindow, someRecords[i]) | ||
356 | deferredResult.addCallback(MochiKit.Base.bind(function(aProgressBar, aProgress) { | ||
357 | MochiKit.Style.setElementDimensions(aProgressBar, {w:aProgress * this.progressWidth()}); | ||
358 | }, this, progressBar, ((i+1)/c))); | ||
359 | deferredResult.addCallback(MochiKit.Async.wait, 0.2); | ||
360 | } | ||
361 | |||
362 | deferredResult.addCallback(function(aWindow, aProgressWrapper) { | ||
363 | MochiKit.DOM.replaceChildNodes(aProgressWrapper); | ||
364 | MochiKit.Style.hideElement(aProgressWrapper); | ||
365 | aWindow.stop(); | ||
366 | }, currentWindow, progressWrapper); | ||
367 | |||
368 | |||
369 | deferredResult.callback(); | ||
370 | }, this, allRecords)); | ||
371 | }, | ||
372 | |||
373 | //------------------------------------------------------------------------- | ||
374 | |||
375 | 'exportAllData': function(anEvent) { | ||
376 | // vardeferredResult; | ||
377 | var newWindow; | ||
378 | var allRecords; | ||
379 | |||
380 | //MochiKit.Logging.logDebug(">>> printAllData"); | ||
381 | newWindow = window.open("", ""); | ||
382 | newWindow.document.write( | ||
383 | "<html>" + | ||
384 | "<header>" + | ||
385 | "<title>Clipperz export data</title>" + | ||
386 | "<style>" + | ||
387 | "#exportedData {" + | ||
388 | " width: 600px;"+ | ||
389 | "}" + | ||
390 | ".ext-mb-progress-wrap {" + | ||
391 | "margin-top:4px;" + | ||
392 | "margin-bottom: 10px;" + | ||
393 | "border:1px solid #6593cf;" + | ||
394 | "width: " + this.progressWidth() + "px;" + | ||
395 | "}" + | ||
396 | ".ext-mb-progress {" + | ||
397 | "height:18px;" + | ||
398 | "background:transparent url(./images/default/basic-dialog/progress2.gif) repeat-x 1px 1px;" + | ||
399 | "}" + | ||
400 | ".ext-mb-progress-bar {" + | ||
401 | "height:18px;" + | ||
402 | "overflow:hidden;" + | ||
403 | "width:0;" + | ||
404 | "background:#8bb8f3;" + | ||
405 | "}" + | ||
406 | "</style>" + | ||
407 | "" + | ||
408 | "<!--[if IE]>" + | ||
409 | "<style>" + | ||
410 | "</style>" + | ||
411 | "<![endif]-->" + | ||
412 | "" + | ||
413 | "</header>" + | ||
414 | "<body>" + | ||
415 | "<div id=\"logo\">" + this.logo() + "</div>" + | ||
416 | "<div id=\"progressWrapper\">" + | ||
417 | " <div class=\"description\">" + Clipperz.PM.Strings['exportDataInProgressDescription'] + "</div>" + | ||
418 | " <div class=\"ext-mb-progress-wrap\"><div class=\"ext-mb-progress\"><div id=\"progress\" class=\"ext-mb-progress-bar\"> </div></div></div>" + | ||
419 | "</div>" + | ||
420 | "<div id=\"textareaWrapper\">" + | ||
421 | " <div class=\"description\">" + Clipperz.PM.Strings['exportDataDescription'] + "</div>" + | ||
422 | " <textarea id=\"exportedData\" cols=\"80\" rows=\"20\">[</textarea>" + | ||
423 | "</div>" + | ||
424 | "</body>" + | ||
425 | "</html>" | ||
426 | ); | ||
427 | |||
428 | anEvent.preventDefault(); | ||
429 | |||
430 | allRecords = MochiKit.Base.values(this.user().records()); | ||
431 | allRecords.sort(this.compareRecords); | ||
432 | |||
433 | MochiKit.DOM.withWindow(newWindow, MochiKit.Base.bind(function(someRecords) { | ||
434 | var currentWindow; | ||
435 | vardeferredResult; | ||
436 | var textareaWrapper; | ||
437 | vartextarea; | ||
438 | var progressBar; | ||
439 | var progressWrapper; | ||
440 | var i, c; | ||
441 | |||
442 | currentWindow = MochiKit.DOM.currentWindow(); | ||
443 | textarea = MochiKit.DOM.getElement('exportedData'); | ||
444 | textareaWrapper = MochiKit.DOM.getElement('textareaWrapper'); | ||
445 | MochiKit.Style.hideElement(textareaWrapper); | ||
446 | progressBar = MochiKit.DOM.getElement('progress'); | ||
447 | progressWrapper = MochiKit.DOM.getElement('progressWrapper'); | ||
448 | |||
449 | deferredResult = new MochiKit.Async.Deferred(); | ||
450 | |||
451 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("exportAllData - 1: " + res); return res;}); | ||
452 | c = someRecords.length; | ||
453 | for (i=0; i<c; i++) { | ||
454 | deferredResult.addCallback(MochiKit.Base.method(someRecords[i], 'deferredData')); | ||
455 | deferredResult.addCallback(MochiKit.Base.method(someRecords[i], 'exportedData')); | ||
456 | deferredResult.addCallback(MochiKit.Base.bind(function(aTextarea, aProgressBar, aProgress, someRecordExportedData) { | ||
457 | aTextarea.value = aTextarea.value + "\n" + someRecordExportedData + ","; | ||
458 | MochiKit.Style.setElementDimensions(aProgressBar, {w:aProgress * this.progressWidth()}); | ||
459 | }, this, textarea, progressBar, ((i+1)/c))); | ||
460 | deferredResult.addCallback(MochiKit.Async.wait, 0.2); | ||
461 | } | ||
462 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("exportAllData - 2: " + res); return res;}); | ||
463 | deferredResult.addCallback(function(aTextareaWrapper, aTextarea, aProgressWrapper) { | ||
464 | aTextarea.value = aTextarea.value.slice(0, -1) + "\n]"; | ||
465 | // MochiKit.DOM.replaceChildNodes(aProgressWrapper); | ||
466 | MochiKit.Style.hideElement(aProgressWrapper); | ||
467 | MochiKit.Style.showElement(aTextareaWrapper); | ||
468 | aTextarea.focus(); | ||
469 | aTextarea.select(); | ||
470 | }, textareaWrapper, textarea, progressWrapper); | ||
471 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("exportAllData - 3: " + res); return res;}); | ||
472 | deferredResult.addBoth(function(aWindow) { | ||
473 | aWindow.stop(); | ||
474 | }, currentWindow); | ||
475 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("exportAllData - 4: " + res); return res;}); | ||
476 | |||
477 | deferredResult.callback(); | ||
478 | }, this, allRecords)); | ||
479 | }, | ||
480 | |||
481 | //------------------------------------------------------------------------- | ||
482 | |||
483 | __syntaxFix__: "syntax fix" | ||
484 | |||
485 | }); | ||
486 | |||
diff --git a/frontend/beta/js/Clipperz/PM/Components/Panels/LoginPanel.js b/frontend/beta/js/Clipperz/PM/Components/Panels/LoginPanel.js new file mode 100644 index 0000000..84b2475 --- a/dev/null +++ b/frontend/beta/js/Clipperz/PM/Components/Panels/LoginPanel.js | |||
@@ -0,0 +1,1114 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
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 | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | 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 | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | ||
30 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | ||
31 | if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; } | ||
32 | if (typeof(Clipperz.PM.Components.Panels) == 'undefined') { Clipperz.PM.Components.Panels = {}; } | ||
33 | |||
34 | |||
35 | Clipperz.PM.Components.Panels.LoginPanel = function(anElement, args) { | ||
36 | args = args || {}; | ||
37 | |||
38 | Clipperz.PM.Components.Panels.LoginPanel.superclass.constructor.call(this, anElement, args); | ||
39 | |||
40 | this._showLoginFormAnimator = null; | ||
41 | this._showRegistrationFormAnimator = null; | ||
42 | this._shouldShowRegistrationAlert = true; | ||
43 | |||
44 | this._visibleForm = null; | ||
45 | //this._isPassphraseVisible = true; | ||
46 | |||
47 | Clipperz.NotificationCenter.register(null, 'switchLanguage', this, 'switchLanguageHandler'); | ||
48 | |||
49 | this.render(); | ||
50 | |||
51 | return this; | ||
52 | } | ||
53 | |||
54 | //============================================================================= | ||
55 | |||
56 | //MochiKit.Base.update(Clipperz.PM.Components.Panels.LoginPanel.prototype, { | ||
57 | YAHOO.extendX(Clipperz.PM.Components.Panels.LoginPanel, Clipperz.PM.Components.Panels.BasePanel, { | ||
58 | |||
59 | 'toString': function() { | ||
60 | return "Clipperz.PM.Components.LoginPanel component"; | ||
61 | }, | ||
62 | |||
63 | //------------------------------------------------------------------------- | ||
64 | |||
65 | 'render': function() { | ||
66 | var result; | ||
67 | varlayout; | ||
68 | var registerButton; | ||
69 | |||
70 | MochiKit.Signal.disconnectAllTo(this); | ||
71 | this.element().update(""); | ||
72 | |||
73 | //MochiKit.Logging.logDebug(">>> LoginPanel.initPanel"); | ||
74 | Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'div', id:this.getId('baseDiv'), cls:'LoginPanel', children:[ | ||
75 | {tag:'table', children:[ | ||
76 | {tag:'thead'}, | ||
77 | {tag:'tbody', children:[ | ||
78 | {tag:'tr', children:[ | ||
79 | {tag:'td', valign:'top', children:[ | ||
80 | {tag:'div', cls:'clipperzServiceDescription', htmlString:Clipperz.PM.Strings['clipperzServiceDescription']} | ||
81 | ]}, | ||
82 | {tag:'td', valign:'top', align:'right', children:[ | ||
83 | {tag:'div', id:this.getId('forms'), cls:'clipperzLoginForm', children:[ | ||
84 | {tag:'div', id:this.getId('loginForm'), cls:'loginForm', children:[ | ||
85 | {tag:'div', cls:'loginFormHeaderBox', children:[{tag:'h3', htmlString:Clipperz.PM.Strings['loginFormTitle']}]}, | ||
86 | {tag:'form', id:this.getId('loginForm_form'), autocomplete:'off', children:[ | ||
87 | |||
88 | {tag:'table', cls:'formLayout', children:[ | ||
89 | {tag:'thead'}, | ||
90 | {tag:'tbody', children:[ | ||
91 | {tag:'tr', cls:'formFieldTR', children:[ | ||
92 | {tag:'td', width:'90', htmlString:Clipperz.PM.Strings['loginFormUsernameLabel']}, | ||
93 | {tag:'td', children:[ | ||
94 | {tag:'input', id:this.getId('login_username'), cls:'loginFormField', type:'text', name:'username'} | ||
95 | ]} | ||
96 | ]}, | ||
97 | {tag:'tr', cls:'formFieldTR', children:[ | ||
98 | {tag:'td', htmlString:Clipperz.PM.Strings['loginFormPassphraseLabel']}, | ||
99 | {tag:'td', children:[ | ||
100 | {tag:'div', id:this.getId('passphraseDIV'), children:[ | ||
101 | {tag:'input', id:this.getId('login_passphrase'), cls:'loginFormField', type:'password', name:'passphrase'} | ||
102 | ]}, | ||
103 | {tag:'div', cls:'oneTimePassword', id:this.getId('oneTimePasswordDIV'), children:[ | ||
104 | {tag:'input', type:'text', id:this.getId('oneTimePassword_1'), name:'passphrase'}, | ||
105 | {tag:'span', html:'-'}, | ||
106 | {tag:'input', type:'text', id:this.getId('oneTimePassword_2'), name:'passphrase'}, | ||
107 | {tag:'span', html:'-'}, | ||
108 | {tag:'input', type:'text', id:this.getId('oneTimePassword_3'), name:'passphrase'}, | ||
109 | {tag:'span', html:'-'}, | ||
110 | {tag:'input', type:'text', id:this.getId('oneTimePassword_4'), name:'passphrase'} | ||
111 | ]} | ||
112 | ]} | ||
113 | ]}, | ||
114 | {tag:'tr', cls:'formFieldTR', id:this.getId('passwordTypeChooserTR'), children:[ | ||
115 | {tag:'td', valign:'top', align:'right', children:[ | ||
116 | {tag:'input', type:'checkbox', cls:'passwordTypeCheckbox', id:this.getId('useOneTimePasswordCheckbox')} | ||
117 | ]}, | ||
118 | {tag:'td', children:[ | ||
119 | {tag:'div', cls:'passwordTypeChooser', children:[ | ||
120 | {tag:'h4', htmlString:Clipperz.PM.Strings['loginFormOneTimePasswordCheckboxLabel']}, | ||
121 | {tag:'span', htmlString:Clipperz.PM.Strings['loginFormOneTimePasswordCheckboxDescription']} | ||
122 | ]} | ||
123 | ]} | ||
124 | ]}, | ||
125 | {tag:'tr', children:[ | ||
126 | {tag:'td'}, | ||
127 | {tag:'td', children:[ | ||
128 | {tag:'div', id:this.getId('login_submit')} | ||
129 | ]} | ||
130 | ]} | ||
131 | ]}, | ||
132 | {tag:'tfoot'} | ||
133 | ]} | ||
134 | ]}, | ||
135 | |||
136 | {tag:'div', cls:'loginFormFooterBox', children:[ | ||
137 | {tag:'ul', children:[ | ||
138 | {tag:'li', id:this.getId('showRegistrationLI'), children:[ | ||
139 | {tag:'span', htmlString:Clipperz.PM.Strings['loginFormDontHaveAnAccountLabel']}, | ||
140 | {tag:'a', href:'.', id:this.getId('showRegistration'), cls:'clipperzActionLink', htmlString:Clipperz.PM.Strings['loginFormCreateOneLabel']} | ||
141 | ]}, | ||
142 | {tag:'li', children:[ | ||
143 | {tag:'span', htmlString:Clipperz.PM.Strings['loginFormForgotYourCredentialsLabel']}, | ||
144 | {tag:'a', href:Clipperz.PM.Strings['loginFormAarghThatsBadUrl'], target:'Clipperz_Help', htmlString:Clipperz.PM.Strings['loginFormAarghThatsBadLabel']} | ||
145 | ]}, | ||
146 | {tag:'li', children:[ | ||
147 | {tag:'span', htmlString:Clipperz.PM.Strings['loginFormAfraidOfMaliciousScriptsLabel']}, | ||
148 | {tag:'a', href:Clipperz.PM.Strings['loginFormVerifyTheCodeUrl'], target:'Clipperz_Help', htmlString:Clipperz.PM.Strings['loginFormVerifyTheCodeLabel']} | ||
149 | ]} | ||
150 | ]} | ||
151 | ]} | ||
152 | ]}, | ||
153 | |||
154 | |||
155 | |||
156 | {tag:'div', id:this.getId('registrationForm'), cls:'registrationForm', children:[ | ||
157 | {tag:'div', cls:'loginFormHeaderBox', children:[{tag:'h3', htmlString:Clipperz.PM.Strings['registrationFormTitle']}]}, | ||
158 | {tag:'form', id:this.getId('registrationForm_form'), children:[ | ||
159 | {tag:'h5', cls:'errorMessage', id:this.getId('registration_errorMessage')}, | ||
160 | {tag:'table', cls:'formLayout', children:[ | ||
161 | {tag:'thead'}, | ||
162 | {tag:'tbody', children:[ | ||
163 | {tag:'tr', cls:'formFieldTR', children:[ | ||
164 | {tag:'td', width:'90', htmlString:Clipperz.PM.Strings['registrationFormUsernameLabel']}, | ||
165 | {tag:'td', children:[ | ||
166 | {tag:'input', id:this.getId('registration_username'), cls:'loginFormField', type:'text', name:'username'} | ||
167 | ]} | ||
168 | ]}, | ||
169 | {tag:'tr', cls:'formFieldTR', children:[ | ||
170 | {tag:'td', htmlString:Clipperz.PM.Strings['registrationFormPassphraseLabel']}, | ||
171 | {tag:'td', children:[ | ||
172 | {tag:'input', id:this.getId('registration_passphrase'), cls:'loginFormField', type:'password', name:'passphrase'} | ||
173 | ]} | ||
174 | ]}, | ||
175 | {tag:'tr', cls:'formFieldTR', children:[ | ||
176 | {tag:'td', htmlString:Clipperz.PM.Strings['registrationFormRetypePassphraseLabel']}, | ||
177 | {tag:'td', children:[ | ||
178 | {tag:'input', id:this.getId('registration_repassphrase'), cls:'loginFormField', type:'password', name:'repeat-passphrase'} | ||
179 | ]} | ||
180 | ]}, | ||
181 | {tag:'tr', cls:'formFieldTR', children:[ | ||
182 | {tag:'td', align:'right', valign:'top', children:[ | ||
183 | {tag:'input', id:this.getId('registration_check'), type:'checkbox', name:'safetyCheck'} | ||
184 | ]}, | ||
185 | {tag:'td', children:[ | ||
186 | {tag:'span', htmlString:Clipperz.PM.Strings['registrationFormSafetyCheckLabel']} | ||
187 | ]} | ||
188 | ]}, | ||
189 | {tag:'tr', cls:'formFieldTR', children:[ | ||
190 | {tag:'td', align:'right', valign:'top', children:[ | ||
191 | {tag:'input', id:this.getId('registration_termsOfServiceCheck'), type:'checkbox', name:'termsOfServiceCheck'} | ||
192 | ]}, | ||
193 | {tag:'td', children:[ | ||
194 | {tag:'span', htmlString:Clipperz.PM.Strings['registrationFormTermsOfServiceCheckLabel']} | ||
195 | ]} | ||
196 | ]}, | ||
197 | // {tag:'tr', cls:'formFieldTR', children:[ | ||
198 | // {tag:'td', htmlString:Clipperz.PM.Strings['registrationFormInvitationCodeLabel']}, | ||
199 | // {tag:'td', children:[ | ||
200 | // {tag:'input', id:this.getId('registration_invitationCode'), type:'text', size:'30', name:'invitationCode'} | ||
201 | // ]} | ||
202 | // ]}, | ||
203 | {tag:'tr', children:[ | ||
204 | {tag:'td'}, | ||
205 | {tag:'td', children:[ | ||
206 | {tag:'div', id:this.getId('registration_submit')} | ||
207 | ]} | ||
208 | ]} | ||
209 | ]}, | ||
210 | {tag:'tfoot'} | ||
211 | ]} | ||
212 | ]}, | ||
213 | {tag:'div', cls:'loginFormFooterBox', children:[ | ||
214 | {tag:'ul', children:[ | ||
215 | {tag:'li', children:[ | ||
216 | {tag:'span', htmlString:Clipperz.PM.Strings['registrationFormDoYouAlreadyHaveAnAccountLabel']}, | ||
217 | {tag:'a', href:'.', id:this.getId('showLogin'), cls:'clipperzActionLink', htmlString:Clipperz.PM.Strings['registrationFormSimplyLoginLabel']} | ||
218 | ]} | ||
219 | ]} | ||
220 | ]} | ||
221 | ]} | ||
222 | ]}, | ||
223 | {tag:'div', cls:'loginPanelSwitchLanguageBox', children:[ | ||
224 | {tag:'div', cls:'loginPanelSwitchLanguageDescription', htmlString:Clipperz.PM.Strings['loginPanelSwithLanguageDescription']}, | ||
225 | {tag:'div', cls:'loginPanelSwitchLanguageSelect', children:[ | ||
226 | {tag:'select', id:this.getId('languageSelector'), children:Clipperz.PM.Strings['loginPanelSwitchLanguageSelectOptions']} | ||
227 | ]} | ||
228 | ]}, | ||
229 | {tag:'div', cls:'browserCompatibilityBox', htmlString:Clipperz.PM.Strings['browserCompatibilityDescription']} | ||
230 | ]} | ||
231 | ]} | ||
232 | ]} | ||
233 | ]} | ||
234 | ]}); | ||
235 | |||
236 | MochiKit.Signal.connect(this.getId('loginForm_form'), 'onsubmit', function(e){e.stop();}); | ||
237 | MochiKit.Signal.connect(this.getId('registrationForm_form'), 'onsubmit', function(e){e.stop();}); | ||
238 | |||
239 | MochiKit.Signal.connect(this.getId('showRegistration'), 'onclick', this, 'showRegistrationFormEventHandler'); | ||
240 | MochiKit.Signal.connect(this.getId('showLogin'), 'onclick', this, 'showLoginFormEventHandler'); | ||
241 | |||
242 | new YAHOO.ext.Button(this.getId('login_submit'), {text:Clipperz.PM.Strings['loginFormButtonLabel'], handler:this.doLogin, scope:this, minWidth:0}); | ||
243 | registerButton = new YAHOO.ext.Button(this.getId('registration_submit'), {text:Clipperz.PM.Strings['registrationFormButtonLabel'], handler:this.doRegister, scope:this, minWidth:0}) | ||
244 | |||
245 | if (Clipperz.PM.Proxy.defaultProxy.isReadOnly()) { | ||
246 | // this.getElement('showRegistrationLI').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide(); | ||
247 | this.getElement('registrationForm_form').addClass('read-only'); | ||
248 | registerButton.disable(); | ||
249 | this.getElement('passwordTypeChooserTR').addClass('read-only'); | ||
250 | this.getDom('useOneTimePasswordCheckbox').disabled = true; | ||
251 | } | ||
252 | |||
253 | MochiKit.Signal.connect(this.getId('loginForm'), 'onkeydown', this, 'onkeydown'); | ||
254 | MochiKit.Signal.connect(this.getId('registrationForm'), 'onkeydown', this, 'onkeydown'); | ||
255 | // MochiKit.Signal.connect(this.getId('useOneTimePasswordCheckbox'), 'onchange', this, 'renderPasswordField'); | ||
256 | MochiKit.Signal.connect(this.getId('useOneTimePasswordCheckbox'), 'onclick', this, 'renderPasswordField'); | ||
257 | this.renderPasswordField(); | ||
258 | |||
259 | this.selectSelectedLanguageOption(); | ||
260 | MochiKit.Signal.connect(this.getId('languageSelector'), 'onchange', this, 'switchLanguage'); | ||
261 | |||
262 | MochiKit.Signal.connect(this.getId('oneTimePassword_1'), 'onkeypress', this, 'handleOneTimePasswordFieldKeyPress'); | ||
263 | MochiKit.Signal.connect(this.getId('oneTimePassword_2'), 'onkeypress', this, 'handleOneTimePasswordFieldKeyPress'); | ||
264 | MochiKit.Signal.connect(this.getId('oneTimePassword_3'), 'onkeypress', this, 'handleOneTimePasswordFieldKeyPress'); | ||
265 | MochiKit.Signal.connect(this.getId('oneTimePassword_4'), 'onkeypress', this, 'handleOneTimePasswordFieldKeyPress'); | ||
266 | |||
267 | MochiKit.Signal.connect(this.getId('oneTimePassword_1'), 'onkeyup', this, 'handleOneTimePasswordFieldKeyUp'); | ||
268 | MochiKit.Signal.connect(this.getId('oneTimePassword_2'), 'onkeyup', this, 'handleOneTimePasswordFieldKeyUp'); | ||
269 | MochiKit.Signal.connect(this.getId('oneTimePassword_3'), 'onkeyup', this, 'handleOneTimePasswordFieldKeyUp'); | ||
270 | MochiKit.Signal.connect(this.getId('oneTimePassword_4'), 'onkeyup', this, 'handleOneTimePasswordFieldKeyUp'); | ||
271 | |||
272 | new Clipperz.PM.Components.PasswordEntropyDisplay(this.getElement('login_passphrase')); | ||
273 | new Clipperz.PM.Components.PasswordEntropyDisplay(this.getElement('registration_passphrase')); | ||
274 | //MochiKit.Logging.logDebug("<<< LoginPanel.initPanel"); | ||
275 | |||
276 | return result; | ||
277 | }, | ||
278 | |||
279 | //------------------------------------------------------------------------- | ||
280 | |||
281 | 'renderPasswordField': function() { | ||
282 | if (this.getDom('useOneTimePasswordCheckbox').checked == false) { | ||
283 | this.getElement('oneTimePasswordDIV').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide(false); | ||
284 | this.getElement('passphraseDIV').setVisibilityMode(YAHOO.ext.Element.DISPLAY).show(false); | ||
285 | this.getElement('login_passphrase').focus(); | ||
286 | } else { | ||
287 | this.getElement('passphraseDIV').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide(); | ||
288 | this.getElement('oneTimePasswordDIV').setVisibilityMode(YAHOO.ext.Element.DISPLAY).show(); | ||
289 | this.getElement('oneTimePassword_1').focus(); | ||
290 | } | ||
291 | |||
292 | }, | ||
293 | |||
294 | //......................................................................... | ||
295 | |||
296 | 'handleOneTimePasswordFieldKeyPress': function(anEvent) { | ||
297 | if (anEvent.key().string == '-') { | ||
298 | switch (anEvent.src().id) { | ||
299 | case this.getId('oneTimePassword_1'): | ||
300 | this.getElement('oneTimePassword_2').focus(); | ||
301 | break; | ||
302 | case this.getId('oneTimePassword_2'): | ||
303 | this.getElement('oneTimePassword_3').focus(); | ||
304 | break; | ||
305 | case this.getId('oneTimePassword_3'): | ||
306 | this.getElement('oneTimePassword_4').focus(); | ||
307 | break; | ||
308 | } | ||
309 | |||
310 | anEvent.stop(); | ||
311 | } | ||
312 | }, | ||
313 | |||
314 | /* | ||
315 | var ctrl = document.getElementById("txtTargetText"); | ||
316 | var saveText = ctrl.value; | ||
317 | ctrl.focus(); | ||
318 | |||
319 | var range = document.selection.createRange(); | ||
320 | var specialchar = String.fromCharCode(1); | ||
321 | range.text = specialchar; | ||
322 | var pos = ctrl.value.indexOf(specialchar); | ||
323 | ctrl.value = saveText; | ||
324 | range = ctrl.createTextRange(); | ||
325 | range.move('character', pos); | ||
326 | range.select(); | ||
327 | range.text = | ||
328 | document.getElementById("txtSourceText").value; | ||
329 | document.getElementById("txtTargetText").focus(); | ||
330 | window.event.returnValue = false; | ||
331 | */ | ||
332 | |||
333 | 'handleOneTimePasswordFieldKeyUp': function(anEvent) { | ||
334 | varfield; | ||
335 | varfieldValue; | ||
336 | var key; | ||
337 | |||
338 | //console.log("keyUp", anEvent); | ||
339 | field = anEvent.src(); | ||
340 | fieldValue = field.value; | ||
341 | key = anEvent.key(); | ||
342 | |||
343 | // &&(key.string != 'KEY_TAB') | ||
344 | // &&(key.string != 'KEY_SHIFT') | ||
345 | // &&(key.string != 'KEY_BACKSPACE') | ||
346 | // &&(key.string != 'KEY_DELETE') | ||
347 | // &&(key.string.indexOf('KEY_ARROW') != 0) | ||
348 | |||
349 | |||
350 | if ((fieldValue.replace(/\s/g, '').length == 8) && (key.string == 'KEY_SPACEBAR')) { | ||
351 | // field.value = Clipperz.Base.trim(fieldValue).replace(/.{4}/g, '$&' + ' '); | ||
352 | |||
353 | switch (field.id) { | ||
354 | case this.getId('oneTimePassword_1'): | ||
355 | this.getElement('oneTimePassword_2').focus(); | ||
356 | break; | ||
357 | case this.getId('oneTimePassword_2'): | ||
358 | this.getElement('oneTimePassword_3').focus(); | ||
359 | break; | ||
360 | case this.getId('oneTimePassword_3'): | ||
361 | this.getElement('oneTimePassword_4').focus(); | ||
362 | break; | ||
363 | } | ||
364 | // } else if (fieldValue.replace(/\s/g, '').length > 8) { | ||
365 | } | ||
366 | |||
367 | //MochiKit.Logging.logDebug("-- fieldValue: " + fieldValue); | ||
368 | }, | ||
369 | |||
370 | //......................................................................... | ||
371 | |||
372 | 'doLogin': function() { | ||
373 | //MochiKit.Logging.logDebug(">>> LoginPanel.doLogin"); | ||
374 | if (this.checkLoginForm()) { | ||
375 | if (this.getDom('useOneTimePasswordCheckbox').checked == false) { | ||
376 | this.doLoginWithUsernameAndPassphrase(this.getDom('login_username').value, this.getDom('login_passphrase').value); | ||
377 | } else { | ||
378 | varoneTimePasswordValue; | ||
379 | |||
380 | oneTimePasswordValue = this.getDom('oneTimePassword_1').value + this.getDom('oneTimePassword_2').value + this.getDom('oneTimePassword_3').value + this.getDom('oneTimePassword_4').value; | ||
381 | this.doLoginWithUsernameAndOneTimePassword(this.getDom('login_username').value, oneTimePasswordValue); | ||
382 | } | ||
383 | } | ||
384 | //MochiKit.Logging.logDebug("<<< LoginPanel.doLogin"); | ||
385 | }, | ||
386 | |||
387 | //......................................................................... | ||
388 | |||
389 | 'doLoginWithUsernameAndPassphrase': function(anUsername, aPassphrase) { | ||
390 | var deferredResult; | ||
391 | var user; | ||
392 | var loginPanel; | ||
393 | |||
394 | //MochiKit.Logging.logDebug(">>> LoginPanel.doLoginWithUsernameAndPassphrase"); | ||
395 | user = new Clipperz.PM.DataModel.User({username:anUsername, passphrase:aPassphrase}); | ||
396 | loginPanel = this; | ||
397 | |||
398 | deferredResult = new MochiKit.Async.Deferred(); | ||
399 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("0 - LoginPanel.doLogin - 0: "/* + res*/); return res;}); | ||
400 | //deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;}); | ||
401 | deferredResult.addCallback(MochiKit.Base.method(Clipperz.PM.Components.MessageBox(), 'deferredShow'), | ||
402 | { | ||
403 | title: "", | ||
404 | text: "", | ||
405 | width:240, | ||
406 | showProgressBar:true, | ||
407 | showCloseButton:false, | ||
408 | fn:MochiKit.Base.method(deferredResult, 'cancel'), | ||
409 | scope:this | ||
410 | }, | ||
411 | this.getDom('login_submit') | ||
412 | ); | ||
413 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("1 - LoginPanel.doLogin - 1: "/* + res*/); return res;}); | ||
414 | //deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;}); | ||
415 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'login_start'); | ||
416 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("2 - LoginPanel.doLogin - 2: "/* + res*/); return res;}); | ||
417 | //deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;}); | ||
418 | deferredResult.addCallback(MochiKit.Base.method(user, 'connect')); | ||
419 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("3 - LoginPanel.doLogin - 3: "/* + res*/); return res;}); | ||
420 | //deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;}); | ||
421 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'connection_done'); | ||
422 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("4 - LoginPanel.doLogin - 4: "/* + res*/); return res;}); | ||
423 | //deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;}); | ||
424 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'connection_loadingUserData'); | ||
425 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("5 - LoginPanel.doLogin - 5: "/* + res*/); return res;}); | ||
426 | //deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;}); | ||
427 | deferredResult.addCallback(MochiKit.Base.method(user, 'loadPreferences')); | ||
428 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("6 - LoginPanel.doLogin - 6: "/* + res*/); return res;}); | ||
429 | //deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;}); | ||
430 | deferredResult.addCallback(MochiKit.Base.method(user, 'loadRecords')); | ||
431 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("7 - LoginPanel.doLogin - 7: "/* + res*/); return res;}); | ||
432 | //deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;}); | ||
433 | deferredResult.addCallback(MochiKit.Base.method(user, 'loadDirectLogins')); | ||
434 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("8 - LoginPanel.doLogin - 8: "/* + res*/); return res;}); | ||
435 | //deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;}); | ||
436 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'login_connected'); | ||
437 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("9 - LoginPanel.doLogin - 9: "/* + res*/); return res;}); | ||
438 | //deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;}); | ||
439 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, user, 'setupDone', null); | ||
440 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("10 - LoginPanel.doLogin - 10: "/* + res*/); return res;}); | ||
441 | //deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;}); | ||
442 | |||
443 | deferredResult.addCallback(MochiKit.Async.wait, 0.5); | ||
444 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("11 - LoginPanel.doLogin - 11: "/* + res*/); return res;}); | ||
445 | //deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;}); | ||
446 | |||
447 | deferredResult.addCallback(function(res) { | ||
448 | Clipperz.PM.Components.MessageBox().hide(YAHOO.ext.Element.get('main')); | ||
449 | return res; | ||
450 | }); | ||
451 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("12 - LoginPanel.doLogin - 12: "/* + res*/); return res;}); | ||
452 | //deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;}); | ||
453 | |||
454 | deferredResult.addErrback(MochiKit.Base.bind(function() { | ||
455 | Clipperz.PM.Components.MessageBox().update({ | ||
456 | title:Clipperz.PM.Strings['loginMessagePanelFailureTitle'], | ||
457 | text:Clipperz.PM.Strings['loginMessagePanelFailureText'], | ||
458 | showProgressBar:false, | ||
459 | buttons:{'ok':Clipperz.PM.Strings['loginMessagePanelFailureButtonLabel']}, | ||
460 | fn:MochiKit.Base.bind(function() { | ||
461 | this.getElement('login_passphrase').focus(); | ||
462 | this.getElement('login_passphrase').dom.select(); | ||
463 | }, this), | ||
464 | scope:this | ||
465 | }); | ||
466 | }, this)); | ||
467 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("13 - LoginPanel.doLogin - 13: "/* + res*/); return res;}); | ||
468 | //deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;}); | ||
469 | |||
470 | deferredResult.callback("token"); | ||
471 | //MochiKit.Logging.logDebug("<<< LoginPanel.doLoginWithUsernameAndPassphrase"); | ||
472 | |||
473 | return deferredResult; | ||
474 | }, | ||
475 | |||
476 | //......................................................................... | ||
477 | |||
478 | 'doLoginWithUsernameAndOneTimePassword': function(anUsername, aOneTimePassword) { | ||
479 | var deferredResult; | ||
480 | var loginPanel; | ||
481 | var oneTimePassword; | ||
482 | |||
483 | oneTimePassword = Clipperz.PM.DataModel.OneTimePassword.normalizedOneTimePassword(aOneTimePassword); | ||
484 | |||
485 | //MochiKit.Logging.logDebug(">>> LoginPanel.doLoginWithUsernameAndPassphrase"); | ||
486 | deferredResult = new MochiKit.Async.Deferred(); | ||
487 | deferredResult.addCallback(MochiKit.Base.method(Clipperz.PM.Components.MessageBox(), 'deferredShow'), | ||
488 | { | ||
489 | title: "", | ||
490 | text: "", | ||
491 | width:240, | ||
492 | showProgressBar:true, | ||
493 | showCloseButton:false, | ||
494 | fn:MochiKit.Base.method(deferredResult, 'cancel'), | ||
495 | scope:this, | ||
496 | steps:7, | ||
497 | buttons:{ | ||
498 | //'ok':Clipperz.PM.Strings['loginMessagePanelInitialButtonLabel'] | ||
499 | } | ||
500 | }, | ||
501 | this.getDom('login_submit') | ||
502 | ); | ||
503 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'OTP_login_start'); | ||
504 | deferredResult.addCallback(function(anUsername, aOneTimePassword) { | ||
505 | var args; | ||
506 | |||
507 | args = { | ||
508 | 'message': 'oneTimePassword', | ||
509 | 'version': Clipperz.PM.Crypto.communicationProtocol.currentVersion, | ||
510 | 'parameters': { | ||
511 | 'oneTimePasswordKey': Clipperz.PM.DataModel.OneTimePassword.computeKeyWithUsernameAndPassword(anUsername, aOneTimePassword), | ||
512 | 'oneTimePasswordKeyChecksum': Clipperz.PM.DataModel.OneTimePassword.computeKeyChecksumWithUsernameAndPassword(anUsername, aOneTimePassword) | ||
513 | } | ||
514 | } | ||
515 | |||
516 | return args; | ||
517 | }, anUsername, oneTimePassword); | ||
518 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'OTP_login_loadingOTP'); | ||
519 | deferredResult.addCallback(MochiKit.Base.method(Clipperz.PM.Proxy.defaultProxy, 'handshake')); | ||
520 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'OTP_login_extractingPassphrase'); | ||
521 | deferredResult.addCallback(function(aResult) { | ||
522 | return Clipperz.PM.Crypto.deferredDecrypt(oneTimePassword, aResult['data'], aResult['version']); | ||
523 | }); | ||
524 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("LoginPanel.otpLogin - 4: " + res); return res;}); | ||
525 | deferredResult.addCallback(function(aResult) { | ||
526 | //MochiKit.Logging.logDebug("aResult") | ||
527 | return (new Clipperz.ByteArray().appendBase64String(aResult['passphrase'])).asString(); | ||
528 | }); | ||
529 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("LoginPanel.otpLogin - 5: " + res); return res;}); | ||
530 | deferredResult.addCallbacks( | ||
531 | MochiKit.Base.method(this, 'doLoginWithUsernameAndPassphrase', anUsername), | ||
532 | MochiKit.Base.bind(function(aLoginPanel) { | ||
533 | Clipperz.PM.Components.MessageBox().update({ | ||
534 | title:Clipperz.PM.Strings['loginMessagePanelFailureTitle'], | ||
535 | text:Clipperz.PM.Strings['loginMessagePanelFailureText'], | ||
536 | showProgressBar:false, | ||
537 | buttons:{'ok':Clipperz.PM.Strings['loginMessagePanelFailureButtonLabel']}, | ||
538 | fn:MochiKit.Base.bind(function() { | ||
539 | this.getElement('oneTimePassword_1').focus(); | ||
540 | }, this), | ||
541 | scope:aLoginPanel | ||
542 | }); | ||
543 | }, this) | ||
544 | ); | ||
545 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("LoginPanel.otpLogin - 6: " + res); return res;}); | ||
546 | deferredResult.callback("token"); | ||
547 | //MochiKit.Logging.logDebug("<<< LoginPanel.doLoginWithUsernameAndPassphrase"); | ||
548 | |||
549 | return deferredResult; | ||
550 | }, | ||
551 | |||
552 | //......................................................................... | ||
553 | |||
554 | 'checkLoginForm': function() { | ||
555 | var result; | ||
556 | var username | ||
557 | |||
558 | result = true; | ||
559 | |||
560 | //MochiKit.Logging.logDebug(">>> checkLoginForm"); | ||
561 | username = Clipperz.Base.trim(this.getDom('login_username').value); | ||
562 | if (username == "") { | ||
563 | this.getElement('login_username').focus(); | ||
564 | result = false; | ||
565 | } else { | ||
566 | if (this.getDom('useOneTimePasswordCheckbox').checked == false) { | ||
567 | varpassphrase; | ||
568 | |||
569 | passphrase = Clipperz.Base.trim(this.getDom('login_passphrase').value); | ||
570 | |||
571 | if (passphrase == "") { | ||
572 | this.getElement('login_passphrase').focus(); | ||
573 | result = false; | ||
574 | } | ||
575 | } else { | ||
576 | if (Clipperz.Base.trim(this.getDom('oneTimePassword_1').value) == "") { | ||
577 | this.getElement('oneTimePassword_1').focus(); | ||
578 | result = false; | ||
579 | } else if (Clipperz.Base.trim(this.getDom('oneTimePassword_2').value) == "") { | ||
580 | this.getElement('oneTimePassword_2').focus(); | ||
581 | result = false; | ||
582 | } else if (Clipperz.Base.trim(this.getDom('oneTimePassword_3').value) == "") { | ||
583 | this.getElement('oneTimePassword_3').focus(); | ||
584 | result = false; | ||
585 | } else if (Clipperz.Base.trim(this.getDom('oneTimePassword_4').value) == "") { | ||
586 | this.getElement('oneTimePassword_4').focus(); | ||
587 | result = false; | ||
588 | } | ||
589 | } | ||
590 | } | ||
591 | //MochiKit.Logging.logDebug("<<< checkLoginForm - " + result); | ||
592 | |||
593 | return result; | ||
594 | }, | ||
595 | |||
596 | //......................................................................... | ||
597 | |||
598 | 'doRegister': function(anEvent) { | ||
599 | if ((Clipperz.PM.Proxy.defaultProxy.isReadOnly() == false) && (this.checkRegistrationForm())) { | ||
600 | this.doRegistrationWithUsernameAndPassphrase(this.getDom('registration_username').value, this.getDom('registration_passphrase').value /*, this.getDom('registration_invitationCode').value*/); | ||
601 | } | ||
602 | }, | ||
603 | |||
604 | //......................................................................... | ||
605 | |||
606 | 'checkRegistrationForm': function() { | ||
607 | var result; | ||
608 | var username | ||
609 | varpassphrase; | ||
610 | varrePassphrase; | ||
611 | varsafetyCheck; | ||
612 | vartermsOfServiceCheck; | ||
613 | // varinvitationCode; | ||
614 | |||
615 | username = this.getDom('registration_username').value; | ||
616 | passphrase = this.getDom('registration_passphrase').value; | ||
617 | rePassphrase = this.getDom('registration_repassphrase').value; | ||
618 | safetyCheck = this.getDom('registration_check').checked; | ||
619 | termsOfServiceCheck = this.getDom('registration_termsOfServiceCheck').checked; | ||
620 | // invitationCode = this.getDom('registration_invitationCode').value; | ||
621 | |||
622 | if ((username != "") && (passphrase != "") && (rePassphrase != "") /*&& (invitationCode != "")*/) { | ||
623 | if (passphrase != rePassphrase) { | ||
624 | //show alert that the passphrase and rePassphrase should be equal | ||
625 | //MochiKit.Logging.logDebug("WARNING: passphrase != rePassphrase"); | ||
626 | this.showRegistrationFormErrorMessageAnimation(Clipperz.PM.Strings['registrationFormWarningMessageNotMatchingPassphrases']); | ||
627 | this.getElement('registration_repassphrase').focus().dom.select(); | ||
628 | // this.getElement('registration_repassphrase').select(); | ||
629 | result = false; | ||
630 | } else if (safetyCheck != true) { | ||
631 | //show alert that the safetyCheck should be checed | ||
632 | //MochiKit.Logging.logDebug("WARNING: safetyCheck not checked"); | ||
633 | this.showRegistrationFormErrorMessageAnimation(Clipperz.PM.Strings['registrationFormWarningMessageSafetyCheckNotSelected']); | ||
634 | this.getElement('registration_check').focus(); | ||
635 | result = false; | ||
636 | } else if (termsOfServiceCheck != true) { | ||
637 | this.showRegistrationFormErrorMessageAnimation(Clipperz.PM.Strings['registrationFormWarningMessageTermsOfServiceCheckNotSelected']); | ||
638 | this.getElement('registration_termsOfServiceCheck').focus(); | ||
639 | } else { | ||
640 | result = true; | ||
641 | } | ||
642 | } else { | ||
643 | if (username == "") { | ||
644 | this.getElement('registration_username').focus(); | ||
645 | } else if (passphrase == "") { | ||
646 | this.getElement('registration_passphrase').focus(); | ||
647 | } else if (rePassphrase == "") { | ||
648 | this.getElement('registration_repassphrase').focus(); | ||
649 | // } else if (invitationCode == "") { | ||
650 | // this.showRegistrationFormErrorMessageAnimation(Clipperz.PM.Strings['registrationFormWarningMessageInvitationCodeMissing']); | ||
651 | // this.getElement('registration_invitationCode').focus(); | ||
652 | } | ||
653 | |||
654 | result = false; | ||
655 | } | ||
656 | |||
657 | if (result === true) { | ||
658 | this.getActor('registration_errorMessage').hide(); | ||
659 | } | ||
660 | |||
661 | return result; | ||
662 | }, | ||
663 | |||
664 | //......................................................................... | ||
665 | |||
666 | 'showRegistrationFormErrorMessageAnimation': function(anErrorMessage, aCallback) { | ||
667 | varerrorMessageActor; | ||
668 | |||
669 | errorMessageActor = this.getActor('registration_errorMessage'); | ||
670 | errorMessageActor.update(anErrorMessage); | ||
671 | errorMessageActor.show(true); | ||
672 | errorMessageActor.play(aCallback); | ||
673 | }, | ||
674 | |||
675 | //......................................................................... | ||
676 | |||
677 | 'doRegistrationWithUsernameAndPassphrase': function(anUsername, aPassphrase /*, anInvitationCode */) { | ||
678 | var deferredResult; | ||
679 | var user; | ||
680 | var loginPanel; | ||
681 | |||
682 | //MochiKit.Logging.logDebug(">>> LoginPanel.doRegistrationWithUsernameAndPassphrase"); | ||
683 | user = new Clipperz.PM.DataModel.User({username:anUsername, passphrase:aPassphrase}); | ||
684 | //MochiKit.Logging.logDebug("--- LoginPanel.doRegistrationWithUsernameAndPassphrase - 1"); | ||
685 | loginPanel = this; | ||
686 | //MochiKit.Logging.logDebug("--- LoginPanel.doRegistrationWithUsernameAndPassphrase - 2"); | ||
687 | |||
688 | deferredResult = new MochiKit.Async.Deferred(); | ||
689 | //MochiKit.Logging.logDebug("--- LoginPanel.doRegistrationWithUsernameAndPassphrase - 3"); | ||
690 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("LoginPanel.doRegistrationWithUsernameAndPassphrase - 1: " + res); return res;}); | ||
691 | deferredResult.addCallback(MochiKit.Base.method(Clipperz.PM.Components.MessageBox(), 'deferredShow'), | ||
692 | { | ||
693 | title:Clipperz.PM.Strings['registrationMessagePanelInitialTitle'], | ||
694 | text: Clipperz.PM.Strings['registrationMessagePanelInitialText'], | ||
695 | width:240, | ||
696 | showProgressBar:true, | ||
697 | showCloseButton:false, | ||
698 | fn:MochiKit.Base.method(deferredResult, 'cancel'), | ||
699 | scope:this, | ||
700 | steps:9, | ||
701 | buttons:{ | ||
702 | 'ok':Clipperz.PM.Strings['registrationMessagePanelInitialButtonLabel'] | ||
703 | } | ||
704 | }, | ||
705 | this.getDom('registration_submit') | ||
706 | ); | ||
707 | //MochiKit.Logging.logDebug("--- LoginPanel.doRegistrationWithUsernameAndPassphrase - 4"); | ||
708 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("LoginPanel.doRegistrationWithUsernameAndPassphrase - 2: " + res); return res;}); | ||
709 | deferredResult.addCallback(MochiKit.Base.method(user, 'register'), /*anInvitationCode*/ "VeryBraveBetaTester"); | ||
710 | //MochiKit.Logging.logDebug("--- LoginPanel.doRegistrationWithUsernameAndPassphrase - 5"); | ||
711 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("LoginPanel.doRegistrationWithUsernameAndPassphrase - 3: " + res); return res;}); | ||
712 | deferredResult.addCallback(function(res) { | ||
713 | Clipperz.PM.Components.MessageBox().update({ | ||
714 | title:Clipperz.PM.Strings['registrationMessagePanelRegistrationDoneTitle'], | ||
715 | text:Clipperz.PM.Strings['registrationMessagePanelRegistrationDoneText'], | ||
716 | step:'next' | ||
717 | }); | ||
718 | return res; | ||
719 | }); | ||
720 | //MochiKit.Logging.logDebug("--- LoginPanel.doRegistrationWithUsernameAndPassphrase - 6"); | ||
721 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("LoginPanel.doRegistrationWithUsernameAndPassphrase - 5: " + res); return res;}); | ||
722 | deferredResult.addCallback(MochiKit.Async.wait, 1); | ||
723 | //MochiKit.Logging.logDebug("--- LoginPanel.doRegistrationWithUsernameAndPassphrase - 7"); | ||
724 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("LoginPanel.doRegistrationWithUsernameAndPassphrase - 6: " + res); return res;}); | ||
725 | deferredResult.addCallback(MochiKit.Base.method(user, 'connect')); | ||
726 | //MochiKit.Logging.logDebug("--- LoginPanel.doRegistrationWithUsernameAndPassphrase - 8"); | ||
727 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("LoginPanel.doRegistrationWithUsernameAndPassphrase - 7: " + res); return res;}); | ||
728 | deferredResult.addCallback(MochiKit.Async.wait, 1); | ||
729 | //MochiKit.Logging.logDebug("--- LoginPanel.doRegistrationWithUsernameAndPassphrase - 9"); | ||
730 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("LoginPanel.doRegistrationWithUsernameAndPassphrase - 8: " + res); return res;}); | ||
731 | deferredResult.addCallback(function(res) { | ||
732 | Clipperz.PM.Components.MessageBox().hide(YAHOO.ext.Element.get('main')); | ||
733 | return res; | ||
734 | }); | ||
735 | deferredResult.addCallback(MochiKit.Base.method(this, 'showRegistrationSplashScreen'), user); | ||
736 | //MochiKit.Logging.logDebug("--- LoginPanel.doRegistrationWithUsernameAndPassphrase - 10"); | ||
737 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("LoginPanel.doRegistrationWithUsernameAndPassphrase - 9: " + res); return res;}); | ||
738 | deferredResult.addErrback(function(anError) { | ||
739 | Clipperz.PM.Components.MessageBox().update({ | ||
740 | title:Clipperz.PM.Strings['registrationMessagePanelFailureTitle'], | ||
741 | text:anError.message, | ||
742 | showProgressBar:false, | ||
743 | buttons:{'ok':Clipperz.PM.Strings['registrationMessagePanelFailureButtonLabel']}}); | ||
744 | return anError; | ||
745 | }); | ||
746 | //MochiKit.Logging.logDebug("--- LoginPanel.doRegistrationWithUsernameAndPassphrase - 11"); | ||
747 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("LoginPanel.doRegistrationWithUsernameAndPassphrase - 10: " + res); return res;}); | ||
748 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, user, 'setupDone', null); | ||
749 | deferredResult.callback("token"); | ||
750 | //MochiKit.Logging.logDebug("--- LoginPanel.doRegistrationWithUsernameAndPassphrase - 12"); | ||
751 | |||
752 | return deferredResult; | ||
753 | }, | ||
754 | |||
755 | //------------------------------------------------------------------------- | ||
756 | |||
757 | 'showRegistrationSplashScreen': function(anUser) { | ||
758 | var deferredResult; | ||
759 | var alertElement; | ||
760 | varalertDialog; | ||
761 | var closeButton; | ||
762 | var closeFunction; | ||
763 | |||
764 | deferredResult = new MochiKit.Async.Deferred(); | ||
765 | |||
766 | //MochiKit.Logging.logDebug(">>> Main.showRegistrationSplashScreen"); | ||
767 | alertElement = Clipperz.YUI.DomHelper.append(document.body, {tag:'div', id:'registrationSplash', children:[ | ||
768 | {tag:'div', cls:'ydlg-hd', htmlString:Clipperz.PM.Strings['registrationSplashPanelTitle']}, | ||
769 | {tag:'div', cls:'ydlg-bd', children:[ | ||
770 | {tag:'div', cls:'alert-message', id:'splashMessage', children:[ | ||
771 | {tag:'div', htmlString:Clipperz.PM.Strings['registrationSplashPanelDescription']}, | ||
772 | {tag:'table', border:'0', cellpadding:'5', children:[ | ||
773 | {tag:'tbody', children:[ | ||
774 | {tag:'tr', children:[ | ||
775 | {tag:'td', valign:'top', children:[ | ||
776 | {tag:'span', cls:'label', htmlString:Clipperz.PM.Strings['registrationSplashPanelUsernameLabel']} | ||
777 | ]}, | ||
778 | {tag:'td', valign:'top', children:[ | ||
779 | {tag:'span', cls:'value', html:Clipperz.Base.escapeHTML(anUser.username())} | ||
780 | ]} | ||
781 | ]}, | ||
782 | {tag:'tr', children:[ | ||
783 | {tag:'td', valign:'top', children:[ | ||
784 | {tag:'span', cls:'label', htmlString:Clipperz.PM.Strings['registrationSplashPanelPassphraseLabel']} | ||
785 | ]}, | ||
786 | {tag:'td', valign:'top', children:[ | ||
787 | {tag:'div', id:this.getId('showPassphraseDiv'), children:[ | ||
788 | {tag:'span', cls:'value', html:Clipperz.Base.escapeHTML(anUser.passphrase())} | ||
789 | ]}, | ||
790 | {tag:'div', id:this.getId('hidePassphraseDiv'), cls:'Clipperz_recordFieldData', children:[ | ||
791 | {tag:'input', id:this.getId('passwordField'), type:'text', cls:'scrambledField', title:Clipperz.PM.Strings['recordDetailPasswordFieldTooltipLabel'], value:"anUser.passphrase()"} | ||
792 | ]} | ||
793 | ]} | ||
794 | ]}, | ||
795 | {tag:'tr', children:[ | ||
796 | {tag:'td'}, | ||
797 | {tag:'td', valign:'top', children:[ | ||
798 | // {tag:'a', href:"#", id:this.getId('togglePassphraseVisibility'), htmlString:Clipperz.PM.Strings['registrationSplashPanelShowPassphraseButtonLabel']} | ||
799 | {tag:'input', type:'checkbox', id:this.getId('showPassphraseCheckbox')}, | ||
800 | {tag:'span', cls:'activeText', id:this.getId('showPassphraseText'), htmlString:Clipperz.PM.Strings['registrationSplashPanelShowPassphraseButtonLabel']} | ||
801 | ]} | ||
802 | ]} | ||
803 | ]} | ||
804 | ]} | ||
805 | ]} | ||
806 | ]}, | ||
807 | {tag:'div', cls:'ydlg-ft'} | ||
808 | ]}, true); | ||
809 | //MochiKit.Logging.logDebug("--- Main.showRegistrationSplashScreen - 1"); | ||
810 | |||
811 | this.getElement('passwordField').dom.value = anUser.passphrase(); | ||
812 | this.getElement('passwordField').wrap({tag:'div', cls:'passwordBackground'}).setStyle('background-position', "0px -" + Math.min(128, Clipperz.PM.Crypto.passwordEntropy(anUser.passphrase())) + "px").setStyle('width', '71px'); | ||
813 | MochiKit.Signal.connect(this.getId('showPassphraseCheckbox'), 'onclick', this, 'togglePassphraseVisibility'); | ||
814 | MochiKit.Signal.connect(this.getId('showPassphraseText'), 'onclick', this, 'togglePassphraseCheckbox'); | ||
815 | //MochiKit.Logging.logDebug("--- Main.showRegistrationSplashScreen - 1.1"); | ||
816 | |||
817 | this.getElement('showPassphraseDiv').setVisibilityMode(YAHOO.ext.Element.DISPLAY); | ||
818 | this.getElement('hidePassphraseDiv').setVisibilityMode(YAHOO.ext.Element.DISPLAY); | ||
819 | //MochiKit.Logging.logDebug("--- Main.showRegistrationSplashScreen - 1.1.1"); | ||
820 | this.togglePassphraseVisibility(); | ||
821 | //MochiKit.Logging.logDebug("--- Main.showRegistrationSplashScreen - 1.2"); | ||
822 | |||
823 | alertDialog = new YAHOO.ext.BasicDialog( | ||
824 | alertElement, { | ||
825 | closable:false, | ||
826 | modal:true, | ||
827 | autoTabs:false, | ||
828 | resizable:false, | ||
829 | fixedcenter:true, | ||
830 | constraintoviewport:false, | ||
831 | width:450, | ||
832 | height:220, | ||
833 | shadow:true, | ||
834 | minWidth:300, | ||
835 | minHeight:300 | ||
836 | } | ||
837 | ); | ||
838 | //MochiKit.Logging.logDebug("--- Main.showRegistrationSplashScreen - 2"); | ||
839 | |||
840 | closeFunction = deferredResult.callback; | ||
841 | //MochiKit.Logging.logDebug("--- Main.showRegistrationSplashScreen - 3"); | ||
842 | alertDialog.addKeyListener(27, closeFunction); | ||
843 | //MochiKit.Logging.logDebug("--- Main.showRegistrationSplashScreen - 4"); | ||
844 | closeButton = alertDialog.addButton(Clipperz.PM.Strings['splashAlertCloseButtonLabel'], closeFunction, deferredResult); | ||
845 | //MochiKit.Logging.logDebug("--- Main.showRegistrationSplashScreen - 5"); | ||
846 | alertDialog.setDefaultButton(closeButton); | ||
847 | //MochiKit.Logging.logDebug("--- Main.showRegistrationSplashScreen - 6"); | ||
848 | alertDialog.show('main'); | ||
849 | //MochiKit.Logging.logDebug("--- Main.showRegistrationSplashScreen - 7"); | ||
850 | |||
851 | deferredResult.addBoth(MochiKit.Base.method(alertDialog, 'hide')); | ||
852 | deferredResult.addCallback(MochiKit.Signal.disconnectAllTo, this) | ||
853 | //MochiKit.Logging.logDebug("--- Main.showRegistrationSplashScreen - 8"); | ||
854 | deferredResult.addCallback(MochiKit.Async.succeed); | ||
855 | //MochiKit.Logging.logDebug("<<< Main.showRegistrationSplashScreen"); | ||
856 | |||
857 | return deferredResult; | ||
858 | }, | ||
859 | |||
860 | //------------------------------------------------------------------------- | ||
861 | |||
862 | 'showLoginFormEventHandler': function(anEvent) { | ||
863 | anEvent.stop(); | ||
864 | this.showLoginForm(true); | ||
865 | }, | ||
866 | |||
867 | 'showLoginForm': function(shouldAnimate) { | ||
868 | if (shouldAnimate) { | ||
869 | this.showLoginFormAnimator().play(); | ||
870 | } else { | ||
871 | this.hideRegistrationForm(false); | ||
872 | this.getActor('loginForm').show(false); | ||
873 | this.getElement('login_username').focus(); | ||
874 | } | ||
875 | this.setVisibleForm('login'); | ||
876 | }, | ||
877 | |||
878 | 'showLoginFormAnimator': function() { | ||
879 | if (this._showLoginFormAnimator == null) { | ||
880 | var animator; | ||
881 | varloginFormActor; | ||
882 | var registrationFormActor; | ||
883 | var usernameFieldActor; | ||
884 | |||
885 | animator = new YAHOO.ext.Animator(); | ||
886 | loginFormActor = this.getActor('loginForm', animator); | ||
887 | loginFormActor.setVisibilityMode(YAHOO.ext.Element.DISPLAY); | ||
888 | registrationFormActor = this.getActor('registrationForm', animator); | ||
889 | registrationFormActor.setVisibilityMode(YAHOO.ext.Element.DISPLAY); | ||
890 | usernameFieldActor = this.getActor('login_username', animator); | ||
891 | |||
892 | animator.startCapture(); | ||
893 | registrationFormActor.hide(true); | ||
894 | loginFormActor.show(true); | ||
895 | usernameFieldActor.focus(); | ||
896 | animator.stopCapture(); | ||
897 | |||
898 | this._showLoginFormAnimator = animator; | ||
899 | } | ||
900 | |||
901 | return this._showLoginFormAnimator; | ||
902 | }, | ||
903 | |||
904 | |||
905 | 'hideLoginForm': function(shouldAnimate) { | ||
906 | var loginFormActor; | ||
907 | |||
908 | loginFormActor = this.getActor('loginForm'); | ||
909 | loginFormActor.setVisibilityMode(YAHOO.ext.Element.DISPLAY); | ||
910 | loginFormActor.hide(shouldAnimate); | ||
911 | }, | ||
912 | |||
913 | //------------------------------------------------------------------------- | ||
914 | |||
915 | 'showRegistrationFormEventHandler': function(anEvent) { | ||
916 | anEvent.stop(); | ||
917 | this.showRegistrationForm(true); | ||
918 | }, | ||
919 | |||
920 | 'showRegistrationForm': function(shouldAnimate) { | ||
921 | if (shouldAnimate) { | ||
922 | this.showRegistrationFormAnimator().play(MochiKit.Base.bind(this.showRegistrationAlert, this)); | ||
923 | } else { | ||
924 | varerrorMessageActor; | ||
925 | |||
926 | this.hideLoginForm(shouldAnimate) | ||
927 | this.getActor('registrationForm').show(false); | ||
928 | this.getElement('registration_username').focus(); | ||
929 | |||
930 | errorMessageActor = this.getActor('registration_errorMessage'); | ||
931 | errorMessageActor.setVisibilityMode(YAHOO.ext.Element.DISPLAY); | ||
932 | errorMessageActor.update("---"); | ||
933 | errorMessageActor.hide(); | ||
934 | |||
935 | this.showRegistrationAlert(); | ||
936 | } | ||
937 | this.setVisibleForm('registration'); | ||
938 | }, | ||
939 | |||
940 | 'showRegistrationFormAnimator': function() { | ||
941 | if (this._showRegistrationFormAnimator == null) { | ||
942 | var animator; | ||
943 | varloginFormActor; | ||
944 | var registrationFormActor; | ||
945 | var usernameFieldActor; | ||
946 | varerrorMessageActor; | ||
947 | |||
948 | animator = new YAHOO.ext.Animator(); | ||
949 | loginFormActor = this.getActor('loginForm', animator); | ||
950 | loginFormActor.setVisibilityMode(YAHOO.ext.Element.DISPLAY); | ||
951 | registrationFormActor = this.getActor('registrationForm', animator); | ||
952 | registrationFormActor.setVisibilityMode(YAHOO.ext.Element.DISPLAY); | ||
953 | usernameFieldActor = this.getActor('registration_username', animator); | ||
954 | errorMessageActor = this.getActor('registration_errorMessage', animator); | ||
955 | errorMessageActor.setVisibilityMode(YAHOO.ext.Element.DISPLAY); | ||
956 | |||
957 | animator.startCapture(); | ||
958 | loginFormActor.hide(true); | ||
959 | errorMessageActor.update("---"); | ||
960 | errorMessageActor.hide(); | ||
961 | registrationFormActor.show(true); | ||
962 | usernameFieldActor.focus(); | ||
963 | animator.stopCapture(); | ||
964 | |||
965 | this._showRegistrationFormAnimator = animator; | ||
966 | } | ||
967 | |||
968 | return this._showRegistrationFormAnimator; | ||
969 | }, | ||
970 | |||
971 | 'hideRegistrationForm': function(shouldAnimate) { | ||
972 | var registrationFormActor; | ||
973 | |||
974 | registrationFormActor = this.getActor('registrationForm'); | ||
975 | registrationFormActor.setVisibilityMode(YAHOO.ext.Element.DISPLAY); | ||
976 | registrationFormActor.hide(shouldAnimate); | ||
977 | }, | ||
978 | |||
979 | //------------------------------------------------------------------------- | ||
980 | |||
981 | 'shouldShowRegistrationAlert': function() { | ||
982 | return this._shouldShowRegistrationAlert; | ||
983 | }, | ||
984 | |||
985 | 'showRegistrationAlert': function() { | ||
986 | if ((this.shouldShowRegistrationAlert()) && (Clipperz.PM.Proxy.defaultProxy.isReadOnly() == false)) { | ||
987 | var alertElement; | ||
988 | varalertDialog; | ||
989 | var closeButton; | ||
990 | var closeFunction; | ||
991 | |||
992 | alertElement = Clipperz.YUI.DomHelper.append(document.body, {tag:'div', id:'alert', children:[ | ||
993 | {tag:'div', cls:'ydlg-hd', htmlString:Clipperz.PM.Strings['splashAlertTitle']}, | ||
994 | {tag:'div', cls:'ydlg-bd', children:[ | ||
995 | {tag:'div', cls:'alert-message', id:'splashMessage', htmlString:Clipperz.PM.Strings['splashAlertText']} | ||
996 | ]}, | ||
997 | {tag:'div', cls:'ydlg-ft'} | ||
998 | ]}, true); | ||
999 | |||
1000 | alertDialog = new YAHOO.ext.BasicDialog( | ||
1001 | alertElement, { | ||
1002 | closable:false, | ||
1003 | modal:true, | ||
1004 | autoTabs:false, | ||
1005 | resizable:false, | ||
1006 | fixedcenter:true, | ||
1007 | constraintoviewport:false, | ||
1008 | width:450, | ||
1009 | height:320, | ||
1010 | shadow:true, | ||
1011 | minWidth:300, | ||
1012 | minHeight:300 | ||
1013 | } | ||
1014 | ); | ||
1015 | |||
1016 | closeFunction = MochiKit.Base.partial(MochiKit.Base.bind(this.closeResigrationAlert, this), alertDialog); | ||
1017 | alertDialog.addKeyListener(27, closeFunction); | ||
1018 | closeButton = alertDialog.addButton(Clipperz.PM.Strings['splashAlertCloseButtonLabel'], closeFunction, this); | ||
1019 | alertDialog.setDefaultButton(closeButton); | ||
1020 | alertDialog.show('main'); | ||
1021 | |||
1022 | this._shouldShowRegistrationAlert = false; | ||
1023 | } | ||
1024 | }, | ||
1025 | |||
1026 | 'closeResigrationAlert': function(anAlertDialog) { | ||
1027 | anAlertDialog.hide(MochiKit.Base.bind(function() {anAlertDialog.destroy(true); this.focusOnVisibleForm();}, this)); | ||
1028 | }, | ||
1029 | |||
1030 | //------------------------------------------------------------------------- | ||
1031 | |||
1032 | 'onkeydown': function(anEvent) { | ||
1033 | //MochiKit.Logging.logDebug(">>> onkeydown - " + anEvent.src().id); | ||
1034 | if (anEvent.key().code == 13) { | ||
1035 | if (anEvent.src() == this.getDom('loginForm')) { | ||
1036 | this.doLogin(); | ||
1037 | } else if (anEvent.src() == this.getDom('registrationForm')) { | ||
1038 | this.doRegister(); | ||
1039 | } else { | ||
1040 | } | ||
1041 | |||
1042 | anEvent.stop(); | ||
1043 | } | ||
1044 | }, | ||
1045 | |||
1046 | //------------------------------------------------------------------------- | ||
1047 | |||
1048 | 'visibleForm': function() { | ||
1049 | return this._visibleForm; | ||
1050 | }, | ||
1051 | |||
1052 | 'setVisibleForm': function(aValue) { | ||
1053 | this._visibleForm = aValue; | ||
1054 | }, | ||
1055 | |||
1056 | //------------------------------------------------------------------------- | ||
1057 | |||
1058 | 'focusOnVisibleForm': function() { | ||
1059 | if (this.visibleForm() == 'registration') { | ||
1060 | this.getElement('registration_username').focus(); | ||
1061 | } else { | ||
1062 | this.getElement('login_username').focus(); | ||
1063 | } | ||
1064 | }, | ||
1065 | |||
1066 | //------------------------------------------------------------------------- | ||
1067 | |||
1068 | 'show': function() { | ||
1069 | if (this.visibleForm() == 'registration') { | ||
1070 | this.showRegistrationForm(false); | ||
1071 | } else { | ||
1072 | this.showLoginForm(false); | ||
1073 | } | ||
1074 | }, | ||
1075 | |||
1076 | //------------------------------------------------------------------------- | ||
1077 | |||
1078 | 'switchLanguage': function(anEvent) { | ||
1079 | Clipperz.PM.Strings.Languages.setSelectedLanguage(anEvent.src().value); | ||
1080 | }, | ||
1081 | |||
1082 | //------------------------------------------------------------------------- | ||
1083 | |||
1084 | 'selectSelectedLanguageOption': function() { | ||
1085 | Clipperz.DOM.selectOptionMatchingValue(this.getDom('languageSelector'), Clipperz.PM.Strings.selectedLanguage, true); | ||
1086 | }, | ||
1087 | |||
1088 | //------------------------------------------------------------------------- | ||
1089 | |||
1090 | 'switchLanguageHandler': function() { | ||
1091 | this.render(); | ||
1092 | this.show(); | ||
1093 | }, | ||
1094 | |||
1095 | //------------------------------------------------------------------------- | ||
1096 | |||
1097 | 'togglePassphraseCheckbox': function(anEvent) { | ||
1098 | this.getDom('showPassphraseCheckbox').click(); | ||
1099 | }, | ||
1100 | |||
1101 | 'togglePassphraseVisibility': function(anEvent) { | ||
1102 | if (this.getDom('showPassphraseCheckbox').checked == true) { | ||
1103 | this.getElement('showPassphraseDiv').show(); | ||
1104 | this.getElement('hidePassphraseDiv').hide(); | ||
1105 | } else { | ||
1106 | this.getElement('showPassphraseDiv').hide(); | ||
1107 | this.getElement('hidePassphraseDiv').show(); | ||
1108 | } | ||
1109 | }, | ||
1110 | |||
1111 | //------------------------------------------------------------------------- | ||
1112 | __syntaxFix__: "syntax fix" | ||
1113 | |||
1114 | }); | ||
diff --git a/frontend/beta/js/Clipperz/PM/Components/Panels/LogoutPanel.js b/frontend/beta/js/Clipperz/PM/Components/Panels/LogoutPanel.js new file mode 100644 index 0000000..d7abfd6 --- a/dev/null +++ b/frontend/beta/js/Clipperz/PM/Components/Panels/LogoutPanel.js | |||
@@ -0,0 +1,73 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
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 | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | 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 | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | ||
30 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | ||
31 | if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; } | ||
32 | if (typeof(Clipperz.PM.Components.Panels) == 'undefined') { Clipperz.PM.Components.Panels = {}; } | ||
33 | |||
34 | //############################################################################# | ||
35 | |||
36 | Clipperz.PM.Components.Panels.LogoutPanel = function(args) { | ||
37 | args = args || {}; | ||
38 | |||
39 | Clipperz.PM.Components.Panels.LogoutPanel.superclass.constructor.call(this, args); | ||
40 | |||
41 | return this; | ||
42 | } | ||
43 | |||
44 | //============================================================================= | ||
45 | |||
46 | YAHOO.extendX(Clipperz.PM.Components.Panels.LogoutPanel, Clipperz.PM.Components.Panels.BasePanel, { | ||
47 | |||
48 | 'toString': function() { | ||
49 | return "Clipperz.PM.Components.LogoutPanel component"; | ||
50 | }, | ||
51 | |||
52 | //------------------------------------------------------------------------- | ||
53 | |||
54 | 'initPanel': function() { | ||
55 | var result; | ||
56 | varlayout; | ||
57 | |||
58 | result = new YAHOO.ext.ContentPanel(this.getId('panel'), {title:'logout', closable:false, autoCreate:true}); | ||
59 | |||
60 | Clipperz.YUI.DomHelper.append(result.getEl().dom, | ||
61 | {tag:'div', children:[ | ||
62 | {tag:'h2', html:'Logout panel'} | ||
63 | ]} | ||
64 | ); | ||
65 | |||
66 | return result; | ||
67 | }, | ||
68 | |||
69 | //------------------------------------------------------------------------- | ||
70 | __syntaxFix__: "syntax fix" | ||
71 | |||
72 | }); | ||
73 | |||
diff --git a/frontend/beta/js/Clipperz/PM/Components/Panels/MainPanel.js b/frontend/beta/js/Clipperz/PM/Components/Panels/MainPanel.js new file mode 100644 index 0000000..e2036d0 --- a/dev/null +++ b/frontend/beta/js/Clipperz/PM/Components/Panels/MainPanel.js | |||
@@ -0,0 +1,906 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
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 | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | 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 | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | ||
30 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | ||
31 | if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; } | ||
32 | if (typeof(Clipperz.PM.Components.Panels) == 'undefined') { Clipperz.PM.Components.Panels = {}; } | ||
33 | |||
34 | //############################################################################# | ||
35 | |||
36 | Clipperz.PM.Components.Panels.MainPanel = function(anElement, args) { | ||
37 | args = args || {}; | ||
38 | |||
39 | Clipperz.PM.Components.Panels.MainPanel.superclass.constructor.call(this, anElement, args); | ||
40 | |||
41 | this._recordListDataModel = null; | ||
42 | this._selectedRecord = null; | ||
43 | this._recordDetailComponent = null; | ||
44 | this._recordListGrid = null; | ||
45 | |||
46 | this._directLinkItemTemplate = null; | ||
47 | this._recordItemTemplate = null; | ||
48 | |||
49 | this._addNewRecordButton = null; | ||
50 | this._deleteRecordButton = null; | ||
51 | |||
52 | this._creationWizard = null; | ||
53 | |||
54 | Clipperz.NotificationCenter.register(null, 'selectAndEnterEditMode', this, 'selectRecordAndEnterEditModeHandler'); | ||
55 | |||
56 | Clipperz.NotificationCenter.register(null, 'recordAdded', this, 'recordAddedHandler'); | ||
57 | Clipperz.NotificationCenter.register(null, 'recordUpdated', this, 'recordUpdatedHandler'); | ||
58 | Clipperz.NotificationCenter.register(null, 'recordRemoved', this, 'recordRemovedHandler'); | ||
59 | |||
60 | Clipperz.NotificationCenter.register(null, 'directLoginAdded', this, 'directLoginAddedHandler'); | ||
61 | Clipperz.NotificationCenter.register(null, 'directLoginUpdated', this, 'directLoginUpdatedHandler'); | ||
62 | Clipperz.NotificationCenter.register(null, 'directLoginRemoved', this, 'directLoginRemovedHandler'); | ||
63 | |||
64 | Clipperz.NotificationCenter.register(null, 'accountLocked', this, 'accountLockedHandler'); | ||
65 | |||
66 | MochiKit.Signal.connect(MochiKit.DOM.currentWindow(), 'onresize', this, 'resizeModalMask'); | ||
67 | this.render(); | ||
68 | |||
69 | return this; | ||
70 | } | ||
71 | |||
72 | //============================================================================= | ||
73 | |||
74 | YAHOO.extendX(Clipperz.PM.Components.Panels.MainPanel, Clipperz.PM.Components.Panels.BasePanel, { | ||
75 | |||
76 | 'toString': function() { | ||
77 | return "Clipperz.PM.Components.Panels.MainPanel component"; | ||
78 | }, | ||
79 | |||
80 | //------------------------------------------------------------------------- | ||
81 | |||
82 | 'render': function() { | ||
83 | this.element().update(""); | ||
84 | Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'table', id:'mainPanelTABLE', border:'0', cellspacing:'0', cellpadding:'0', children:[ | ||
85 | {tag:'tbody', children:[ | ||
86 | {tag:'tr', children:[ | ||
87 | {tag:'td', width:'15', children:[ | ||
88 | {tag:'div', cls:'mainPanelMinHeightDiv'} | ||
89 | ]}, | ||
90 | {tag:'td', valign:'top', id:'directLoginsTD', width:'200', children:[ | ||
91 | {tag:'div', id:'directLoginsBlock', children:[ | ||
92 | {tag:'div', cls:'directLoginsBlockHeaderBox', children:[{tag:'h3', id:'directLoginTitle', htmlString:Clipperz.PM.Strings['mainPanelDirectLoginBlockLabel']}]}, | ||
93 | {tag:'div', id:'directLoginsDescription', htmlString:Clipperz.PM.Strings['mainPanelDirectLoginBlockDescription']}, | ||
94 | {tag:'ul', id:'directLogins'} | ||
95 | ]} | ||
96 | ]}, | ||
97 | {tag:'td', width:'15', children:[ | ||
98 | {tag:'div', cls:'mainPanelMinHeightDiv'} | ||
99 | ]}, | ||
100 | {tag:'td', valign:'top', children:[ | ||
101 | {tag:'div', id:'mainContent', children:[ | ||
102 | {tag:'div', id:'recordListBlockHeader'}, | ||
103 | {tag:'div', id:'recordListAndDetailBlock', children:[ | ||
104 | {tag:'table', id:'recordListAndDetailBlockTABLE', border:'0', cellspacing:'0', cellpadding:'0', children:[ | ||
105 | {tag:'tbody', children:[ | ||
106 | {tag:'tr', children:[ | ||
107 | {tag:'td', valign:'top', width:'250', children:[ | ||
108 | {tag:'div', id:'recordListBlock', children:[ | ||
109 | {tag:'div', id:'recordListFilterHeader'}, | ||
110 | {tag:'ul', id:'records'} | ||
111 | ]} | ||
112 | ]}, | ||
113 | {tag:'td', id:'recordDetailSeparatorTD', rowspan:'2', valign:'top', bgcolor:'#ddddff', html:' '}, | ||
114 | {tag:'td', valign:'top', children:[ | ||
115 | {tag:'div', id:'recordDetailMainBlock', children:[ | ||
116 | {tag:'div', id:'recordTitleTopBlock'}, | ||
117 | {tag:'div', id:'recordDetailBlock', children:[ | ||
118 | {tag:'div', id:'recordDetail'} | ||
119 | ]} | ||
120 | ]}, | ||
121 | {tag:'div', id:'recordCreationWizardMainBlock', children:[ | ||
122 | {tag:'div', id:'recordCreationWizard', html:"WIZARD"} | ||
123 | ]} | ||
124 | ]} | ||
125 | ]}, | ||
126 | {tag:'tr', children:[ | ||
127 | {tag:'td', id:'cardBoxLowerLeftTD', html:' '}, | ||
128 | {tag:'td', id:'cardBoxLowerRightTD', html:' '} | ||
129 | ]} | ||
130 | ]} | ||
131 | ]} | ||
132 | ]} | ||
133 | ]} | ||
134 | ]}, | ||
135 | {tag:'td', width:'15', html:" "} | ||
136 | ]} | ||
137 | ]} | ||
138 | ]}); | ||
139 | |||
140 | this.renderRecordListBlockHeader(); | ||
141 | // this.renderRecordListFilterHeader(); | ||
142 | |||
143 | YAHOO.ext.Element.get('directLogins').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide(); | ||
144 | |||
145 | this.recordDetailComponent(); | ||
146 | |||
147 | YAHOO.ext.Element.get('recordDetailMainBlock').setVisibilityMode(YAHOO.ext.Element.DISPLAY).show(); | ||
148 | YAHOO.ext.Element.get('recordCreationWizardMainBlock').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide(); | ||
149 | }, | ||
150 | |||
151 | //------------------------------------------------------------------------- | ||
152 | |||
153 | 'addNewRecordButton': function() { | ||
154 | return this._addNewRecordButton; | ||
155 | }, | ||
156 | |||
157 | 'setAddNewRecordButton': function(aValue) { | ||
158 | this._addNewRecordButton = aValue; | ||
159 | }, | ||
160 | |||
161 | 'deleteRecordButton': function() { | ||
162 | return this._deleteRecordButton; | ||
163 | }, | ||
164 | |||
165 | 'setDeleteRecordButton': function(aValue) { | ||
166 | this._deleteRecordButton = aValue; | ||
167 | }, | ||
168 | |||
169 | //------------------------------------------------------------------------- | ||
170 | |||
171 | 'addNewRecord': function(anEvent) { | ||
172 | var deferredResult; | ||
173 | // var currentNumberOfRecords; | ||
174 | |||
175 | deferredResult = new MochiKit.Async.Deferred(); | ||
176 | |||
177 | // currentNumberOfRecords = MochiKit.Base.keys(this.user().records()).length; | ||
178 | /* | ||
179 | // if ((this.user().preferences().shouldShowDonationPanel()) && (currentNumberOfRecords > 0) && ((currentNumberOfRecords%10) == 0)) { | ||
180 | // if (true) { | ||
181 | if ((this.user().preferences().shouldShowDonationPanel()) && (currentNumberOfRecords >= 5)) { | ||
182 | deferredResult.addCallback(Clipperz.PM.showDonationSplashScreen, this.user(), 'recordListAddRecordButton'); | ||
183 | } | ||
184 | */ | ||
185 | deferredResult.addCallback(MochiKit.Base.bind(function() { | ||
186 | var currentlySelectedRecord; | ||
187 | |||
188 | currentlySelecedRecord = this.selectedRecord(); | ||
189 | this.setSelectedRecord(null); | ||
190 | |||
191 | YAHOO.ext.Element.get('recordDetailMainBlock').hide(); | ||
192 | YAHOO.ext.Element.get('recordCreationWizardMainBlock').show(); | ||
193 | this.setCreationWizard(new Clipperz.PM.Components.RecordDetail.CreationWizard(YAHOO.ext.Element.get('recordCreationWizardMainBlock'), {previouslySelectedRecord:currentlySelecedRecord, mainComponent:this})); | ||
194 | |||
195 | this.enterModalView(); | ||
196 | }, this)); | ||
197 | |||
198 | deferredResult.callback(); | ||
199 | }, | ||
200 | |||
201 | //------------------------------------------------------------------------- | ||
202 | |||
203 | 'creationWizard': function() { | ||
204 | return this._creationWizard; | ||
205 | }, | ||
206 | |||
207 | 'setCreationWizard': function(aValue) { | ||
208 | this._creationWizard = aValue; | ||
209 | }, | ||
210 | |||
211 | //------------------------------------------------------------------------- | ||
212 | |||
213 | 'exitWizard': function(aSelectedRecord, shouldEnterEditMode) { | ||
214 | //MochiKit.Logging.logDebug(">>> MainPanel.exitWizard - " + aSelectedRecord) | ||
215 | YAHOO.ext.Element.get('recordCreationWizardMainBlock').hide(); | ||
216 | YAHOO.ext.Element.get('recordDetailMainBlock').show(); | ||
217 | |||
218 | if (shouldEnterEditMode == true) { | ||
219 | this.selectRecordAndEnterEditMode(aSelectedRecord); | ||
220 | } else { | ||
221 | this.setSelectedRecord(aSelectedRecord); | ||
222 | this.exitModalView(); | ||
223 | } | ||
224 | |||
225 | this.creationWizard().remove(); | ||
226 | this.setCreationWizard(null); | ||
227 | //MochiKit.Logging.logDebug("<<< MainPanel.exitWizard"); | ||
228 | }, | ||
229 | |||
230 | //------------------------------------------------------------------------- | ||
231 | |||
232 | 'selectRecordAndEnterEditMode': function(aRecord) { | ||
233 | this.setSelectedRecord(aRecord); | ||
234 | this.recordDetailComponent().setEditMode('EDIT'); | ||
235 | }, | ||
236 | |||
237 | 'selectRecordAndEnterEditModeHandler': function(anEvent) { | ||
238 | this.selectRecordAndEnterEditMode(anEvent.source()); | ||
239 | }, | ||
240 | |||
241 | //------------------------------------------------------------------------- | ||
242 | |||
243 | 'resizeModalMask': function() { | ||
244 | //MochiKit.Logging.logDebug(">>> MainPanel.resizeModalMask"); | ||
245 | MochiKit.Style.setElementDimensions('recordDetailEditModeHeaderMask', {w:MochiKit.Style.getElementDimensions('mainDiv').w, h:119}); | ||
246 | |||
247 | MochiKit.Style.setElementDimensions('recordDetailEditModeVerticalMask', {w:511, h:MochiKit.Style.getElementDimensions('mainDiv').h - 119}); | ||
248 | //MochiKit.Logging.logDebug("<<< MainPanel.resizeModalMask"); | ||
249 | }, | ||
250 | |||
251 | //------------------------------------------------------------------------- | ||
252 | |||
253 | 'enterModalView': function() { | ||
254 | if (this.user().preferences().useSafeEditMode()) { | ||
255 | var headerMaskElement; | ||
256 | var verticalMaskElement; | ||
257 | |||
258 | this.resizeModalMask(); | ||
259 | |||
260 | headerMaskElement = YAHOO.ext.Element.get('recordDetailEditModeHeaderMask'); | ||
261 | headerMaskElement.show(); | ||
262 | headerMaskElement.mask(); | ||
263 | |||
264 | verticalMaskElement = YAHOO.ext.Element.get('recordDetailEditModeVerticalMask'); | ||
265 | verticalMaskElement.show(); | ||
266 | verticalMaskElement.mask(); | ||
267 | } | ||
268 | }, | ||
269 | |||
270 | //------------------------------------------------------------------------- | ||
271 | |||
272 | 'exitModalView': function() { | ||
273 | if (this.user().preferences().useSafeEditMode()) { | ||
274 | var headerMaskElement; | ||
275 | var verticalMaskElement; | ||
276 | |||
277 | headerMaskElement = YAHOO.ext.Element.get('recordDetailEditModeHeaderMask'); | ||
278 | headerMaskElement.unmask(); | ||
279 | headerMaskElement.hide(); | ||
280 | |||
281 | verticalMaskElement = YAHOO.ext.Element.get('recordDetailEditModeVerticalMask'); | ||
282 | verticalMaskElement.unmask(); | ||
283 | verticalMaskElement.hide(); | ||
284 | } | ||
285 | }, | ||
286 | |||
287 | //------------------------------------------------------------------------- | ||
288 | |||
289 | 'removeSelectedRecord': function() { | ||
290 | var selectedRecordReferences; | ||
291 | |||
292 | //MochiKit.Logging.logDebug(">>> MainPanel.removeSelectedRecord"); | ||
293 | if (this.selectedRecord() != null) { | ||
294 | selectedRecordReferences = [this.selectedRecord().reference()]; | ||
295 | } else { | ||
296 | selectedRecordReferences = []; | ||
297 | } | ||
298 | |||
299 | if (selectedRecordReferences.length > 0 ) { | ||
300 | varrecordReference; | ||
301 | varrecords; | ||
302 | var deferred; | ||
303 | |||
304 | records = []; | ||
305 | for (recordReference in selectedRecordReferences) { | ||
306 | var record; | ||
307 | |||
308 | //MochiKit.Logging.logDebug("### MainPanel.removeSelectedRecord - recordReference: " + selectedRecordReferences[recordReference]); | ||
309 | record = this.user().records()[selectedRecordReferences[recordReference]]; | ||
310 | //MochiKit.Logging.logDebug("### MainPanel.removeSelectedRecord - record: " + record); | ||
311 | records.push(record); | ||
312 | } | ||
313 | //MochiKit.Logging.logDebug("### MainPanel.removeSelectedRecord - records.length: " + records.length); | ||
314 | |||
315 | deferred = new MochiKit.Async.Deferred(); | ||
316 | //MochiKit.Logging.logDebug("--- MainPanel.removeSelectedRecord - 1:"); | ||
317 | //deferred.addBoth(function(res) {MochiKit.Logging.logDebug("MainPanel.removeSelectedRecord - 1: " + res); return res;}); | ||
318 | //MochiKit.Logging.logDebug("--- MainPanel.removeSelectedRecord - 2:"); | ||
319 | deferred.addCallback(function() { | ||
320 | var deferredResult; | ||
321 | |||
322 | deferredResult = new MochiKit.Async.Deferred(); | ||
323 | Clipperz.PM.Components.MessageBox().deferredShow({ | ||
324 | title:Clipperz.PM.Strings['mainPanelDeletingRecordPanelConfirmationTitle'], | ||
325 | text:Clipperz.PM.Strings['mainPanelDeleteRecordPanelConfirmationText'], | ||
326 | width:240, | ||
327 | showProgressBar:false, | ||
328 | showCloseButton:false, | ||
329 | buttons:{ | ||
330 | 'yes':Clipperz.PM.Strings['mainPanelDeleteRecordPanelConfirmButtonLabel'], | ||
331 | 'no':Clipperz.PM.Strings['mainPanelDeleteRecordPanelDenyButtonLabel'] | ||
332 | }, | ||
333 | fn:MochiKit.Base.partial(function(aDeferred, aResult) { | ||
334 | if (aResult == 'yes') { | ||
335 | aDeferred.callback(aResult); | ||
336 | } else { | ||
337 | aDeferred.errback(aResult); | ||
338 | } | ||
339 | }, deferredResult) | ||
340 | }, 'recordListRemoveRecordButton'); | ||
341 | |||
342 | return deferredResult; | ||
343 | }); | ||
344 | //MochiKit.Logging.logDebug("--- MainPanel.removeSelectedRecord - 3:"); | ||
345 | //deferred.addBoth(function(res) {MochiKit.Logging.logDebug("MainPanel.removeSelectedRecord - 2: " + res); return res;}); | ||
346 | //MochiKit.Logging.logDebug("--- MainPanel.removeSelectedRecord - 4:"); | ||
347 | //deferred.addBoth(function(res) {MochiKit.Logging.logDebug("MainPanel.removeSelectedRecord - 3: " + res); return res;}); | ||
348 | deferred.addCallback(MochiKit.Base.method(Clipperz.PM.Components.MessageBox(), 'deferredShow'), | ||
349 | { | ||
350 | title:Clipperz.PM.Strings['mainPanelDeletingRecordPanelInitialTitle'], | ||
351 | text:Clipperz.PM.Strings['mainPanelDeletingRecordPanelInitialText'], | ||
352 | width:240, | ||
353 | showProgressBar:true, | ||
354 | showCloseButton:false, | ||
355 | steps:5 | ||
356 | } | ||
357 | ); | ||
358 | //MochiKit.Logging.logDebug("--- MainPanel.removeSelectedRecord - 5:"); | ||
359 | //deferred.addBoth(function(res) {MochiKit.Logging.logDebug("MainPanel.removeSelectedRecord - 4: " + res); return res;}); | ||
360 | deferred.addCallback(MochiKit.Base.method(this.user(), 'deleteRecordsAction'), records); | ||
361 | //MochiKit.Logging.logDebug("--- MainPanel.removeSelectedRecord - 6:"); | ||
362 | //deferred.addBoth(function(res) {MochiKit.Logging.logDebug("MainPanel.removeSelectedRecord - 5: " + res); return res;}); | ||
363 | //MochiKit.Logging.logDebug("--- MainPanel.removeSelectedRecord - 7:"); | ||
364 | //deferred.addBoth(function(res) {MochiKit.Logging.logDebug("MainPanel.removeSelectedRecord - 6: " + res); return res;}); | ||
365 | deferred.addCallback(function() { | ||
366 | Clipperz.PM.Components.MessageBox().update({ | ||
367 | title:null, | ||
368 | text:Clipperz.PM.Strings['mainPanelDeletingRecordPanelCompletedText'], | ||
369 | step:'next', | ||
370 | buttons:{} | ||
371 | }); | ||
372 | }); | ||
373 | //MochiKit.Logging.logDebug("--- MainPanel.removeSelectedRecord - 8:"); | ||
374 | //deferred.addBoth(function(res) {MochiKit.Logging.logDebug("MainPanel.removeSelectedRecord - 7: " + res); return res;}); | ||
375 | deferred.addCallback(MochiKit.Async.wait, 1); | ||
376 | //MochiKit.Logging.logDebug("--- MainPanel.removeSelectedRecord - 9:"); | ||
377 | //deferred.addBoth(function(res) {MochiKit.Logging.logDebug("MainPanel.removeSelectedRecord - 8: " + res); return res;}); | ||
378 | deferred.addCallback(function(res) { | ||
379 | Clipperz.PM.Components.MessageBox().hide(YAHOO.ext.Element.get('main')); | ||
380 | return res; | ||
381 | }); | ||
382 | //MochiKit.Logging.logDebug("--- MainPanel.removeSelectedRecord - 10:"); | ||
383 | //deferred.addBoth(function(res) {MochiKit.Logging.logDebug("MainPanel.removeSelectedRecord - 9: " + res); return res;}); | ||
384 | deferred.callback(); | ||
385 | } else { | ||
386 | //MochiKit.Logging.logDebug("+++ MainPanel.removeSelectedRecord - nothing selected"); | ||
387 | } | ||
388 | }, | ||
389 | |||
390 | //------------------------------------------------------------------------- | ||
391 | |||
392 | 'recordDetailComponent': function() { | ||
393 | //MochiKit.Logging.logDebug(">>> MainPanel.recordDetailComponent"); | ||
394 | if (this._recordDetailComponent == null) { | ||
395 | //MochiKit.Logging.logDebug("--- MainPanel.recordDetailComponent - 1"); | ||
396 | //MochiKit.Logging.logDebug("--- MainPanel.recordDetailComponent - 1 - user: " + this.user()); | ||
397 | this._recordDetailComponent = new Clipperz.PM.Components.RecordDetail.MainComponent( | ||
398 | YAHOO.ext.Element.get('recordDetail'), | ||
399 | {user:this.user(), mainPanel:this} | ||
400 | ); | ||
401 | } | ||
402 | |||
403 | //MochiKit.Logging.logDebug("<<< MainPanel.recordDetailComponent"); | ||
404 | |||
405 | return this._recordDetailComponent; | ||
406 | }, | ||
407 | |||
408 | //------------------------------------------------------------------------- | ||
409 | |||
410 | 'selectedRecord': function() { | ||
411 | return this._selectedRecord; | ||
412 | }, | ||
413 | |||
414 | 'setSelectedRecord': function(aValue) { | ||
415 | // this.hideNewRecordPanel(); | ||
416 | //MochiKit.Logging.logDebug(">>> MainPanel.setSelectedRecord"); | ||
417 | if (aValue != this._selectedRecord) { | ||
418 | //MochiKit.Logging.logDebug("--- MainPanel.setSelectedRecord - 1"); | ||
419 | this._selectedRecord = aValue; | ||
420 | //MochiKit.Logging.logDebug("--- MainPanel.setSelectedRecord - 2"); | ||
421 | this.redrawRecordItems(); | ||
422 | //MochiKit.Logging.logDebug("--- MainPanel.setSelectedRecord - 3"); | ||
423 | this.recordDetailComponent().setRecord(aValue); | ||
424 | //MochiKit.Logging.logDebug("--- MainPanel.setSelectedRecord - 4"); | ||
425 | } | ||
426 | |||
427 | if ((aValue == null) || (Clipperz.PM.Proxy.defaultProxy.isReadOnly())) { | ||
428 | this.deleteRecordButton().disable(); | ||
429 | } else { | ||
430 | this.deleteRecordButton().enable(); | ||
431 | } | ||
432 | //MochiKit.Logging.logDebug("<<< MainPanel.setSelectedRecord"); | ||
433 | }, | ||
434 | |||
435 | //------------------------------------------------------------------------- | ||
436 | |||
437 | 'recordAddedHandler': function(anEvent) { | ||
438 | //MochiKit.Logging.logDebug(">>> MainPanel.recordAddedHandler"); | ||
439 | this.recordDetailComponent(); | ||
440 | this.redrawRecordItems(); | ||
441 | //MochiKit.Logging.logDebug("<<< MainPanel.recordAddedHandler"); | ||
442 | }, | ||
443 | |||
444 | 'recordUpdatedHandler': function(anEvent) { | ||
445 | //MochiKit.Logging.logDebug(">>> MainPanel.recordUpdatedHandler"); | ||
446 | this.redrawRecordItems(); | ||
447 | //MochiKit.Logging.logDebug("<<< MainPanel.recordUpdatedHandler"); | ||
448 | }, | ||
449 | |||
450 | 'recordRemovedHandler': function(anEvent) { | ||
451 | //MochiKit.Logging.logDebug(">>> MainPanel.recordRemovedHandler"); | ||
452 | this.setSelectedRecord(null); | ||
453 | //MochiKit.Logging.logDebug("--- MainPanel.recordRemovedHandler - 1"); | ||
454 | this.redrawRecordItems(); | ||
455 | //MochiKit.Logging.logDebug("<<< MainPanel.recordRemovedHandler"); | ||
456 | }, | ||
457 | |||
458 | 'compareRecords': function(a, b) { | ||
459 | //MochiKit.Logging.logDebug("=== compareRecords: " + a.toString() + " - " + b.toString()); | ||
460 | return MochiKit.Base.compare(a.label().toLowerCase(), b.label().toLowerCase()); | ||
461 | }, | ||
462 | |||
463 | 'redrawRecordItems': function() { | ||
464 | var template; | ||
465 | var allRecords; | ||
466 | |||
467 | //MochiKit.Logging.logDebug(">>> MainPanel.redrawRecordItems"); | ||
468 | MochiKit.Iter.forEach(YAHOO.ext.Element.get('records').getChildrenByTagName('li'), function(aRecordElement) { | ||
469 | MochiKit.Signal.disconnectAll(aRecordElement.dom); | ||
470 | }) | ||
471 | //MochiKit.Logging.logDebug("--- MainPanel.redrawRecordItems - 1"); | ||
472 | YAHOO.ext.Element.get('records').update(""); | ||
473 | //MochiKit.Logging.logDebug("--- MainPanel.redrawRecordItems - 2"); | ||
474 | allRecords = MochiKit.Base.values(this.user().records()); | ||
475 | //MochiKit.Logging.logDebug("--- MainPanel.redrawRecordItems - 3"); | ||
476 | allRecords.sort(this.compareRecords); | ||
477 | //MochiKit.Logging.logDebug("--- MainPanel.redrawRecordItems - 4"); | ||
478 | template = this.recordItemTemplate(); | ||
479 | //MochiKit.Logging.logDebug("--- MainPanel.redrawRecordItems - 5"); | ||
480 | MochiKit.Iter.forEach(allRecords, MochiKit.Base.bind(function(aRecord) { | ||
481 | varrecordElement; | ||
482 | recordElement = template.append('records', { | ||
483 | recordTitle:aRecord.label(), | ||
484 | recordReference:aRecord.reference(), | ||
485 | cls:((aRecord == this.selectedRecord()) ? 'selected': '') | ||
486 | }, true); | ||
487 | //MochiKit.Logging.logDebug("--- MainPanel.redrawRecordItems - 6: " + recordElement.dom); | ||
488 | recordElement.addClassOnOver('hover'); | ||
489 | MochiKit.Signal.connect(recordElement.dom, 'onclick', this, 'selectRecord'); | ||
490 | }, this)); | ||
491 | //MochiKit.Logging.logDebug("<<< MainPanel.redrawRecordItems"); | ||
492 | }, | ||
493 | |||
494 | 'selectRecord': function(anEvent) { | ||
495 | //MochiKit.Logging.logDebug(">>> MainPanel.selectRecord"); | ||
496 | //MochiKit.Logging.logDebug("--- MainPanel.selectRecord !!! - ", this.user().records()[anEvent.src().id].label()); | ||
497 | this.setSelectedRecord(this.user().records()[anEvent.src().id]); | ||
498 | //MochiKit.Logging.logDebug("<<< MainPanel.selectRecord"); | ||
499 | }, | ||
500 | |||
501 | //------------------------------------------------------------------------- | ||
502 | |||
503 | 'directLoginAddedHandler': function(anEvent) { | ||
504 | //MochiKit.Logging.logDebug(">>> MainPanel.recordRemovedHandler"); | ||
505 | this.redrawDirectLoginItems(); | ||
506 | //MochiKit.Logging.logDebug("<<< MainPanel.recordRemovedHandler"); | ||
507 | }, | ||
508 | |||
509 | 'directLoginUpdatedHandler': function(anEvent) { | ||
510 | //MochiKit.Logging.logDebug(">>> MainPanel.directLoginUpdatedHandler"); | ||
511 | this.redrawDirectLoginItems(); | ||
512 | //MochiKit.Logging.logDebug("<<< MainPanel.directLoginUpdatedHandler"); | ||
513 | }, | ||
514 | |||
515 | 'directLoginRemovedHandler': function(anEvent) { | ||
516 | //MochiKit.Logging.logDebug(">>> MainPanel.directLoginRemovedHandler"); | ||
517 | this.redrawDirectLoginItems(); | ||
518 | //MochiKit.Logging.logDebug("<<< MainPanel.directLoginRemovedHandler"); | ||
519 | }, | ||
520 | |||
521 | 'compareDirectLogins': function(a, b) { | ||
522 | return MochiKit.Base.compare(a.label().toLowerCase(), b.label().toLowerCase()); | ||
523 | }, | ||
524 | |||
525 | 'redrawDirectLoginItems': function() { | ||
526 | var template; | ||
527 | var allDirectLogins; | ||
528 | |||
529 | //MochiKit.Logging.logDebug(">>> MainPanel.redrawDirectLoginItems"); | ||
530 | MochiKit.Iter.forEach(YAHOO.ext.Element.get('directLogins').getChildrenByTagName('li'), function(aDirectLoginElement) { | ||
531 | MochiKit.Signal.disconnectAll(aDirectLoginElement.dom); | ||
532 | //MochiKit.Logging.logDebug("disconnecting IMG " + aDirectLoginElement.getChildrenByTagName('img')[0].dom.src); | ||
533 | MochiKit.Signal.disconnectAll(aDirectLoginElement.getChildrenByTagName('img')[0].dom); | ||
534 | }) | ||
535 | //MochiKit.Logging.logDebug("--- MainPanel.redrawDirectLoginItems - 1"); | ||
536 | YAHOO.ext.Element.get('directLogins').update(""); | ||
537 | //MochiKit.Logging.logDebug("--- MainPanel.redrawDirectLoginItems - 2"); | ||
538 | allDirectLogins = MochiKit.Base.values(this.user().directLoginReferences()); | ||
539 | //MochiKit.Logging.logDebug("--- MainPanel.redrawDirectLoginItems - 3"); | ||
540 | allDirectLogins.sort(this.compareDirectLogins); | ||
541 | |||
542 | if (allDirectLogins.length == 0) { | ||
543 | YAHOO.ext.Element.get('directLoginsDescription').show(); | ||
544 | YAHOO.ext.Element.get('directLogins').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide(); | ||
545 | } else { | ||
546 | YAHOO.ext.Element.get('directLoginsDescription').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide(); | ||
547 | YAHOO.ext.Element.get('directLogins').show(); | ||
548 | } | ||
549 | //MochiKit.Logging.logDebug("--- MainPanel.redrawDirectLoginItems - 4"); | ||
550 | template = this.directLoginItemTemplate(); | ||
551 | //MochiKit.Logging.logDebug("--- MainPanel.redrawDirectLoginItems - 5"); | ||
552 | MochiKit.Iter.forEach(allDirectLogins, MochiKit.Base.bind(function(aDirectLogin) { | ||
553 | vardirectLoginElement; | ||
554 | varfaviconImageElementID; | ||
555 | |||
556 | faviconImageElementID = aDirectLogin.reference() + "_faviconIMG"; | ||
557 | directLoginElement = template.append('directLogins', { | ||
558 | elementID:faviconImageElementID, | ||
559 | faviconUrl:aDirectLogin.fixedFavicon(), | ||
560 | directLoginTitle:aDirectLogin.label(), | ||
561 | directLoginReference:aDirectLogin.reference() | ||
562 | }, true); | ||
563 | //MochiKit.Logging.logDebug("--- MainPanel.redrawDirectLoginItems - 6: " + recordElement.dom); | ||
564 | directLoginElement.addClassOnOver("hover"); | ||
565 | MochiKit.Signal.connect(directLoginElement.dom, 'onclick', this, 'handleDirectLoginClick'); | ||
566 | |||
567 | MochiKit.Signal.connect(faviconImageElementID, 'onload', this, 'handleLoadedFaviconImage'); | ||
568 | MochiKit.Signal.connect(faviconImageElementID, 'onerror', aDirectLogin, 'handleMissingFaviconImage'); | ||
569 | MochiKit.Signal.connect(faviconImageElementID, 'onabort', aDirectLogin, 'handleMissingFaviconImage'); | ||
570 | |||
571 | // YAHOO.ext.Element.get(faviconImageElementID).dom.src = aDirectLogin.fixedFavicon(); | ||
572 | }, this)); | ||
573 | //MochiKit.Logging.logDebug("<<< MainPanel.redrawDirectLoginItems"); | ||
574 | }, | ||
575 | |||
576 | //------------------------------------------------------------------------- | ||
577 | |||
578 | 'handleDirectLoginClick': function(anEvent) { | ||
579 | vardirectLoginReference; | ||
580 | //MochiKit.Logging.logDebug(">>> MainPanel.handleDirectLoginClick !!!"); | ||
581 | |||
582 | directLoginReference = this.user().directLoginReferences()[anEvent.src().id]; | ||
583 | if (anEvent.target().className == 'directLoginItemEditButton') { | ||
584 | this.editDirectLogin(directLoginReference); | ||
585 | } else { | ||
586 | this.openDirectLogin(directLoginReference); | ||
587 | } | ||
588 | //MochiKit.Logging.logDebug("<<< MainPanel.handleDirectLoginClick"); | ||
589 | }, | ||
590 | |||
591 | 'editDirectLogin': function(aDirectLoginReference) { | ||
592 | //MochiKit.Logging.logDebug("=== MainPanel.editDirectLogin - " + aDirectLoginReference.label()); | ||
593 | this.setSelectedRecord(aDirectLoginReference.record()); | ||
594 | }, | ||
595 | |||
596 | 'openDirectLogin': function(aDirectLoginReference) { | ||
597 | vardeferredResult; | ||
598 | varnewWindow; | ||
599 | |||
600 | //MochiKit.Logging.logDebug(">>> MainPanel.openDirectLogin - " + aDirectLoginReference.label()); | ||
601 | deferredResult = new MochiKit.Async.Deferred(); | ||
602 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("MainPanel.openDirectLogin - 1: " + res); return res;}); | ||
603 | deferredResult.addCallback(MochiKit.Base.method(aDirectLoginReference, 'setupJumpPageWindow')); | ||
604 | deferredResult.addCallback(MochiKit.Base.method(aDirectLoginReference, 'deferredDirectLogin')); | ||
605 | deferredResult.addCallback(function(aDirectLogin) { | ||
606 | aDirectLogin.runDirectLogin(newWindow); | ||
607 | }); | ||
608 | |||
609 | newWindow = window.open(Clipperz.PM.Strings['directLoginJumpPageUrl'], ""); | ||
610 | // MochiKit.Signal.connect(newWindow, 'onload', MochiKit.Base.method(deferredResult, 'callback', newWindow)) | ||
611 | // MochiKit.Signal.connect(newWindow, 'onload', MochiKit.Base.partial(alert, "done")); | ||
612 | deferredResult.callback(newWindow); | ||
613 | //MochiKit.Logging.logDebug("<<< MainPanel.openDirectLogin"); | ||
614 | }, | ||
615 | |||
616 | //------------------------------------------------------------------------- | ||
617 | |||
618 | 'handleLoadedFaviconImage': function(anEvent) { | ||
619 | //MochiKit.Logging.logDebug(">>> MainPanel.handleLoadedFaviconImage"); | ||
620 | MochiKit.Signal.disconnectAll(anEvent.src()) | ||
621 | //MochiKit.Logging.logDebug("<<< MainPanel.handleLoadedFaviconImage"); | ||
622 | }, | ||
623 | |||
624 | //------------------------------------------------------------------------- | ||
625 | |||
626 | 'recordItemTemplate': function() { | ||
627 | if (this._recordItemTemplate == null) { | ||
628 | this._recordItemTemplate = Clipperz.YUI.DomHelper.createTemplate({tag:'li', cls:'{cls}', id:'{recordReference}', children:[ | ||
629 | {tag:'span', html:'{recordTitle}'} | ||
630 | ]}); | ||
631 | this._recordItemTemplate.compile(); | ||
632 | } | ||
633 | |||
634 | return this._recordItemTemplate; | ||
635 | }, | ||
636 | |||
637 | 'directLoginItemTemplate': function() { | ||
638 | if (this._directLoginItemTemplate == null) { | ||
639 | this._directLoginItemTemplate = Clipperz.YUI.DomHelper.createTemplate({tag:'li', id:'{directLoginReference}', children:[ | ||
640 | {tag:'table', border:'0', cellpadding:'0', cellspacing:'0', children:[ | ||
641 | {tag:'tbody', children:[ | ||
642 | {tag:'tr', children:[ | ||
643 | {tag:'td', width:'20', align:'center', valign:'top', children:[ | ||
644 | {tag:'img', id:'{elementID}', src:'{faviconUrl}'} | ||
645 | ]}, | ||
646 | {tag:'td', valign:'top', children:[ | ||
647 | {tag:'a', cls:'directLoginItemTitle', html:'{directLoginTitle}'} | ||
648 | ]}, | ||
649 | {tag:'td', valign:'top', align:'right', children:[ | ||
650 | // {tag:'span', cls:'directLoginItemEditButton', htmlString:Clipperz.PM.Strings['directLinkReferenceShowButtonLabel']} | ||
651 | {tag:'a', cls:'directLoginItemEditButton', htmlString:Clipperz.PM.Strings['directLinkReferenceShowButtonLabel']} | ||
652 | ]} | ||
653 | ]} | ||
654 | ]} | ||
655 | ]} | ||
656 | ]}); | ||
657 | this._directLoginItemTemplate.compile(); | ||
658 | } | ||
659 | |||
660 | return this._directLoginItemTemplate; | ||
661 | }, | ||
662 | |||
663 | //------------------------------------------------------------------------- | ||
664 | /* | ||
665 | 'newRecordButton': function() { | ||
666 | return this._newRecordButton; | ||
667 | }, | ||
668 | |||
669 | 'setNewRecordButton': function(aValue) { | ||
670 | this._newRecordButton = aValue; | ||
671 | }, | ||
672 | |||
673 | 'newRecordCancelButton': function() { | ||
674 | return this._newRecordCancelButton; | ||
675 | }, | ||
676 | |||
677 | 'setNewRecordCancelButton': function(aValue) { | ||
678 | this._newRecordCancelButton = aValue; | ||
679 | }, | ||
680 | */ | ||
681 | //------------------------------------------------------------------------- | ||
682 | |||
683 | 'onkeydown': function(anEvent) { | ||
684 | //MochiKit.Logging.logDebug(">>> onkeydown - " + anEvent.src().id + ": " + anEvent.key().code); | ||
685 | switch (anEvent.src().id) { | ||
686 | /* | ||
687 | case this.getId('newRecordForm'): | ||
688 | if (anEvent.key().code == 13) { | ||
689 | this.newRecordButton().focus(); | ||
690 | // this.addNewRecord(); | ||
691 | } else if (anEvent.key().code == 27) { | ||
692 | this.newRecordCancelButton().focus(); | ||
693 | this.hideNewRecordPanel(true); | ||
694 | } | ||
695 | break; | ||
696 | */ | ||
697 | case "recordFilterSearchForm": | ||
698 | if (anEvent.key().code == 13) { | ||
699 | //MochiKit.Logging.logDebug("SEARCH"); | ||
700 | this.filterCardsWithName(YAHOO.ext.Element.get('recordFilterSearchValue').dom.value); | ||
701 | anEvent.event().stopPropagation(); | ||
702 | YAHOO.ext.Element.get('recordFilterSearchValue').focus(); | ||
703 | } else if (anEvent.key().code == 27) { | ||
704 | this.hideRecordFilterSearchPanel(true); | ||
705 | this.showRecordFilterAllPanel(); | ||
706 | } | ||
707 | break; | ||
708 | } | ||
709 | |||
710 | }, | ||
711 | |||
712 | //------------------------------------------------------------------------- | ||
713 | |||
714 | 'renderRecordListBlockHeader': function(){ | ||
715 | var recordListBlockHeaderElement; | ||
716 | |||
717 | recordListBlockHeaderElement = YAHOO.ext.Element.get('recordListBlockHeader'); | ||
718 | recordListBlockHeaderElement.update(""); | ||
719 | Clipperz.YUI.DomHelper.append(recordListBlockHeaderElement.dom, | ||
720 | {tag:'table', cls:'recordListBlockHeaderTABLE', border:'0', cellspacing:'0', cellpadding:'0', children:[ | ||
721 | {tag:'tbody', children:[ | ||
722 | {tag:'tr', children:[ | ||
723 | {tag:'td', /*width:'50%',*/ cls:'recordBlockTitleTD', children:[ | ||
724 | {tag:'h3', id:'recordBlockTitle', htmlString:Clipperz.PM.Strings['mainPanelRecordsBlockLabel']} | ||
725 | ]}, | ||
726 | {tag:'td', align:'right', children:[ | ||
727 | {tag:'table', id:'recordListButtonsTABLE', border:'0', cellspacing:'0', cellpadding:'0', children:[ | ||
728 | {tag:'tbody', children:[ | ||
729 | {tag:'tr', children:[ | ||
730 | {tag:'td', cls:'recordButtonTD', align:'right', children:[ | ||
731 | {tag:'div', cls:'recordButton', id:'recordListAddRecordButton'} | ||
732 | ]}, | ||
733 | {tag:'td', cls:'recordButtonTD', align:'left', children:[ | ||
734 | {tag:'div', cls:'recordButton', id:'recordListRemoveRecordButton'} | ||
735 | ]} | ||
736 | ]} | ||
737 | ]} | ||
738 | ]} | ||
739 | ]}, | ||
740 | {tag:'td', width:'15', html:" "} | ||
741 | ]} | ||
742 | ]} | ||
743 | ]} | ||
744 | ); | ||
745 | |||
746 | this.setAddNewRecordButton(new YAHOO.ext.Button('recordListAddRecordButton', {text:Clipperz.PM.Strings['mainPanelAddRecordButtonLabel'], handler:this.addNewRecord, scope:this})); | ||
747 | // this.setAddNewRecordButton(new YAHOO.ext.Button('recordListAddRecordButton', {text:Clipperz.PM.Strings['mainPanelAddRecordButtonLabel'], handler:this.showNewRecordPanel, scope:this})); | ||
748 | this.setDeleteRecordButton(new YAHOO.ext.Button('recordListRemoveRecordButton', {text:Clipperz.PM.Strings['mainPanelRemoveRecordButtonLabel'], handler:this.removeSelectedRecord, scope:this})); | ||
749 | |||
750 | |||
751 | if ((Clipperz.PM.Proxy.defaultProxy.isReadOnly()) || (this.selectedRecord() == null)) { | ||
752 | this.deleteRecordButton().disable(); | ||
753 | } | ||
754 | |||
755 | if (Clipperz.PM.Proxy.defaultProxy.isReadOnly()) { | ||
756 | this.addNewRecordButton().disable(); | ||
757 | } | ||
758 | |||
759 | }, | ||
760 | |||
761 | //------------------------------------------------------------------------- | ||
762 | |||
763 | 'renderRecordListFilterHeader': function(){ | ||
764 | var recordListFilterHeaderElement; | ||
765 | |||
766 | recordListFilterHeaderElement = YAHOO.ext.Element.get('recordListFilterHeader'); | ||
767 | recordListFilterHeaderElement.update(""); | ||
768 | Clipperz.YUI.DomHelper.append(recordListFilterHeaderElement.dom, | ||
769 | {tag:'div', id:'recordFiltersDIV', children:[ | ||
770 | {tag:'div', id:'recordFiltersTableWrapper', children:[ | ||
771 | {tag:'table', id:'recordFiltersTABLE', border:'0', cellspacing:'0', cellpadding:'0', children:[ | ||
772 | {tag:'tbody', children:[ | ||
773 | {tag:'tr', children:[ | ||
774 | {tag:'td', id:'recordFilterAllTD', children:[{tag:'div', children:[{tag:'a', id:'recordFilterAll', htmlString:Clipperz.PM.Strings['mainPanelRecordFilterBlockAllLabel']}]}]}, | ||
775 | {tag:'td', id:'recordFilterTagsTD', children:[{tag:'div', children:[{tag:'a', id:'recordFilterTags', htmlString:Clipperz.PM.Strings['mainPanelRecordFilterBlockTagsLabel']}]}]}, | ||
776 | {tag:'td', id:'recordFilterSearchTD', children:[{tag:'div', children:[{tag:'a', id:'recordFilterSearch', htmlString:Clipperz.PM.Strings['mainPanelRecordFilterBlockSearchLabel']}]}]} | ||
777 | ]} | ||
778 | ]} | ||
779 | ]} | ||
780 | ]}, | ||
781 | {tag:'div', id:'recordFiltersTagsPanel'}, | ||
782 | {tag:'div', id:'recordFiltersSearchPanel', children:[{tag:'div', id:'recordFiltersSearchInnerPanel', children:[{tag:'div', id:'recordFiltersSearchInnerInnerPanel', children:[ | ||
783 | {tag:'form', id:'recordFilterSearchForm', children:[ | ||
784 | {tag:'input', type:'text', name:'search', id:'recordFilterSearchValue'} | ||
785 | ]} | ||
786 | ]}]}]} | ||
787 | ]} | ||
788 | ); | ||
789 | |||
790 | /// YAHOO.ext.Element.get('recordFiltersSearchPanel').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide(); | ||
791 | this.showRecordFilterAllPanel(false); | ||
792 | |||
793 | MochiKit.Signal.connect('recordFilterSearchForm', 'onkeydown', this, 'onkeydown'); | ||
794 | MochiKit.Signal.connect('recordFilterSearchForm', 'onsubmit', this, 'onkeydown'); | ||
795 | |||
796 | MochiKit.Signal.connect('recordFilterAll', 'onclick', this, 'showRecordFilterAllPanel'); | ||
797 | MochiKit.Signal.connect('recordFilterTags', 'onclick', this, 'showRecordFilterTagsPanel'); | ||
798 | MochiKit.Signal.connect('recordFilterSearch', 'onclick', this, 'showRecordFilterSearchPanel'); | ||
799 | }, | ||
800 | |||
801 | //------------------------------------------------------------------------- | ||
802 | |||
803 | 'showRecordFilterAllPanel': function(shouldSlide) { | ||
804 | this.hideRecordFilterTagsPanel(shouldSlide); | ||
805 | this.hideRecordFilterSearchPanel(shouldSlide); | ||
806 | YAHOO.ext.Element.get('recordFilterAllTD').addClass('selectedTab'); | ||
807 | }, | ||
808 | |||
809 | 'hideRecordFilterAllPanel': function(shouldSlide) { | ||
810 | YAHOO.ext.Element.get('recordFilterAllTD').removeClass('selectedTab'); | ||
811 | }, | ||
812 | |||
813 | //------------------------------------------------------------------------- | ||
814 | |||
815 | 'showRecordFilterTagsPanel': function(shouldSlide) { | ||
816 | this.hideRecordFilterAllPanel(shouldSlide); | ||
817 | this.hideRecordFilterSearchPanel(shouldSlide); | ||
818 | YAHOO.ext.Element.get('recordFilterTagsTD').addClass('selectedTab'); | ||
819 | }, | ||
820 | |||
821 | 'hideRecordFilterTagsPanel': function(shouldSlide) { | ||
822 | YAHOO.ext.Element.get('recordFilterTagsTD').removeClass('selectedTab'); | ||
823 | }, | ||
824 | |||
825 | //------------------------------------------------------------------------- | ||
826 | |||
827 | 'showRecordFilterSearchPanel': function(shouldSlide) { | ||
828 | var searchPanelActor; | ||
829 | |||
830 | this.hideRecordFilterAllPanel(shouldSlide); | ||
831 | this.hideRecordFilterTagsPanel(shouldSlide); | ||
832 | YAHOO.ext.Element.get('recordFilterSearchTD').addClass('selectedTab'); | ||
833 | YAHOO.ext.Element.get('recordFilterSearchValue').dom.value = ""; | ||
834 | |||
835 | searchPanelActor = new YAHOO.ext.Actor('recordFiltersSearchPanel'); | ||
836 | |||
837 | searchPanelActor.startCapture(true); | ||
838 | searchPanelActor.slideShow('top', 54); | ||
839 | searchPanelActor.play(MochiKit.Base.bind(function() { | ||
840 | YAHOO.ext.Element.get('recordFilterSearchValue').focus(); | ||
841 | }, this)); | ||
842 | }, | ||
843 | |||
844 | 'hideRecordFilterSearchPanel': function(shouldSlide) { | ||
845 | var searchPanelActor; | ||
846 | varcallback; | ||
847 | |||
848 | YAHOO.ext.Element.get('recordFilterSearchTD').removeClass('selectedTab'); | ||
849 | |||
850 | searchPanelActor = new YAHOO.ext.Actor('recordFiltersSearchPanel'); | ||
851 | |||
852 | searchPanelActor.startCapture(true) | ||
853 | if (shouldSlide === false) { | ||
854 | searchPanelActor.hide(); | ||
855 | searchPanelActor.slideHide('top'); | ||
856 | searchPanelActor.show(); | ||
857 | } else { | ||
858 | searchPanelActor.slideHide('top'); | ||
859 | } | ||
860 | |||
861 | callback = MochiKit.Base.bind(function() { | ||
862 | }, this); | ||
863 | |||
864 | searchPanelActor.play(callback); | ||
865 | }, | ||
866 | |||
867 | //------------------------------------------------------------------------- | ||
868 | |||
869 | 'filterCardsWithName': function(aValue) { | ||
870 | MochiKit.Logging.logDebug(">>> filterCardsWithName: " + aValue); | ||
871 | |||
872 | MochiKit.Logging.logDebug("<<< filterCardsWithName"); | ||
873 | }, | ||
874 | |||
875 | 'accountLockedHandler': function() { | ||
876 | this.setSelectedRecord(null); | ||
877 | }, | ||
878 | |||
879 | //------------------------------------------------------------------------- | ||
880 | |||
881 | 'switchLanguageHandler': function() { | ||
882 | YAHOO.ext.Element.get('directLoginTitle').update(Clipperz.PM.Strings['mainPanelDirectLoginBlockLabel']); | ||
883 | YAHOO.ext.Element.get('directLoginsDescription').update(""); | ||
884 | MochiKit.Iter.forEach(Clipperz.PM.Strings['mainPanelDirectLoginBlockDescriptionConfig'], function(aConfigItem) { | ||
885 | Clipperz.YUI.DomHelper.append(YAHOO.ext.Element.get('directLoginsDescription').dom, aConfigItem); | ||
886 | }); | ||
887 | YAHOO.ext.Element.get('recordBlockTitle').update(Clipperz.PM.Strings['mainPanelRecordsBlockLabel']); | ||
888 | this.renderRecordListBlockHeader(); | ||
889 | // this.renderRecordListFilterHeader(); | ||
890 | |||
891 | // YAHOO.ext.Element.get('newRecordPanelTitleH2').update(Clipperz.PM.Strings['mainPanelNewRecordPanelTitle']); | ||
892 | // YAHOO.ext.Element.get('newRecordPanelTitleLabel').update(Clipperz.PM.Strings['mainPanelNewRecordPanelRecordTitleLabel']); | ||
893 | // YAHOO.ext.Element.get('newRecordPanelConfigLabel').update(""); | ||
894 | // MochiKit.Iter.forEach(Clipperz.PM.Strings['mainPanelNewRecordPanelRecordConfigConfig'], function(aConfigItem) { | ||
895 | // Clipperz.YUI.DomHelper.append(YAHOO.ext.Element.get('newRecordPanelConfigLabel').dom, aConfigItem); | ||
896 | // }); | ||
897 | // this.newRecordButton().setText(Clipperz.PM.Strings['mainPanelNewRecordPanelCreateButtonLabel']); | ||
898 | // this.newRecordCancelButton().setText(Clipperz.PM.Strings['mainPanelNewRecordPanelCancelButtonLabel']); | ||
899 | |||
900 | this.recordDetailComponent().render(); | ||
901 | }, | ||
902 | |||
903 | //------------------------------------------------------------------------- | ||
904 | __syntaxFix__: "syntax fix" | ||
905 | |||
906 | }); | ||
diff --git a/frontend/beta/js/Clipperz/PM/Components/Panels/ToolsPanel.js b/frontend/beta/js/Clipperz/PM/Components/Panels/ToolsPanel.js new file mode 100644 index 0000000..abd2621 --- a/dev/null +++ b/frontend/beta/js/Clipperz/PM/Components/Panels/ToolsPanel.js | |||
@@ -0,0 +1,305 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
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 | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | 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 | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | ||
30 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | ||
31 | if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; } | ||
32 | if (typeof(Clipperz.PM.Components.Panels) == 'undefined') { Clipperz.PM.Components.Panels = {}; } | ||
33 | |||
34 | //############################################################################# | ||
35 | |||
36 | Clipperz.PM.Components.Panels.ToolsPanel = function(anElement, args) { | ||
37 | args = args || {}; | ||
38 | |||
39 | Clipperz.PM.Components.Panels.ToolsPanel.superclass.constructor.call(this, anElement, args); | ||
40 | |||
41 | this._generateButtonElement = null; | ||
42 | this._needsRenderingUponTabSwitch = false; | ||
43 | |||
44 | this.render(); | ||
45 | |||
46 | return this; | ||
47 | } | ||
48 | |||
49 | //============================================================================= | ||
50 | |||
51 | YAHOO.extendX(Clipperz.PM.Components.Panels.ToolsPanel, Clipperz.PM.Components.Panels.BasePanel, { | ||
52 | |||
53 | 'toString': function() { | ||
54 | return "Clipperz.PM.Components.Panels.ToolsPanel component"; | ||
55 | }, | ||
56 | |||
57 | //------------------------------------------------------------------------- | ||
58 | |||
59 | 'render': function() { | ||
60 | var bookmarkletUrl; | ||
61 | |||
62 | //MochiKit.Logging.logDebug(">>> ToolsPanel.render"); | ||
63 | Clipperz.NotificationCenter.unregister(this); | ||
64 | MochiKit.Signal.disconnectAllTo(this); | ||
65 | |||
66 | if (Clipperz_IEisBroken == true) { | ||
67 | bookmarkletUrl = bookmarklet_ie; | ||
68 | } else { | ||
69 | bookmarkletUrl = bookmarklet; | ||
70 | } | ||
71 | |||
72 | this.element().update(""); | ||
73 | Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'table', border:'0', cellspacing:'0', cellpadding:'0', children:[ | ||
74 | {tag:'tbody', children:[ | ||
75 | {tag:'tr', children:[ | ||
76 | {tag:'td', valign:'top', width:'200', children:[ | ||
77 | {tag:'ul', id:"dataSubMenu", cls:'subMenu', children:[ | ||
78 | {tag:'li', id:this.getId('passwordGenerator'), htmlString:Clipperz.PM.Strings['passwordGeneratorTabLabel']}, | ||
79 | {tag:'li', id:this.getId('bookmarklet'), htmlString:Clipperz.PM.Strings['bookmarkletTabLabel']}, | ||
80 | {tag:'li', id:this.getId('compact'), htmlString:Clipperz.PM.Strings['compactTabLabel']}, | ||
81 | {tag:'li', id:this.getId('httpAuth'), htmlString:Clipperz.PM.Strings['httpAuthTabLabel']} | ||
82 | ]} | ||
83 | ]}, | ||
84 | {tag:'td', valign:'top', children:[ | ||
85 | {tag:'ul', cls:'clipperzTabPanels', children:[ | ||
86 | {tag:'li', id:this.getId('passwordGeneratorPanel'), children:[ | ||
87 | {tag:'div', cls:'clipperzSubPanel', children:[ | ||
88 | {tag:'h5', htmlString:Clipperz.PM.Strings['passwordGeneratorTabTitle']}, | ||
89 | {tag:'div', cls:'panelDescription', htmlString:Clipperz.PM.Strings['paswordGeneratorTabDescription']}, | ||
90 | |||
91 | //--------------------------------------------------- | ||
92 | {tag:'div', children:[ | ||
93 | {tag:'form', id:this.getId('passwordGeneratorForm'), cls:'passwordGenerator', children:[ | ||
94 | {tag:'input', type:'text', cls:'clipperz_passwordGenerator_password', id:this.getId('passwordField')}, | ||
95 | {tag:'table', children:[ | ||
96 | {tag:'tbody', children:[ | ||
97 | {tag:'tr', children:[ | ||
98 | {tag:'td', width:'20%', children:[ | ||
99 | {tag:'input', type:'checkbox', name:'lowercase', id:this.getId('lowercase'), checked:true}, | ||
100 | {tag:'span', htmlString:Clipperz.PM.Strings['passwordGeneratorLowercaseLabel']} | ||
101 | ]}, | ||
102 | {tag:'td', width:'20%', children:[ | ||
103 | {tag:'input', type:'checkbox', name:'uppercase', id:this.getId('uppercase'), checked:true}, | ||
104 | {tag:'span', htmlString:Clipperz.PM.Strings['passwordGeneratorUppercaseLabel']} | ||
105 | ]}, | ||
106 | {tag:'td', width:'20%', children:[ | ||
107 | {tag:'input', type:'checkbox', name:'numbers', id:this.getId('numbers'), checked:true}, | ||
108 | {tag:'span', htmlString:Clipperz.PM.Strings['passwordGeneratorNumberLabel']} | ||
109 | ]}, | ||
110 | {tag:'td', width:'20%', children:[ | ||
111 | {tag:'input', type:'checkbox', name:'symbols', id:this.getId('symbols'), checked:true}, | ||
112 | {tag:'span', htmlString:Clipperz.PM.Strings['passwordGeneratorSymbolLabel']} | ||
113 | ]}, | ||
114 | {tag:'td', width:'20%', children:[ | ||
115 | {tag:'span', cls:'passwordGeneratorLength', children:[ | ||
116 | {tag:'span', htmlString:Clipperz.PM.Strings['passwordGeneratorLengthLabel']}, | ||
117 | {tag:'span', id:this.getId('passwordLength'), cls:'passwordGeneratorLengthValue', html:'0'} | ||
118 | ]} | ||
119 | ]} | ||
120 | ]} | ||
121 | ]} | ||
122 | ]} | ||
123 | ]}, | ||
124 | {tag:'div', id:this.getId('generateRandomPassword')} | ||
125 | ]} | ||
126 | //--------------------------------------------------- | ||
127 | |||
128 | ]} | ||
129 | ]}, | ||
130 | {tag:'li', id:this.getId('bookmarkletPanel'), children:[ | ||
131 | {tag:'div', cls:'clipperzSubPanel', children:[ | ||
132 | {tag:'h5', htmlString:Clipperz.PM.Strings['bookmarkletTabTitle']}, | ||
133 | {tag:'div', cls:'panelDescription', htmlString:Clipperz.PM.Strings['bookmarkletTabDescription']}, | ||
134 | {tag:'a', href:bookmarkletUrl, cls:'bookmarkletLink', htmlString:Clipperz.PM.Strings['bookmarkletTabBookmarkletTitle']}, | ||
135 | {tag:'div', cls:'panelDescription', htmlString:Clipperz.PM.Strings['bookmarkletTabInstructions']} | ||
136 | ]} | ||
137 | ]}, | ||
138 | {tag:'li', id:this.getId('compactPanel'), children:[ | ||
139 | {tag:'div', cls:'clipperzSubPanel', children:[ | ||
140 | {tag:'h5', htmlString:Clipperz.PM.Strings['compactTabTitle']}, | ||
141 | {tag:'div', cls:'panelDescription', htmlString:Clipperz.PM.Strings['compactTabDescription']} | ||
142 | ]} | ||
143 | ]}, | ||
144 | {tag:'li', id:this.getId('httpAuthPanel'), children:[ | ||
145 | {tag:'div', cls:'clipperzSubPanel', children:[ | ||
146 | {tag:'h5', htmlString:Clipperz.PM.Strings['httpAuthTabTitle']}, | ||
147 | {tag:'div', cls:'panelDescription', htmlString:Clipperz.PM.Strings['httpAuthTabDescription']}, | ||
148 | {tag:'div', cls:'bookmarkletConfiguration', children:[Clipperz.PM.Strings['httpAuthBookmarkletConfiguration']]} | ||
149 | ]} | ||
150 | ]} | ||
151 | ]} | ||
152 | ]} | ||
153 | ]} | ||
154 | ]} | ||
155 | ]}); | ||
156 | |||
157 | new Clipperz.PM.Components.PasswordEntropyDisplay(this.getElement('passwordField')); | ||
158 | |||
159 | MochiKit.Signal.connect(this.getId('lowercase'), 'onclick', this, 'updatePasswordValue'); | ||
160 | MochiKit.Signal.connect(this.getId('uppercase'), 'onclick', this, 'updatePasswordValue'); | ||
161 | MochiKit.Signal.connect(this.getId('numbers'), 'onclick', this, 'updatePasswordValue'); | ||
162 | MochiKit.Signal.connect(this.getId('symbols'), 'onclick', this, 'updatePasswordValue'); | ||
163 | |||
164 | MochiKit.Signal.connect(this.getDom('passwordField'), 'onkeyup', this, 'updatePasswordLengthLabel'); | ||
165 | MochiKit.Signal.connect(this.getDom('passwordField'), 'onchange', this, 'updatePasswordLengthLabel'); | ||
166 | MochiKit.Signal.connect(this.getDom('passwordField'), 'onblur', this, 'updatePasswordLengthLabel'); | ||
167 | |||
168 | this.setGenerateButtonElement(new YAHOO.ext.Button(this.getDom('generateRandomPassword'), {text:Clipperz.PM.Strings['passwordGeneratorTabButtonLabel'], handler:this.updatePasswordValue, scope:this})); | ||
169 | |||
170 | this.setNeedsRenderingUponTabSwitch(false); | ||
171 | this.tabPanelController().setUp(); | ||
172 | Clipperz.NotificationCenter.register(null, 'tabSelected', this, 'tabSelectedHandler'); | ||
173 | Clipperz.NotificationCenter.register(null, 'switchLanguage', this, 'switchLanguageHandler'); | ||
174 | //MochiKit.Logging.logDebug("<<< ToolsPanel.render"); | ||
175 | }, | ||
176 | |||
177 | //------------------------------------------------------------------------- | ||
178 | |||
179 | 'needsRenderingUponTabSwitch': function() { | ||
180 | return this._needsRenderingUponTabSwitch; | ||
181 | }, | ||
182 | |||
183 | 'setNeedsRenderingUponTabSwitch': function(aValue) { | ||
184 | this._needsRenderingUponTabSwitch = aValue; | ||
185 | }, | ||
186 | |||
187 | 'tabSelectedHandler': function(anEvent) { | ||
188 | if (this.needsRenderingUponTabSwitch()) { | ||
189 | this.render(); | ||
190 | } | ||
191 | |||
192 | if (anEvent.parameters() == this.getId('httpAuth')) { | ||
193 | var textarea; | ||
194 | |||
195 | textarea = document.getElementById("httpAuthDefaultConfiguration"); | ||
196 | textarea.focus(); | ||
197 | textarea.select(); | ||
198 | } | ||
199 | }, | ||
200 | |||
201 | //------------------------------------------------------------------------- | ||
202 | |||
203 | 'tabPanelController': function() { | ||
204 | if (this._tabPanelController == null) { | ||
205 | var tabPanelControllerConfig; | ||
206 | |||
207 | tabPanelControllerConfig = {} | ||
208 | tabPanelControllerConfig[this.getId('passwordGenerator')] = this.getId('passwordGeneratorPanel'); | ||
209 | tabPanelControllerConfig[this.getId('bookmarklet')] = this.getId('bookmarkletPanel'); | ||
210 | tabPanelControllerConfig[this.getId('compact')] = this.getId('compactPanel'); | ||
211 | tabPanelControllerConfig[this.getId('httpAuth')] = this.getId('httpAuthPanel'); | ||
212 | this._tabPanelController = new Clipperz.PM.Components.TabPanel.TabPanelController({ config:tabPanelControllerConfig, selectedTab:this.getId('passwordGenerator') }); | ||
213 | } | ||
214 | |||
215 | return this._tabPanelController; | ||
216 | }, | ||
217 | |||
218 | //------------------------------------------------------------------------- | ||
219 | |||
220 | 'generateButtonElement': function() { | ||
221 | return this._generateButtonElement; | ||
222 | }, | ||
223 | |||
224 | 'setGenerateButtonElement': function(aValue) { | ||
225 | this._generateButtonElement = aValue; | ||
226 | }, | ||
227 | |||
228 | //------------------------------------------------------------------------- | ||
229 | |||
230 | 'updatePasswordValue': function(anEvent) { | ||
231 | varrandomBytes; | ||
232 | varrandomValue; | ||
233 | var charset; | ||
234 | var charsetBitSize; | ||
235 | var stringValue; | ||
236 | varblockIndex; | ||
237 | |||
238 | //MochiKit.Logging.logDebug(">>> updatePasswordValue"); | ||
239 | randomBytes = Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(50); | ||
240 | stringValue = ""; | ||
241 | blockIndex = 0; | ||
242 | |||
243 | charset = ""; | ||
244 | if (this.getDom('lowercase').checked) { | ||
245 | charset += Clipperz.PM.Strings['passwordGeneratorLowercaseCharset']; | ||
246 | } | ||
247 | if (this.getDom('uppercase').checked) { | ||
248 | charset += Clipperz.PM.Strings['passwordGeneratorUppercaseCharset']; | ||
249 | } | ||
250 | if (this.getDom('numbers').checked) { | ||
251 | charset += Clipperz.PM.Strings['passwordGeneratorNumberCharset']; | ||
252 | } | ||
253 | if (this.getDom('symbols').checked) { | ||
254 | charset += Clipperz.PM.Strings['passwordGeneratorSymbolCharset']; | ||
255 | } | ||
256 | |||
257 | charsetBitSize = 0; | ||
258 | while (Math.pow(2, charsetBitSize) < charset.length) { | ||
259 | charsetBitSize ++; | ||
260 | } | ||
261 | |||
262 | if (charsetBitSize > 0) { | ||
263 | while (Clipperz.PM.Crypto.passwordEntropy(stringValue) < 128) { | ||
264 | if (((blockIndex + 1)*charsetBitSize) > (randomBytes.length() * 8)) { | ||
265 | randomBytes = Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(50); | ||
266 | blockIndex = 0; | ||
267 | } | ||
268 | randomValue = randomBytes.bitBlockAtIndexWithSize(blockIndex*charsetBitSize, charsetBitSize); | ||
269 | if (randomValue < charset.length) { | ||
270 | stringValue += charset.charAt(randomValue); | ||
271 | } | ||
272 | |||
273 | blockIndex ++; | ||
274 | } | ||
275 | } else { | ||
276 | stringValue = ""; | ||
277 | } | ||
278 | |||
279 | this.getElement('passwordField').dom.focus() | ||
280 | this.getElement('passwordField').dom.value = stringValue; | ||
281 | |||
282 | |||
283 | if (anEvent.src) { | ||
284 | anEvent.src().focus(); | ||
285 | } else { | ||
286 | this.generateButtonElement().el.focus(); | ||
287 | } | ||
288 | |||
289 | this.setNeedsRenderingUponTabSwitch(true); | ||
290 | |||
291 | return false; | ||
292 | //MochiKit.Logging.logDebug("<<< updatePasswordValue"); | ||
293 | }, | ||
294 | |||
295 | //----------------------------------------------------- | ||
296 | |||
297 | 'updatePasswordLengthLabel': function() { | ||
298 | this.getElement('passwordLength').update(this.getDom('passwordField').value.length); | ||
299 | }, | ||
300 | |||
301 | //------------------------------------------------------------------------- | ||
302 | __syntaxFix__: "syntax fix" | ||
303 | |||
304 | }); | ||
305 | |||