Diffstat (limited to 'frontend/beta/js/Clipperz/PM/Components/Import/GenericImportComponent.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/beta/js/Clipperz/PM/Components/Import/GenericImportComponent.js | 523 |
1 files changed, 523 insertions, 0 deletions
diff --git a/frontend/beta/js/Clipperz/PM/Components/Import/GenericImportComponent.js b/frontend/beta/js/Clipperz/PM/Components/Import/GenericImportComponent.js new file mode 100644 index 0000000..4f6b1e4 --- a/dev/null +++ b/frontend/beta/js/Clipperz/PM/Components/Import/GenericImportComponent.js | |||
@@ -0,0 +1,523 @@ | |||
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.Import) == 'undefined') { Clipperz.PM.Components.Import = {}; } | ||
33 | |||
34 | //############################################################################# | ||
35 | |||
36 | Clipperz.PM.Components.Import.GenericImportComponent = function(anElement, args) { | ||
37 | args = args || {}; | ||
38 | |||
39 | this._steps = this._steps || ['EDIT', 'PREVIEW', 'IMPORT']; | ||
40 | |||
41 | Clipperz.PM.Components.Import.GenericImportComponent.superclass.constructor.call(this, anElement, args); | ||
42 | |||
43 | this._user = args['user']; | ||
44 | |||
45 | this._currentStep = 0; | ||
46 | this._currentStatus = 'IDLE'; //'PROCESSING' | ||
47 | |||
48 | this._parsedValues = null; | ||
49 | this._processedValues = null; | ||
50 | |||
51 | this._backButton = null; | ||
52 | this._nextButton = null; | ||
53 | |||
54 | Clipperz.NotificationCenter.register(null, 'importProcessorProgressUpdate', this, 'updateProgressDialogStatus'); | ||
55 | |||
56 | return this; | ||
57 | } | ||
58 | |||
59 | //============================================================================= | ||
60 | |||
61 | YAHOO.extendX(Clipperz.PM.Components.Import.GenericImportComponent, Clipperz.PM.Components.BaseComponent, { | ||
62 | |||
63 | 'toString': function() { | ||
64 | return "Clipperz.PM.Components.Import.GenericImportComponent component"; | ||
65 | }, | ||
66 | |||
67 | //------------------------------------------------------------------------- | ||
68 | |||
69 | 'user': function() { | ||
70 | return this._user; | ||
71 | }, | ||
72 | |||
73 | //------------------------------------------------------------------------- | ||
74 | |||
75 | 'textAreaConfig': function() { | ||
76 | return {tag:'textarea', name:this.getId('importTextArea'), cls:'importTextArea', id:this.getId('importTextArea'), cols:60, rows:15, html:""}; | ||
77 | }, | ||
78 | |||
79 | 'textAreaContent': function() { | ||
80 | return this.getDom('importTextArea').value | ||
81 | }, | ||
82 | |||
83 | //------------------------------------------------------------------------- | ||
84 | |||
85 | 'steps': function() { | ||
86 | return this._steps; | ||
87 | }, | ||
88 | |||
89 | 'currentStep': function() { | ||
90 | return this._currentStep; | ||
91 | }, | ||
92 | |||
93 | 'setCurrentStep': function(aValue) { | ||
94 | this._currentStep = aValue; | ||
95 | this.updateSteps(); | ||
96 | }, | ||
97 | |||
98 | //------------------------------------------------------------------------- | ||
99 | |||
100 | 'currentStatus': function() { | ||
101 | return this._currentStatus; | ||
102 | }, | ||
103 | |||
104 | 'startProcessing': function() { | ||
105 | this._currentStatus = 'PROCESSING'; | ||
106 | this.updateSteps(); | ||
107 | }, | ||
108 | |||
109 | 'processingDone': function() { | ||
110 | this._currentStatus = 'IDLE'; | ||
111 | this.setCurrentStep(this.currentStep() + 1); | ||
112 | }, | ||
113 | |||
114 | 'processingAborted': function() { | ||
115 | this._currentStatus = 'IDLE'; | ||
116 | this.updateSteps(); | ||
117 | }, | ||
118 | |||
119 | //------------------------------------------------------------------------- | ||
120 | |||
121 | 'stepsConfig': function() { | ||
122 | var result; | ||
123 | var i,c; | ||
124 | |||
125 | result = []; | ||
126 | c = this.steps().length; | ||
127 | for (i=0; i<c; i++) { | ||
128 | var cls; | ||
129 | |||
130 | if (this.currentStep() == i) { | ||
131 | if (this.currentStatus() == 'IDLE') { | ||
132 | cls = 'current'; | ||
133 | } else { | ||
134 | cls = 'currentProcessing'; | ||
135 | } | ||
136 | } else { | ||
137 | cls = ""; | ||
138 | } | ||
139 | |||
140 | result.push({tag:'td', cls:cls, children:[ | ||
141 | {tag:'div', children:[{tag:'span', htmlString:Clipperz.PM.Strings['ImportWizard'][this.steps()[i]]}]} | ||
142 | ]}) | ||
143 | if (i < (c-1)) { | ||
144 | if ((this.currentStep() == i) && (this.currentStatus() == 'PROCESSING')) { | ||
145 | cls = 'stepSeparatorProcessing'; | ||
146 | } else { | ||
147 | cls = 'stepSeparator'; | ||
148 | } | ||
149 | |||
150 | result.push({tag:'td', cls:cls, children:[ | ||
151 | {tag:'div', children:[{tag:'span', html:">"}]} | ||
152 | ]}); | ||
153 | } | ||
154 | } | ||
155 | |||
156 | result = [{tag:'div', cls:'importWizardStepsBox', children:[ | ||
157 | {tag:'div', cls:'importWizardStepsInnerBox', children:[ | ||
158 | {tag:'table', cls:'importWizardSteps', children:[ | ||
159 | {tag:'tbody', children:[ | ||
160 | {tag:'tr', children:result} | ||
161 | ]} | ||
162 | ]} | ||
163 | ]}, | ||
164 | {tag:'div', cls:'importWizardStepsBoxFooter'} | ||
165 | ]}]; | ||
166 | |||
167 | return result; | ||
168 | }, | ||
169 | |||
170 | 'updateSteps': function() { | ||
171 | this.getElement('importSteps').update(""); | ||
172 | Clipperz.YUI.DomHelper.append(this.getDom('importSteps'), {tag:'div', children:this.stepsConfig()}); | ||
173 | }, | ||
174 | |||
175 | //------------------------------------------------------------------------- | ||
176 | |||
177 | 'backAction': function() { | ||
178 | //MochiKit.Logging.logDebug(">>> backAction"); | ||
179 | if (this.currentStep() == 0) { | ||
180 | Clipperz.NotificationCenter.notify(this, 'importCancelled'); | ||
181 | } else { | ||
182 | this.getElement('step_' + this.currentStep()).hide(); | ||
183 | this.setCurrentStep(this.currentStep() - 1); | ||
184 | this.getElement('step_' + this.currentStep()).show(); | ||
185 | |||
186 | this.nextButton().enable(); | ||
187 | } | ||
188 | //MochiKit.Logging.logDebug("<<< backAction"); | ||
189 | }, | ||
190 | |||
191 | //------------------------------------------------------------------------- | ||
192 | |||
193 | 'backButton': function() { | ||
194 | return this._backButton; | ||
195 | }, | ||
196 | |||
197 | 'setBackButton': function(aValue) { | ||
198 | this._backButton = aValue; | ||
199 | }, | ||
200 | |||
201 | 'nextButton': function() { | ||
202 | return this._nextButton; | ||
203 | }, | ||
204 | |||
205 | 'setNextButton': function(aValue) { | ||
206 | this._nextButton = aValue; | ||
207 | }, | ||
208 | |||
209 | //------------------------------------------------------------------------- | ||
210 | |||
211 | 'render': function() { | ||
212 | //MochiKit.Logging.logDebug(">>> Import.GenericImportComponent.render"); | ||
213 | this.domHelper().append(this.element(), {tag:'div', children:[ | ||
214 | {tag:'h2', html:this.toString()} | ||
215 | ]}); | ||
216 | //MochiKit.Logging.logDebug("<<< Import.GenericImportComponent.render"); | ||
217 | }, | ||
218 | |||
219 | //------------------------------------------------------------------------- | ||
220 | |||
221 | 'previewValues': function() { | ||
222 | Clipperz.PM.Components.MessageBox.showProgressPanel( | ||
223 | MochiKit.Base.method(this, 'deferredPreviewValues'), | ||
224 | MochiKit.Base.method(this, 'handlePreviewError'), | ||
225 | this.getDom('nextActionButton') | ||
226 | ); | ||
227 | }, | ||
228 | |||
229 | 'deferredPreviewValues': function() { | ||
230 | throw Clipperz.Base.exception.AbstractMethod; | ||
231 | }, | ||
232 | |||
233 | 'handlePreviewError': function(anError) { | ||
234 | console.log("anError", anError); | ||
235 | MochiKit.Logging.logError("An error occurred while previewing the data: " + anError); | ||
236 | alert("An error occurred while previewing the data"); | ||
237 | Clipperz.PM.Components.MessageBox().hide(); | ||
238 | }, | ||
239 | |||
240 | //------------------------------------------------------------------------- | ||
241 | |||
242 | 'previewRecordValues': function(someProcessedRecords) { | ||
243 | //MochiKit.Logging.logDebug(">>> previewRecordValues"); | ||
244 | this.getElement('previewDiv').update(""); | ||
245 | //MochiKit.Logging.logDebug("--- previewRecordValues - 1"); | ||
246 | this.domHelper().append(this.getElement('previewDiv'), {tag:'div', cls:'importPreviewDiv', children:[{tag:'table', id:'importPreview', cellspacing:'0', children:[ | ||
247 | {tag:'tbody', children: | ||
248 | MochiKit.Base.map(MochiKit.Base.bind(function(aRecord) { | ||
249 | var result; | ||
250 | //MochiKit.Logging.logDebug("--- previewRecordValues - 1.1"); | ||
251 | //console.log("fields", aRecord.currentVersion().fields()); | ||
252 | result = {tag:'tr', children:[{tag:'td', children:[ | ||
253 | {tag:'table', cls:'importPreview_record', children:[ | ||
254 | {tag:'tbody', children:[ | ||
255 | {tag:'tr', children:[ | ||
256 | {tag:'td', rowspan:'2', valign:'top', children:[ | ||
257 | {tag:'input', type:'checkbox', id:this.getId(aRecord.reference()), value:"aRecord.reference()", checked:true} | ||
258 | ]}, | ||
259 | {tag:'td', colspan:'2', children:[ | ||
260 | {tag:'span', cls:'importPreview_title', html:aRecord.label()} | ||
261 | ]} | ||
262 | ]}, | ||
263 | {tag:'tr', children:[ | ||
264 | {tag:'td', valign:'top', children:[ | ||
265 | {tag:'span', cls:'importPreview_notes', html:(MochiKit.Base.isNotEmpty(aRecord.notes()) ? aRecord.notes().replace(/\n/g, '<br>') : ' ')} | ||
266 | ]}, | ||
267 | {tag:'td', valign:'top', cls:'importPreview_fieds', children:[ | ||
268 | {tag:'table', cls:'importPreview_fields', children:[ | ||
269 | {tag:'tbody', children:MochiKit.Base.map(function(aField) { | ||
270 | var result; | ||
271 | //MochiKit.Logging.logDebug("--- previewRecordValues - 1.1.1"); | ||
272 | result = {tag:'tr', children:[ | ||
273 | {tag:'td', valign:'top', children:[ | ||
274 | {tag:'span', cls:'importPreview_fields_label', html:aField.label()} | ||
275 | ]}, | ||
276 | {tag:'td', valign:'top', children:[ | ||
277 | {tag:'span', cls:'importPreview_fields_value', html:aField.value()} | ||
278 | ]} | ||
279 | ]}; | ||
280 | //MochiKit.Logging.logDebug("--- previewRecordValues - 1.1.2"); | ||
281 | return result; | ||
282 | }, MochiKit.Base.values(aRecord.currentVersion().fields()))} | ||
283 | ]} | ||
284 | ]} | ||
285 | ]} | ||
286 | ]} | ||
287 | ]} | ||
288 | ]}]}; | ||
289 | //MochiKit.Logging.logDebug("--- previewRecordValues - 1.2"); | ||
290 | return result; | ||
291 | }, this), someProcessedRecords) | ||
292 | } | ||
293 | ]}]}); | ||
294 | //MochiKit.Logging.logDebug("--- previewRecordValues - 2"); | ||
295 | |||
296 | MochiKit.Base.map(MochiKit.Base.bind(function(aRecord) { | ||
297 | this.getElement(aRecord.reference()).dom.value = aRecord.reference(); | ||
298 | }, this), someProcessedRecords); | ||
299 | |||
300 | Clipperz.Style.applyZebraStylesToTable('importPreview'); | ||
301 | //MochiKit.Logging.logDebug("<<< previewRecordValues"); | ||
302 | }, | ||
303 | |||
304 | //------------------------------------------------------------------------- | ||
305 | |||
306 | 'updateProgressDialogStatus': function(anEvent) { | ||
307 | Clipperz.PM.Components.MessageBox().update({step:anEvent.parameters().progress}); | ||
308 | }, | ||
309 | |||
310 | //------------------------------------------------------------------------- | ||
311 | |||
312 | 'parsedValues': function() { | ||
313 | return this._parsedValues; | ||
314 | }, | ||
315 | |||
316 | 'setParsedValues': function(aValue) { | ||
317 | this._parsedValues = aValue; | ||
318 | |||
319 | return this._parsedValues; | ||
320 | }, | ||
321 | |||
322 | //------------------------------------------------------------------------- | ||
323 | |||
324 | 'processedValues': function() { | ||
325 | return this._processedValues; | ||
326 | }, | ||
327 | |||
328 | 'setProcessedValues': function(aValue) { | ||
329 | this._processedValues = aValue; | ||
330 | return this._processedValues; | ||
331 | }, | ||
332 | |||
333 | //------------------------------------------------------------------------- | ||
334 | |||
335 | 'importValues': function() { | ||
336 | var deferredResult; | ||
337 | |||
338 | deferredResult = new MochiKit.Async.Deferred(); | ||
339 | |||
340 | deferredResult.addCallback(MochiKit.Base.bind(function() { | ||
341 | this.nextButton().disable(); | ||
342 | this.startProcessing(); | ||
343 | },this)); | ||
344 | deferredResult.addCallback(MochiKit.Base.method(this, 'importProcessedValues')); | ||
345 | deferredResult.addCallback(MochiKit.Base.method(this, 'processingDone')); | ||
346 | deferredResult.addErrback (MochiKit.Base.method(this, 'processingAborted')); | ||
347 | deferredResult.callback(); | ||
348 | |||
349 | return deferredResult; | ||
350 | }, | ||
351 | |||
352 | //------------------------------------------------------------------------- | ||
353 | |||
354 | 'importProcessedValues': function() { | ||
355 | var deferredResult; | ||
356 | var processedValues; | ||
357 | var selectedRecords; | ||
358 | var i,c; | ||
359 | |||
360 | //MochiKit.Logging.logDebug(">>> GenericImportComponent.importProcessedValues"); | ||
361 | processedValues = this.processedValues(); | ||
362 | selectedRecords = []; | ||
363 | |||
364 | c = processedValues.length; | ||
365 | for (i=0; i<c; i++) { | ||
366 | var currentRecord; | ||
367 | |||
368 | currentRecord = processedValues[i]; | ||
369 | if (this.getDom(currentRecord.reference()).checked == true) { | ||
370 | selectedRecords.push(currentRecord); | ||
371 | } | ||
372 | } | ||
373 | |||
374 | deferredResult = new MochiKit.Async.Deferred(); | ||
375 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("GenericImportComponent - 1: " + res); return res;}); | ||
376 | deferredResult.addCallback(function(someRecords) { | ||
377 | var innerDeferredResult; | ||
378 | var text; | ||
379 | |||
380 | text = Clipperz.PM.Strings['importData_importConfirmation_text']; | ||
381 | text = text.replace(/__numberOfRecords__/, someRecords.length); | ||
382 | |||
383 | innerDeferredResult = new MochiKit.Async.Deferred(); | ||
384 | //innerDeferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("GenericImportComponent - 1.1: " + res); return res;}); | ||
385 | innerDeferredResult.addCallback(MochiKit.Async.succeed, someRecords); | ||
386 | //innerDeferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("GenericImportComponent - 1.2: " + res); return res;}); | ||
387 | |||
388 | Clipperz.PM.Components.MessageBox().deferredShow({ | ||
389 | title:Clipperz.PM.Strings['importData_importConfirmation_title'], | ||
390 | text:text, | ||
391 | width:240, | ||
392 | showProgressBar:false, | ||
393 | showCloseButton:false, | ||
394 | buttons:{ | ||
395 | 'yes':"yes", //Clipperz.PM.Strings['mainPanelDeleteRecordPanelConfirmButtonLabel'], | ||
396 | 'no':"no" //Clipperz.PM.Strings['mainPanelDeleteRecordPanelDenyButtonLabel'] | ||
397 | }, | ||
398 | fn:MochiKit.Base.partial(function(aDeferred, aResult) { | ||
399 | if (aResult == 'yes') { | ||
400 | aDeferred.callback(aResult); | ||
401 | } else { | ||
402 | aDeferred.errback(aResult); | ||
403 | } | ||
404 | }, innerDeferredResult) | ||
405 | }/*, this.getId('nextActionButton')*/); | ||
406 | |||
407 | return innerDeferredResult; | ||
408 | }); | ||
409 | |||
410 | //------------------- | ||
411 | // deferredResult.addCallback(MochiKit.Base.bind(function(someRecords) { | ||
412 | // Clipperz.PM.Components.MessageBox.showProgressPanel( | ||
413 | // MochiKit.Base.method(this, 'importProcessedValues_core', someRecords), | ||
414 | // MochiKit.Base.method(this, 'handleProcessError'), | ||
415 | // this.getDom('mainDiv') | ||
416 | // ); | ||
417 | // }, this)); | ||
418 | |||
419 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("GenericImportComponent - 2: " + res); return res;}); | ||
420 | deferredResult.addCallback(MochiKit.Base.method(Clipperz.PM.Components.MessageBox(), 'deferredShow'), | ||
421 | { | ||
422 | // title:Clipperz.PM.Strings['accountPanelDeletingAccountPanelProgressTitle'], | ||
423 | // text:Clipperz.PM.Strings['accountPanelDeletingAccountPanelProgressText'], | ||
424 | width:240, | ||
425 | showProgressBar:true, | ||
426 | showCloseButton:false | ||
427 | } | ||
428 | ); | ||
429 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("GenericImportComponent - 3: " + res); return res;}); | ||
430 | |||
431 | deferredResult.addCallback(MochiKit.Base.bind(function(someRecords) { | ||
432 | var innerDeferredResult; | ||
433 | |||
434 | //MochiKit.Logging.logDebug(">>> inner deferred"); | ||
435 | innerDeferredResult = new MochiKit.Async.Deferred(); | ||
436 | |||
437 | //innerDeferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("GenericImportComponent - 3.1: " + res); return res;}); | ||
438 | innerDeferredResult.addCallback(MochiKit.Base.method(this, 'importProcessedValues_core', someRecords)); | ||
439 | //innerDeferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("GenericImportComponent - 3.2: " + res); return res;}); | ||
440 | innerDeferredResult.addErrback(MochiKit.Base.method(this, 'handleProcessError')); | ||
441 | //innerDeferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("GenericImportComponent - 3.3: " + res); return res;}); | ||
442 | innerDeferredResult.callback(someRecords); | ||
443 | //MochiKit.Logging.logDebug("<<< inner deferred"); | ||
444 | |||
445 | return innerDeferredResult; | ||
446 | }, this), selectedRecords); | ||
447 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("GenericImportComponent - 4: " + res); return res;}); | ||
448 | |||
449 | deferredResult.addCallback(MochiKit.Base.method(Clipperz.PM.Components.MessageBox(), 'hide'), 'mainDiv'); | ||
450 | |||
451 | deferredResult.addErrback(MochiKit.Base.bind(function() { | ||
452 | this.nextButton().enable(); | ||
453 | this.setCurrentStep(this.currentStep() -1); | ||
454 | }, this)); | ||
455 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("GenericImportComponent - 5: " + res); return res;}); | ||
456 | |||
457 | deferredResult.callback(selectedRecords); | ||
458 | //MochiKit.Logging.logDebug("<<< GenericImportComponent.importProcessedValues"); | ||
459 | |||
460 | return deferredResult; | ||
461 | }, | ||
462 | |||
463 | //------------------------------------------------------------------------- | ||
464 | |||
465 | 'importProcessedValues_core': function(someRecords) { | ||
466 | var deferredResult; | ||
467 | |||
468 | deferredResult = new MochiKit.Async.Deferred(); | ||
469 | |||
470 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'processingImportData'); | ||
471 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', {steps:(someRecords.length + 6 + 1)}); | ||
472 | deferredResult.addCallback(MochiKit.Async.wait, 0.5); | ||
473 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("importProcessedValues_core - 3: " + res); return res;}); | ||
474 | deferredResult.addCallback(MochiKit.Base.bind(function(someRecords) { | ||
475 | var i,c; | ||
476 | |||
477 | c = someRecords.length; | ||
478 | for (i=0; i<c; i++) { | ||
479 | this.user().addRecord(someRecords[i], true); | ||
480 | } | ||
481 | |||
482 | return someRecords; | ||
483 | }, this)); | ||
484 | deferredResult.addCallback(MochiKit.Async.wait, 0.5); | ||
485 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("importProcessedValues_core - 4: " + res); return res;}); | ||
486 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'recordAdded', null); | ||
487 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("importProcessedValues_core - 5: " + res); return res;}); | ||
488 | deferredResult.addCallback(MochiKit.Base.method(this.user(), 'saveRecords')); | ||
489 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("importProcessedValues_core - 6: " + res); return res;}); | ||
490 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'selectTab', 'mainTabPanel.recordsTab'); | ||
491 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("importProcessedValues_core - 7: " + res); return res;}); | ||
492 | |||
493 | if (this.user().preferences().shouldShowDonationPanel()) { | ||
494 | deferredResult.addCallback(Clipperz.PM.showDonationSplashScreen, this.user(), 'mainDiv'); | ||
495 | } | ||
496 | |||
497 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'importCompleted', null); | ||
498 | |||
499 | deferredResult.callback(someRecords); | ||
500 | |||
501 | return deferredResult; | ||
502 | }, | ||
503 | |||
504 | //------------------------------------------------------------------------- | ||
505 | |||
506 | 'handleParseError': function(res) { | ||
507 | this.processingAborted(); | ||
508 | MochiKit.Logging.logError("An error occurred while parsing the values: " + res); | ||
509 | alert("An error occurred while parsing the values: " + res); | ||
510 | Clipperz.PM.Components.MessageBox().hide(); | ||
511 | }, | ||
512 | |||
513 | 'handleProcessError': function(res) { | ||
514 | this.processingAborted(); | ||
515 | MochiKit.Logging.logError("An error occurred while processing the values: " + res); | ||
516 | alert("An error occurred while processing the values: " + res); | ||
517 | Clipperz.PM.Components.MessageBox().hide(); | ||
518 | }, | ||
519 | |||
520 | //------------------------------------------------------------------------- | ||
521 | __syntaxFix__: "syntax fix" | ||
522 | }); | ||
523 | |||