-rw-r--r-- | frontend/beta/js/Clipperz/PM/DataModel/User.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/frontend/beta/js/Clipperz/PM/DataModel/User.js b/frontend/beta/js/Clipperz/PM/DataModel/User.js index b065557..b29d224 100644 --- a/frontend/beta/js/Clipperz/PM/DataModel/User.js +++ b/frontend/beta/js/Clipperz/PM/DataModel/User.js | |||
@@ -301,25 +301,30 @@ MochiKit.Logging.logError("- User.errorHandler: " + anErrorString + " (" + anExc | |||
301 | MochiKit.Logging.logDebug("--- User.saveRecords - 1"); | 301 | MochiKit.Logging.logDebug("--- User.saveRecords - 1"); |
302 | MochiKit.Iter.forEach(someRecords, function(aRecord) { | 302 | MochiKit.Iter.forEach(someRecords, function(aRecord) { |
303 | if (aRecord.headerNotes() != null) { | 303 | if (aRecord.headerNotes() != null) { |
304 | aRecord.setNotes(aRecord.headerNotes()); | 304 | aRecord.setNotes(aRecord.headerNotes()); |
305 | } | 305 | } |
306 | aRecord.syncDirectLoginReferenceValues(); | 306 | aRecord.syncDirectLoginReferenceValues(); |
307 | aRecord.currentVersion().createNewVersion(); | 307 | aRecord.currentVersion().createNewVersion(); |
308 | aRecord.updateKey(); | 308 | aRecord.updateKey(); |
309 | }); | 309 | }); |
310 | MochiKit.Logging.logDebug("--- User.saveRecords - 2"); | 310 | MochiKit.Logging.logDebug("--- User.saveRecords - 2"); |
311 | */ | 311 | */ |
312 | 312 | ||
313 | result = {'records': []}; | 313 | result = { |
314 | 'records': { | ||
315 | // 'deleted': [], | ||
316 | 'updated': [] | ||
317 | } | ||
318 | }; | ||
314 | 319 | ||
315 | deferredResult = new MochiKit.Async.Deferred(); | 320 | deferredResult = new MochiKit.Async.Deferred(); |
316 | c = someRecords.length; | 321 | c = someRecords.length; |
317 | for (i=0; i<c; i++) { | 322 | for (i=0; i<c; i++) { |
318 | deferredResult.addCallback(function(aRecord) { | 323 | deferredResult.addCallback(function(aRecord) { |
319 | if (aRecord.headerNotes() != null) { | 324 | if (aRecord.headerNotes() != null) { |
320 | aRecord.setNotes(aRecord.headerNotes()); | 325 | aRecord.setNotes(aRecord.headerNotes()); |
321 | } | 326 | } |
322 | aRecord.syncDirectLoginReferenceValues(); | 327 | aRecord.syncDirectLoginReferenceValues(); |
323 | aRecord.currentVersion().createNewVersion(); | 328 | aRecord.currentVersion().createNewVersion(); |
324 | aRecord.updateKey(); | 329 | aRecord.updateKey(); |
325 | }, someRecords[i]); | 330 | }, someRecords[i]); |
@@ -358,25 +363,25 @@ MochiKit.Logging.logDebug("--- User.saveRecords - 2"); | |||
358 | 363 | ||
359 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', {} /*'saveCard_encryptRecordVersions'*/); | 364 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', {} /*'saveCard_encryptRecordVersions'*/); |
360 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.saveRecords - 6.5 " + res); return res;}); | 365 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.saveRecords - 6.5 " + res); return res;}); |
361 | deferredResult.addCallback(MochiKit.Base.method(someRecords[i].currentVersion(), 'encryptedData')); | 366 | deferredResult.addCallback(MochiKit.Base.method(someRecords[i].currentVersion(), 'encryptedData')); |
362 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.saveRecords - 6.6 " + res); return res;}); | 367 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.saveRecords - 6.6 " + res); return res;}); |
363 | deferredResult.addCallback(function(aResult, res) { | 368 | deferredResult.addCallback(function(aResult, res) { |
364 | aResult['currentRecordVersion'] = res; | 369 | aResult['currentRecordVersion'] = res; |
365 | return aResult; | 370 | return aResult; |
366 | }, recordData); | 371 | }, recordData); |
367 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.saveRecords - 6.7 " + res); return res;}); | 372 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.saveRecords - 6.7 " + res); return res;}); |
368 | 373 | ||
369 | deferredResult.addCallback(function(aResult, res) { | 374 | deferredResult.addCallback(function(aResult, res) { |
370 | aResult['records'] = { 'updated': [res] }; | 375 | aResult['records']['updated'].push(res); |
371 | return aResult; | 376 | return aResult; |
372 | }, result); | 377 | }, result); |
373 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.saveRecords - 6.8 " + res); return res;}); | 378 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.saveRecords - 6.8 " + res); return res;}); |
374 | } | 379 | } |
375 | 380 | ||
376 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.saveRecords - 7 " + res); return res;}); | 381 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.saveRecords - 7 " + res); return res;}); |
377 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'saveCard_sendingData'); | 382 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'saveCard_sendingData'); |
378 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.saveRecords - 8 " + res); return res;}); | 383 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.saveRecords - 8 " + res); return res;}); |
379 | // deferredResult.addCallback(MochiKit.Base.method(this.connection(), 'message'), methodName); | 384 | // deferredResult.addCallback(MochiKit.Base.method(this.connection(), 'message'), methodName); |
380 | deferredResult.addCallback(MochiKit.Base.method(this.connection(), 'message'), 'saveChanges'); | 385 | deferredResult.addCallback(MochiKit.Base.method(this.connection(), 'message'), 'saveChanges'); |
381 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.saveRecords - 9 " + res); return res;}); | 386 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.saveRecords - 9 " + res); return res;}); |
382 | 387 | ||