summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--frontend/beta/js/Clipperz/PM/DataModel/User.js9
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
@@ -297,33 +297,38 @@ MochiKit.Logging.logError("- User.errorHandler: " + anErrorString + " (" + anExc
Clipperz.NotificationCenter.notify(this, 'updatedSection', 'records', true);
//MochiKit.Logging.logDebug(">>> User.saveRecords");
//MochiKit.Logging.logDebug(">>> [" + (new Date()).valueOf() + "] User.saveRecords");
/*
MochiKit.Logging.logDebug("--- User.saveRecords - 1");
MochiKit.Iter.forEach(someRecords, function(aRecord) {
if (aRecord.headerNotes() != null) {
aRecord.setNotes(aRecord.headerNotes());
}
aRecord.syncDirectLoginReferenceValues();
aRecord.currentVersion().createNewVersion();
aRecord.updateKey();
});
MochiKit.Logging.logDebug("--- User.saveRecords - 2");
*/
- result = {'records': []};
+ result = {
+ 'records': {
+// 'deleted': [],
+ 'updated': []
+ }
+ };
deferredResult = new MochiKit.Async.Deferred();
c = someRecords.length;
for (i=0; i<c; i++) {
deferredResult.addCallback(function(aRecord) {
if (aRecord.headerNotes() != null) {
aRecord.setNotes(aRecord.headerNotes());
}
aRecord.syncDirectLoginReferenceValues();
aRecord.currentVersion().createNewVersion();
aRecord.updateKey();
}, someRecords[i]);
deferredResult.addCallback(MochiKit.Async.wait, 0.1);
}
//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.saveRecords - 1 " + res); return res;});
deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'saveCard_collectRecordInfo');
@@ -354,33 +359,33 @@ MochiKit.Logging.logDebug("--- User.saveRecords - 2");
aResult['record'] = res;
return aResult;
}, recordData);
//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.saveRecords - 6.4 " + res); return res;});
deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', {} /*'saveCard_encryptRecordVersions'*/);
//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.saveRecords - 6.5 " + res); return res;});
deferredResult.addCallback(MochiKit.Base.method(someRecords[i].currentVersion(), 'encryptedData'));
//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.saveRecords - 6.6 " + res); return res;});
deferredResult.addCallback(function(aResult, res) {
aResult['currentRecordVersion'] = res;
return aResult;
}, recordData);
//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.saveRecords - 6.7 " + res); return res;});
deferredResult.addCallback(function(aResult, res) {
- aResult['records'] = { 'updated': [res] };
+ aResult['records']['updated'].push(res);
return aResult;
}, result);
//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.saveRecords - 6.8 " + res); return res;});
}
//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.saveRecords - 7 " + res); return res;});
deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'saveCard_sendingData');
//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.saveRecords - 8 " + res); return res;});
// deferredResult.addCallback(MochiKit.Base.method(this.connection(), 'message'), methodName);
deferredResult.addCallback(MochiKit.Base.method(this.connection(), 'message'), 'saveChanges');
//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.saveRecords - 9 " + res); return res;});
for (i=0; i<c; i++) {
//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.saveRecords - 9.1 " + res); return res;});
deferredResult.addCallback(MochiKit.Base.method(someRecords[i], 'takeSnapshotOfCurrentData'));
//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.saveRecords - 9.2 " + res); return res;});