summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--frontend/beta/js/Clipperz/PM/Connection.js9
-rw-r--r--frontend/beta/js/Clipperz/PM/DataModel/Record.js12
-rw-r--r--frontend/beta/js/Clipperz/PM/DataModel/User.js17
3 files changed, 24 insertions, 14 deletions
diff --git a/frontend/beta/js/Clipperz/PM/Connection.js b/frontend/beta/js/Clipperz/PM/Connection.js
index 85aea21..e81c7a6 100644
--- a/frontend/beta/js/Clipperz/PM/Connection.js
+++ b/frontend/beta/js/Clipperz/PM/Connection.js
@@ -297,9 +297,13 @@ deferredResult.addErrback(MochiKit.Base.bind(function(res) {MochiKit.Logging.log
297 this.user().setLoginInfo(someParameters['loginInfo']); 297 this.user().setLoginInfo(someParameters['loginInfo']);
298 this.user().setShouldDownloadOfflineCopy(someParameters['offlineCopyNeeded']); 298 this.user().setShouldDownloadOfflineCopy(someParameters['offlineCopyNeeded']);
299 this.user().setLock(someParameters['lock']); 299
300 if ((isReconnecting == true) && (this.user().lock() != someParameters['lock'])) {
301 throw Clipperz.PM.Connection.exception.StaleData;
302 }
300 303
301 if (this.oneTimePassword() != null) { 304 if (this.oneTimePassword() != null) {
302 result.addCallback(MochiKit.Base.method(this.user().oneTimePasswordManager(), 'archiveOneTimePassword', this.oneTimePassword())); 305 result.addCallback(MochiKit.Base.method(this.user().oneTimePasswordManager(), 'archiveOneTimePassword', this.oneTimePassword()));
303 } 306 }
307
304 result.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'connection_loggedIn'); 308 result.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'connection_loggedIn');
305 result.addCallback(MochiKit.Async.succeed, someParameters); 309 result.addCallback(MochiKit.Async.succeed, someParameters);
@@ -578,4 +582,5 @@ Clipperz.PM.Connection.SRP['1.1'].prototype = MochiKit.Base.update(new Clipperz.
578 582
579Clipperz.PM.Connection.exception = { 583Clipperz.PM.Connection.exception = {
580 WrongChecksum: new MochiKit.Base.NamedError("Clipperz.ByteArray.exception.InvalidValue") 584 WrongChecksum: new MochiKit.Base.NamedError("Clipperz.ByteArray.exception.InvalidValue"),
585 StaleData: new MochiKit.Base.NamedError("Stale data")
581}; 586};
diff --git a/frontend/beta/js/Clipperz/PM/DataModel/Record.js b/frontend/beta/js/Clipperz/PM/DataModel/Record.js
index ffb45de..ecb6c37 100644
--- a/frontend/beta/js/Clipperz/PM/DataModel/Record.js
+++ b/frontend/beta/js/Clipperz/PM/DataModel/Record.js
@@ -640,9 +640,11 @@ console.log("Record.processData - currentVersionParameters", currentVersionParam
640 var result; 640 var result;
641 641
642 if (this.isBrandNew() == false) { 642 // if (this.isBrandNew() == false) {
643 result = this.user().saveRecords([this], 'updateData'); 643 // result = this.user().saveRecords([this], 'updateData');
644 } else { 644 // } else {
645 result = this.user().saveRecords([this], 'addNewRecords'); 645 // result = this.user().saveRecords([this], 'addNewRecords');
646 } 646 // }
647
648 result = this.user().saveRecords([this]);
647 649
648 return result; 650 return result;
diff --git a/frontend/beta/js/Clipperz/PM/DataModel/User.js b/frontend/beta/js/Clipperz/PM/DataModel/User.js
index dbbe9a0..b065557 100644
--- a/frontend/beta/js/Clipperz/PM/DataModel/User.js
+++ b/frontend/beta/js/Clipperz/PM/DataModel/User.js
@@ -286,12 +286,12 @@ MochiKit.Logging.logError("- User.errorHandler: " + anErrorString + " (" + anExc
286 //------------------------------------------------------------------------- 286 //-------------------------------------------------------------------------
287 287
288 'saveRecords': function(someRecords, aMethodName) { 288 'saveRecords': function(someRecords /*, aMethodName*/) {
289 var deferredResult; 289 var deferredResult;
290 var methodName; 290 // var methodName;
291 varresult; 291 varresult;
292 var i,c; 292 var i,c;
293 293
294//console.log("User.saveRecords - someRecords", someRecords); 294//console.log("User.saveRecords - someRecords", someRecords);
295 methodName = aMethodName || 'addNewRecords'; 295 // methodName = aMethodName || 'addNewRecords';
296 296
297 Clipperz.NotificationCenter.notify(this, 'updatedSection', 'records', true); 297 Clipperz.NotificationCenter.notify(this, 'updatedSection', 'records', true);
@@ -368,5 +368,5 @@ MochiKit.Logging.logDebug("--- User.saveRecords - 2");
368 368
369 deferredResult.addCallback(function(aResult, res) { 369 deferredResult.addCallback(function(aResult, res) {
370 aResult['records'].push(res); 370 aResult['records'] = { 'updated': [res] };
371 return aResult; 371 return aResult;
372 }, result); 372 }, result);
@@ -377,5 +377,6 @@ MochiKit.Logging.logDebug("--- User.saveRecords - 2");
377 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'saveCard_sendingData'); 377 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'saveCard_sendingData');
378//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.saveRecords - 8 " + res); return res;}); 378//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.saveRecords - 8 " + res); return res;});
379 deferredResult.addCallback(MochiKit.Base.method(this.connection(), 'message'), methodName); 379 // deferredResult.addCallback(MochiKit.Base.method(this.connection(), 'message'), methodName);
380 deferredResult.addCallback(MochiKit.Base.method(this.connection(), 'message'), 'saveChanges');
380//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.saveRecords - 9 " + res); return res;}); 381//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.saveRecords - 9 " + res); return res;});
381 382
@@ -432,5 +433,6 @@ MochiKit.Logging.logDebug("--- User.saveRecords - 2");
432 return result; 433 return result;
433 }, someRecords); 434 }, someRecords);
434 someParameters.recordReferences = recordReferences; 435 // someParameters.recordReferences = recordReferences;
436 someParameters['records'] = { 'deleted': recordReferences};
435 437
436 return someParameters; 438 return someParameters;
@@ -449,5 +451,6 @@ MochiKit.Logging.logDebug("--- User.saveRecords - 2");
449//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.deleteRecords parameters: " + Clipperz.Base.serializeJSON(res)); return res;}); 451//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.deleteRecords parameters: " + Clipperz.Base.serializeJSON(res)); return res;});
450//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.deleteRecordsAction - 7 " + res); return res;}); 452//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.deleteRecordsAction - 7 " + res); return res;});
451 deferredResult.addCallback(MochiKit.Base.method(this.connection(), 'message'), 'deleteRecords'); 453 // deferredResult.addCallback(MochiKit.Base.method(this.connection(), 'message'), 'deleteRecords');
454 deferredResult.addCallback(MochiKit.Base.method(this.connection(), 'message'), 'saveChanges');
452//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.deleteRecordsAction - 8 " + res); return res;}); 455//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.deleteRecordsAction - 8 " + res); return res;});
453 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'deleteRecord_updatingInterface'); 456 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'deleteRecord_updatingInterface');