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.js22
1 files changed, 10 insertions, 12 deletions
diff --git a/frontend/beta/js/Clipperz/PM/Main.js b/frontend/beta/js/Clipperz/PM/Main.js
index 989e0a4..3dded31 100644
--- a/frontend/beta/js/Clipperz/PM/Main.js
+++ b/frontend/beta/js/Clipperz/PM/Main.js
@@ -1,214 +1,212 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2013 Clipperz Srl
4 4
5This file is part of Clipperz Community Edition. 5This file is part of Clipperz, the online password manager.
6Clipperz Community Edition is an online password manager.
7For further information about its features and functionalities please 6For further information about its features and functionalities please
8refer to http://www.clipperz.com. 7refer to http://www.clipperz.com.
9 8
10* Clipperz Community Edition is free software: you can redistribute 9* Clipperz is free software: you can redistribute it and/or modify it
11 it and/or modify it under the terms of the GNU Affero General Public 10 under the terms of the GNU Affero General Public License as published
12 License as published by the Free Software Foundation, either version 11 by the Free Software Foundation, either version 3 of the License, or
13 3 of the License, or (at your option) any later version. 12 (at your option) any later version.
14 13
15* Clipperz Community Edition is distributed in the hope that it will 14* Clipperz is distributed in the hope that it will be useful, but
16 be useful, but WITHOUT ANY WARRANTY; without even the implied 15 WITHOUT ANY WARRANTY; without even the implied warranty of
17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU Affero General Public License for more details. 17 See the GNU Affero General Public License for more details.
19 18
20* You should have received a copy of the GNU Affero General Public 19* You should have received a copy of the GNU Affero General Public
21 License along with Clipperz Community Edition. If not, see 20 License along with Clipperz. If not, see http://www.gnu.org/licenses/.
22 <http://www.gnu.org/licenses/>.
23 21
24*/ 22*/
25 23
26if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } 24if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
27 25
28Clipperz.PM.VERSION = "0.1"; 26Clipperz.PM.VERSION = "0.1";
29Clipperz.PM.NAME = "Clipperz.PM"; 27Clipperz.PM.NAME = "Clipperz.PM";
30 28
31//############################################################################# 29//#############################################################################
32 30
33Clipperz.PM.Main = function() { 31Clipperz.PM.Main = function() {
34 this._loginPanel = null; 32 this._loginPanel = null;
35 this._user = null; 33 this._user = null;
36 34
37 this._isRunningCompact = false; 35 this._isRunningCompact = false;
38 36
39 Clipperz.NotificationCenter.register(null, 'userConnected', this, 'userConnectedCallback'); 37 Clipperz.NotificationCenter.register(null, 'userConnected', this, 'userConnectedCallback');
40 Clipperz.NotificationCenter.register(null, 'switchLanguage', this, 'switchLanguageHandler'); 38 Clipperz.NotificationCenter.register(null, 'switchLanguage', this, 'switchLanguageHandler');
41 39
42 Clipperz.NotificationCenter.register(null, 'EXCEPTION', this, 'reportException'); 40 Clipperz.NotificationCenter.register(null, 'EXCEPTION', this, 'reportException');
43 41
44 return this; 42 return this;
45} 43}
46 44
47//============================================================================= 45//=============================================================================
48 46
49MochiKit.Base.update(Clipperz.PM.Main.prototype, { 47MochiKit.Base.update(Clipperz.PM.Main.prototype, {
50 'toString': function() { 48 'toString': function() {
51 return "Clipperz.PM.Main"; 49 return "Clipperz.PM.Main";
52 }, 50 },
53 51
54 'switchLanguageHandler': function() { 52 'switchLanguageHandler': function() {
55//MochiKit.Logging.logDebug(">>> main.switchLanguageHandler"); 53//MochiKit.Logging.logDebug(">>> main.switchLanguageHandler");
56 YAHOO.ext.Element.get('donateHeaderIconLink').dom.href = Clipperz.PM.Strings['donateHeaderLinkUrl']; 54 YAHOO.ext.Element.get('donateHeaderIconLink').dom.href = Clipperz.PM.Strings['donateHeaderLinkUrl'];
57 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'];
58 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'];
59 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'];
60 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'];
61 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'];
62 60
63 if (YAHOO.ext.Element.get('logout') != null) { 61 if (YAHOO.ext.Element.get('logout') != null) {
64 YAHOO.ext.Element.get('logout').update(Clipperz.PM.Strings['logoutMenuLabel']); 62 YAHOO.ext.Element.get('logout').update(Clipperz.PM.Strings['logoutMenuLabel']);
65 YAHOO.ext.Element.get('lock').update(Clipperz.PM.Strings['lockMenuLabel']); 63 YAHOO.ext.Element.get('lock').update(Clipperz.PM.Strings['lockMenuLabel']);
66 64
67 YAHOO.ext.Element.get('recordsTabAnchor').update(Clipperz.PM.Strings['recordMenuLabel']); 65 YAHOO.ext.Element.get('recordsTabAnchor').update(Clipperz.PM.Strings['recordMenuLabel']);
68 YAHOO.ext.Element.get('accountTabAnchor').update(Clipperz.PM.Strings['accountMenuLabel']); 66 YAHOO.ext.Element.get('accountTabAnchor').update(Clipperz.PM.Strings['accountMenuLabel']);
69 YAHOO.ext.Element.get('dataTabAnchor').update(Clipperz.PM.Strings['dataMenuLabel']); 67 YAHOO.ext.Element.get('dataTabAnchor').update(Clipperz.PM.Strings['dataMenuLabel']);
70 // YAHOO.ext.Element.get('contactsTabAnchor').update(Clipperz.PM.Strings['contactsMenuLabel']); 68 // YAHOO.ext.Element.get('contactsTabAnchor').update(Clipperz.PM.Strings['contactsMenuLabel']);
71 YAHOO.ext.Element.get('toolsTabAnchor').update(Clipperz.PM.Strings['toolsMenuLabel']); 69 YAHOO.ext.Element.get('toolsTabAnchor').update(Clipperz.PM.Strings['toolsMenuLabel']);
72 } 70 }
73//MochiKit.Logging.logDebug("<<< main.switchLanguageHandler"); 71//MochiKit.Logging.logDebug("<<< main.switchLanguageHandler");
74 }, 72 },
75 73
76 //------------------------------------------------------------------------- 74 //-------------------------------------------------------------------------
77 75
78 'fixToDrawTheMainTabsCorrectlyOnSafari': function() { 76 'fixToDrawTheMainTabsCorrectlyOnSafari': function() {
79 this.switchLanguageHandler(); 77 this.switchLanguageHandler();
80 }, 78 },
81 79
82 //------------------------------------------------------------------------- 80 //-------------------------------------------------------------------------
83 81
84 'run': function(shouldShowRegistrationForm) { 82 'run': function(shouldShowRegistrationForm) {
85 varmainElement; 83 varmainElement;
86 84
87 Clipperz.NotificationCenter.register(null, 'updatedProgressState', this, 'updateProgressDialogStatus'); 85 Clipperz.NotificationCenter.register(null, 'updatedProgressState', this, 'updateProgressDialogStatus');
88 86
89 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();
90 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();
91 89
92//MochiKit.Logging.logDebug(">>> Main.run"); 90//MochiKit.Logging.logDebug(">>> Main.run");
93 mainElement = YAHOO.ext.Element.get('main'); 91 mainElement = YAHOO.ext.Element.get('main');
94 if (Clipperz.PM.Proxy.defaultProxy.isReadOnly()) { 92 if (Clipperz.PM.Proxy.defaultProxy.isReadOnly()) {
95 YAHOO.ext.Element.get('applicationVersionType').dom.className = "readOnly"; 93 YAHOO.ext.Element.get('applicationVersionType').dom.className = "readOnly";
96 } 94 }
97 mainElement.update(""); 95 mainElement.update("");
98 96
99 Clipperz.YUI.DomHelper.append(mainElement.dom, {tag:'ul', cls:'clipperzTabPanels', children:[ 97 Clipperz.YUI.DomHelper.append(mainElement.dom, {tag:'ul', cls:'clipperzTabPanels', children:[
100 {tag:'li', id:'loginPanel'} 98 {tag:'li', id:'loginPanel'}
101 ]}) 99 ]})
102 100
103 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')));
104 102
105//MochiKit.Logging.logDebug("--- Main.run - selecting active form to show ..."); 103//MochiKit.Logging.logDebug("--- Main.run - selecting active form to show ...");
106 if (shouldShowRegistrationForm == true) { 104 if (shouldShowRegistrationForm == true) {
107 this.loginPanel().showRegistrationForm(false); 105 this.loginPanel().showRegistrationForm(false);
108 } else { 106 } else {
109 this.loginPanel().showLoginForm(false); 107 this.loginPanel().showLoginForm(false);
110 } 108 }
111 109
112 this.switchLanguageHandler(); 110 this.switchLanguageHandler();
113//MochiKit.Logging.logDebug("--- Main.run - selecting active form to show. done."); 111//MochiKit.Logging.logDebug("--- Main.run - selecting active form to show. done.");
114//MochiKit.Logging.logDebug("<<< Main.run"); 112//MochiKit.Logging.logDebug("<<< Main.run");
115 }, 113 },
116 114
117 //------------------------------------------------------------------------- 115 //-------------------------------------------------------------------------
118 116
119 'runCompact': function() { 117 'runCompact': function() {
120 this.setIsRunningCompact(true); 118 this.setIsRunningCompact(true);
121 YAHOO.ext.Element.get(document.body).addClass("compact"); 119 YAHOO.ext.Element.get(document.body).addClass("compact");
122 new Clipperz.PM.Components.Compact.LoginForm(YAHOO.ext.Element.get('mainDiv')); 120 new Clipperz.PM.Components.Compact.LoginForm(YAHOO.ext.Element.get('mainDiv'));
123 }, 121 },
124 122
125 'showCompactInterface': function() { 123 'showCompactInterface': function() {
126//MochiKit.Logging.logDebug(">>> main.showCompactInterface"); 124//MochiKit.Logging.logDebug(">>> main.showCompactInterface");
127 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()});
128//MochiKit.Logging.logDebug("<<< main.showCompactInterface"); 126//MochiKit.Logging.logDebug("<<< main.showCompactInterface");
129 }, 127 },
130 128
131 //------------------------------------------------------------------------- 129 //-------------------------------------------------------------------------
132 130
133 'mainPage': function() { 131 'mainPage': function() {
134 if (this._mainPage == null) { 132 if (this._mainPage == null) {
135 this._mainPage = new Clipperz.PM.Components.MainPage(); 133 this._mainPage = new Clipperz.PM.Components.MainPage();
136 } 134 }
137 135
138 return this._mainPage; 136 return this._mainPage;
139 }, 137 },
140 138
141 //------------------------------------------------------------------------- 139 //-------------------------------------------------------------------------
142 140
143 'loginPanel': function() { 141 'loginPanel': function() {
144 return this._loginPanel; 142 return this._loginPanel;
145 }, 143 },
146 144
147 'setLoginPanel': function(aValue) { 145 'setLoginPanel': function(aValue) {
148 this._loginPanel = aValue; 146 this._loginPanel = aValue;
149 }, 147 },
150 148
151 //------------------------------------------------------------------------- 149 //-------------------------------------------------------------------------
152 150
153 'showMainPanels': function() { 151 'showMainPanels': function() {
154 varmainElement; 152 varmainElement;
155 var logoutBlock; 153 var logoutBlock;
156 var lockBlock; 154 var lockBlock;
157 var menusTRElement; 155 var menusTRElement;
158 156
159 this.loginPanel().remove(); 157 this.loginPanel().remove();
160 this.setLoginPanel(null); 158 this.setLoginPanel(null);
161 159
162 logoutBlock = YAHOO.ext.Element.get('logoutLI'); 160 logoutBlock = YAHOO.ext.Element.get('logoutLI');
163 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']});
164 MochiKit.Signal.connect('logout', 'onclick', this, 'doLogoutEventHandler'); 162 MochiKit.Signal.connect('logout', 'onclick', this, 'doLogoutEventHandler');
165 163
166 lockBlock = YAHOO.ext.Element.get('lockLI'); 164 lockBlock = YAHOO.ext.Element.get('lockLI');
167 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']});
168 MochiKit.Signal.connect('lock', 'onclick', this, 'doLockEventHandler'); 166 MochiKit.Signal.connect('lock', 'onclick', this, 'doLockEventHandler');
169 167
170 menusTRElement = YAHOO.ext.Element.get('menusTR'); 168 menusTRElement = YAHOO.ext.Element.get('menusTR');
171 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']}]}]});
172 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']}]}]});
173 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']}]}]});
174 // 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']}]}]});
175 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']}]}]});
176 174
177 mainElement = YAHOO.ext.Element.get('main'); 175 mainElement = YAHOO.ext.Element.get('main');
178 mainElement.update(""); 176 mainElement.update("");
179 Clipperz.YUI.DomHelper.append(mainElement.dom, {tag:'ul', cls:'clipperzTabPanels', children:[ 177 Clipperz.YUI.DomHelper.append(mainElement.dom, {tag:'ul', cls:'clipperzTabPanels', children:[
180 {tag:'li', id:'recordsPanel'}, 178 {tag:'li', id:'recordsPanel'},
181 {tag:'li', id:'accountPanel'}, 179 {tag:'li', id:'accountPanel'},
182 {tag:'li', id:'dataPanel'}, 180 {tag:'li', id:'dataPanel'},
183 // {tag:'li', id:'contactsPanel'}, 181 // {tag:'li', id:'contactsPanel'},
184 {tag:'li', id:'toolsPanel'} 182 {tag:'li', id:'toolsPanel'}
185 ]}, true) 183 ]}, true)
186 184
187 new Clipperz.PM.Components.TabPanel.TabPanelController({ 185 new Clipperz.PM.Components.TabPanel.TabPanelController({
188 name: 'mainTabPanel', 186 name: 'mainTabPanel',
189 config:{'recordsTab':'recordsPanel', 187 config:{'recordsTab':'recordsPanel',
190 'accountTab':'accountPanel', 188 'accountTab':'accountPanel',
191 'dataTab':'dataPanel', 189 'dataTab':'dataPanel',
192 // 'contactsTab':'contactsPanel', 190 // 'contactsTab':'contactsPanel',
193 'toolsTab':'toolsPanel'}, 191 'toolsTab':'toolsPanel'},
194 selectedTab:'recordsTab' 192 selectedTab:'recordsTab'
195 }).setUp(); 193 }).setUp();
196 194
197 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()});
198 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()});
199 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()});
200 // 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()});
201 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()});
202 200
203 this.fixToDrawTheMainTabsCorrectlyOnSafari(); //fix to 201 this.fixToDrawTheMainTabsCorrectlyOnSafari(); //fix to
204//MochiKit.Logging.logDebug("<<< Main.showMainPanels"); 202//MochiKit.Logging.logDebug("<<< Main.showMainPanels");
205 }, 203 },
206 204
207 //------------------------------------------------------------------------- 205 //-------------------------------------------------------------------------
208 206
209 'userConnectedCallback': function(anEvent) { 207 'userConnectedCallback': function(anEvent) {
210//MochiKit.Logging.logDebug(">>> Main.userConnectedCallback"); 208//MochiKit.Logging.logDebug(">>> Main.userConnectedCallback");
211//MochiKit.Logging.logDebug(">>> doConnect - user: " + this.user()); 209//MochiKit.Logging.logDebug(">>> doConnect - user: " + this.user());
212 this.setUser(anEvent.source()); 210 this.setUser(anEvent.source());
213 211
214 if (this.isRunningCompact()) { 212 if (this.isRunningCompact()) {