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.js32
1 files changed, 31 insertions, 1 deletions
diff --git a/frontend/beta/js/Clipperz/PM/Components/Panels/MainPanel.js b/frontend/beta/js/Clipperz/PM/Components/Panels/MainPanel.js
index c19a8a3..bab5fba 100644
--- a/frontend/beta/js/Clipperz/PM/Components/Panels/MainPanel.js
+++ b/frontend/beta/js/Clipperz/PM/Components/Panels/MainPanel.js
@@ -1,336 +1,366 @@
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) == 'undefined') { Clipperz = {}; } 24if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
25if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } 25if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
26if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; } 26if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
27if (typeof(Clipperz.PM.Components.Panels) == 'undefined') { Clipperz.PM.Components.Panels = {}; } 27if (typeof(Clipperz.PM.Components.Panels) == 'undefined') { Clipperz.PM.Components.Panels = {}; }
28 28
29//############################################################################# 29//#############################################################################
30 30
31Clipperz.PM.Components.Panels.MainPanel = function(anElement, args) { 31Clipperz.PM.Components.Panels.MainPanel = function(anElement, args) {
32 args = args || {}; 32 args = args || {};
33 33
34 Clipperz.PM.Components.Panels.MainPanel.superclass.constructor.call(this, anElement, args); 34 Clipperz.PM.Components.Panels.MainPanel.superclass.constructor.call(this, anElement, args);
35 35
36 this._recordListDataModel = null; 36 this._recordListDataModel = null;
37 this._selectedRecord = null; 37 this._selectedRecord = null;
38 this._recordDetailComponent = null; 38 this._recordDetailComponent = null;
39 this._recordListGrid = null; 39 this._recordListGrid = null;
40 40
41 this._directLinkItemTemplate = null; 41 this._directLinkItemTemplate = null;
42 this._recordItemTemplate = null; 42 this._recordItemTemplate = null;
43 43
44 this._addNewRecordButton = null; 44 this._addNewRecordButton = null;
45 this._deleteRecordButton = null; 45 this._deleteRecordButton = null;
46 46
47 this._creationWizard = null; 47 this._creationWizard = null;
48 48
49 Clipperz.NotificationCenter.register(null, 'selectAndEnterEditMode', this, 'selectRecordAndEnterEditModeHandler'); 49 Clipperz.NotificationCenter.register(null, 'selectAndEnterEditMode', this, 'selectRecordAndEnterEditModeHandler');
50 50
51 Clipperz.NotificationCenter.register(null, 'recordAdded', this, 'recordAddedHandler'); 51 Clipperz.NotificationCenter.register(null, 'recordAdded', this, 'recordAddedHandler');
52 Clipperz.NotificationCenter.register(null, 'recordUpdated', this, 'recordUpdatedHandler'); 52 Clipperz.NotificationCenter.register(null, 'recordUpdated', this, 'recordUpdatedHandler');
53 Clipperz.NotificationCenter.register(null, 'recordRemoved', this, 'recordRemovedHandler'); 53 Clipperz.NotificationCenter.register(null, 'recordRemoved', this, 'recordRemovedHandler');
54 54
55 Clipperz.NotificationCenter.register(null, 'directLoginAdded', this, 'directLoginAddedHandler'); 55 Clipperz.NotificationCenter.register(null, 'directLoginAdded', this, 'directLoginAddedHandler');
56 Clipperz.NotificationCenter.register(null, 'directLoginUpdated', this, 'directLoginUpdatedHandler'); 56 Clipperz.NotificationCenter.register(null, 'directLoginUpdated', this, 'directLoginUpdatedHandler');
57 Clipperz.NotificationCenter.register(null, 'directLoginRemoved', this, 'directLoginRemovedHandler'); 57 Clipperz.NotificationCenter.register(null, 'directLoginRemoved', this, 'directLoginRemovedHandler');
58 58
59 Clipperz.NotificationCenter.register(null, 'accountLocked', this, 'accountLockedHandler'); 59 Clipperz.NotificationCenter.register(null, 'accountLocked', this, 'accountLockedHandler');
60 60
61 MochiKit.Signal.connect(MochiKit.DOM.currentWindow(), 'onresize', this, 'resizeModalMask'); 61 MochiKit.Signal.connect(MochiKit.DOM.currentWindow(), 'onresize', this, 'resizeModalMask');
62 this.render(); 62 this.render();
63 63
64 return this; 64 return this;
65} 65}
66 66
67//============================================================================= 67//=============================================================================
68 68
69YAHOO.extendX(Clipperz.PM.Components.Panels.MainPanel, Clipperz.PM.Components.Panels.BasePanel, { 69YAHOO.extendX(Clipperz.PM.Components.Panels.MainPanel, Clipperz.PM.Components.Panels.BasePanel, {
70 70
71 'toString': function() { 71 'toString': function() {
72 return "Clipperz.PM.Components.Panels.MainPanel component"; 72 return "Clipperz.PM.Components.Panels.MainPanel component";
73 }, 73 },
74 74
75 //------------------------------------------------------------------------- 75 //-------------------------------------------------------------------------
76 76
77 'render': function() { 77 'render': function() {
78 this.element().update(""); 78 this.element().update("");
79 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:[
80 {tag:'tbody', children:[ 80 {tag:'tbody', children:[
81 {tag:'tr', children:[ 81 {tag:'tr', children:[
82 {tag:'td', width:'15', children:[ 82 {tag:'td', width:'15', children:[
83 {tag:'div', cls:'mainPanelMinHeightDiv'} 83 {tag:'div', cls:'mainPanelMinHeightDiv'}
84 ]}, 84 ]},
85 {tag:'td', valign:'top', id:'directLoginsTD', width:'200', children:[ 85 {tag:'td', valign:'top', id:'directLoginsTD', width:'200', children:[
86 {tag:'div', id:'accountStatus', children:[
87 {tag:'div', cls:'header', children:[{tag:'h5', cls:'title', htmlString:"Account info"}]},
88 // {tag:'div', cls:'accountStatus', html:"early adopter"},
89 {tag:'div', cls:'accountLevel', children:[
90 {tag:'span', cls:'label', html:"status"},
91 {tag:'span', cls:'status', html:"early adopter"}
92 ]},
93 {tag:'div', cls:'accountLevel', children:[
94 {tag:'span', cls:'label', html:"level"},
95 // {tag:'span', cls:'level', html:"★☆☆☆"}
96 {tag:'span', cls:'level', html:"☆☆☆☆"}
97 ]},
98 {tag:'div', cls:'accountExpiration', children:[
99 {tag:'span', cls:'label', html:"expires"},
100 // {tag:'span', cls:'expriation', html:"on 26 April 2014"}
101 {tag:'span', cls:'expriation', html:"never"}
102 ]},
103 // {tag:'div', cls:'payButton', children:[
104 // {tag:'a', href:'#', cls:'info', html:"info"}
105 // ]}
106 {tag:'div', id:'payButton', cls:'payButton'}
107 ]},
86 {tag:'div', id:'directLoginsBlock', children:[ 108 {tag:'div', id:'directLoginsBlock', children:[
87 {tag:'div', cls:'directLoginsBlockHeaderBox', children:[{tag:'h3', id:'directLoginTitle', htmlString:Clipperz.PM.Strings['mainPanelDirectLoginBlockLabel']}]}, 109 {tag:'div', cls:'directLoginsBlockHeaderBox', children:[{tag:'h3', id:'directLoginTitle', htmlString:Clipperz.PM.Strings['mainPanelDirectLoginBlockLabel']}]},
88 {tag:'div', id:'directLoginsDescription', htmlString:Clipperz.PM.Strings['mainPanelDirectLoginBlockDescription']}, 110 {tag:'div', id:'directLoginsDescription', htmlString:Clipperz.PM.Strings['mainPanelDirectLoginBlockDescription']},
89 {tag:'ul', id:'directLogins'} 111 {tag:'ul', id:'directLogins'}
90 ]} 112 ]}
91 ]}, 113 ]},
92 {tag:'td', width:'15', children:[ 114 {tag:'td', width:'15', children:[
93 {tag:'div', cls:'mainPanelMinHeightDiv'} 115 {tag:'div', cls:'mainPanelMinHeightDiv'}
94 ]}, 116 ]},
95 {tag:'td', valign:'top', children:[ 117 {tag:'td', valign:'top', children:[
96 {tag:'div', id:'mainContent', children:[ 118 {tag:'div', id:'mainContent', children:[
97 {tag:'div', id:'recordListBlockHeader'}, 119 {tag:'div', id:'recordListBlockHeader'},
98 {tag:'div', id:'recordListAndDetailBlock', children:[ 120 {tag:'div', id:'recordListAndDetailBlock', children:[
99 {tag:'table', id:'recordListAndDetailBlockTABLE', border:'0', cellspacing:'0', cellpadding:'0', children:[ 121 {tag:'table', id:'recordListAndDetailBlockTABLE', border:'0', cellspacing:'0', cellpadding:'0', children:[
100 {tag:'tbody', children:[ 122 {tag:'tbody', children:[
101 {tag:'tr', children:[ 123 {tag:'tr', children:[
102 {tag:'td', valign:'top', width:'250', children:[ 124 {tag:'td', valign:'top', width:'250', children:[
103 {tag:'div', id:'recordListBlock', children:[ 125 {tag:'div', id:'recordListBlock', children:[
104 {tag:'div', id:'recordListFilterHeader'}, 126 {tag:'div', id:'recordListFilterHeader'},
105 {tag:'ul', id:'records'} 127 {tag:'ul', id:'records'}
106 ]} 128 ]}
107 ]}, 129 ]},
108 {tag:'td', id:'recordDetailSeparatorTD', rowspan:'2', valign:'top', bgcolor:'#ddddff', html:' '}, 130 {tag:'td', id:'recordDetailSeparatorTD', rowspan:'2', valign:'top', bgcolor:'#ddddff', html:' '},
109 {tag:'td', valign:'top', children:[ 131 {tag:'td', valign:'top', children:[
110 {tag:'div', id:'recordDetailMainBlock', children:[ 132 {tag:'div', id:'recordDetailMainBlock', children:[
111 {tag:'div', id:'recordTitleTopBlock'}, 133 {tag:'div', id:'recordTitleTopBlock'},
112 {tag:'div', id:'recordDetailBlock', children:[ 134 {tag:'div', id:'recordDetailBlock', children:[
113 {tag:'div', id:'recordDetail'} 135 {tag:'div', id:'recordDetail'}
114 ]} 136 ]}
115 ]}, 137 ]},
116 {tag:'div', id:'recordCreationWizardMainBlock', children:[ 138 {tag:'div', id:'recordCreationWizardMainBlock', children:[
117 {tag:'div', id:'recordCreationWizard', html:"WIZARD"} 139 {tag:'div', id:'recordCreationWizard', html:"WIZARD"}
118 ]} 140 ]}
119 ]} 141 ]}
120 ]}, 142 ]},
121 {tag:'tr', children:[ 143 {tag:'tr', children:[
122 {tag:'td', id:'cardBoxLowerLeftTD', html:' '}, 144 {tag:'td', id:'cardBoxLowerLeftTD', html:' '},
123 {tag:'td', id:'cardBoxLowerRightTD', html:' '} 145 {tag:'td', id:'cardBoxLowerRightTD', html:' '}
124 ]} 146 ]}
125 ]} 147 ]}
126 ]} 148 ]}
127 ]} 149 ]}
128 ]} 150 ]}
129 ]}, 151 ]},
130 {tag:'td', width:'15', html:" "} 152 {tag:'td', width:'15', html:" "}
131 ]} 153 ]}
132 ]} 154 ]}
133 ]}); 155 ]});
134 156
135 this.renderRecordListBlockHeader(); 157 this.renderRecordListBlockHeader();
136 // this.renderRecordListFilterHeader(); 158 // this.renderRecordListFilterHeader();
137 159
138 YAHOO.ext.Element.get('directLogins').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide(); 160 YAHOO.ext.Element.get('directLogins').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide();
139 161 //TODO
162 new YAHOO.ext.Button('payButton', {text:"Info", handler:this.payButtonHandler, scope:this});
163
140 this.recordDetailComponent(); 164 this.recordDetailComponent();
141 165
142 YAHOO.ext.Element.get('recordDetailMainBlock').setVisibilityMode(YAHOO.ext.Element.DISPLAY).show(); 166 YAHOO.ext.Element.get('recordDetailMainBlock').setVisibilityMode(YAHOO.ext.Element.DISPLAY).show();
143 YAHOO.ext.Element.get('recordCreationWizardMainBlock').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide(); 167 YAHOO.ext.Element.get('recordCreationWizardMainBlock').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide();
144 }, 168 },
169
170 //-------------------------------------------------------------------------
171
172 'payButtonHandler': function(anEvent) {
173 window.open('https://www.clipperz.com/pricing/', '_blank');
174 },
145 175
146 //------------------------------------------------------------------------- 176 //-------------------------------------------------------------------------
147 177
148 'addNewRecordButton': function() { 178 'addNewRecordButton': function() {
149 return this._addNewRecordButton; 179 return this._addNewRecordButton;
150 }, 180 },
151 181
152 'setAddNewRecordButton': function(aValue) { 182 'setAddNewRecordButton': function(aValue) {
153 this._addNewRecordButton = aValue; 183 this._addNewRecordButton = aValue;
154 }, 184 },
155 185
156 'deleteRecordButton': function() { 186 'deleteRecordButton': function() {
157 return this._deleteRecordButton; 187 return this._deleteRecordButton;
158 }, 188 },
159 189
160 'setDeleteRecordButton': function(aValue) { 190 'setDeleteRecordButton': function(aValue) {
161 this._deleteRecordButton = aValue; 191 this._deleteRecordButton = aValue;
162 }, 192 },
163 193
164 //------------------------------------------------------------------------- 194 //-------------------------------------------------------------------------
165 195
166 'addNewRecord': function(anEvent) { 196 'addNewRecord': function(anEvent) {
167 var deferredResult; 197 var deferredResult;
168 // var currentNumberOfRecords; 198 // var currentNumberOfRecords;
169 199
170 deferredResult = new MochiKit.Async.Deferred(); 200 deferredResult = new MochiKit.Async.Deferred();
171 201
172 // currentNumberOfRecords = MochiKit.Base.keys(this.user().records()).length; 202 // currentNumberOfRecords = MochiKit.Base.keys(this.user().records()).length;
173/* 203/*
174 // if ((this.user().preferences().shouldShowDonationPanel()) && (currentNumberOfRecords > 0) && ((currentNumberOfRecords%10) == 0)) { 204 // if ((this.user().preferences().shouldShowDonationPanel()) && (currentNumberOfRecords > 0) && ((currentNumberOfRecords%10) == 0)) {
175 // if (true) { 205 // if (true) {
176 if ((this.user().preferences().shouldShowDonationPanel()) && (currentNumberOfRecords >= 5)) { 206 if ((this.user().preferences().shouldShowDonationPanel()) && (currentNumberOfRecords >= 5)) {
177 deferredResult.addCallback(Clipperz.PM.showDonationSplashScreen, this.user(), 'recordListAddRecordButton'); 207 deferredResult.addCallback(Clipperz.PM.showDonationSplashScreen, this.user(), 'recordListAddRecordButton');
178 } 208 }
179*/ 209*/
180 deferredResult.addCallback(MochiKit.Base.bind(function() { 210 deferredResult.addCallback(MochiKit.Base.bind(function() {
181 var currentlySelectedRecord; 211 var currentlySelectedRecord;
182 212
183 currentlySelecedRecord = this.selectedRecord(); 213 currentlySelecedRecord = this.selectedRecord();
184 this.setSelectedRecord(null); 214 this.setSelectedRecord(null);
185 215
186 YAHOO.ext.Element.get('recordDetailMainBlock').hide(); 216 YAHOO.ext.Element.get('recordDetailMainBlock').hide();
187 YAHOO.ext.Element.get('recordCreationWizardMainBlock').show(); 217 YAHOO.ext.Element.get('recordCreationWizardMainBlock').show();
188 this.setCreationWizard(new Clipperz.PM.Components.RecordDetail.CreationWizard(YAHOO.ext.Element.get('recordCreationWizardMainBlock'), {previouslySelectedRecord:currentlySelecedRecord, mainComponent:this})); 218 this.setCreationWizard(new Clipperz.PM.Components.RecordDetail.CreationWizard(YAHOO.ext.Element.get('recordCreationWizardMainBlock'), {previouslySelectedRecord:currentlySelecedRecord, mainComponent:this}));
189 219
190 this.enterModalView(); 220 this.enterModalView();
191 }, this)); 221 }, this));
192 222
193 deferredResult.callback(); 223 deferredResult.callback();
194 }, 224 },
195 225
196 //------------------------------------------------------------------------- 226 //-------------------------------------------------------------------------
197 227
198 'creationWizard': function() { 228 'creationWizard': function() {
199 return this._creationWizard; 229 return this._creationWizard;
200 }, 230 },
201 231
202 'setCreationWizard': function(aValue) { 232 'setCreationWizard': function(aValue) {
203 this._creationWizard = aValue; 233 this._creationWizard = aValue;
204 }, 234 },
205 235
206 //------------------------------------------------------------------------- 236 //-------------------------------------------------------------------------
207 237
208 'exitWizard': function(aSelectedRecord, shouldEnterEditMode) { 238 'exitWizard': function(aSelectedRecord, shouldEnterEditMode) {
209//MochiKit.Logging.logDebug(">>> MainPanel.exitWizard - " + aSelectedRecord) 239//MochiKit.Logging.logDebug(">>> MainPanel.exitWizard - " + aSelectedRecord)
210 YAHOO.ext.Element.get('recordCreationWizardMainBlock').hide(); 240 YAHOO.ext.Element.get('recordCreationWizardMainBlock').hide();
211 YAHOO.ext.Element.get('recordDetailMainBlock').show(); 241 YAHOO.ext.Element.get('recordDetailMainBlock').show();
212 242
213 if (shouldEnterEditMode == true) { 243 if (shouldEnterEditMode == true) {
214 this.selectRecordAndEnterEditMode(aSelectedRecord); 244 this.selectRecordAndEnterEditMode(aSelectedRecord);
215 } else { 245 } else {
216 this.setSelectedRecord(aSelectedRecord); 246 this.setSelectedRecord(aSelectedRecord);
217 this.exitModalView(); 247 this.exitModalView();
218 } 248 }
219 249
220 this.creationWizard().remove(); 250 this.creationWizard().remove();
221 this.setCreationWizard(null); 251 this.setCreationWizard(null);
222//MochiKit.Logging.logDebug("<<< MainPanel.exitWizard"); 252//MochiKit.Logging.logDebug("<<< MainPanel.exitWizard");
223 }, 253 },
224 254
225 //------------------------------------------------------------------------- 255 //-------------------------------------------------------------------------
226 256
227 'selectRecordAndEnterEditMode': function(aRecord) { 257 'selectRecordAndEnterEditMode': function(aRecord) {
228 this.setSelectedRecord(aRecord); 258 this.setSelectedRecord(aRecord);
229 this.recordDetailComponent().setEditMode('EDIT'); 259 this.recordDetailComponent().setEditMode('EDIT');
230 }, 260 },
231 261
232 'selectRecordAndEnterEditModeHandler': function(anEvent) { 262 'selectRecordAndEnterEditModeHandler': function(anEvent) {
233 this.selectRecordAndEnterEditMode(anEvent.source()); 263 this.selectRecordAndEnterEditMode(anEvent.source());
234 }, 264 },
235 265
236 //------------------------------------------------------------------------- 266 //-------------------------------------------------------------------------
237 267
238 'resizeModalMask': function() { 268 'resizeModalMask': function() {
239//MochiKit.Logging.logDebug(">>> MainPanel.resizeModalMask"); 269//MochiKit.Logging.logDebug(">>> MainPanel.resizeModalMask");
240 MochiKit.Style.setElementDimensions('recordDetailEditModeHeaderMask', {w:MochiKit.Style.getElementDimensions('mainDiv').w, h:119}); 270 MochiKit.Style.setElementDimensions('recordDetailEditModeHeaderMask', {w:MochiKit.Style.getElementDimensions('mainDiv').w, h:119});
241 271
242 MochiKit.Style.setElementDimensions('recordDetailEditModeVerticalMask', {w:511, h:MochiKit.Style.getElementDimensions('mainDiv').h - 119}); 272 MochiKit.Style.setElementDimensions('recordDetailEditModeVerticalMask', {w:511, h:MochiKit.Style.getElementDimensions('mainDiv').h - 119});
243//MochiKit.Logging.logDebug("<<< MainPanel.resizeModalMask"); 273//MochiKit.Logging.logDebug("<<< MainPanel.resizeModalMask");
244 }, 274 },
245 275
246 //------------------------------------------------------------------------- 276 //-------------------------------------------------------------------------
247 277
248 'enterModalView': function() { 278 'enterModalView': function() {
249 if (this.user().preferences().useSafeEditMode()) { 279 if (this.user().preferences().useSafeEditMode()) {
250 var headerMaskElement; 280 var headerMaskElement;
251 var verticalMaskElement; 281 var verticalMaskElement;
252 282
253 this.resizeModalMask(); 283 this.resizeModalMask();
254 284
255 headerMaskElement = YAHOO.ext.Element.get('recordDetailEditModeHeaderMask'); 285 headerMaskElement = YAHOO.ext.Element.get('recordDetailEditModeHeaderMask');
256 headerMaskElement.show(); 286 headerMaskElement.show();
257 headerMaskElement.mask(); 287 headerMaskElement.mask();
258 288
259 verticalMaskElement = YAHOO.ext.Element.get('recordDetailEditModeVerticalMask'); 289 verticalMaskElement = YAHOO.ext.Element.get('recordDetailEditModeVerticalMask');
260 verticalMaskElement.show(); 290 verticalMaskElement.show();
261 verticalMaskElement.mask(); 291 verticalMaskElement.mask();
262 } 292 }
263 }, 293 },
264 294
265 //------------------------------------------------------------------------- 295 //-------------------------------------------------------------------------
266 296
267 'exitModalView': function() { 297 'exitModalView': function() {
268 if (this.user().preferences().useSafeEditMode()) { 298 if (this.user().preferences().useSafeEditMode()) {
269 var headerMaskElement; 299 var headerMaskElement;
270 var verticalMaskElement; 300 var verticalMaskElement;
271 301
272 headerMaskElement = YAHOO.ext.Element.get('recordDetailEditModeHeaderMask'); 302 headerMaskElement = YAHOO.ext.Element.get('recordDetailEditModeHeaderMask');
273 headerMaskElement.unmask(); 303 headerMaskElement.unmask();
274 headerMaskElement.hide(); 304 headerMaskElement.hide();
275 305
276 verticalMaskElement = YAHOO.ext.Element.get('recordDetailEditModeVerticalMask'); 306 verticalMaskElement = YAHOO.ext.Element.get('recordDetailEditModeVerticalMask');
277 verticalMaskElement.unmask(); 307 verticalMaskElement.unmask();
278 verticalMaskElement.hide(); 308 verticalMaskElement.hide();
279 } 309 }
280 }, 310 },
281 311
282 //------------------------------------------------------------------------- 312 //-------------------------------------------------------------------------
283 313
284 'removeSelectedRecord': function() { 314 'removeSelectedRecord': function() {
285 var selectedRecordReferences; 315 var selectedRecordReferences;
286 316
287//MochiKit.Logging.logDebug(">>> MainPanel.removeSelectedRecord"); 317//MochiKit.Logging.logDebug(">>> MainPanel.removeSelectedRecord");
288 if (this.selectedRecord() != null) { 318 if (this.selectedRecord() != null) {
289 selectedRecordReferences = [this.selectedRecord().reference()]; 319 selectedRecordReferences = [this.selectedRecord().reference()];
290 } else { 320 } else {
291 selectedRecordReferences = []; 321 selectedRecordReferences = [];
292 } 322 }
293 323
294 if (selectedRecordReferences.length > 0 ) { 324 if (selectedRecordReferences.length > 0 ) {
295 varrecordReference; 325 varrecordReference;
296 varrecords; 326 varrecords;
297 var deferred; 327 var deferred;
298 328
299 records = []; 329 records = [];
300 for (recordReference in selectedRecordReferences) { 330 for (recordReference in selectedRecordReferences) {
301 var record; 331 var record;
302 332
303//MochiKit.Logging.logDebug("### MainPanel.removeSelectedRecord - recordReference: " + selectedRecordReferences[recordReference]); 333//MochiKit.Logging.logDebug("### MainPanel.removeSelectedRecord - recordReference: " + selectedRecordReferences[recordReference]);
304 record = this.user().records()[selectedRecordReferences[recordReference]]; 334 record = this.user().records()[selectedRecordReferences[recordReference]];
305//MochiKit.Logging.logDebug("### MainPanel.removeSelectedRecord - record: " + record); 335//MochiKit.Logging.logDebug("### MainPanel.removeSelectedRecord - record: " + record);
306 records.push(record); 336 records.push(record);
307 } 337 }
308//MochiKit.Logging.logDebug("### MainPanel.removeSelectedRecord - records.length: " + records.length); 338//MochiKit.Logging.logDebug("### MainPanel.removeSelectedRecord - records.length: " + records.length);
309 339
310 deferred = new MochiKit.Async.Deferred(); 340 deferred = new MochiKit.Async.Deferred();
311//MochiKit.Logging.logDebug("--- MainPanel.removeSelectedRecord - 1:"); 341//MochiKit.Logging.logDebug("--- MainPanel.removeSelectedRecord - 1:");
312//deferred.addBoth(function(res) {MochiKit.Logging.logDebug("MainPanel.removeSelectedRecord - 1: " + res); return res;}); 342//deferred.addBoth(function(res) {MochiKit.Logging.logDebug("MainPanel.removeSelectedRecord - 1: " + res); return res;});
313//MochiKit.Logging.logDebug("--- MainPanel.removeSelectedRecord - 2:"); 343//MochiKit.Logging.logDebug("--- MainPanel.removeSelectedRecord - 2:");
314 deferred.addCallback(function() { 344 deferred.addCallback(function() {
315 var deferredResult; 345 var deferredResult;
316 346
317 deferredResult = new MochiKit.Async.Deferred(); 347 deferredResult = new MochiKit.Async.Deferred();
318 Clipperz.PM.Components.MessageBox().deferredShow({ 348 Clipperz.PM.Components.MessageBox().deferredShow({
319 title:Clipperz.PM.Strings['mainPanelDeletingRecordPanelConfirmationTitle'], 349 title:Clipperz.PM.Strings['mainPanelDeletingRecordPanelConfirmationTitle'],
320 text:Clipperz.PM.Strings['mainPanelDeleteRecordPanelConfirmationText'], 350 text:Clipperz.PM.Strings['mainPanelDeleteRecordPanelConfirmationText'],
321 width:240, 351 width:240,
322 showProgressBar:false, 352 showProgressBar:false,
323 showCloseButton:false, 353 showCloseButton:false,
324 buttons:{ 354 buttons:{
325 'yes':Clipperz.PM.Strings['mainPanelDeleteRecordPanelConfirmButtonLabel'], 355 'yes':Clipperz.PM.Strings['mainPanelDeleteRecordPanelConfirmButtonLabel'],
326 'no':Clipperz.PM.Strings['mainPanelDeleteRecordPanelDenyButtonLabel'] 356 'no':Clipperz.PM.Strings['mainPanelDeleteRecordPanelDenyButtonLabel']
327 }, 357 },
328 fn:MochiKit.Base.partial(function(aDeferred, aResult) { 358 fn:MochiKit.Base.partial(function(aDeferred, aResult) {
329 if (aResult == 'yes') { 359 if (aResult == 'yes') {
330 aDeferred.callback(aResult); 360 aDeferred.callback(aResult);
331 } else { 361 } else {
332 aDeferred.errback(aResult); 362 aDeferred.errback(aResult);
333 } 363 }
334 }, deferredResult) 364 }, deferredResult)
335 }, 'recordListRemoveRecordButton'); 365 }, 'recordListRemoveRecordButton');
336 366