Diffstat (limited to 'frontend/beta/js/Clipperz/PM/Main.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/beta/js/Clipperz/PM/Main.js | 588 |
1 files changed, 588 insertions, 0 deletions
diff --git a/frontend/beta/js/Clipperz/PM/Main.js b/frontend/beta/js/Clipperz/PM/Main.js new file mode 100644 index 0000000..9a068e1 --- a/dev/null +++ b/frontend/beta/js/Clipperz/PM/Main.js | |||
@@ -0,0 +1,588 @@ | |||
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.PM) == 'undefined') { Clipperz.PM = {}; } | ||
30 | |||
31 | Clipperz.PM.VERSION = "0.1"; | ||
32 | Clipperz.PM.NAME = "Clipperz.PM"; | ||
33 | |||
34 | //############################################################################# | ||
35 | |||
36 | Clipperz.PM.Main = function() { | ||
37 | this._loginPanel = null; | ||
38 | this._user = null; | ||
39 | |||
40 | this._isRunningCompact = false; | ||
41 | |||
42 | Clipperz.NotificationCenter.register(null, 'userConnected', this, 'userConnectedCallback'); | ||
43 | Clipperz.NotificationCenter.register(null, 'switchLanguage', this, 'switchLanguageHandler'); | ||
44 | |||
45 | Clipperz.NotificationCenter.register(null, 'EXCEPTION', this, 'reportException'); | ||
46 | |||
47 | return this; | ||
48 | } | ||
49 | |||
50 | //============================================================================= | ||
51 | |||
52 | MochiKit.Base.update(Clipperz.PM.Main.prototype, { | ||
53 | 'toString': function() { | ||
54 | return "Clipperz.PM.Main"; | ||
55 | }, | ||
56 | |||
57 | 'switchLanguageHandler': function() { | ||
58 | //MochiKit.Logging.logDebug(">>> main.switchLanguageHandler"); | ||
59 | YAHOO.ext.Element.get('donateHeaderIconLink').dom.href = Clipperz.PM.Strings['donateHeaderLinkUrl']; | ||
60 | YAHOO.ext.Element.get('donateHeaderLink').update(Clipperz.PM.Strings['donateHeaderLinkLabel']).dom.href = Clipperz.PM.Strings['donateHeaderLinkUrl']; | ||
61 | YAHOO.ext.Element.get('creditsHeaderLink').update(Clipperz.PM.Strings['creditsHeaderLinkLabel']).dom.href = Clipperz.PM.Strings['creditsHeaderLinkUrl']; | ||
62 | YAHOO.ext.Element.get('feedbackHeaderLink').update(Clipperz.PM.Strings['feedbackHeaderLinkLabel']).dom.href = Clipperz.PM.Strings['feedbackHeaderLinkUrl']; | ||
63 | YAHOO.ext.Element.get('helpHeaderLink').update(Clipperz.PM.Strings['helpHeaderLinkLabel']).dom.href = Clipperz.PM.Strings['helpHeaderLinkUrl']; | ||
64 | YAHOO.ext.Element.get('forumHeaderLink').update(Clipperz.PM.Strings['forumHeaderLinkLabel']).dom.href = Clipperz.PM.Strings['forumHeaderLinkUrl']; | ||
65 | |||
66 | if (YAHOO.ext.Element.get('logout') != null) { | ||
67 | YAHOO.ext.Element.get('logout').update(Clipperz.PM.Strings['logoutMenuLabel']); | ||
68 | YAHOO.ext.Element.get('lock').update(Clipperz.PM.Strings['lockMenuLabel']); | ||
69 | |||
70 | YAHOO.ext.Element.get('recordsTabAnchor').update(Clipperz.PM.Strings['recordMenuLabel']); | ||
71 | YAHOO.ext.Element.get('accountTabAnchor').update(Clipperz.PM.Strings['accountMenuLabel']); | ||
72 | YAHOO.ext.Element.get('dataTabAnchor').update(Clipperz.PM.Strings['dataMenuLabel']); | ||
73 | // YAHOO.ext.Element.get('contactsTabAnchor').update(Clipperz.PM.Strings['contactsMenuLabel']); | ||
74 | YAHOO.ext.Element.get('toolsTabAnchor').update(Clipperz.PM.Strings['toolsMenuLabel']); | ||
75 | } | ||
76 | //MochiKit.Logging.logDebug("<<< main.switchLanguageHandler"); | ||
77 | }, | ||
78 | |||
79 | //------------------------------------------------------------------------- | ||
80 | |||
81 | 'fixToDrawTheMainTabsCorrectlyOnSafari': function() { | ||
82 | this.switchLanguageHandler(); | ||
83 | }, | ||
84 | |||
85 | //------------------------------------------------------------------------- | ||
86 | |||
87 | 'run': function(shouldShowRegistrationForm) { | ||
88 | varmainElement; | ||
89 | |||
90 | Clipperz.NotificationCenter.register(null, 'updatedProgressState', this, 'updateProgressDialogStatus'); | ||
91 | |||
92 | YAHOO.ext.Element.get('recordDetailEditModeHeaderMask').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide().unmask(); | ||
93 | YAHOO.ext.Element.get('recordDetailEditModeVerticalMask').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide().unmask(); | ||
94 | |||
95 | //MochiKit.Logging.logDebug(">>> Main.run"); | ||
96 | mainElement = YAHOO.ext.Element.get('main'); | ||
97 | if (Clipperz.PM.Proxy.defaultProxy.isReadOnly()) { | ||
98 | YAHOO.ext.Element.get('applicationVersionType').dom.className = "readOnly"; | ||
99 | } | ||
100 | mainElement.update(""); | ||
101 | |||
102 | Clipperz.YUI.DomHelper.append(mainElement.dom, {tag:'ul', cls:'clipperzTabPanels', children:[ | ||
103 | {tag:'li', id:'loginPanel'} | ||
104 | ]}) | ||
105 | |||
106 | this.setLoginPanel(new Clipperz.PM.Components.Panels.LoginPanel(YAHOO.ext.Element.get('loginPanel'))); | ||
107 | |||
108 | //MochiKit.Logging.logDebug("--- Main.run - selecting active form to show ..."); | ||
109 | if (shouldShowRegistrationForm == true) { | ||
110 | this.loginPanel().showRegistrationForm(false); | ||
111 | } else { | ||
112 | this.loginPanel().showLoginForm(false); | ||
113 | } | ||
114 | |||
115 | this.switchLanguageHandler(); | ||
116 | //MochiKit.Logging.logDebug("--- Main.run - selecting active form to show. done."); | ||
117 | //MochiKit.Logging.logDebug("<<< Main.run"); | ||
118 | }, | ||
119 | |||
120 | //------------------------------------------------------------------------- | ||
121 | |||
122 | 'runCompact': function() { | ||
123 | this.setIsRunningCompact(true); | ||
124 | YAHOO.ext.Element.get(document.body).addClass("compact"); | ||
125 | new Clipperz.PM.Components.Compact.LoginForm(YAHOO.ext.Element.get('mainDiv')); | ||
126 | }, | ||
127 | |||
128 | 'showCompactInterface': function() { | ||
129 | //MochiKit.Logging.logDebug(">>> main.showCompactInterface"); | ||
130 | new Clipperz.PM.Components.Compact.CompactInterface(YAHOO.ext.Element.get('compactBody'), {user:this.user()}); | ||
131 | //MochiKit.Logging.logDebug("<<< main.showCompactInterface"); | ||
132 | }, | ||
133 | |||
134 | //------------------------------------------------------------------------- | ||
135 | |||
136 | 'mainPage': function() { | ||
137 | if (this._mainPage == null) { | ||
138 | this._mainPage = new Clipperz.PM.Components.MainPage(); | ||
139 | } | ||
140 | |||
141 | return this._mainPage; | ||
142 | }, | ||
143 | |||
144 | //------------------------------------------------------------------------- | ||
145 | |||
146 | 'loginPanel': function() { | ||
147 | return this._loginPanel; | ||
148 | }, | ||
149 | |||
150 | 'setLoginPanel': function(aValue) { | ||
151 | this._loginPanel = aValue; | ||
152 | }, | ||
153 | |||
154 | //------------------------------------------------------------------------- | ||
155 | |||
156 | 'showMainPanels': function() { | ||
157 | varmainElement; | ||
158 | var logoutBlock; | ||
159 | var lockBlock; | ||
160 | var menusTRElement; | ||
161 | |||
162 | this.loginPanel().remove(); | ||
163 | this.setLoginPanel(null); | ||
164 | |||
165 | logoutBlock = YAHOO.ext.Element.get('logoutLI'); | ||
166 | Clipperz.YUI.DomHelper.append(logoutBlock.dom, {tag:'a', href:"#", id:'logout', htmlString:Clipperz.PM.Strings['logoutMenuLabel']}); | ||
167 | MochiKit.Signal.connect('logout', 'onclick', this, 'doLogoutEventHandler'); | ||
168 | |||
169 | lockBlock = YAHOO.ext.Element.get('lockLI'); | ||
170 | Clipperz.YUI.DomHelper.append(lockBlock.dom, {tag:'a', href:"#", id:'lock', htmlString:Clipperz.PM.Strings['lockMenuLabel']}); | ||
171 | MochiKit.Signal.connect('lock', 'onclick', this, 'doLockEventHandler'); | ||
172 | |||
173 | menusTRElement = YAHOO.ext.Element.get('menusTR'); | ||
174 | Clipperz.YUI.DomHelper.append(menusTRElement.dom, {tag:'td', id:'recordsTab', children:[{tag:'div', children:[{tag:'a', id:'recordsTabAnchor', htmlString:Clipperz.PM.Strings['recordMenuLabel']}]}]}); | ||
175 | Clipperz.YUI.DomHelper.append(menusTRElement.dom, {tag:'td', id:'accountTab', children:[{tag:'div', children:[{tag:'a', id:'accountTabAnchor', htmlString:Clipperz.PM.Strings['accountMenuLabel']}]}]}); | ||
176 | Clipperz.YUI.DomHelper.append(menusTRElement.dom, {tag:'td', id:'dataTab', children:[{tag:'div', children:[{tag:'a', id:'dataTabAnchor', htmlString:Clipperz.PM.Strings['dataMenuLabel']}]}]}); | ||
177 | // Clipperz.YUI.DomHelper.append(menusTRElement.dom, {tag:'td', id:'contactsTab', children:[{tag:'div', children:[{tag:'a', id:'contactsTabAnchor', htmlString:Clipperz.PM.Strings['contactsMenuLabel']}]}]}); | ||
178 | Clipperz.YUI.DomHelper.append(menusTRElement.dom, {tag:'td', id:'toolsTab', children:[{tag:'div', children:[{tag:'a', id:'toolsTabAnchor', htmlString:Clipperz.PM.Strings['toolsMenuLabel']}]}]}); | ||
179 | |||
180 | mainElement = YAHOO.ext.Element.get('main'); | ||
181 | mainElement.update(""); | ||
182 | Clipperz.YUI.DomHelper.append(mainElement.dom, {tag:'ul', cls:'clipperzTabPanels', children:[ | ||
183 | {tag:'li', id:'recordsPanel'}, | ||
184 | {tag:'li', id:'accountPanel'}, | ||
185 | {tag:'li', id:'dataPanel'}, | ||
186 | // {tag:'li', id:'contactsPanel'}, | ||
187 | {tag:'li', id:'toolsPanel'} | ||
188 | ]}, true) | ||
189 | |||
190 | new Clipperz.PM.Components.TabPanel.TabPanelController({ | ||
191 | name: 'mainTabPanel', | ||
192 | config:{'recordsTab':'recordsPanel', | ||
193 | 'accountTab':'accountPanel', | ||
194 | 'dataTab':'dataPanel', | ||
195 | // 'contactsTab':'contactsPanel', | ||
196 | 'toolsTab':'toolsPanel'}, | ||
197 | selectedTab:'recordsTab' | ||
198 | }).setUp(); | ||
199 | |||
200 | new Clipperz.PM.Components.Panels.MainPanel(YAHOO.ext.Element.get('recordsPanel'), {user:this.user()}); | ||
201 | new Clipperz.PM.Components.Panels.AccountPanel(YAHOO.ext.Element.get('accountPanel'), {user:this.user()}); | ||
202 | new Clipperz.PM.Components.Panels.DataPanel(YAHOO.ext.Element.get('dataPanel'), {user:this.user()}); | ||
203 | // new Clipperz.PM.Components.Panels.ContactsPanel(YAHOO.ext.Element.get('contactsPanel'), {user:this.user()}); | ||
204 | new Clipperz.PM.Components.Panels.ToolsPanel(YAHOO.ext.Element.get('toolsPanel'), {user:this.user()}); | ||
205 | |||
206 | this.fixToDrawTheMainTabsCorrectlyOnSafari(); //fix to | ||
207 | //MochiKit.Logging.logDebug("<<< Main.showMainPanels"); | ||
208 | }, | ||
209 | |||
210 | //------------------------------------------------------------------------- | ||
211 | |||
212 | 'userConnectedCallback': function(anEvent) { | ||
213 | //MochiKit.Logging.logDebug(">>> Main.userConnectedCallback"); | ||
214 | //MochiKit.Logging.logDebug(">>> doConnect - user: " + this.user()); | ||
215 | this.setUser(anEvent.source()); | ||
216 | |||
217 | if (this.isRunningCompact()) { | ||
218 | this.showCompactInterface(); | ||
219 | } else { | ||
220 | this.showMainPanels(); | ||
221 | } | ||
222 | //MochiKit.Logging.logDebug("<<< Main.userConnectedCallback"); | ||
223 | }, | ||
224 | |||
225 | //----------------------------------------------------------------------------- | ||
226 | |||
227 | 'user': function() { | ||
228 | return this._user; | ||
229 | }, | ||
230 | |||
231 | 'setUser': function(aValue) { | ||
232 | this._user = aValue; | ||
233 | }, | ||
234 | |||
235 | //----------------------------------------------------------------------------- | ||
236 | |||
237 | 'doLogoutEventHandler': function(anEvent) { | ||
238 | var deferred; | ||
239 | |||
240 | anEvent.stop(); | ||
241 | |||
242 | deferred = new MochiKit.Async.Deferred(); | ||
243 | //deferred.addBoth(function(res) {MochiKit.Logging.logDebug("Main.doLogoutEventHandler - 1: " + res); return res;}); | ||
244 | deferred.addCallback(MochiKit.Base.method(this.user(), 'doLogout')); | ||
245 | //deferred.addBoth(function(res) {MochiKit.Logging.logDebug("Main.doLogoutEventHandler - 2: " + res); return res;}); | ||
246 | deferred.addCallback(Clipperz.PM.exit, 'logout.html'); | ||
247 | //deferred.addBoth(function(res) {MochiKit.Logging.logDebug("Main.doLogoutEventHandler - 3: " + res); return res;}); | ||
248 | deferred.callback(); | ||
249 | }, | ||
250 | |||
251 | //----------------------------------------------------------------------------- | ||
252 | |||
253 | 'doLockEventHandler': function(anEvent) { | ||
254 | vardeferredResult; | ||
255 | varlockDialogElement; | ||
256 | var lockDialog; | ||
257 | var unlockButton; | ||
258 | |||
259 | anEvent.stop(); | ||
260 | |||
261 | Clipperz.NotificationCenter.notify(this, 'accountLocked', null, true); | ||
262 | |||
263 | lockDialogElement = Clipperz.YUI.DomHelper.append(document.body, {tag:'div', id:'lockDialog', children:[ | ||
264 | {tag:'div', cls:'ydlg-hd', htmlString:Clipperz.PM.Strings['lockTitle']}, | ||
265 | {tag:'div', cls:'ydlg-bd', children:[ | ||
266 | {tag:'div', cls:'alert-message', id:'lockMessage', children:[ | ||
267 | {tag:'div', htmlString:Clipperz.PM.Strings['lockDescription']}, | ||
268 | {tag:'form', id:'lockDialogForm', children:[ | ||
269 | {tag:'input', type:'password', id:'lockPassphrase'} | ||
270 | ]} | ||
271 | ]} | ||
272 | ]}, | ||
273 | {tag:'div', cls:'ydlg-ft'} | ||
274 | ]}, true); | ||
275 | new Clipperz.PM.Components.PasswordEntropyDisplay(YAHOO.ext.Element.get('lockPassphrase')); | ||
276 | |||
277 | lockDialog = new YAHOO.ext.BasicDialog( | ||
278 | lockDialogElement, { | ||
279 | closable:false, | ||
280 | modal:true, | ||
281 | autoTabs:false, | ||
282 | resizable:false, | ||
283 | fixedcenter:true, | ||
284 | constraintoviewport:false, | ||
285 | width:350, | ||
286 | height:130, | ||
287 | shadow:true | ||
288 | } | ||
289 | ); | ||
290 | |||
291 | unlockButton = lockDialog.addButton(Clipperz.PM.Strings['unlockButtonLabel'], MochiKit.Base.method(this, 'exitLock', lockDialog)); | ||
292 | //MochiKit.Logging.logDebug("--- Main.showAlertDialog - 5"); | ||
293 | lockDialog.setDefaultButton(unlockButton); | ||
294 | |||
295 | MochiKit.Signal.connect('lockDialogForm', 'onsubmit', MochiKit.Base.method(this, 'exitLock', lockDialog)); | ||
296 | lockDialog.on('show', function() {YAHOO.ext.Element.get('lockPassphrase').focus();}); | ||
297 | lockDialog.show('main'); | ||
298 | // this.user().lock(); | ||
299 | }, | ||
300 | |||
301 | 'exitLock': function(aLockDialog, anEvent) { | ||
302 | // var deferredResult; | ||
303 | |||
304 | //MochiKit.Logging.logDebug(">>> Exiting lock"); | ||
305 | if (typeof(anEvent.stop) != 'undefined') { | ||
306 | anEvent.stop(); | ||
307 | } | ||
308 | |||
309 | if (this.user().passphrase() == YAHOO.ext.Element.get('lockPassphrase').dom.value) { | ||
310 | aLockDialog.hide(MochiKit.Base.method(aLockDialog, 'destroy', true)); | ||
311 | Clipperz.NotificationCenter.notify(this, 'accountUnlocked', null, true); | ||
312 | } else { | ||
313 | YAHOO.ext.Element.get('lockPassphrase').dom.value = ""; | ||
314 | YAHOO.ext.Element.get('lockPassphrase').focus(); | ||
315 | } | ||
316 | |||
317 | // deferredResult = new MochiKit.Async.Deferred(); | ||
318 | // deferredResult.addCallback(MochiKit.Base.method(this.user(), 'unlockWithPassphrase')); | ||
319 | // deferredResult.addCallback(MochiKit.Base.method(aLockDialog, 'hide', MochiKit.Base.method(aLockDialog, 'destroy', true))); | ||
320 | // deferredResult.addCallback(MochiKit.Base.method(Clipperz.NotificationCenter, 'notify', this, 'accountUnlocked', null, true)); | ||
321 | // deferredResult.addErrback(function() { | ||
322 | // YAHOO.ext.Element.get('lockPassphrase').dom.value = ""; | ||
323 | // YAHOO.ext.Element.get('lockPassphrase').focus(); | ||
324 | // }); | ||
325 | // deferredResult.callback(YAHOO.ext.Element.get('lockPassphrase').dom.value); | ||
326 | |||
327 | return false; | ||
328 | }, | ||
329 | |||
330 | //----------------------------------------------------------------------------- | ||
331 | |||
332 | 'updateProgressDialogStatus': function(anEvent) { | ||
333 | //MochiKit.Logging.logDebug(">>> main.updateProgressDialogStatus - " + anEvent.parameters()); | ||
334 | //try { | ||
335 | if (Clipperz.Base.objectType(anEvent.parameters()) == 'string') { | ||
336 | Clipperz.PM.Components.MessageBox().update(Clipperz.PM.Strings.messagePanelConfigurations[anEvent.parameters()]()); | ||
337 | } else { | ||
338 | Clipperz.PM.Components.MessageBox().update(anEvent.parameters()); | ||
339 | } | ||
340 | //} catch (exception) { | ||
341 | //console.log("updateProgressDialogStatus - anEvent", anEvent); | ||
342 | //MochiKit.Logging.logError("Main.updateProgressDialogStatus: " + exception); | ||
343 | //throw exception; | ||
344 | //} | ||
345 | //MochiKit.Logging.logDebug("<<< main.updateProgressDialogStatus"); | ||
346 | }, | ||
347 | |||
348 | //----------------------------------------------------------------------------- | ||
349 | |||
350 | 'defaultErrorHandler': function(anErrorString, anException) { | ||
351 | MochiKit.Logging.logDebug(">>> DEFAULT ERROR HANDLER: " + anErrorString + " (exception: " + Clipperz.Base.serializeJSON(anException) + ")"); | ||
352 | }, | ||
353 | |||
354 | //----------------------------------------------------------------------------- | ||
355 | |||
356 | 'isRunningCompact': function() { | ||
357 | return this._isRunningCompact; | ||
358 | }, | ||
359 | |||
360 | 'setIsRunningCompact': function(aValue) { | ||
361 | this._isRunningCompact = aValue; | ||
362 | }, | ||
363 | |||
364 | //----------------------------------------------------------------------------- | ||
365 | |||
366 | 'reportException': function(anError) { | ||
367 | /* | ||
368 | var deferredResult; | ||
369 | |||
370 | deferredResult = new MochiKit.Async.Deferred(); | ||
371 | |||
372 | Clipperz.PM.Components.MessageBox().show( | ||
373 | { | ||
374 | title:Clipperz.PM.Strings['fatalErrorMessageTitle'], | ||
375 | text:Clipperz.PM.Strings['fatalErrorMessageText'], | ||
376 | width:240, | ||
377 | showProgressBar:false, | ||
378 | showCloseButton:false, | ||
379 | fn:MochiKit.Base.method(deferredResult, 'callback'), | ||
380 | scope:this, | ||
381 | buttons:{ | ||
382 | 'ok':Clipperz.PM.Strings['fatalErrorMessageCloseButtonLabel'] | ||
383 | } | ||
384 | } | ||
385 | ); | ||
386 | |||
387 | deferredResult.addCallback(function() { | ||
388 | window.document.body.innerHTML = ""; | ||
389 | window.location.reload(true); | ||
390 | }); | ||
391 | */ | ||
392 | Clipperz.PM.exit('error.html'); | ||
393 | }, | ||
394 | |||
395 | //----------------------------------------------------------------------------- | ||
396 | __syntaxFix__: "syntax fix" | ||
397 | |||
398 | }); | ||
399 | |||
400 | |||
401 | |||
402 | //############################################################################# | ||
403 | |||
404 | MochiKit.Base.update(Clipperz.PM, { | ||
405 | |||
406 | __repr__: function() { | ||
407 | return "[" + this.NAME + " " + this.VERSION + "]"; | ||
408 | }, | ||
409 | |||
410 | toString: function() { | ||
411 | return this.__repr__(); | ||
412 | }, | ||
413 | |||
414 | //----------------------------------------------------------------------------- | ||
415 | |||
416 | 'initPage': function() { | ||
417 | varmain; | ||
418 | var shouldShowRegistrationForm; | ||
419 | var useCompactDesign; | ||
420 | |||
421 | //MochiKit.Logging.logWarning("Just testing logging system"); | ||
422 | Clipperz.PM.Strings.Languages.initSetup(); | ||
423 | // DWRUtil.useLoadingMessage(Clipperz.PM.Strings['DWRUtilLoadingMessage']); | ||
424 | |||
425 | if (window.location.search.indexOf("registration") != -1) { | ||
426 | shouldShowRegistrationForm = true; | ||
427 | } else { | ||
428 | shouldShowRegistrationForm = false; | ||
429 | } | ||
430 | |||
431 | if (window.location.search.indexOf("compact") != -1) { | ||
432 | useCompactDesign = true; | ||
433 | } else { | ||
434 | useCompactDesign = false; | ||
435 | } | ||
436 | |||
437 | main = new Clipperz.PM.Main(); | ||
438 | |||
439 | if (useCompactDesign == true) { | ||
440 | main.runCompact(); | ||
441 | } else { | ||
442 | if (Clipperz_IEisBroken === true) { | ||
443 | if (Clipperz.PM.Proxy.defaultProxy.isReadOnly()) { | ||
444 | var logoParentNode; | ||
445 | |||
446 | YAHOO.ext.Element.get('donateHeaderIcon').remove(); | ||
447 | logoParentNode = YAHOO.ext.Element.get('logo').dom.parentNode; | ||
448 | YAHOO.ext.Element.get('logo').remove(); | ||
449 | Clipperz.YUI.DomHelper.append(logoParentNode, {tag:'span', children:[ | ||
450 | {tag:'span', cls:'clipperzLogoSpan', html:'clipper'}, | ||
451 | {tag:'span', cls:'clipperzLogoZSpan', html:'z'} | ||
452 | ]}) | ||
453 | } else { | ||
454 | YAHOO.ext.Element.get('donateHeaderIcon').dom.src = "./images/smiles.gif"; | ||
455 | YAHOO.ext.Element.get('logo').dom.src = "./images/logo.gif"; | ||
456 | } | ||
457 | } else { | ||
458 | YAHOO.ext.Element.get('donateHeaderIcon').dom.src = "data:image/gif;charset=utf-8;base64,R0lGODlhEAAQAPf/ADMzZvrFL/KbGPrER3VXJeaJHvnGXNJ/KAEAAPnKefvJDamopMvLy8GZEfrTpvvgwGhVB0xKSO3BDUk+A/vYqnVgLcmndoRqM/exO3hrS3lmPYRsB39lDum9Dv3aCuebVPnIdP////3cCvewE07BafrQk/rHG1tYR5qZl7eUWZl7CfnGjdeuDPnCPpl4LDEoA5R2OP3XC/jBgfi2EvrXrvrRlWpYHgGtKdiqKP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+dO655/pIfQBqB/Viw98NePIQCexkzt9AlAChwuykJs4z2eQOVZC3AFBTNAAnJFWQKt9hoQ0SLuJRSUO4jn7QEWwQ6kEdEKnxDJARFDRGok7t/Y/tluLu1CwF0U0VI7rzjhtBLCQYXlJzKFpTQSCHPH/zpBNUgTrSUw+REYFAFQBEQIyBMIBjVOkHwuZSKWpRBQdZIMgjnEAVaEzidwA4wKYGIghGUCUcF2wWVXiRon9oAwE/AgAczoK/gtzCDx44UgMsAIGCbKMh/qLKJ0LwASIYgjOXSBH4/xz4Lx1QRgXgoUWo5AUEyvCBSxkYCAKdIo8dUGYXJQOAHvBEFecRpA88IFQA/ECHK5jxjHSQWULyIImnweENHdLZh8aGqaeJoYS8q9ElYiQQErTjaZ/IBxed4sWBgFGMf5PhL6DAEGeMI4vgScIWCNKUaH0PLFcRHxruoCF6IG2JAMDBHQT4HXnMbyDMkIeJLDGxgeBjPaHIn0AOKcZaBsAGjGQIJQThjlaFpwQ6+ORAglGCYlqBdNMoZgmsoDtMteIbH7iABwHgBGC+jSDeKkQZniCJaYaiBEAow0Fo8Igk+JKaViBFIApiDWWKoC0ESQYbQEDPetqznrLIZUOMQIEDcExhC9EoIfsYQFAGsKBUBTXo4gpBOSM4IzBBWIxBJDeAfxihCoEBBR8TUokyjKJggWgGcBJ6UIJAQAMoTalKV1pDlmDKC5RrCEXpwpOXxpQhM6WpS2zqkJzqlCVYOppD6kOuU/5UJfwYxOxs8Q2HTOEes+ODOI9K1apa9aoLCQgAOwo="; | ||
460 | } | ||
461 | |||
462 | main.run(shouldShowRegistrationForm); | ||
463 | } | ||
464 | |||
465 | Clipperz.PM.defaultErrorHandler = main.defaultErrorHandler; | ||
466 | |||
467 | //DEBUG | ||
468 | if ((typeof(_clipperz_pm_test_user) != 'undefined') && (typeof(_clipperz_pm_test_passphrase) != 'undefined')) { | ||
469 | //------- automatic login with test/test -------------- | ||
470 | // Clipperz.PM.Proxy.defaultProxy = new Clipperz.PM.Proxy.Offline(); | ||
471 | //MochiKit.Logging.logWarning("activating AUTOLOGIN (" + _clipperz_pm_test_user + "/" + _clipperz_pm_test_passphrase + ")"); | ||
472 | // MochiKit.Async.callLater(0.9, MochiKit.Base.bind(main.doLogin, main), _clipperz_pm_test_user, _clipperz_pm_test_passphrase, YAHOO.ext.Element.get('Clipperz_PM_Components_Panels_login_submit_9')); | ||
473 | MochiKit.Async.callLater(0.5, MochiKit.Base.bind(main.loginPanel().doLoginWithUsernameAndPassphrase, main.loginPanel()), _clipperz_pm_test_user, _clipperz_pm_test_passphrase); | ||
474 | //------- automatic registration -------------- | ||
475 | //MochiKit.Logging.logWarning("Testing registration (user,passwd)"); | ||
476 | //MochiKit.Logging.logDebug("mainPanel: " + main.mainPage().mainPanel().content()); | ||
477 | // main.mainPage().getActivePanel().showRegistrationFormAnimator().play(); | ||
478 | // MochiKit.Async.callLater(1.9, MochiKit.Base.bind(main.doRegistration, main), 'user', 'passwd'); | ||
479 | //------------------------------------- | ||
480 | // main.showMainPanels('ok'); | ||
481 | }; | ||
482 | |||
483 | if (/fastEntropyAccumulationForTestingPurpose/.test(window.location.search)) { | ||
484 | Clipperz.Crypto.PRNG.defaultRandomGenerator().fastEntropyAccumulationForTestingPurpose(); | ||
485 | } | ||
486 | |||
487 | // Clipperz.PM.Proxy.defaultProxy.knock(); | ||
488 | }, | ||
489 | |||
490 | //------------------------------------------------------------------------- | ||
491 | |||
492 | 'showDonationSplashScreen': function(aUser, aFocusElementId) { | ||
493 | var deferredResult; | ||
494 | var donateElement; | ||
495 | vardonateDialog; | ||
496 | var closeButton; | ||
497 | var closeFunction; | ||
498 | var donateButton; | ||
499 | var donateFunction; | ||
500 | |||
501 | deferredResult = new MochiKit.Async.Deferred(); | ||
502 | |||
503 | //MochiKit.Logging.logDebug(">>> Main.showRegistrationSplashScreen"); | ||
504 | donateElement = Clipperz.YUI.DomHelper.append(document.body, {tag:'div', id:'donateSplash', children:[ | ||
505 | {tag:'div', cls:'ydlg-hd', htmlString:Clipperz.PM.Strings['donateSplashPanelTitle']}, | ||
506 | {tag:'div', cls:'ydlg-bd', children:[ | ||
507 | {tag:'div', cls:'alert-message', id:'donateMessage', children:[ | ||
508 | {tag:'div', cls:'donateSplashPanelIcon', children:[ | ||
509 | {tag:'img', src:Clipperz.PM.Strings['donateSplashPanelIconUrl']} | ||
510 | ]}, | ||
511 | {tag:'div', cls:'donateSplashPanelDescription', htmlString:Clipperz.PM.Strings['donateSplashPanelDescription']} | ||
512 | ]} | ||
513 | ]}, | ||
514 | {tag:'div', cls:'ydlg-ft'} | ||
515 | ]}, true); | ||
516 | |||
517 | donateDialog = new YAHOO.ext.BasicDialog( | ||
518 | donateElement, { | ||
519 | closable:false, | ||
520 | modal:true, | ||
521 | autoTabs:false, | ||
522 | resizable:false, | ||
523 | fixedcenter:true, | ||
524 | constraintoviewport:false, | ||
525 | width:450, | ||
526 | height:220, | ||
527 | shadow:true, | ||
528 | minWidth:300, | ||
529 | minHeight:300 | ||
530 | } | ||
531 | ); | ||
532 | |||
533 | closeFunction = MochiKit.Base.partial(deferredResult.callback, false); | ||
534 | donateFunction = MochiKit.Base.partial(deferredResult.callback, true); | ||
535 | donateButton = donateDialog.addButton(Clipperz.PM.Strings['donateDonateButtonLabel'], donateFunction, deferredResult); | ||
536 | |||
537 | donateDialog.addKeyListener(27, closeFunction, deferredResult); | ||
538 | closeButton = donateDialog.addButton(Clipperz.PM.Strings['donateCloseButtonLabel'], closeFunction, deferredResult); | ||
539 | |||
540 | donateDialog.setDefaultButton(donateButton); | ||
541 | donateDialog.show(aFocusElementId /*'recordListAddRecordButton'*/); | ||
542 | |||
543 | deferredResult.addCallback(MochiKit.Base.bind(function(shouldOpenDonatePage) { | ||
544 | var result; | ||
545 | |||
546 | if (shouldOpenDonatePage) { | ||
547 | window.open(Clipperz.PM.Strings['donateHeaderLinkUrl'], "donate"); | ||
548 | aUser.preferences().setShouldShowDonationPanel(false); | ||
549 | aUser.preferences().saveChanges(); | ||
550 | } | ||
551 | }, this)); | ||
552 | deferredResult.addBoth(MochiKit.Base.method(donateDialog, 'hide')); | ||
553 | deferredResult.addBoth(MochiKit.Base.method(donateElement, 'remove')); | ||
554 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Main.showDonationSplashScreen - 2: " + res); return res;}); | ||
555 | //MochiKit.Logging.logDebug("<<< Main.showRegistrationSplashScreen"); | ||
556 | |||
557 | return deferredResult; | ||
558 | }, | ||
559 | |||
560 | //----------------------------------------------------------------------------- | ||
561 | |||
562 | 'exit': function(aPageName) { | ||
563 | // alert("ERROR: " + aPageName); | ||
564 | |||
565 | // YAHOO.ext.Element.get('menus').update(""); | ||
566 | // YAHOO.ext.Element.get('logoutLI').update(""); | ||
567 | // YAHOO.ext.Element.get('lockLI').update(""); | ||
568 | // YAHOO.ext.Element.get('main').update(""); | ||
569 | // Clipperz.YUI.DomHelper.append('main', {tag:'div', id:'exitBlock', children:Clipperz.PM.Strings['exitConfig']}); | ||
570 | |||
571 | MochiKit.Async.wait(0).addCallback(function() { | ||
572 | // window.location.href = "http://www.google.com/search?hl=" + Clipperz.PM.Strings.preferredLanguage + "&q=phishing&btnI=Google+Search"; | ||
573 | window.location.href = "./" + aPageName; | ||
574 | }); | ||
575 | }, | ||
576 | |||
577 | //----------------------------------------------------------------------------- | ||
578 | __syntaxFix__: "syntax fix" | ||
579 | |||
580 | }); | ||
581 | |||
582 | //############################################################################# | ||
583 | |||
584 | //Clipperz.PM.SerializeAsyncCalls = function(aDelay, aFunction) { | ||
585 | //aFunction.apply(extend(null, arguments, 1)); | ||
586 | //}; | ||
587 | |||
588 | MochiKit.DOM.addLoadEvent(Clipperz.PM.initPage); | ||