author | Giulio Cesare Solaroli <giulio.cesare@clipperz.com> | 2011-10-02 23:56:18 (UTC) |
---|---|---|
committer | Giulio Cesare Solaroli <giulio.cesare@clipperz.com> | 2011-10-02 23:56:18 (UTC) |
commit | ef68436ac04da078ffdcacd7e1f785473a303d45 (patch) (unidiff) | |
tree | c403752d66a2c4775f00affd4fa8431b29c5b68c /frontend/beta/js/Clipperz/PM/Components/Panels/MainPanel.js | |
parent | 597ecfbc0249d83e1b856cbd558340c01237a360 (diff) | |
download | clipperz-ef68436ac04da078ffdcacd7e1f785473a303d45.zip clipperz-ef68436ac04da078ffdcacd7e1f785473a303d45.tar.gz clipperz-ef68436ac04da078ffdcacd7e1f785473a303d45.tar.bz2 |
First version of the newly restructured repository
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.js | 906 |
1 files changed, 906 insertions, 0 deletions
diff --git a/frontend/beta/js/Clipperz/PM/Components/Panels/MainPanel.js b/frontend/beta/js/Clipperz/PM/Components/Panels/MainPanel.js new file mode 100644 index 0000000..e2036d0 --- a/dev/null +++ b/frontend/beta/js/Clipperz/PM/Components/Panels/MainPanel.js | |||
@@ -0,0 +1,906 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
7 | and efficient set of cryptographic functions. The library aims to | ||
8 | obtain maximum execution speed while preserving modularity and | ||
9 | reusability. | ||
10 | For further information about its features and functionalities please | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | it and/or modify it under the terms of the GNU Affero General Public | ||
15 | License as published by the Free Software Foundation, either version | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | ||
30 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | ||
31 | if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; } | ||
32 | if (typeof(Clipperz.PM.Components.Panels) == 'undefined') { Clipperz.PM.Components.Panels = {}; } | ||
33 | |||
34 | //############################################################################# | ||
35 | |||
36 | Clipperz.PM.Components.Panels.MainPanel = function(anElement, args) { | ||
37 | args = args || {}; | ||
38 | |||
39 | Clipperz.PM.Components.Panels.MainPanel.superclass.constructor.call(this, anElement, args); | ||
40 | |||
41 | this._recordListDataModel = null; | ||
42 | this._selectedRecord = null; | ||
43 | this._recordDetailComponent = null; | ||
44 | this._recordListGrid = null; | ||
45 | |||
46 | this._directLinkItemTemplate = null; | ||
47 | this._recordItemTemplate = null; | ||
48 | |||
49 | this._addNewRecordButton = null; | ||
50 | this._deleteRecordButton = null; | ||
51 | |||
52 | this._creationWizard = null; | ||
53 | |||
54 | Clipperz.NotificationCenter.register(null, 'selectAndEnterEditMode', this, 'selectRecordAndEnterEditModeHandler'); | ||
55 | |||
56 | Clipperz.NotificationCenter.register(null, 'recordAdded', this, 'recordAddedHandler'); | ||
57 | Clipperz.NotificationCenter.register(null, 'recordUpdated', this, 'recordUpdatedHandler'); | ||
58 | Clipperz.NotificationCenter.register(null, 'recordRemoved', this, 'recordRemovedHandler'); | ||
59 | |||
60 | Clipperz.NotificationCenter.register(null, 'directLoginAdded', this, 'directLoginAddedHandler'); | ||
61 | Clipperz.NotificationCenter.register(null, 'directLoginUpdated', this, 'directLoginUpdatedHandler'); | ||
62 | Clipperz.NotificationCenter.register(null, 'directLoginRemoved', this, 'directLoginRemovedHandler'); | ||
63 | |||
64 | Clipperz.NotificationCenter.register(null, 'accountLocked', this, 'accountLockedHandler'); | ||
65 | |||
66 | MochiKit.Signal.connect(MochiKit.DOM.currentWindow(), 'onresize', this, 'resizeModalMask'); | ||
67 | this.render(); | ||
68 | |||
69 | return this; | ||
70 | } | ||
71 | |||
72 | //============================================================================= | ||
73 | |||
74 | YAHOO.extendX(Clipperz.PM.Components.Panels.MainPanel, Clipperz.PM.Components.Panels.BasePanel, { | ||
75 | |||
76 | 'toString': function() { | ||
77 | return "Clipperz.PM.Components.Panels.MainPanel component"; | ||
78 | }, | ||
79 | |||
80 | //------------------------------------------------------------------------- | ||
81 | |||
82 | 'render': function() { | ||
83 | this.element().update(""); | ||
84 | Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'table', id:'mainPanelTABLE', border:'0', cellspacing:'0', cellpadding:'0', children:[ | ||
85 | {tag:'tbody', children:[ | ||
86 | {tag:'tr', children:[ | ||
87 | {tag:'td', width:'15', children:[ | ||
88 | {tag:'div', cls:'mainPanelMinHeightDiv'} | ||
89 | ]}, | ||
90 | {tag:'td', valign:'top', id:'directLoginsTD', width:'200', children:[ | ||
91 | {tag:'div', id:'directLoginsBlock', children:[ | ||
92 | {tag:'div', cls:'directLoginsBlockHeaderBox', children:[{tag:'h3', id:'directLoginTitle', htmlString:Clipperz.PM.Strings['mainPanelDirectLoginBlockLabel']}]}, | ||
93 | {tag:'div', id:'directLoginsDescription', htmlString:Clipperz.PM.Strings['mainPanelDirectLoginBlockDescription']}, | ||
94 | {tag:'ul', id:'directLogins'} | ||
95 | ]} | ||
96 | ]}, | ||
97 | {tag:'td', width:'15', children:[ | ||
98 | {tag:'div', cls:'mainPanelMinHeightDiv'} | ||
99 | ]}, | ||
100 | {tag:'td', valign:'top', children:[ | ||
101 | {tag:'div', id:'mainContent', children:[ | ||
102 | {tag:'div', id:'recordListBlockHeader'}, | ||
103 | {tag:'div', id:'recordListAndDetailBlock', children:[ | ||
104 | {tag:'table', id:'recordListAndDetailBlockTABLE', border:'0', cellspacing:'0', cellpadding:'0', children:[ | ||
105 | {tag:'tbody', children:[ | ||
106 | {tag:'tr', children:[ | ||
107 | {tag:'td', valign:'top', width:'250', children:[ | ||
108 | {tag:'div', id:'recordListBlock', children:[ | ||
109 | {tag:'div', id:'recordListFilterHeader'}, | ||
110 | {tag:'ul', id:'records'} | ||
111 | ]} | ||
112 | ]}, | ||
113 | {tag:'td', id:'recordDetailSeparatorTD', rowspan:'2', valign:'top', bgcolor:'#ddddff', html:' '}, | ||
114 | {tag:'td', valign:'top', children:[ | ||
115 | {tag:'div', id:'recordDetailMainBlock', children:[ | ||
116 | {tag:'div', id:'recordTitleTopBlock'}, | ||
117 | {tag:'div', id:'recordDetailBlock', children:[ | ||
118 | {tag:'div', id:'recordDetail'} | ||
119 | ]} | ||
120 | ]}, | ||
121 | {tag:'div', id:'recordCreationWizardMainBlock', children:[ | ||
122 | {tag:'div', id:'recordCreationWizard', html:"WIZARD"} | ||
123 | ]} | ||
124 | ]} | ||
125 | ]}, | ||
126 | {tag:'tr', children:[ | ||
127 | {tag:'td', id:'cardBoxLowerLeftTD', html:' '}, | ||
128 | {tag:'td', id:'cardBoxLowerRightTD', html:' '} | ||
129 | ]} | ||
130 | ]} | ||
131 | ]} | ||
132 | ]} | ||
133 | ]} | ||
134 | ]}, | ||
135 | {tag:'td', width:'15', html:" "} | ||
136 | ]} | ||
137 | ]} | ||
138 | ]}); | ||
139 | |||
140 | this.renderRecordListBlockHeader(); | ||
141 | // this.renderRecordListFilterHeader(); | ||
142 | |||
143 | YAHOO.ext.Element.get('directLogins').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide(); | ||
144 | |||
145 | this.recordDetailComponent(); | ||
146 | |||
147 | YAHOO.ext.Element.get('recordDetailMainBlock').setVisibilityMode(YAHOO.ext.Element.DISPLAY).show(); | ||
148 | YAHOO.ext.Element.get('recordCreationWizardMainBlock').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide(); | ||
149 | }, | ||
150 | |||
151 | //------------------------------------------------------------------------- | ||
152 | |||
153 | 'addNewRecordButton': function() { | ||
154 | return this._addNewRecordButton; | ||
155 | }, | ||
156 | |||
157 | 'setAddNewRecordButton': function(aValue) { | ||
158 | this._addNewRecordButton = aValue; | ||
159 | }, | ||
160 | |||
161 | 'deleteRecordButton': function() { | ||
162 | return this._deleteRecordButton; | ||
163 | }, | ||
164 | |||
165 | 'setDeleteRecordButton': function(aValue) { | ||
166 | this._deleteRecordButton = aValue; | ||
167 | }, | ||
168 | |||
169 | //------------------------------------------------------------------------- | ||
170 | |||
171 | 'addNewRecord': function(anEvent) { | ||
172 | var deferredResult; | ||
173 | // var currentNumberOfRecords; | ||
174 | |||
175 | deferredResult = new MochiKit.Async.Deferred(); | ||
176 | |||
177 | // currentNumberOfRecords = MochiKit.Base.keys(this.user().records()).length; | ||
178 | /* | ||
179 | // if ((this.user().preferences().shouldShowDonationPanel()) && (currentNumberOfRecords > 0) && ((currentNumberOfRecords%10) == 0)) { | ||
180 | // if (true) { | ||
181 | if ((this.user().preferences().shouldShowDonationPanel()) && (currentNumberOfRecords >= 5)) { | ||
182 | deferredResult.addCallback(Clipperz.PM.showDonationSplashScreen, this.user(), 'recordListAddRecordButton'); | ||
183 | } | ||
184 | */ | ||
185 | deferredResult.addCallback(MochiKit.Base.bind(function() { | ||
186 | var currentlySelectedRecord; | ||
187 | |||
188 | currentlySelecedRecord = this.selectedRecord(); | ||
189 | this.setSelectedRecord(null); | ||
190 | |||
191 | YAHOO.ext.Element.get('recordDetailMainBlock').hide(); | ||
192 | YAHOO.ext.Element.get('recordCreationWizardMainBlock').show(); | ||
193 | this.setCreationWizard(new Clipperz.PM.Components.RecordDetail.CreationWizard(YAHOO.ext.Element.get('recordCreationWizardMainBlock'), {previouslySelectedRecord:currentlySelecedRecord, mainComponent:this})); | ||
194 | |||
195 | this.enterModalView(); | ||
196 | }, this)); | ||
197 | |||
198 | deferredResult.callback(); | ||
199 | }, | ||
200 | |||
201 | //------------------------------------------------------------------------- | ||
202 | |||
203 | 'creationWizard': function() { | ||
204 | return this._creationWizard; | ||
205 | }, | ||
206 | |||
207 | 'setCreationWizard': function(aValue) { | ||
208 | this._creationWizard = aValue; | ||
209 | }, | ||
210 | |||
211 | //------------------------------------------------------------------------- | ||
212 | |||
213 | 'exitWizard': function(aSelectedRecord, shouldEnterEditMode) { | ||
214 | //MochiKit.Logging.logDebug(">>> MainPanel.exitWizard - " + aSelectedRecord) | ||
215 | YAHOO.ext.Element.get('recordCreationWizardMainBlock').hide(); | ||
216 | YAHOO.ext.Element.get('recordDetailMainBlock').show(); | ||
217 | |||
218 | if (shouldEnterEditMode == true) { | ||
219 | this.selectRecordAndEnterEditMode(aSelectedRecord); | ||
220 | } else { | ||
221 | this.setSelectedRecord(aSelectedRecord); | ||
222 | this.exitModalView(); | ||
223 | } | ||
224 | |||
225 | this.creationWizard().remove(); | ||
226 | this.setCreationWizard(null); | ||
227 | //MochiKit.Logging.logDebug("<<< MainPanel.exitWizard"); | ||
228 | }, | ||
229 | |||
230 | //------------------------------------------------------------------------- | ||
231 | |||
232 | 'selectRecordAndEnterEditMode': function(aRecord) { | ||
233 | this.setSelectedRecord(aRecord); | ||
234 | this.recordDetailComponent().setEditMode('EDIT'); | ||
235 | }, | ||
236 | |||
237 | 'selectRecordAndEnterEditModeHandler': function(anEvent) { | ||
238 | this.selectRecordAndEnterEditMode(anEvent.source()); | ||
239 | }, | ||
240 | |||
241 | //------------------------------------------------------------------------- | ||
242 | |||
243 | 'resizeModalMask': function() { | ||
244 | //MochiKit.Logging.logDebug(">>> MainPanel.resizeModalMask"); | ||
245 | MochiKit.Style.setElementDimensions('recordDetailEditModeHeaderMask', {w:MochiKit.Style.getElementDimensions('mainDiv').w, h:119}); | ||
246 | |||
247 | MochiKit.Style.setElementDimensions('recordDetailEditModeVerticalMask', {w:511, h:MochiKit.Style.getElementDimensions('mainDiv').h - 119}); | ||
248 | //MochiKit.Logging.logDebug("<<< MainPanel.resizeModalMask"); | ||
249 | }, | ||
250 | |||
251 | //------------------------------------------------------------------------- | ||
252 | |||
253 | 'enterModalView': function() { | ||
254 | if (this.user().preferences().useSafeEditMode()) { | ||
255 | var headerMaskElement; | ||
256 | var verticalMaskElement; | ||
257 | |||
258 | this.resizeModalMask(); | ||
259 | |||
260 | headerMaskElement = YAHOO.ext.Element.get('recordDetailEditModeHeaderMask'); | ||
261 | headerMaskElement.show(); | ||
262 | headerMaskElement.mask(); | ||
263 | |||
264 | verticalMaskElement = YAHOO.ext.Element.get('recordDetailEditModeVerticalMask'); | ||
265 | verticalMaskElement.show(); | ||
266 | verticalMaskElement.mask(); | ||
267 | } | ||
268 | }, | ||
269 | |||
270 | //------------------------------------------------------------------------- | ||
271 | |||
272 | 'exitModalView': function() { | ||
273 | if (this.user().preferences().useSafeEditMode()) { | ||
274 | var headerMaskElement; | ||
275 | var verticalMaskElement; | ||
276 | |||
277 | headerMaskElement = YAHOO.ext.Element.get('recordDetailEditModeHeaderMask'); | ||
278 | headerMaskElement.unmask(); | ||
279 | headerMaskElement.hide(); | ||
280 | |||
281 | verticalMaskElement = YAHOO.ext.Element.get('recordDetailEditModeVerticalMask'); | ||
282 | verticalMaskElement.unmask(); | ||
283 | verticalMaskElement.hide(); | ||
284 | } | ||
285 | }, | ||
286 | |||
287 | //------------------------------------------------------------------------- | ||
288 | |||
289 | 'removeSelectedRecord': function() { | ||
290 | var selectedRecordReferences; | ||
291 | |||
292 | //MochiKit.Logging.logDebug(">>> MainPanel.removeSelectedRecord"); | ||
293 | if (this.selectedRecord() != null) { | ||
294 | selectedRecordReferences = [this.selectedRecord().reference()]; | ||
295 | } else { | ||
296 | selectedRecordReferences = []; | ||
297 | } | ||
298 | |||
299 | if (selectedRecordReferences.length > 0 ) { | ||
300 | varrecordReference; | ||
301 | varrecords; | ||
302 | var deferred; | ||
303 | |||
304 | records = []; | ||
305 | for (recordReference in selectedRecordReferences) { | ||
306 | var record; | ||
307 | |||
308 | //MochiKit.Logging.logDebug("### MainPanel.removeSelectedRecord - recordReference: " + selectedRecordReferences[recordReference]); | ||
309 | record = this.user().records()[selectedRecordReferences[recordReference]]; | ||
310 | //MochiKit.Logging.logDebug("### MainPanel.removeSelectedRecord - record: " + record); | ||
311 | records.push(record); | ||
312 | } | ||
313 | //MochiKit.Logging.logDebug("### MainPanel.removeSelectedRecord - records.length: " + records.length); | ||
314 | |||
315 | deferred = new MochiKit.Async.Deferred(); | ||
316 | //MochiKit.Logging.logDebug("--- MainPanel.removeSelectedRecord - 1:"); | ||
317 | //deferred.addBoth(function(res) {MochiKit.Logging.logDebug("MainPanel.removeSelectedRecord - 1: " + res); return res;}); | ||
318 | //MochiKit.Logging.logDebug("--- MainPanel.removeSelectedRecord - 2:"); | ||
319 | deferred.addCallback(function() { | ||
320 | var deferredResult; | ||
321 | |||
322 | deferredResult = new MochiKit.Async.Deferred(); | ||
323 | Clipperz.PM.Components.MessageBox().deferredShow({ | ||
324 | title:Clipperz.PM.Strings['mainPanelDeletingRecordPanelConfirmationTitle'], | ||
325 | text:Clipperz.PM.Strings['mainPanelDeleteRecordPanelConfirmationText'], | ||
326 | width:240, | ||
327 | showProgressBar:false, | ||
328 | showCloseButton:false, | ||
329 | buttons:{ | ||
330 | 'yes':Clipperz.PM.Strings['mainPanelDeleteRecordPanelConfirmButtonLabel'], | ||
331 | 'no':Clipperz.PM.Strings['mainPanelDeleteRecordPanelDenyButtonLabel'] | ||
332 | }, | ||
333 | fn:MochiKit.Base.partial(function(aDeferred, aResult) { | ||
334 | if (aResult == 'yes') { | ||
335 | aDeferred.callback(aResult); | ||
336 | } else { | ||
337 | aDeferred.errback(aResult); | ||
338 | } | ||
339 | }, deferredResult) | ||
340 | }, 'recordListRemoveRecordButton'); | ||
341 | |||
342 | return deferredResult; | ||
343 | }); | ||
344 | //MochiKit.Logging.logDebug("--- MainPanel.removeSelectedRecord - 3:"); | ||
345 | //deferred.addBoth(function(res) {MochiKit.Logging.logDebug("MainPanel.removeSelectedRecord - 2: " + res); return res;}); | ||
346 | //MochiKit.Logging.logDebug("--- MainPanel.removeSelectedRecord - 4:"); | ||
347 | //deferred.addBoth(function(res) {MochiKit.Logging.logDebug("MainPanel.removeSelectedRecord - 3: " + res); return res;}); | ||
348 | deferred.addCallback(MochiKit.Base.method(Clipperz.PM.Components.MessageBox(), 'deferredShow'), | ||
349 | { | ||
350 | title:Clipperz.PM.Strings['mainPanelDeletingRecordPanelInitialTitle'], | ||
351 | text:Clipperz.PM.Strings['mainPanelDeletingRecordPanelInitialText'], | ||
352 | width:240, | ||
353 | showProgressBar:true, | ||
354 | showCloseButton:false, | ||
355 | steps:5 | ||
356 | } | ||
357 | ); | ||
358 | //MochiKit.Logging.logDebug("--- MainPanel.removeSelectedRecord - 5:"); | ||
359 | //deferred.addBoth(function(res) {MochiKit.Logging.logDebug("MainPanel.removeSelectedRecord - 4: " + res); return res;}); | ||
360 | deferred.addCallback(MochiKit.Base.method(this.user(), 'deleteRecordsAction'), records); | ||
361 | //MochiKit.Logging.logDebug("--- MainPanel.removeSelectedRecord - 6:"); | ||
362 | //deferred.addBoth(function(res) {MochiKit.Logging.logDebug("MainPanel.removeSelectedRecord - 5: " + res); return res;}); | ||
363 | //MochiKit.Logging.logDebug("--- MainPanel.removeSelectedRecord - 7:"); | ||
364 | //deferred.addBoth(function(res) {MochiKit.Logging.logDebug("MainPanel.removeSelectedRecord - 6: " + res); return res;}); | ||
365 | deferred.addCallback(function() { | ||
366 | Clipperz.PM.Components.MessageBox().update({ | ||
367 | title:null, | ||
368 | text:Clipperz.PM.Strings['mainPanelDeletingRecordPanelCompletedText'], | ||
369 | step:'next', | ||
370 | buttons:{} | ||
371 | }); | ||
372 | }); | ||
373 | //MochiKit.Logging.logDebug("--- MainPanel.removeSelectedRecord - 8:"); | ||
374 | //deferred.addBoth(function(res) {MochiKit.Logging.logDebug("MainPanel.removeSelectedRecord - 7: " + res); return res;}); | ||
375 | deferred.addCallback(MochiKit.Async.wait, 1); | ||
376 | //MochiKit.Logging.logDebug("--- MainPanel.removeSelectedRecord - 9:"); | ||
377 | //deferred.addBoth(function(res) {MochiKit.Logging.logDebug("MainPanel.removeSelectedRecord - 8: " + res); return res;}); | ||
378 | deferred.addCallback(function(res) { | ||
379 | Clipperz.PM.Components.MessageBox().hide(YAHOO.ext.Element.get('main')); | ||
380 | return res; | ||
381 | }); | ||
382 | //MochiKit.Logging.logDebug("--- MainPanel.removeSelectedRecord - 10:"); | ||
383 | //deferred.addBoth(function(res) {MochiKit.Logging.logDebug("MainPanel.removeSelectedRecord - 9: " + res); return res;}); | ||
384 | deferred.callback(); | ||
385 | } else { | ||
386 | //MochiKit.Logging.logDebug("+++ MainPanel.removeSelectedRecord - nothing selected"); | ||
387 | } | ||
388 | }, | ||
389 | |||
390 | //------------------------------------------------------------------------- | ||
391 | |||
392 | 'recordDetailComponent': function() { | ||
393 | //MochiKit.Logging.logDebug(">>> MainPanel.recordDetailComponent"); | ||
394 | if (this._recordDetailComponent == null) { | ||
395 | //MochiKit.Logging.logDebug("--- MainPanel.recordDetailComponent - 1"); | ||
396 | //MochiKit.Logging.logDebug("--- MainPanel.recordDetailComponent - 1 - user: " + this.user()); | ||
397 | this._recordDetailComponent = new Clipperz.PM.Components.RecordDetail.MainComponent( | ||
398 | YAHOO.ext.Element.get('recordDetail'), | ||
399 | {user:this.user(), mainPanel:this} | ||
400 | ); | ||
401 | } | ||
402 | |||
403 | //MochiKit.Logging.logDebug("<<< MainPanel.recordDetailComponent"); | ||
404 | |||
405 | return this._recordDetailComponent; | ||
406 | }, | ||
407 | |||
408 | //------------------------------------------------------------------------- | ||
409 | |||
410 | 'selectedRecord': function() { | ||
411 | return this._selectedRecord; | ||
412 | }, | ||
413 | |||
414 | 'setSelectedRecord': function(aValue) { | ||
415 | // this.hideNewRecordPanel(); | ||
416 | //MochiKit.Logging.logDebug(">>> MainPanel.setSelectedRecord"); | ||
417 | if (aValue != this._selectedRecord) { | ||
418 | //MochiKit.Logging.logDebug("--- MainPanel.setSelectedRecord - 1"); | ||
419 | this._selectedRecord = aValue; | ||
420 | //MochiKit.Logging.logDebug("--- MainPanel.setSelectedRecord - 2"); | ||
421 | this.redrawRecordItems(); | ||
422 | //MochiKit.Logging.logDebug("--- MainPanel.setSelectedRecord - 3"); | ||
423 | this.recordDetailComponent().setRecord(aValue); | ||
424 | //MochiKit.Logging.logDebug("--- MainPanel.setSelectedRecord - 4"); | ||
425 | } | ||
426 | |||
427 | if ((aValue == null) || (Clipperz.PM.Proxy.defaultProxy.isReadOnly())) { | ||
428 | this.deleteRecordButton().disable(); | ||
429 | } else { | ||
430 | this.deleteRecordButton().enable(); | ||
431 | } | ||
432 | //MochiKit.Logging.logDebug("<<< MainPanel.setSelectedRecord"); | ||
433 | }, | ||
434 | |||
435 | //------------------------------------------------------------------------- | ||
436 | |||
437 | 'recordAddedHandler': function(anEvent) { | ||
438 | //MochiKit.Logging.logDebug(">>> MainPanel.recordAddedHandler"); | ||
439 | this.recordDetailComponent(); | ||
440 | this.redrawRecordItems(); | ||
441 | //MochiKit.Logging.logDebug("<<< MainPanel.recordAddedHandler"); | ||
442 | }, | ||
443 | |||
444 | 'recordUpdatedHandler': function(anEvent) { | ||
445 | //MochiKit.Logging.logDebug(">>> MainPanel.recordUpdatedHandler"); | ||
446 | this.redrawRecordItems(); | ||
447 | //MochiKit.Logging.logDebug("<<< MainPanel.recordUpdatedHandler"); | ||
448 | }, | ||
449 | |||
450 | 'recordRemovedHandler': function(anEvent) { | ||
451 | //MochiKit.Logging.logDebug(">>> MainPanel.recordRemovedHandler"); | ||
452 | this.setSelectedRecord(null); | ||
453 | //MochiKit.Logging.logDebug("--- MainPanel.recordRemovedHandler - 1"); | ||
454 | this.redrawRecordItems(); | ||
455 | //MochiKit.Logging.logDebug("<<< MainPanel.recordRemovedHandler"); | ||
456 | }, | ||
457 | |||
458 | 'compareRecords': function(a, b) { | ||
459 | //MochiKit.Logging.logDebug("=== compareRecords: " + a.toString() + " - " + b.toString()); | ||
460 | return MochiKit.Base.compare(a.label().toLowerCase(), b.label().toLowerCase()); | ||
461 | }, | ||
462 | |||
463 | 'redrawRecordItems': function() { | ||
464 | var template; | ||
465 | var allRecords; | ||
466 | |||
467 | //MochiKit.Logging.logDebug(">>> MainPanel.redrawRecordItems"); | ||
468 | MochiKit.Iter.forEach(YAHOO.ext.Element.get('records').getChildrenByTagName('li'), function(aRecordElement) { | ||
469 | MochiKit.Signal.disconnectAll(aRecordElement.dom); | ||
470 | }) | ||
471 | //MochiKit.Logging.logDebug("--- MainPanel.redrawRecordItems - 1"); | ||
472 | YAHOO.ext.Element.get('records').update(""); | ||
473 | //MochiKit.Logging.logDebug("--- MainPanel.redrawRecordItems - 2"); | ||
474 | allRecords = MochiKit.Base.values(this.user().records()); | ||
475 | //MochiKit.Logging.logDebug("--- MainPanel.redrawRecordItems - 3"); | ||
476 | allRecords.sort(this.compareRecords); | ||
477 | //MochiKit.Logging.logDebug("--- MainPanel.redrawRecordItems - 4"); | ||
478 | template = this.recordItemTemplate(); | ||
479 | //MochiKit.Logging.logDebug("--- MainPanel.redrawRecordItems - 5"); | ||
480 | MochiKit.Iter.forEach(allRecords, MochiKit.Base.bind(function(aRecord) { | ||
481 | varrecordElement; | ||
482 | recordElement = template.append('records', { | ||
483 | recordTitle:aRecord.label(), | ||
484 | recordReference:aRecord.reference(), | ||
485 | cls:((aRecord == this.selectedRecord()) ? 'selected': '') | ||
486 | }, true); | ||
487 | //MochiKit.Logging.logDebug("--- MainPanel.redrawRecordItems - 6: " + recordElement.dom); | ||
488 | recordElement.addClassOnOver('hover'); | ||
489 | MochiKit.Signal.connect(recordElement.dom, 'onclick', this, 'selectRecord'); | ||
490 | }, this)); | ||
491 | //MochiKit.Logging.logDebug("<<< MainPanel.redrawRecordItems"); | ||
492 | }, | ||
493 | |||
494 | 'selectRecord': function(anEvent) { | ||
495 | //MochiKit.Logging.logDebug(">>> MainPanel.selectRecord"); | ||
496 | //MochiKit.Logging.logDebug("--- MainPanel.selectRecord !!! - ", this.user().records()[anEvent.src().id].label()); | ||
497 | this.setSelectedRecord(this.user().records()[anEvent.src().id]); | ||
498 | //MochiKit.Logging.logDebug("<<< MainPanel.selectRecord"); | ||
499 | }, | ||
500 | |||
501 | //------------------------------------------------------------------------- | ||
502 | |||
503 | 'directLoginAddedHandler': function(anEvent) { | ||
504 | //MochiKit.Logging.logDebug(">>> MainPanel.recordRemovedHandler"); | ||
505 | this.redrawDirectLoginItems(); | ||
506 | //MochiKit.Logging.logDebug("<<< MainPanel.recordRemovedHandler"); | ||
507 | }, | ||
508 | |||
509 | 'directLoginUpdatedHandler': function(anEvent) { | ||
510 | //MochiKit.Logging.logDebug(">>> MainPanel.directLoginUpdatedHandler"); | ||
511 | this.redrawDirectLoginItems(); | ||
512 | //MochiKit.Logging.logDebug("<<< MainPanel.directLoginUpdatedHandler"); | ||
513 | }, | ||
514 | |||
515 | 'directLoginRemovedHandler': function(anEvent) { | ||
516 | //MochiKit.Logging.logDebug(">>> MainPanel.directLoginRemovedHandler"); | ||
517 | this.redrawDirectLoginItems(); | ||
518 | //MochiKit.Logging.logDebug("<<< MainPanel.directLoginRemovedHandler"); | ||
519 | }, | ||
520 | |||
521 | 'compareDirectLogins': function(a, b) { | ||
522 | return MochiKit.Base.compare(a.label().toLowerCase(), b.label().toLowerCase()); | ||
523 | }, | ||
524 | |||
525 | 'redrawDirectLoginItems': function() { | ||
526 | var template; | ||
527 | var allDirectLogins; | ||
528 | |||
529 | //MochiKit.Logging.logDebug(">>> MainPanel.redrawDirectLoginItems"); | ||
530 | MochiKit.Iter.forEach(YAHOO.ext.Element.get('directLogins').getChildrenByTagName('li'), function(aDirectLoginElement) { | ||
531 | MochiKit.Signal.disconnectAll(aDirectLoginElement.dom); | ||
532 | //MochiKit.Logging.logDebug("disconnecting IMG " + aDirectLoginElement.getChildrenByTagName('img')[0].dom.src); | ||
533 | MochiKit.Signal.disconnectAll(aDirectLoginElement.getChildrenByTagName('img')[0].dom); | ||
534 | }) | ||
535 | //MochiKit.Logging.logDebug("--- MainPanel.redrawDirectLoginItems - 1"); | ||
536 | YAHOO.ext.Element.get('directLogins').update(""); | ||
537 | //MochiKit.Logging.logDebug("--- MainPanel.redrawDirectLoginItems - 2"); | ||
538 | allDirectLogins = MochiKit.Base.values(this.user().directLoginReferences()); | ||
539 | //MochiKit.Logging.logDebug("--- MainPanel.redrawDirectLoginItems - 3"); | ||
540 | allDirectLogins.sort(this.compareDirectLogins); | ||
541 | |||
542 | if (allDirectLogins.length == 0) { | ||
543 | YAHOO.ext.Element.get('directLoginsDescription').show(); | ||
544 | YAHOO.ext.Element.get('directLogins').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide(); | ||
545 | } else { | ||
546 | YAHOO.ext.Element.get('directLoginsDescription').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide(); | ||
547 | YAHOO.ext.Element.get('directLogins').show(); | ||
548 | } | ||
549 | //MochiKit.Logging.logDebug("--- MainPanel.redrawDirectLoginItems - 4"); | ||
550 | template = this.directLoginItemTemplate(); | ||
551 | //MochiKit.Logging.logDebug("--- MainPanel.redrawDirectLoginItems - 5"); | ||
552 | MochiKit.Iter.forEach(allDirectLogins, MochiKit.Base.bind(function(aDirectLogin) { | ||
553 | vardirectLoginElement; | ||
554 | varfaviconImageElementID; | ||
555 | |||
556 | faviconImageElementID = aDirectLogin.reference() + "_faviconIMG"; | ||
557 | directLoginElement = template.append('directLogins', { | ||
558 | elementID:faviconImageElementID, | ||
559 | faviconUrl:aDirectLogin.fixedFavicon(), | ||
560 | directLoginTitle:aDirectLogin.label(), | ||
561 | directLoginReference:aDirectLogin.reference() | ||
562 | }, true); | ||
563 | //MochiKit.Logging.logDebug("--- MainPanel.redrawDirectLoginItems - 6: " + recordElement.dom); | ||
564 | directLoginElement.addClassOnOver("hover"); | ||
565 | MochiKit.Signal.connect(directLoginElement.dom, 'onclick', this, 'handleDirectLoginClick'); | ||
566 | |||
567 | MochiKit.Signal.connect(faviconImageElementID, 'onload', this, 'handleLoadedFaviconImage'); | ||
568 | MochiKit.Signal.connect(faviconImageElementID, 'onerror', aDirectLogin, 'handleMissingFaviconImage'); | ||
569 | MochiKit.Signal.connect(faviconImageElementID, 'onabort', aDirectLogin, 'handleMissingFaviconImage'); | ||
570 | |||
571 | // YAHOO.ext.Element.get(faviconImageElementID).dom.src = aDirectLogin.fixedFavicon(); | ||
572 | }, this)); | ||
573 | //MochiKit.Logging.logDebug("<<< MainPanel.redrawDirectLoginItems"); | ||
574 | }, | ||
575 | |||
576 | //------------------------------------------------------------------------- | ||
577 | |||
578 | 'handleDirectLoginClick': function(anEvent) { | ||
579 | vardirectLoginReference; | ||
580 | //MochiKit.Logging.logDebug(">>> MainPanel.handleDirectLoginClick !!!"); | ||
581 | |||
582 | directLoginReference = this.user().directLoginReferences()[anEvent.src().id]; | ||
583 | if (anEvent.target().className == 'directLoginItemEditButton') { | ||
584 | this.editDirectLogin(directLoginReference); | ||
585 | } else { | ||
586 | this.openDirectLogin(directLoginReference); | ||
587 | } | ||
588 | //MochiKit.Logging.logDebug("<<< MainPanel.handleDirectLoginClick"); | ||
589 | }, | ||
590 | |||
591 | 'editDirectLogin': function(aDirectLoginReference) { | ||
592 | //MochiKit.Logging.logDebug("=== MainPanel.editDirectLogin - " + aDirectLoginReference.label()); | ||
593 | this.setSelectedRecord(aDirectLoginReference.record()); | ||
594 | }, | ||
595 | |||
596 | 'openDirectLogin': function(aDirectLoginReference) { | ||
597 | vardeferredResult; | ||
598 | varnewWindow; | ||
599 | |||
600 | //MochiKit.Logging.logDebug(">>> MainPanel.openDirectLogin - " + aDirectLoginReference.label()); | ||
601 | deferredResult = new MochiKit.Async.Deferred(); | ||
602 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("MainPanel.openDirectLogin - 1: " + res); return res;}); | ||
603 | deferredResult.addCallback(MochiKit.Base.method(aDirectLoginReference, 'setupJumpPageWindow')); | ||
604 | deferredResult.addCallback(MochiKit.Base.method(aDirectLoginReference, 'deferredDirectLogin')); | ||
605 | deferredResult.addCallback(function(aDirectLogin) { | ||
606 | aDirectLogin.runDirectLogin(newWindow); | ||
607 | }); | ||
608 | |||
609 | newWindow = window.open(Clipperz.PM.Strings['directLoginJumpPageUrl'], ""); | ||
610 | // MochiKit.Signal.connect(newWindow, 'onload', MochiKit.Base.method(deferredResult, 'callback', newWindow)) | ||
611 | // MochiKit.Signal.connect(newWindow, 'onload', MochiKit.Base.partial(alert, "done")); | ||
612 | deferredResult.callback(newWindow); | ||
613 | //MochiKit.Logging.logDebug("<<< MainPanel.openDirectLogin"); | ||
614 | }, | ||
615 | |||
616 | //------------------------------------------------------------------------- | ||
617 | |||
618 | 'handleLoadedFaviconImage': function(anEvent) { | ||
619 | //MochiKit.Logging.logDebug(">>> MainPanel.handleLoadedFaviconImage"); | ||
620 | MochiKit.Signal.disconnectAll(anEvent.src()) | ||
621 | //MochiKit.Logging.logDebug("<<< MainPanel.handleLoadedFaviconImage"); | ||
622 | }, | ||
623 | |||
624 | //------------------------------------------------------------------------- | ||
625 | |||
626 | 'recordItemTemplate': function() { | ||
627 | if (this._recordItemTemplate == null) { | ||
628 | this._recordItemTemplate = Clipperz.YUI.DomHelper.createTemplate({tag:'li', cls:'{cls}', id:'{recordReference}', children:[ | ||
629 | {tag:'span', html:'{recordTitle}'} | ||
630 | ]}); | ||
631 | this._recordItemTemplate.compile(); | ||
632 | } | ||
633 | |||
634 | return this._recordItemTemplate; | ||
635 | }, | ||
636 | |||
637 | 'directLoginItemTemplate': function() { | ||
638 | if (this._directLoginItemTemplate == null) { | ||
639 | this._directLoginItemTemplate = Clipperz.YUI.DomHelper.createTemplate({tag:'li', id:'{directLoginReference}', children:[ | ||
640 | {tag:'table', border:'0', cellpadding:'0', cellspacing:'0', children:[ | ||
641 | {tag:'tbody', children:[ | ||
642 | {tag:'tr', children:[ | ||
643 | {tag:'td', width:'20', align:'center', valign:'top', children:[ | ||
644 | {tag:'img', id:'{elementID}', src:'{faviconUrl}'} | ||
645 | ]}, | ||
646 | {tag:'td', valign:'top', children:[ | ||
647 | {tag:'a', cls:'directLoginItemTitle', html:'{directLoginTitle}'} | ||
648 | ]}, | ||
649 | {tag:'td', valign:'top', align:'right', children:[ | ||
650 | // {tag:'span', cls:'directLoginItemEditButton', htmlString:Clipperz.PM.Strings['directLinkReferenceShowButtonLabel']} | ||
651 | {tag:'a', cls:'directLoginItemEditButton', htmlString:Clipperz.PM.Strings['directLinkReferenceShowButtonLabel']} | ||
652 | ]} | ||
653 | ]} | ||
654 | ]} | ||
655 | ]} | ||
656 | ]}); | ||
657 | this._directLoginItemTemplate.compile(); | ||
658 | } | ||
659 | |||
660 | return this._directLoginItemTemplate; | ||
661 | }, | ||
662 | |||
663 | //------------------------------------------------------------------------- | ||
664 | /* | ||
665 | 'newRecordButton': function() { | ||
666 | return this._newRecordButton; | ||
667 | }, | ||
668 | |||
669 | 'setNewRecordButton': function(aValue) { | ||
670 | this._newRecordButton = aValue; | ||
671 | }, | ||
672 | |||
673 | 'newRecordCancelButton': function() { | ||
674 | return this._newRecordCancelButton; | ||
675 | }, | ||
676 | |||
677 | 'setNewRecordCancelButton': function(aValue) { | ||
678 | this._newRecordCancelButton = aValue; | ||
679 | }, | ||
680 | */ | ||
681 | //------------------------------------------------------------------------- | ||
682 | |||
683 | 'onkeydown': function(anEvent) { | ||
684 | //MochiKit.Logging.logDebug(">>> onkeydown - " + anEvent.src().id + ": " + anEvent.key().code); | ||
685 | switch (anEvent.src().id) { | ||
686 | /* | ||
687 | case this.getId('newRecordForm'): | ||
688 | if (anEvent.key().code == 13) { | ||
689 | this.newRecordButton().focus(); | ||
690 | // this.addNewRecord(); | ||
691 | } else if (anEvent.key().code == 27) { | ||
692 | this.newRecordCancelButton().focus(); | ||
693 | this.hideNewRecordPanel(true); | ||
694 | } | ||
695 | break; | ||
696 | */ | ||
697 | case "recordFilterSearchForm": | ||
698 | if (anEvent.key().code == 13) { | ||
699 | //MochiKit.Logging.logDebug("SEARCH"); | ||
700 | this.filterCardsWithName(YAHOO.ext.Element.get('recordFilterSearchValue').dom.value); | ||
701 | anEvent.event().stopPropagation(); | ||
702 | YAHOO.ext.Element.get('recordFilterSearchValue').focus(); | ||
703 | } else if (anEvent.key().code == 27) { | ||
704 | this.hideRecordFilterSearchPanel(true); | ||
705 | this.showRecordFilterAllPanel(); | ||
706 | } | ||
707 | break; | ||
708 | } | ||
709 | |||
710 | }, | ||
711 | |||
712 | //------------------------------------------------------------------------- | ||
713 | |||
714 | 'renderRecordListBlockHeader': function(){ | ||
715 | var recordListBlockHeaderElement; | ||
716 | |||
717 | recordListBlockHeaderElement = YAHOO.ext.Element.get('recordListBlockHeader'); | ||
718 | recordListBlockHeaderElement.update(""); | ||
719 | Clipperz.YUI.DomHelper.append(recordListBlockHeaderElement.dom, | ||
720 | {tag:'table', cls:'recordListBlockHeaderTABLE', border:'0', cellspacing:'0', cellpadding:'0', children:[ | ||
721 | {tag:'tbody', children:[ | ||
722 | {tag:'tr', children:[ | ||
723 | {tag:'td', /*width:'50%',*/ cls:'recordBlockTitleTD', children:[ | ||
724 | {tag:'h3', id:'recordBlockTitle', htmlString:Clipperz.PM.Strings['mainPanelRecordsBlockLabel']} | ||
725 | ]}, | ||
726 | {tag:'td', align:'right', children:[ | ||
727 | {tag:'table', id:'recordListButtonsTABLE', border:'0', cellspacing:'0', cellpadding:'0', children:[ | ||
728 | {tag:'tbody', children:[ | ||
729 | {tag:'tr', children:[ | ||
730 | {tag:'td', cls:'recordButtonTD', align:'right', children:[ | ||
731 | {tag:'div', cls:'recordButton', id:'recordListAddRecordButton'} | ||
732 | ]}, | ||
733 | {tag:'td', cls:'recordButtonTD', align:'left', children:[ | ||
734 | {tag:'div', cls:'recordButton', id:'recordListRemoveRecordButton'} | ||
735 | ]} | ||
736 | ]} | ||
737 | ]} | ||
738 | ]} | ||
739 | ]}, | ||
740 | {tag:'td', width:'15', html:" "} | ||
741 | ]} | ||
742 | ]} | ||
743 | ]} | ||
744 | ); | ||
745 | |||
746 | this.setAddNewRecordButton(new YAHOO.ext.Button('recordListAddRecordButton', {text:Clipperz.PM.Strings['mainPanelAddRecordButtonLabel'], handler:this.addNewRecord, scope:this})); | ||
747 | // this.setAddNewRecordButton(new YAHOO.ext.Button('recordListAddRecordButton', {text:Clipperz.PM.Strings['mainPanelAddRecordButtonLabel'], handler:this.showNewRecordPanel, scope:this})); | ||
748 | this.setDeleteRecordButton(new YAHOO.ext.Button('recordListRemoveRecordButton', {text:Clipperz.PM.Strings['mainPanelRemoveRecordButtonLabel'], handler:this.removeSelectedRecord, scope:this})); | ||
749 | |||
750 | |||
751 | if ((Clipperz.PM.Proxy.defaultProxy.isReadOnly()) || (this.selectedRecord() == null)) { | ||
752 | this.deleteRecordButton().disable(); | ||
753 | } | ||
754 | |||
755 | if (Clipperz.PM.Proxy.defaultProxy.isReadOnly()) { | ||
756 | this.addNewRecordButton().disable(); | ||
757 | } | ||
758 | |||
759 | }, | ||
760 | |||
761 | //------------------------------------------------------------------------- | ||
762 | |||
763 | 'renderRecordListFilterHeader': function(){ | ||
764 | var recordListFilterHeaderElement; | ||
765 | |||
766 | recordListFilterHeaderElement = YAHOO.ext.Element.get('recordListFilterHeader'); | ||
767 | recordListFilterHeaderElement.update(""); | ||
768 | Clipperz.YUI.DomHelper.append(recordListFilterHeaderElement.dom, | ||
769 | {tag:'div', id:'recordFiltersDIV', children:[ | ||
770 | {tag:'div', id:'recordFiltersTableWrapper', children:[ | ||
771 | {tag:'table', id:'recordFiltersTABLE', border:'0', cellspacing:'0', cellpadding:'0', children:[ | ||
772 | {tag:'tbody', children:[ | ||
773 | {tag:'tr', children:[ | ||
774 | {tag:'td', id:'recordFilterAllTD', children:[{tag:'div', children:[{tag:'a', id:'recordFilterAll', htmlString:Clipperz.PM.Strings['mainPanelRecordFilterBlockAllLabel']}]}]}, | ||
775 | {tag:'td', id:'recordFilterTagsTD', children:[{tag:'div', children:[{tag:'a', id:'recordFilterTags', htmlString:Clipperz.PM.Strings['mainPanelRecordFilterBlockTagsLabel']}]}]}, | ||
776 | {tag:'td', id:'recordFilterSearchTD', children:[{tag:'div', children:[{tag:'a', id:'recordFilterSearch', htmlString:Clipperz.PM.Strings['mainPanelRecordFilterBlockSearchLabel']}]}]} | ||
777 | ]} | ||
778 | ]} | ||
779 | ]} | ||
780 | ]}, | ||
781 | {tag:'div', id:'recordFiltersTagsPanel'}, | ||
782 | {tag:'div', id:'recordFiltersSearchPanel', children:[{tag:'div', id:'recordFiltersSearchInnerPanel', children:[{tag:'div', id:'recordFiltersSearchInnerInnerPanel', children:[ | ||
783 | {tag:'form', id:'recordFilterSearchForm', children:[ | ||
784 | {tag:'input', type:'text', name:'search', id:'recordFilterSearchValue'} | ||
785 | ]} | ||
786 | ]}]}]} | ||
787 | ]} | ||
788 | ); | ||
789 | |||
790 | /// YAHOO.ext.Element.get('recordFiltersSearchPanel').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide(); | ||
791 | this.showRecordFilterAllPanel(false); | ||
792 | |||
793 | MochiKit.Signal.connect('recordFilterSearchForm', 'onkeydown', this, 'onkeydown'); | ||
794 | MochiKit.Signal.connect('recordFilterSearchForm', 'onsubmit', this, 'onkeydown'); | ||
795 | |||
796 | MochiKit.Signal.connect('recordFilterAll', 'onclick', this, 'showRecordFilterAllPanel'); | ||
797 | MochiKit.Signal.connect('recordFilterTags', 'onclick', this, 'showRecordFilterTagsPanel'); | ||
798 | MochiKit.Signal.connect('recordFilterSearch', 'onclick', this, 'showRecordFilterSearchPanel'); | ||
799 | }, | ||
800 | |||
801 | //------------------------------------------------------------------------- | ||
802 | |||
803 | 'showRecordFilterAllPanel': function(shouldSlide) { | ||
804 | this.hideRecordFilterTagsPanel(shouldSlide); | ||
805 | this.hideRecordFilterSearchPanel(shouldSlide); | ||
806 | YAHOO.ext.Element.get('recordFilterAllTD').addClass('selectedTab'); | ||
807 | }, | ||
808 | |||
809 | 'hideRecordFilterAllPanel': function(shouldSlide) { | ||
810 | YAHOO.ext.Element.get('recordFilterAllTD').removeClass('selectedTab'); | ||
811 | }, | ||
812 | |||
813 | //------------------------------------------------------------------------- | ||
814 | |||
815 | 'showRecordFilterTagsPanel': function(shouldSlide) { | ||
816 | this.hideRecordFilterAllPanel(shouldSlide); | ||
817 | this.hideRecordFilterSearchPanel(shouldSlide); | ||
818 | YAHOO.ext.Element.get('recordFilterTagsTD').addClass('selectedTab'); | ||
819 | }, | ||
820 | |||
821 | 'hideRecordFilterTagsPanel': function(shouldSlide) { | ||
822 | YAHOO.ext.Element.get('recordFilterTagsTD').removeClass('selectedTab'); | ||
823 | }, | ||
824 | |||
825 | //------------------------------------------------------------------------- | ||
826 | |||
827 | 'showRecordFilterSearchPanel': function(shouldSlide) { | ||
828 | var searchPanelActor; | ||
829 | |||
830 | this.hideRecordFilterAllPanel(shouldSlide); | ||
831 | this.hideRecordFilterTagsPanel(shouldSlide); | ||
832 | YAHOO.ext.Element.get('recordFilterSearchTD').addClass('selectedTab'); | ||
833 | YAHOO.ext.Element.get('recordFilterSearchValue').dom.value = ""; | ||
834 | |||
835 | searchPanelActor = new YAHOO.ext.Actor('recordFiltersSearchPanel'); | ||
836 | |||
837 | searchPanelActor.startCapture(true); | ||
838 | searchPanelActor.slideShow('top', 54); | ||
839 | searchPanelActor.play(MochiKit.Base.bind(function() { | ||
840 | YAHOO.ext.Element.get('recordFilterSearchValue').focus(); | ||
841 | }, this)); | ||
842 | }, | ||
843 | |||
844 | 'hideRecordFilterSearchPanel': function(shouldSlide) { | ||
845 | var searchPanelActor; | ||
846 | varcallback; | ||
847 | |||
848 | YAHOO.ext.Element.get('recordFilterSearchTD').removeClass('selectedTab'); | ||
849 | |||
850 | searchPanelActor = new YAHOO.ext.Actor('recordFiltersSearchPanel'); | ||
851 | |||
852 | searchPanelActor.startCapture(true) | ||
853 | if (shouldSlide === false) { | ||
854 | searchPanelActor.hide(); | ||
855 | searchPanelActor.slideHide('top'); | ||
856 | searchPanelActor.show(); | ||
857 | } else { | ||
858 | searchPanelActor.slideHide('top'); | ||
859 | } | ||
860 | |||
861 | callback = MochiKit.Base.bind(function() { | ||
862 | }, this); | ||
863 | |||
864 | searchPanelActor.play(callback); | ||
865 | }, | ||
866 | |||
867 | //------------------------------------------------------------------------- | ||
868 | |||
869 | 'filterCardsWithName': function(aValue) { | ||
870 | MochiKit.Logging.logDebug(">>> filterCardsWithName: " + aValue); | ||
871 | |||
872 | MochiKit.Logging.logDebug("<<< filterCardsWithName"); | ||
873 | }, | ||
874 | |||
875 | 'accountLockedHandler': function() { | ||
876 | this.setSelectedRecord(null); | ||
877 | }, | ||
878 | |||
879 | //------------------------------------------------------------------------- | ||
880 | |||
881 | 'switchLanguageHandler': function() { | ||
882 | YAHOO.ext.Element.get('directLoginTitle').update(Clipperz.PM.Strings['mainPanelDirectLoginBlockLabel']); | ||
883 | YAHOO.ext.Element.get('directLoginsDescription').update(""); | ||
884 | MochiKit.Iter.forEach(Clipperz.PM.Strings['mainPanelDirectLoginBlockDescriptionConfig'], function(aConfigItem) { | ||
885 | Clipperz.YUI.DomHelper.append(YAHOO.ext.Element.get('directLoginsDescription').dom, aConfigItem); | ||
886 | }); | ||
887 | YAHOO.ext.Element.get('recordBlockTitle').update(Clipperz.PM.Strings['mainPanelRecordsBlockLabel']); | ||
888 | this.renderRecordListBlockHeader(); | ||
889 | // this.renderRecordListFilterHeader(); | ||
890 | |||
891 | // YAHOO.ext.Element.get('newRecordPanelTitleH2').update(Clipperz.PM.Strings['mainPanelNewRecordPanelTitle']); | ||
892 | // YAHOO.ext.Element.get('newRecordPanelTitleLabel').update(Clipperz.PM.Strings['mainPanelNewRecordPanelRecordTitleLabel']); | ||
893 | // YAHOO.ext.Element.get('newRecordPanelConfigLabel').update(""); | ||
894 | // MochiKit.Iter.forEach(Clipperz.PM.Strings['mainPanelNewRecordPanelRecordConfigConfig'], function(aConfigItem) { | ||
895 | // Clipperz.YUI.DomHelper.append(YAHOO.ext.Element.get('newRecordPanelConfigLabel').dom, aConfigItem); | ||
896 | // }); | ||
897 | // this.newRecordButton().setText(Clipperz.PM.Strings['mainPanelNewRecordPanelCreateButtonLabel']); | ||
898 | // this.newRecordCancelButton().setText(Clipperz.PM.Strings['mainPanelNewRecordPanelCancelButtonLabel']); | ||
899 | |||
900 | this.recordDetailComponent().render(); | ||
901 | }, | ||
902 | |||
903 | //------------------------------------------------------------------------- | ||
904 | __syntaxFix__: "syntax fix" | ||
905 | |||
906 | }); | ||