summaryrefslogtreecommitdiff
path: root/frontend/beta/js/Clipperz/PM/Components/Panels/MainPanel.js
Unidiff
Diffstat (limited to 'frontend/beta/js/Clipperz/PM/Components/Panels/MainPanel.js') (more/less context) (ignore whitespace changes)
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/Panels/MainPanel.js22
1 files changed, 10 insertions, 12 deletions
diff --git a/frontend/beta/js/Clipperz/PM/Components/Panels/MainPanel.js b/frontend/beta/js/Clipperz/PM/Components/Panels/MainPanel.js
index 29ef516..c19a8a3 100644
--- a/frontend/beta/js/Clipperz/PM/Components/Panels/MainPanel.js
+++ b/frontend/beta/js/Clipperz/PM/Components/Panels/MainPanel.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) == 'undefined') { Clipperz = {}; } 24if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
27if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } 25if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
28if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; } 26if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
29if (typeof(Clipperz.PM.Components.Panels) == 'undefined') { Clipperz.PM.Components.Panels = {}; } 27if (typeof(Clipperz.PM.Components.Panels) == 'undefined') { Clipperz.PM.Components.Panels = {}; }
30 28
31//############################################################################# 29//#############################################################################
32 30
33Clipperz.PM.Components.Panels.MainPanel = function(anElement, args) { 31Clipperz.PM.Components.Panels.MainPanel = function(anElement, args) {
34 args = args || {}; 32 args = args || {};
35 33
36 Clipperz.PM.Components.Panels.MainPanel.superclass.constructor.call(this, anElement, args); 34 Clipperz.PM.Components.Panels.MainPanel.superclass.constructor.call(this, anElement, args);
37 35
38 this._recordListDataModel = null; 36 this._recordListDataModel = null;
39 this._selectedRecord = null; 37 this._selectedRecord = null;
40 this._recordDetailComponent = null; 38 this._recordDetailComponent = null;
41 this._recordListGrid = null; 39 this._recordListGrid = null;
42 40
43 this._directLinkItemTemplate = null; 41 this._directLinkItemTemplate = null;
44 this._recordItemTemplate = null; 42 this._recordItemTemplate = null;
45 43
46 this._addNewRecordButton = null; 44 this._addNewRecordButton = null;
47 this._deleteRecordButton = null; 45 this._deleteRecordButton = null;
48 46
49 this._creationWizard = null; 47 this._creationWizard = null;
50 48
51 Clipperz.NotificationCenter.register(null, 'selectAndEnterEditMode', this, 'selectRecordAndEnterEditModeHandler'); 49 Clipperz.NotificationCenter.register(null, 'selectAndEnterEditMode', this, 'selectRecordAndEnterEditModeHandler');
52 50
53 Clipperz.NotificationCenter.register(null, 'recordAdded', this, 'recordAddedHandler'); 51 Clipperz.NotificationCenter.register(null, 'recordAdded', this, 'recordAddedHandler');
54 Clipperz.NotificationCenter.register(null, 'recordUpdated', this, 'recordUpdatedHandler'); 52 Clipperz.NotificationCenter.register(null, 'recordUpdated', this, 'recordUpdatedHandler');
55 Clipperz.NotificationCenter.register(null, 'recordRemoved', this, 'recordRemovedHandler'); 53 Clipperz.NotificationCenter.register(null, 'recordRemoved', this, 'recordRemovedHandler');
56 54
57 Clipperz.NotificationCenter.register(null, 'directLoginAdded', this, 'directLoginAddedHandler'); 55 Clipperz.NotificationCenter.register(null, 'directLoginAdded', this, 'directLoginAddedHandler');
58 Clipperz.NotificationCenter.register(null, 'directLoginUpdated', this, 'directLoginUpdatedHandler'); 56 Clipperz.NotificationCenter.register(null, 'directLoginUpdated', this, 'directLoginUpdatedHandler');
59 Clipperz.NotificationCenter.register(null, 'directLoginRemoved', this, 'directLoginRemovedHandler'); 57 Clipperz.NotificationCenter.register(null, 'directLoginRemoved', this, 'directLoginRemovedHandler');
60 58
61 Clipperz.NotificationCenter.register(null, 'accountLocked', this, 'accountLockedHandler'); 59 Clipperz.NotificationCenter.register(null, 'accountLocked', this, 'accountLockedHandler');
62 60
63 MochiKit.Signal.connect(MochiKit.DOM.currentWindow(), 'onresize', this, 'resizeModalMask'); 61 MochiKit.Signal.connect(MochiKit.DOM.currentWindow(), 'onresize', this, 'resizeModalMask');
64 this.render(); 62 this.render();
65 63
66 return this; 64 return this;
67} 65}
68 66
69//============================================================================= 67//=============================================================================
70 68
71YAHOO.extendX(Clipperz.PM.Components.Panels.MainPanel, Clipperz.PM.Components.Panels.BasePanel, { 69YAHOO.extendX(Clipperz.PM.Components.Panels.MainPanel, Clipperz.PM.Components.Panels.BasePanel, {
72 70
73 'toString': function() { 71 'toString': function() {
74 return "Clipperz.PM.Components.Panels.MainPanel component"; 72 return "Clipperz.PM.Components.Panels.MainPanel component";
75 }, 73 },
76 74
77 //------------------------------------------------------------------------- 75 //-------------------------------------------------------------------------
78 76
79 'render': function() { 77 'render': function() {
80 this.element().update(""); 78 this.element().update("");
81 Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'table', id:'mainPanelTABLE', border:'0', cellspacing:'0', cellpadding:'0', children:[ 79 Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'table', id:'mainPanelTABLE', border:'0', cellspacing:'0', cellpadding:'0', children:[
82 {tag:'tbody', children:[ 80 {tag:'tbody', children:[
83 {tag:'tr', children:[ 81 {tag:'tr', children:[
84 {tag:'td', width:'15', children:[ 82 {tag:'td', width:'15', children:[
85 {tag:'div', cls:'mainPanelMinHeightDiv'} 83 {tag:'div', cls:'mainPanelMinHeightDiv'}
86 ]}, 84 ]},
87 {tag:'td', valign:'top', id:'directLoginsTD', width:'200', children:[ 85 {tag:'td', valign:'top', id:'directLoginsTD', width:'200', children:[
88 {tag:'div', id:'directLoginsBlock', children:[ 86 {tag:'div', id:'directLoginsBlock', children:[
89 {tag:'div', cls:'directLoginsBlockHeaderBox', children:[{tag:'h3', id:'directLoginTitle', htmlString:Clipperz.PM.Strings['mainPanelDirectLoginBlockLabel']}]}, 87 {tag:'div', cls:'directLoginsBlockHeaderBox', children:[{tag:'h3', id:'directLoginTitle', htmlString:Clipperz.PM.Strings['mainPanelDirectLoginBlockLabel']}]},
90 {tag:'div', id:'directLoginsDescription', htmlString:Clipperz.PM.Strings['mainPanelDirectLoginBlockDescription']}, 88 {tag:'div', id:'directLoginsDescription', htmlString:Clipperz.PM.Strings['mainPanelDirectLoginBlockDescription']},
91 {tag:'ul', id:'directLogins'} 89 {tag:'ul', id:'directLogins'}
92 ]} 90 ]}
93 ]}, 91 ]},
94 {tag:'td', width:'15', children:[ 92 {tag:'td', width:'15', children:[
95 {tag:'div', cls:'mainPanelMinHeightDiv'} 93 {tag:'div', cls:'mainPanelMinHeightDiv'}
96 ]}, 94 ]},
97 {tag:'td', valign:'top', children:[ 95 {tag:'td', valign:'top', children:[
98 {tag:'div', id:'mainContent', children:[ 96 {tag:'div', id:'mainContent', children:[
99 {tag:'div', id:'recordListBlockHeader'}, 97 {tag:'div', id:'recordListBlockHeader'},
100 {tag:'div', id:'recordListAndDetailBlock', children:[ 98 {tag:'div', id:'recordListAndDetailBlock', children:[
101 {tag:'table', id:'recordListAndDetailBlockTABLE', border:'0', cellspacing:'0', cellpadding:'0', children:[ 99 {tag:'table', id:'recordListAndDetailBlockTABLE', border:'0', cellspacing:'0', cellpadding:'0', children:[
102 {tag:'tbody', children:[ 100 {tag:'tbody', children:[
103 {tag:'tr', children:[ 101 {tag:'tr', children:[
104 {tag:'td', valign:'top', width:'250', children:[ 102 {tag:'td', valign:'top', width:'250', children:[
105 {tag:'div', id:'recordListBlock', children:[ 103 {tag:'div', id:'recordListBlock', children:[
106 {tag:'div', id:'recordListFilterHeader'}, 104 {tag:'div', id:'recordListFilterHeader'},
107 {tag:'ul', id:'records'} 105 {tag:'ul', id:'records'}
108 ]} 106 ]}
109 ]}, 107 ]},
110 {tag:'td', id:'recordDetailSeparatorTD', rowspan:'2', valign:'top', bgcolor:'#ddddff', html:'&nbsp;'}, 108 {tag:'td', id:'recordDetailSeparatorTD', rowspan:'2', valign:'top', bgcolor:'#ddddff', html:'&nbsp;'},
111 {tag:'td', valign:'top', children:[ 109 {tag:'td', valign:'top', children:[
112 {tag:'div', id:'recordDetailMainBlock', children:[ 110 {tag:'div', id:'recordDetailMainBlock', children:[
113 {tag:'div', id:'recordTitleTopBlock'}, 111 {tag:'div', id:'recordTitleTopBlock'},
114 {tag:'div', id:'recordDetailBlock', children:[ 112 {tag:'div', id:'recordDetailBlock', children:[
115 {tag:'div', id:'recordDetail'} 113 {tag:'div', id:'recordDetail'}
116 ]} 114 ]}
117 ]}, 115 ]},
118 {tag:'div', id:'recordCreationWizardMainBlock', children:[ 116 {tag:'div', id:'recordCreationWizardMainBlock', children:[
119 {tag:'div', id:'recordCreationWizard', html:"WIZARD"} 117 {tag:'div', id:'recordCreationWizard', html:"WIZARD"}
120 ]} 118 ]}
121 ]} 119 ]}
122 ]}, 120 ]},
123 {tag:'tr', children:[ 121 {tag:'tr', children:[
124 {tag:'td', id:'cardBoxLowerLeftTD', html:'&nbsp;'}, 122 {tag:'td', id:'cardBoxLowerLeftTD', html:'&nbsp;'},
125 {tag:'td', id:'cardBoxLowerRightTD', html:'&nbsp;'} 123 {tag:'td', id:'cardBoxLowerRightTD', html:'&nbsp;'}
126 ]} 124 ]}
127 ]} 125 ]}
128 ]} 126 ]}
129 ]} 127 ]}
130 ]} 128 ]}
131 ]}, 129 ]},
132 {tag:'td', width:'15', html:"&nbsp;"} 130 {tag:'td', width:'15', html:"&nbsp;"}
133 ]} 131 ]}
134 ]} 132 ]}
135 ]}); 133 ]});
136 134
137 this.renderRecordListBlockHeader(); 135 this.renderRecordListBlockHeader();
138 // this.renderRecordListFilterHeader(); 136 // this.renderRecordListFilterHeader();
139 137
140 YAHOO.ext.Element.get('directLogins').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide(); 138 YAHOO.ext.Element.get('directLogins').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide();
141 139
142 this.recordDetailComponent(); 140 this.recordDetailComponent();
143 141
144 YAHOO.ext.Element.get('recordDetailMainBlock').setVisibilityMode(YAHOO.ext.Element.DISPLAY).show(); 142 YAHOO.ext.Element.get('recordDetailMainBlock').setVisibilityMode(YAHOO.ext.Element.DISPLAY).show();
145 YAHOO.ext.Element.get('recordCreationWizardMainBlock').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide(); 143 YAHOO.ext.Element.get('recordCreationWizardMainBlock').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide();
146 }, 144 },
147 145
148 //------------------------------------------------------------------------- 146 //-------------------------------------------------------------------------
149 147
150 'addNewRecordButton': function() { 148 'addNewRecordButton': function() {
151 return this._addNewRecordButton; 149 return this._addNewRecordButton;
152 }, 150 },
153 151
154 'setAddNewRecordButton': function(aValue) { 152 'setAddNewRecordButton': function(aValue) {
155 this._addNewRecordButton = aValue; 153 this._addNewRecordButton = aValue;
156 }, 154 },
157 155
158 'deleteRecordButton': function() { 156 'deleteRecordButton': function() {
159 return this._deleteRecordButton; 157 return this._deleteRecordButton;
160 }, 158 },
161 159
162 'setDeleteRecordButton': function(aValue) { 160 'setDeleteRecordButton': function(aValue) {
163 this._deleteRecordButton = aValue; 161 this._deleteRecordButton = aValue;
164 }, 162 },
165 163
166 //------------------------------------------------------------------------- 164 //-------------------------------------------------------------------------
167 165
168 'addNewRecord': function(anEvent) { 166 'addNewRecord': function(anEvent) {
169 var deferredResult; 167 var deferredResult;
170 // var currentNumberOfRecords; 168 // var currentNumberOfRecords;
171 169
172 deferredResult = new MochiKit.Async.Deferred(); 170 deferredResult = new MochiKit.Async.Deferred();
173 171
174 // currentNumberOfRecords = MochiKit.Base.keys(this.user().records()).length; 172 // currentNumberOfRecords = MochiKit.Base.keys(this.user().records()).length;
175/* 173/*
176 // if ((this.user().preferences().shouldShowDonationPanel()) && (currentNumberOfRecords > 0) && ((currentNumberOfRecords%10) == 0)) { 174 // if ((this.user().preferences().shouldShowDonationPanel()) && (currentNumberOfRecords > 0) && ((currentNumberOfRecords%10) == 0)) {
177 // if (true) { 175 // if (true) {
178 if ((this.user().preferences().shouldShowDonationPanel()) && (currentNumberOfRecords >= 5)) { 176 if ((this.user().preferences().shouldShowDonationPanel()) && (currentNumberOfRecords >= 5)) {
179 deferredResult.addCallback(Clipperz.PM.showDonationSplashScreen, this.user(), 'recordListAddRecordButton'); 177 deferredResult.addCallback(Clipperz.PM.showDonationSplashScreen, this.user(), 'recordListAddRecordButton');
180 } 178 }
181*/ 179*/
182 deferredResult.addCallback(MochiKit.Base.bind(function() { 180 deferredResult.addCallback(MochiKit.Base.bind(function() {
183 var currentlySelectedRecord; 181 var currentlySelectedRecord;
184 182
185 currentlySelecedRecord = this.selectedRecord(); 183 currentlySelecedRecord = this.selectedRecord();
186 this.setSelectedRecord(null); 184 this.setSelectedRecord(null);
187 185
188 YAHOO.ext.Element.get('recordDetailMainBlock').hide(); 186 YAHOO.ext.Element.get('recordDetailMainBlock').hide();
189 YAHOO.ext.Element.get('recordCreationWizardMainBlock').show(); 187 YAHOO.ext.Element.get('recordCreationWizardMainBlock').show();
190 this.setCreationWizard(new Clipperz.PM.Components.RecordDetail.CreationWizard(YAHOO.ext.Element.get('recordCreationWizardMainBlock'), {previouslySelectedRecord:currentlySelecedRecord, mainComponent:this})); 188 this.setCreationWizard(new Clipperz.PM.Components.RecordDetail.CreationWizard(YAHOO.ext.Element.get('recordCreationWizardMainBlock'), {previouslySelectedRecord:currentlySelecedRecord, mainComponent:this}));
191 189
192 this.enterModalView(); 190 this.enterModalView();
193 }, this)); 191 }, this));
194 192
195 deferredResult.callback(); 193 deferredResult.callback();
196 }, 194 },
197 195
198 //------------------------------------------------------------------------- 196 //-------------------------------------------------------------------------
199 197
200 'creationWizard': function() { 198 'creationWizard': function() {
201 return this._creationWizard; 199 return this._creationWizard;
202 }, 200 },
203 201
204 'setCreationWizard': function(aValue) { 202 'setCreationWizard': function(aValue) {
205 this._creationWizard = aValue; 203 this._creationWizard = aValue;
206 }, 204 },
207 205
208 //------------------------------------------------------------------------- 206 //-------------------------------------------------------------------------
209 207
210 'exitWizard': function(aSelectedRecord, shouldEnterEditMode) { 208 'exitWizard': function(aSelectedRecord, shouldEnterEditMode) {
211//MochiKit.Logging.logDebug(">>> MainPanel.exitWizard - " + aSelectedRecord) 209//MochiKit.Logging.logDebug(">>> MainPanel.exitWizard - " + aSelectedRecord)
212 YAHOO.ext.Element.get('recordCreationWizardMainBlock').hide(); 210 YAHOO.ext.Element.get('recordCreationWizardMainBlock').hide();
213 YAHOO.ext.Element.get('recordDetailMainBlock').show(); 211 YAHOO.ext.Element.get('recordDetailMainBlock').show();
214 212