summaryrefslogtreecommitdiff
path: root/frontend/beta/js/Clipperz/PM/Main.js
Unidiff
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.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/frontend/beta/js/Clipperz/PM/Main.js b/frontend/beta/js/Clipperz/PM/Main.js
index 3dded31..3329a8e 100644
--- a/frontend/beta/js/Clipperz/PM/Main.js
+++ b/frontend/beta/js/Clipperz/PM/Main.js
@@ -1,440 +1,440 @@
1/* 1/*
2 2
3Copyright 2008-2013 Clipperz Srl 3Copyright 2008-2013 Clipperz Srl
4 4
5This file is part of Clipperz, the online password manager. 5This file is part of Clipperz, the online password manager.
6For further information about its features and functionalities please 6For further information about its features and functionalities please
7refer to http://www.clipperz.com. 7refer to http://www.clipperz.com.
8 8
9* Clipperz is free software: you can redistribute it and/or modify it 9* Clipperz is free software: you can redistribute it and/or modify it
10 under the terms of the GNU Affero General Public License as published 10 under the terms of the GNU Affero General Public License as published
11 by the Free Software Foundation, either version 3 of the License, or 11 by the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version. 12 (at your option) any later version.
13 13
14* Clipperz is distributed in the hope that it will be useful, but 14* Clipperz is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of 15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17 See the GNU Affero General Public License for more details. 17 See the GNU Affero General Public License for more details.
18 18
19* You should have received a copy of the GNU Affero General Public 19* You should have received a copy of the GNU Affero General Public
20 License along with Clipperz. If not, see http://www.gnu.org/licenses/. 20 License along with Clipperz. If not, see http://www.gnu.org/licenses/.
21 21
22*/ 22*/
23 23
24if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } 24if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
25 25
26Clipperz.PM.VERSION = "0.1"; 26Clipperz.PM.VERSION = "0.1";
27Clipperz.PM.NAME = "Clipperz.PM"; 27Clipperz.PM.NAME = "Clipperz.PM";
28 28
29//############################################################################# 29//#############################################################################
30 30
31Clipperz.PM.Main = function() { 31Clipperz.PM.Main = function() {
32 this._loginPanel = null; 32 this._loginPanel = null;
33 this._user = null; 33 this._user = null;
34 34
35 this._isRunningCompact = false; 35 this._isRunningCompact = false;
36 36
37 Clipperz.NotificationCenter.register(null, 'userConnected', this, 'userConnectedCallback'); 37 Clipperz.NotificationCenter.register(null, 'userConnected', this, 'userConnectedCallback');
38 Clipperz.NotificationCenter.register(null, 'switchLanguage', this, 'switchLanguageHandler'); 38 Clipperz.NotificationCenter.register(null, 'switchLanguage', this, 'switchLanguageHandler');
39 39
40 Clipperz.NotificationCenter.register(null, 'EXCEPTION', this, 'reportException'); 40 Clipperz.NotificationCenter.register(null, 'EXCEPTION', this, 'reportException');
41 41
42 return this; 42 return this;
43} 43}
44 44
45//============================================================================= 45//=============================================================================
46 46
47MochiKit.Base.update(Clipperz.PM.Main.prototype, { 47MochiKit.Base.update(Clipperz.PM.Main.prototype, {
48 'toString': function() { 48 'toString': function() {
49 return "Clipperz.PM.Main"; 49 return "Clipperz.PM.Main";
50 }, 50 },
51 51
52 'switchLanguageHandler': function() { 52 'switchLanguageHandler': function() {
53//MochiKit.Logging.logDebug(">>> main.switchLanguageHandler"); 53//MochiKit.Logging.logDebug(">>> main.switchLanguageHandler");
54 YAHOO.ext.Element.get('donateHeaderIconLink').dom.href = Clipperz.PM.Strings['donateHeaderLinkUrl']; 54 YAHOO.ext.Element.get('donateHeaderIconLink').dom.href = Clipperz.PM.Strings['donateHeaderLinkUrl'];
55 YAHOO.ext.Element.get('donateHeaderLink').update(Clipperz.PM.Strings['donateHeaderLinkLabel']).dom.href = Clipperz.PM.Strings['donateHeaderLinkUrl']; 55 YAHOO.ext.Element.get('donateHeaderLink').update(Clipperz.PM.Strings['donateHeaderLinkLabel']).dom.href = Clipperz.PM.Strings['donateHeaderLinkUrl'];
56 YAHOO.ext.Element.get('creditsHeaderLink').update(Clipperz.PM.Strings['creditsHeaderLinkLabel']).dom.href = Clipperz.PM.Strings['creditsHeaderLinkUrl']; 56 // YAHOO.ext.Element.get('creditsHeaderLink').update(Clipperz.PM.Strings['creditsHeaderLinkLabel']).dom.href = Clipperz.PM.Strings['creditsHeaderLinkUrl'];
57 YAHOO.ext.Element.get('feedbackHeaderLink').update(Clipperz.PM.Strings['feedbackHeaderLinkLabel']).dom.href = Clipperz.PM.Strings['feedbackHeaderLinkUrl']; 57 YAHOO.ext.Element.get('feedbackHeaderLink').update(Clipperz.PM.Strings['feedbackHeaderLinkLabel']).dom.href = Clipperz.PM.Strings['feedbackHeaderLinkUrl'];
58 YAHOO.ext.Element.get('helpHeaderLink').update(Clipperz.PM.Strings['helpHeaderLinkLabel']).dom.href = Clipperz.PM.Strings['helpHeaderLinkUrl']; 58 YAHOO.ext.Element.get('helpHeaderLink').update(Clipperz.PM.Strings['helpHeaderLinkLabel']).dom.href = Clipperz.PM.Strings['helpHeaderLinkUrl'];
59 YAHOO.ext.Element.get('forumHeaderLink').update(Clipperz.PM.Strings['forumHeaderLinkLabel']).dom.href = Clipperz.PM.Strings['forumHeaderLinkUrl']; 59 YAHOO.ext.Element.get('forumHeaderLink').update(Clipperz.PM.Strings['forumHeaderLinkLabel']).dom.href = Clipperz.PM.Strings['forumHeaderLinkUrl'];
60 60
61 if (YAHOO.ext.Element.get('logout') != null) { 61 if (YAHOO.ext.Element.get('logout') != null) {
62 YAHOO.ext.Element.get('logout').update(Clipperz.PM.Strings['logoutMenuLabel']); 62 YAHOO.ext.Element.get('logout').update(Clipperz.PM.Strings['logoutMenuLabel']);
63 YAHOO.ext.Element.get('lock').update(Clipperz.PM.Strings['lockMenuLabel']); 63 YAHOO.ext.Element.get('lock').update(Clipperz.PM.Strings['lockMenuLabel']);
64 64
65 YAHOO.ext.Element.get('recordsTabAnchor').update(Clipperz.PM.Strings['recordMenuLabel']); 65 YAHOO.ext.Element.get('recordsTabAnchor').update(Clipperz.PM.Strings['recordMenuLabel']);
66 YAHOO.ext.Element.get('accountTabAnchor').update(Clipperz.PM.Strings['accountMenuLabel']); 66 YAHOO.ext.Element.get('accountTabAnchor').update(Clipperz.PM.Strings['accountMenuLabel']);
67 YAHOO.ext.Element.get('dataTabAnchor').update(Clipperz.PM.Strings['dataMenuLabel']); 67 YAHOO.ext.Element.get('dataTabAnchor').update(Clipperz.PM.Strings['dataMenuLabel']);
68 // YAHOO.ext.Element.get('contactsTabAnchor').update(Clipperz.PM.Strings['contactsMenuLabel']); 68 // YAHOO.ext.Element.get('contactsTabAnchor').update(Clipperz.PM.Strings['contactsMenuLabel']);
69 YAHOO.ext.Element.get('toolsTabAnchor').update(Clipperz.PM.Strings['toolsMenuLabel']); 69 YAHOO.ext.Element.get('toolsTabAnchor').update(Clipperz.PM.Strings['toolsMenuLabel']);
70 } 70 }
71//MochiKit.Logging.logDebug("<<< main.switchLanguageHandler"); 71//MochiKit.Logging.logDebug("<<< main.switchLanguageHandler");
72 }, 72 },
73 73
74 //------------------------------------------------------------------------- 74 //-------------------------------------------------------------------------
75 75
76 'fixToDrawTheMainTabsCorrectlyOnSafari': function() { 76 'fixToDrawTheMainTabsCorrectlyOnSafari': function() {
77 this.switchLanguageHandler(); 77 this.switchLanguageHandler();
78 }, 78 },
79 79
80 //------------------------------------------------------------------------- 80 //-------------------------------------------------------------------------
81 81
82 'run': function(shouldShowRegistrationForm) { 82 'run': function(shouldShowRegistrationForm) {
83 varmainElement; 83 varmainElement;
84 84
85 Clipperz.NotificationCenter.register(null, 'updatedProgressState', this, 'updateProgressDialogStatus'); 85 Clipperz.NotificationCenter.register(null, 'updatedProgressState', this, 'updateProgressDialogStatus');
86 86
87 YAHOO.ext.Element.get('recordDetailEditModeHeaderMask').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide().unmask(); 87 YAHOO.ext.Element.get('recordDetailEditModeHeaderMask').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide().unmask();
88 YAHOO.ext.Element.get('recordDetailEditModeVerticalMask').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide().unmask(); 88 YAHOO.ext.Element.get('recordDetailEditModeVerticalMask').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide().unmask();
89 89
90//MochiKit.Logging.logDebug(">>> Main.run"); 90//MochiKit.Logging.logDebug(">>> Main.run");
91 mainElement = YAHOO.ext.Element.get('main'); 91 mainElement = YAHOO.ext.Element.get('main');
92 if (Clipperz.PM.Proxy.defaultProxy.isReadOnly()) { 92 if (Clipperz.PM.Proxy.defaultProxy.isReadOnly()) {
93 YAHOO.ext.Element.get('applicationVersionType').dom.className = "readOnly"; 93 YAHOO.ext.Element.get('applicationVersionType').dom.className = "readOnly";
94 } 94 }
95 mainElement.update(""); 95 mainElement.update("");
96 96
97 Clipperz.YUI.DomHelper.append(mainElement.dom, {tag:'ul', cls:'clipperzTabPanels', children:[ 97 Clipperz.YUI.DomHelper.append(mainElement.dom, {tag:'ul', cls:'clipperzTabPanels', children:[
98 {tag:'li', id:'loginPanel'} 98 {tag:'li', id:'loginPanel'}
99 ]}) 99 ]})
100 100
101 this.setLoginPanel(new Clipperz.PM.Components.Panels.LoginPanel(YAHOO.ext.Element.get('loginPanel'))); 101 this.setLoginPanel(new Clipperz.PM.Components.Panels.LoginPanel(YAHOO.ext.Element.get('loginPanel')));
102 102
103//MochiKit.Logging.logDebug("--- Main.run - selecting active form to show ..."); 103//MochiKit.Logging.logDebug("--- Main.run - selecting active form to show ...");
104 if (shouldShowRegistrationForm == true) { 104 if (shouldShowRegistrationForm == true) {
105 this.loginPanel().showRegistrationForm(false); 105 this.loginPanel().showRegistrationForm(false);
106 } else { 106 } else {
107 this.loginPanel().showLoginForm(false); 107 this.loginPanel().showLoginForm(false);
108 } 108 }
109 109
110 this.switchLanguageHandler(); 110 this.switchLanguageHandler();
111//MochiKit.Logging.logDebug("--- Main.run - selecting active form to show. done."); 111//MochiKit.Logging.logDebug("--- Main.run - selecting active form to show. done.");
112//MochiKit.Logging.logDebug("<<< Main.run"); 112//MochiKit.Logging.logDebug("<<< Main.run");
113 }, 113 },
114 114
115 //------------------------------------------------------------------------- 115 //-------------------------------------------------------------------------
116 116
117 'runCompact': function() { 117 'runCompact': function() {
118 this.setIsRunningCompact(true); 118 this.setIsRunningCompact(true);
119 YAHOO.ext.Element.get(document.body).addClass("compact"); 119 YAHOO.ext.Element.get(document.body).addClass("compact");
120 new Clipperz.PM.Components.Compact.LoginForm(YAHOO.ext.Element.get('mainDiv')); 120 new Clipperz.PM.Components.Compact.LoginForm(YAHOO.ext.Element.get('mainDiv'));
121 }, 121 },
122 122
123 'showCompactInterface': function() { 123 'showCompactInterface': function() {
124//MochiKit.Logging.logDebug(">>> main.showCompactInterface"); 124//MochiKit.Logging.logDebug(">>> main.showCompactInterface");
125 new Clipperz.PM.Components.Compact.CompactInterface(YAHOO.ext.Element.get('compactBody'), {user:this.user()}); 125 new Clipperz.PM.Components.Compact.CompactInterface(YAHOO.ext.Element.get('compactBody'), {user:this.user()});
126//MochiKit.Logging.logDebug("<<< main.showCompactInterface"); 126//MochiKit.Logging.logDebug("<<< main.showCompactInterface");
127 }, 127 },
128 128
129 //------------------------------------------------------------------------- 129 //-------------------------------------------------------------------------
130 130
131 'mainPage': function() { 131 'mainPage': function() {
132 if (this._mainPage == null) { 132 if (this._mainPage == null) {
133 this._mainPage = new Clipperz.PM.Components.MainPage(); 133 this._mainPage = new Clipperz.PM.Components.MainPage();
134 } 134 }
135 135
136 return this._mainPage; 136 return this._mainPage;
137 }, 137 },
138 138
139 //------------------------------------------------------------------------- 139 //-------------------------------------------------------------------------
140 140
141 'loginPanel': function() { 141 'loginPanel': function() {
142 return this._loginPanel; 142 return this._loginPanel;
143 }, 143 },
144 144
145 'setLoginPanel': function(aValue) { 145 'setLoginPanel': function(aValue) {
146 this._loginPanel = aValue; 146 this._loginPanel = aValue;
147 }, 147 },
148 148
149 //------------------------------------------------------------------------- 149 //-------------------------------------------------------------------------
150 150
151 'showMainPanels': function() { 151 'showMainPanels': function() {
152 varmainElement; 152 varmainElement;
153 var logoutBlock; 153 var logoutBlock;
154 var lockBlock; 154 var lockBlock;
155 var menusTRElement; 155 var menusTRElement;
156 156
157 this.loginPanel().remove(); 157 this.loginPanel().remove();
158 this.setLoginPanel(null); 158 this.setLoginPanel(null);
159 159
160 logoutBlock = YAHOO.ext.Element.get('logoutLI'); 160 logoutBlock = YAHOO.ext.Element.get('logoutLI');
161 Clipperz.YUI.DomHelper.append(logoutBlock.dom, {tag:'a', href:"#", id:'logout', htmlString:Clipperz.PM.Strings['logoutMenuLabel']}); 161 Clipperz.YUI.DomHelper.append(logoutBlock.dom, {tag:'a', href:"#", id:'logout', htmlString:Clipperz.PM.Strings['logoutMenuLabel']});
162 MochiKit.Signal.connect('logout', 'onclick', this, 'doLogoutEventHandler'); 162 MochiKit.Signal.connect('logout', 'onclick', this, 'doLogoutEventHandler');
163 163
164 lockBlock = YAHOO.ext.Element.get('lockLI'); 164 lockBlock = YAHOO.ext.Element.get('lockLI');
165 Clipperz.YUI.DomHelper.append(lockBlock.dom, {tag:'a', href:"#", id:'lock', htmlString:Clipperz.PM.Strings['lockMenuLabel']}); 165 Clipperz.YUI.DomHelper.append(lockBlock.dom, {tag:'a', href:"#", id:'lock', htmlString:Clipperz.PM.Strings['lockMenuLabel']});
166 MochiKit.Signal.connect('lock', 'onclick', this, 'doLockEventHandler'); 166 MochiKit.Signal.connect('lock', 'onclick', this, 'doLockEventHandler');
167 167
168 menusTRElement = YAHOO.ext.Element.get('menusTR'); 168 menusTRElement = YAHOO.ext.Element.get('menusTR');
169 Clipperz.YUI.DomHelper.append(menusTRElement.dom, {tag:'td', id:'recordsTab', children:[{tag:'div', children:[{tag:'a', id:'recordsTabAnchor', htmlString:Clipperz.PM.Strings['recordMenuLabel']}]}]}); 169 Clipperz.YUI.DomHelper.append(menusTRElement.dom, {tag:'td', id:'recordsTab', children:[{tag:'div', children:[{tag:'a', id:'recordsTabAnchor', htmlString:Clipperz.PM.Strings['recordMenuLabel']}]}]});
170 Clipperz.YUI.DomHelper.append(menusTRElement.dom, {tag:'td', id:'accountTab', children:[{tag:'div', children:[{tag:'a', id:'accountTabAnchor', htmlString:Clipperz.PM.Strings['accountMenuLabel']}]}]}); 170 Clipperz.YUI.DomHelper.append(menusTRElement.dom, {tag:'td', id:'accountTab', children:[{tag:'div', children:[{tag:'a', id:'accountTabAnchor', htmlString:Clipperz.PM.Strings['accountMenuLabel']}]}]});
171 Clipperz.YUI.DomHelper.append(menusTRElement.dom, {tag:'td', id:'dataTab', children:[{tag:'div', children:[{tag:'a', id:'dataTabAnchor', htmlString:Clipperz.PM.Strings['dataMenuLabel']}]}]}); 171 Clipperz.YUI.DomHelper.append(menusTRElement.dom, {tag:'td', id:'dataTab', children:[{tag:'div', children:[{tag:'a', id:'dataTabAnchor', htmlString:Clipperz.PM.Strings['dataMenuLabel']}]}]});
172 // Clipperz.YUI.DomHelper.append(menusTRElement.dom, {tag:'td', id:'contactsTab', children:[{tag:'div', children:[{tag:'a', id:'contactsTabAnchor', htmlString:Clipperz.PM.Strings['contactsMenuLabel']}]}]}); 172 // Clipperz.YUI.DomHelper.append(menusTRElement.dom, {tag:'td', id:'contactsTab', children:[{tag:'div', children:[{tag:'a', id:'contactsTabAnchor', htmlString:Clipperz.PM.Strings['contactsMenuLabel']}]}]});
173 Clipperz.YUI.DomHelper.append(menusTRElement.dom, {tag:'td', id:'toolsTab', children:[{tag:'div', children:[{tag:'a', id:'toolsTabAnchor', htmlString:Clipperz.PM.Strings['toolsMenuLabel']}]}]}); 173 Clipperz.YUI.DomHelper.append(menusTRElement.dom, {tag:'td', id:'toolsTab', children:[{tag:'div', children:[{tag:'a', id:'toolsTabAnchor', htmlString:Clipperz.PM.Strings['toolsMenuLabel']}]}]});
174 174
175 mainElement = YAHOO.ext.Element.get('main'); 175 mainElement = YAHOO.ext.Element.get('main');
176 mainElement.update(""); 176 mainElement.update("");
177 Clipperz.YUI.DomHelper.append(mainElement.dom, {tag:'ul', cls:'clipperzTabPanels', children:[ 177 Clipperz.YUI.DomHelper.append(mainElement.dom, {tag:'ul', cls:'clipperzTabPanels', children:[
178 {tag:'li', id:'recordsPanel'}, 178 {tag:'li', id:'recordsPanel'},
179 {tag:'li', id:'accountPanel'}, 179 {tag:'li', id:'accountPanel'},
180 {tag:'li', id:'dataPanel'}, 180 {tag:'li', id:'dataPanel'},
181 // {tag:'li', id:'contactsPanel'}, 181 // {tag:'li', id:'contactsPanel'},
182 {tag:'li', id:'toolsPanel'} 182 {tag:'li', id:'toolsPanel'}
183 ]}, true) 183 ]}, true)
184 184
185 new Clipperz.PM.Components.TabPanel.TabPanelController({ 185 new Clipperz.PM.Components.TabPanel.TabPanelController({
186 name: 'mainTabPanel', 186 name: 'mainTabPanel',
187 config:{'recordsTab':'recordsPanel', 187 config:{'recordsTab':'recordsPanel',
188 'accountTab':'accountPanel', 188 'accountTab':'accountPanel',
189 'dataTab':'dataPanel', 189 'dataTab':'dataPanel',
190 // 'contactsTab':'contactsPanel', 190 // 'contactsTab':'contactsPanel',
191 'toolsTab':'toolsPanel'}, 191 'toolsTab':'toolsPanel'},
192 selectedTab:'recordsTab' 192 selectedTab:'recordsTab'
193 }).setUp(); 193 }).setUp();
194 194
195 new Clipperz.PM.Components.Panels.MainPanel(YAHOO.ext.Element.get('recordsPanel'), {user:this.user()}); 195 new Clipperz.PM.Components.Panels.MainPanel(YAHOO.ext.Element.get('recordsPanel'), {user:this.user()});
196 new Clipperz.PM.Components.Panels.AccountPanel(YAHOO.ext.Element.get('accountPanel'), {user:this.user()}); 196 new Clipperz.PM.Components.Panels.AccountPanel(YAHOO.ext.Element.get('accountPanel'), {user:this.user()});
197 new Clipperz.PM.Components.Panels.DataPanel(YAHOO.ext.Element.get('dataPanel'), {user:this.user()}); 197 new Clipperz.PM.Components.Panels.DataPanel(YAHOO.ext.Element.get('dataPanel'), {user:this.user()});
198 // new Clipperz.PM.Components.Panels.ContactsPanel(YAHOO.ext.Element.get('contactsPanel'), {user:this.user()}); 198 // new Clipperz.PM.Components.Panels.ContactsPanel(YAHOO.ext.Element.get('contactsPanel'), {user:this.user()});
199 new Clipperz.PM.Components.Panels.ToolsPanel(YAHOO.ext.Element.get('toolsPanel'), {user:this.user()}); 199 new Clipperz.PM.Components.Panels.ToolsPanel(YAHOO.ext.Element.get('toolsPanel'), {user:this.user()});
200 200
201 this.fixToDrawTheMainTabsCorrectlyOnSafari(); //fix to 201 this.fixToDrawTheMainTabsCorrectlyOnSafari(); //fix to
202//MochiKit.Logging.logDebug("<<< Main.showMainPanels"); 202//MochiKit.Logging.logDebug("<<< Main.showMainPanels");
203 }, 203 },
204 204
205 //------------------------------------------------------------------------- 205 //-------------------------------------------------------------------------
206 206
207 'userConnectedCallback': function(anEvent) { 207 'userConnectedCallback': function(anEvent) {
208//MochiKit.Logging.logDebug(">>> Main.userConnectedCallback"); 208//MochiKit.Logging.logDebug(">>> Main.userConnectedCallback");
209//MochiKit.Logging.logDebug(">>> doConnect - user: " + this.user()); 209//MochiKit.Logging.logDebug(">>> doConnect - user: " + this.user());
210 this.setUser(anEvent.source()); 210 this.setUser(anEvent.source());
211 211
212 if (this.isRunningCompact()) { 212 if (this.isRunningCompact()) {
213 this.showCompactInterface(); 213 this.showCompactInterface();
214 } else { 214 } else {
215 this.showMainPanels(); 215 this.showMainPanels();
216 } 216 }
217//MochiKit.Logging.logDebug("<<< Main.userConnectedCallback"); 217//MochiKit.Logging.logDebug("<<< Main.userConnectedCallback");
218 }, 218 },
219 219
220 //----------------------------------------------------------------------------- 220 //-----------------------------------------------------------------------------
221 221
222 'user': function() { 222 'user': function() {
223 return this._user; 223 return this._user;
224 }, 224 },
225 225
226 'setUser': function(aValue) { 226 'setUser': function(aValue) {
227 this._user = aValue; 227 this._user = aValue;
228 }, 228 },
229 229
230 //----------------------------------------------------------------------------- 230 //-----------------------------------------------------------------------------
231 231
232 'doLogoutEventHandler': function(anEvent) { 232 'doLogoutEventHandler': function(anEvent) {
233 var deferred; 233 var deferred;
234 234
235 anEvent.stop(); 235 anEvent.stop();
236 236
237 deferred = new MochiKit.Async.Deferred(); 237 deferred = new MochiKit.Async.Deferred();
238//deferred.addBoth(function(res) {MochiKit.Logging.logDebug("Main.doLogoutEventHandler - 1: " + res); return res;}); 238//deferred.addBoth(function(res) {MochiKit.Logging.logDebug("Main.doLogoutEventHandler - 1: " + res); return res;});
239 deferred.addCallback(MochiKit.Base.method(this.user(), 'doLogout')); 239 deferred.addCallback(MochiKit.Base.method(this.user(), 'doLogout'));
240//deferred.addBoth(function(res) {MochiKit.Logging.logDebug("Main.doLogoutEventHandler - 2: " + res); return res;}); 240//deferred.addBoth(function(res) {MochiKit.Logging.logDebug("Main.doLogoutEventHandler - 2: " + res); return res;});
241 deferred.addCallback(Clipperz.PM.exit, 'logout.html'); 241 deferred.addCallback(Clipperz.PM.exit, 'logout.html');
242//deferred.addBoth(function(res) {MochiKit.Logging.logDebug("Main.doLogoutEventHandler - 3: " + res); return res;}); 242//deferred.addBoth(function(res) {MochiKit.Logging.logDebug("Main.doLogoutEventHandler - 3: " + res); return res;});
243 deferred.callback(); 243 deferred.callback();
244 }, 244 },
245 245
246 //----------------------------------------------------------------------------- 246 //-----------------------------------------------------------------------------
247 247
248 'doLockEventHandler': function(anEvent) { 248 'doLockEventHandler': function(anEvent) {
249 vardeferredResult; 249 vardeferredResult;
250 varlockDialogElement; 250 varlockDialogElement;
251 var lockDialog; 251 var lockDialog;
252 var unlockButton; 252 var unlockButton;
253 253
254 anEvent.stop(); 254 anEvent.stop();
255 255
256 Clipperz.NotificationCenter.notify(this, 'accountLocked', null, true); 256 Clipperz.NotificationCenter.notify(this, 'accountLocked', null, true);
257 257
258 lockDialogElement = Clipperz.YUI.DomHelper.append(document.body, {tag:'div', id:'lockDialog', children:[ 258 lockDialogElement = Clipperz.YUI.DomHelper.append(document.body, {tag:'div', id:'lockDialog', children:[
259 {tag:'div', cls:'ydlg-hd', htmlString:Clipperz.PM.Strings['lockTitle']}, 259 {tag:'div', cls:'ydlg-hd', htmlString:Clipperz.PM.Strings['lockTitle']},
260 {tag:'div', cls:'ydlg-bd', children:[ 260 {tag:'div', cls:'ydlg-bd', children:[
261 {tag:'div', cls:'alert-message', id:'lockMessage', children:[ 261 {tag:'div', cls:'alert-message', id:'lockMessage', children:[
262 {tag:'div', htmlString:Clipperz.PM.Strings['lockDescription']}, 262 {tag:'div', htmlString:Clipperz.PM.Strings['lockDescription']},
263 {tag:'form', id:'lockDialogForm', children:[ 263 {tag:'form', id:'lockDialogForm', children:[
264 {tag:'input', type:'password', id:'lockPassphrase'} 264 {tag:'input', type:'password', id:'lockPassphrase'}
265 ]} 265 ]}
266 ]} 266 ]}
267 ]}, 267 ]},
268 {tag:'div', cls:'ydlg-ft'} 268 {tag:'div', cls:'ydlg-ft'}
269 ]}, true); 269 ]}, true);
270 new Clipperz.PM.Components.PasswordEntropyDisplay(YAHOO.ext.Element.get('lockPassphrase')); 270 new Clipperz.PM.Components.PasswordEntropyDisplay(YAHOO.ext.Element.get('lockPassphrase'));
271 271
272 lockDialog = new YAHOO.ext.BasicDialog( 272 lockDialog = new YAHOO.ext.BasicDialog(
273 lockDialogElement, { 273 lockDialogElement, {
274 closable:false, 274 closable:false,
275 modal:true, 275 modal:true,
276 autoTabs:false, 276 autoTabs:false,
277 resizable:false, 277 resizable:false,
278 fixedcenter:true, 278 fixedcenter:true,
279 constraintoviewport:false, 279 constraintoviewport:false,
280 width:350, 280 width:350,
281 height:130, 281 height:130,
282 shadow:true 282 shadow:true
283 } 283 }
284 ); 284 );
285 285
286 unlockButton = lockDialog.addButton(Clipperz.PM.Strings['unlockButtonLabel'], MochiKit.Base.method(this, 'exitLock', lockDialog)); 286 unlockButton = lockDialog.addButton(Clipperz.PM.Strings['unlockButtonLabel'], MochiKit.Base.method(this, 'exitLock', lockDialog));
287//MochiKit.Logging.logDebug("--- Main.showAlertDialog - 5"); 287//MochiKit.Logging.logDebug("--- Main.showAlertDialog - 5");
288 lockDialog.setDefaultButton(unlockButton); 288 lockDialog.setDefaultButton(unlockButton);
289 289
290 MochiKit.Signal.connect('lockDialogForm', 'onsubmit', MochiKit.Base.method(this, 'exitLock', lockDialog)); 290 MochiKit.Signal.connect('lockDialogForm', 'onsubmit', MochiKit.Base.method(this, 'exitLock', lockDialog));
291 lockDialog.on('show', function() {YAHOO.ext.Element.get('lockPassphrase').focus();}); 291 lockDialog.on('show', function() {YAHOO.ext.Element.get('lockPassphrase').focus();});
292 lockDialog.show('main'); 292 lockDialog.show('main');
293 // this.user().lock(); 293 // this.user().lock();
294 }, 294 },
295 295
296 'exitLock': function(aLockDialog, anEvent) { 296 'exitLock': function(aLockDialog, anEvent) {
297 // var deferredResult; 297 // var deferredResult;
298 298
299//MochiKit.Logging.logDebug(">>> Exiting lock"); 299//MochiKit.Logging.logDebug(">>> Exiting lock");
300 if (typeof(anEvent.stop) != 'undefined') { 300 if (typeof(anEvent.stop) != 'undefined') {
301 anEvent.stop(); 301 anEvent.stop();
302 } 302 }
303 303
304 if (this.user().passphrase() == YAHOO.ext.Element.get('lockPassphrase').dom.value) { 304 if (this.user().passphrase() == YAHOO.ext.Element.get('lockPassphrase').dom.value) {
305 aLockDialog.hide(MochiKit.Base.method(aLockDialog, 'destroy', true)); 305 aLockDialog.hide(MochiKit.Base.method(aLockDialog, 'destroy', true));
306 Clipperz.NotificationCenter.notify(this, 'accountUnlocked', null, true); 306 Clipperz.NotificationCenter.notify(this, 'accountUnlocked', null, true);
307 } else { 307 } else {
308 YAHOO.ext.Element.get('lockPassphrase').dom.value = ""; 308 YAHOO.ext.Element.get('lockPassphrase').dom.value = "";
309 YAHOO.ext.Element.get('lockPassphrase').focus(); 309 YAHOO.ext.Element.get('lockPassphrase').focus();
310 } 310 }
311 311
312 // deferredResult = new MochiKit.Async.Deferred(); 312 // deferredResult = new MochiKit.Async.Deferred();
313 // deferredResult.addCallback(MochiKit.Base.method(this.user(), 'unlockWithPassphrase')); 313 // deferredResult.addCallback(MochiKit.Base.method(this.user(), 'unlockWithPassphrase'));
314 // deferredResult.addCallback(MochiKit.Base.method(aLockDialog, 'hide', MochiKit.Base.method(aLockDialog, 'destroy', true))); 314 // deferredResult.addCallback(MochiKit.Base.method(aLockDialog, 'hide', MochiKit.Base.method(aLockDialog, 'destroy', true)));
315 // deferredResult.addCallback(MochiKit.Base.method(Clipperz.NotificationCenter, 'notify', this, 'accountUnlocked', null, true)); 315 // deferredResult.addCallback(MochiKit.Base.method(Clipperz.NotificationCenter, 'notify', this, 'accountUnlocked', null, true));
316 // deferredResult.addErrback(function() { 316 // deferredResult.addErrback(function() {
317 // YAHOO.ext.Element.get('lockPassphrase').dom.value = ""; 317 // YAHOO.ext.Element.get('lockPassphrase').dom.value = "";
318 // YAHOO.ext.Element.get('lockPassphrase').focus(); 318 // YAHOO.ext.Element.get('lockPassphrase').focus();
319 // }); 319 // });
320 // deferredResult.callback(YAHOO.ext.Element.get('lockPassphrase').dom.value); 320 // deferredResult.callback(YAHOO.ext.Element.get('lockPassphrase').dom.value);
321 321
322 return false; 322 return false;
323 }, 323 },
324 324
325 //----------------------------------------------------------------------------- 325 //-----------------------------------------------------------------------------
326 326
327 'updateProgressDialogStatus': function(anEvent) { 327 'updateProgressDialogStatus': function(anEvent) {
328//MochiKit.Logging.logDebug(">>> main.updateProgressDialogStatus - " + anEvent.parameters()); 328//MochiKit.Logging.logDebug(">>> main.updateProgressDialogStatus - " + anEvent.parameters());
329//try { 329//try {
330 if (Clipperz.Base.objectType(anEvent.parameters()) == 'string') { 330 if (Clipperz.Base.objectType(anEvent.parameters()) == 'string') {
331 Clipperz.PM.Components.MessageBox().update(Clipperz.PM.Strings.messagePanelConfigurations[anEvent.parameters()]()); 331 Clipperz.PM.Components.MessageBox().update(Clipperz.PM.Strings.messagePanelConfigurations[anEvent.parameters()]());
332 } else { 332 } else {
333 Clipperz.PM.Components.MessageBox().update(anEvent.parameters()); 333 Clipperz.PM.Components.MessageBox().update(anEvent.parameters());
334 } 334 }
335//} catch (exception) { 335//} catch (exception) {
336//console.log("updateProgressDialogStatus - anEvent", anEvent); 336//console.log("updateProgressDialogStatus - anEvent", anEvent);
337 //MochiKit.Logging.logError("Main.updateProgressDialogStatus: " + exception); 337 //MochiKit.Logging.logError("Main.updateProgressDialogStatus: " + exception);
338 //throw exception; 338 //throw exception;
339//} 339//}
340//MochiKit.Logging.logDebug("<<< main.updateProgressDialogStatus"); 340//MochiKit.Logging.logDebug("<<< main.updateProgressDialogStatus");
341 }, 341 },
342 342
343 //----------------------------------------------------------------------------- 343 //-----------------------------------------------------------------------------
344 344
345 'defaultErrorHandler': function(anErrorString, anException) { 345 'defaultErrorHandler': function(anErrorString, anException) {
346MochiKit.Logging.logDebug(">>> DEFAULT ERROR HANDLER: " + anErrorString + " (exception: " + Clipperz.Base.serializeJSON(anException) + ")"); 346MochiKit.Logging.logDebug(">>> DEFAULT ERROR HANDLER: " + anErrorString + " (exception: " + Clipperz.Base.serializeJSON(anException) + ")");
347 }, 347 },
348 348
349 //----------------------------------------------------------------------------- 349 //-----------------------------------------------------------------------------
350 350
351 'isRunningCompact': function() { 351 'isRunningCompact': function() {
352 return this._isRunningCompact; 352 return this._isRunningCompact;
353 }, 353 },
354 354
355 'setIsRunningCompact': function(aValue) { 355 'setIsRunningCompact': function(aValue) {
356 this._isRunningCompact = aValue; 356 this._isRunningCompact = aValue;
357 }, 357 },
358 358
359 //----------------------------------------------------------------------------- 359 //-----------------------------------------------------------------------------
360 360
361 'reportException': function(anError) { 361 'reportException': function(anError) {
362/* 362/*
363 var deferredResult; 363 var deferredResult;
364 364
365 deferredResult = new MochiKit.Async.Deferred(); 365 deferredResult = new MochiKit.Async.Deferred();
366 366
367 Clipperz.PM.Components.MessageBox().show( 367 Clipperz.PM.Components.MessageBox().show(
368 { 368 {
369 title:Clipperz.PM.Strings['fatalErrorMessageTitle'], 369 title:Clipperz.PM.Strings['fatalErrorMessageTitle'],
370 text:Clipperz.PM.Strings['fatalErrorMessageText'], 370 text:Clipperz.PM.Strings['fatalErrorMessageText'],
371 width:240, 371 width:240,
372 showProgressBar:false, 372 showProgressBar:false,
373 showCloseButton:false, 373 showCloseButton:false,
374 fn:MochiKit.Base.method(deferredResult, 'callback'), 374 fn:MochiKit.Base.method(deferredResult, 'callback'),
375 scope:this, 375 scope:this,
376 buttons:{ 376 buttons:{
377 'ok':Clipperz.PM.Strings['fatalErrorMessageCloseButtonLabel'] 377 'ok':Clipperz.PM.Strings['fatalErrorMessageCloseButtonLabel']
378 } 378 }
379 } 379 }
380 ); 380 );
381 381
382 deferredResult.addCallback(function() { 382 deferredResult.addCallback(function() {
383 window.document.body.innerHTML = ""; 383 window.document.body.innerHTML = "";
384 window.location.reload(true); 384 window.location.reload(true);
385 }); 385 });
386*/ 386*/
387 Clipperz.PM.exit('error.html'); 387 Clipperz.PM.exit('error.html');
388 }, 388 },
389 389
390 //----------------------------------------------------------------------------- 390 //-----------------------------------------------------------------------------
391 __syntaxFix__: "syntax fix" 391 __syntaxFix__: "syntax fix"
392 392
393}); 393});
394 394
395 395
396 396
397//############################################################################# 397//#############################################################################
398 398
399MochiKit.Base.update(Clipperz.PM, { 399MochiKit.Base.update(Clipperz.PM, {
400 400
401 __repr__: function() { 401 __repr__: function() {
402 return "[" + this.NAME + " " + this.VERSION + "]"; 402 return "[" + this.NAME + " " + this.VERSION + "]";
403 }, 403 },
404 404
405 toString: function() { 405 toString: function() {
406 return this.__repr__(); 406 return this.__repr__();
407 }, 407 },
408 408
409 //----------------------------------------------------------------------------- 409 //-----------------------------------------------------------------------------
410 410
411 'initPage': function() { 411 'initPage': function() {
412 varmain; 412 varmain;
413 var shouldShowRegistrationForm; 413 var shouldShowRegistrationForm;
414 var useCompactDesign; 414 var useCompactDesign;
415 415
416//MochiKit.Logging.logWarning("Just testing logging system"); 416//MochiKit.Logging.logWarning("Just testing logging system");
417 Clipperz.PM.Strings.Languages.initSetup(); 417 Clipperz.PM.Strings.Languages.initSetup();
418 // DWRUtil.useLoadingMessage(Clipperz.PM.Strings['DWRUtilLoadingMessage']); 418 // DWRUtil.useLoadingMessage(Clipperz.PM.Strings['DWRUtilLoadingMessage']);
419 419
420 if (window.location.search.indexOf("registration") != -1) { 420 if (window.location.search.indexOf("registration") != -1) {
421 shouldShowRegistrationForm = true; 421 shouldShowRegistrationForm = true;
422 } else { 422 } else {
423 shouldShowRegistrationForm = false; 423 shouldShowRegistrationForm = false;
424 } 424 }
425 425
426 if (window.location.search.indexOf("compact") != -1) { 426 if (window.location.search.indexOf("compact") != -1) {
427 useCompactDesign = true; 427 useCompactDesign = true;
428 } else { 428 } else {
429 useCompactDesign = false; 429 useCompactDesign = false;
430 } 430 }
431 431
432 main = new Clipperz.PM.Main(); 432 main = new Clipperz.PM.Main();
433 433
434 if (useCompactDesign == true) { 434 if (useCompactDesign == true) {
435 main.runCompact(); 435 main.runCompact();
436 } else { 436 } else {
437 if (Clipperz_IEisBroken === true) { 437 if (Clipperz_IEisBroken === true) {
438 if (Clipperz.PM.Proxy.defaultProxy.isReadOnly()) { 438 if (Clipperz.PM.Proxy.defaultProxy.isReadOnly()) {
439 var logoParentNode; 439 var logoParentNode;
440 440