-rw-r--r-- | frontend/beta/js/Clipperz/PM/Connection.js | 9 | ||||
-rw-r--r-- | frontend/beta/js/Clipperz/PM/DataModel/Record.js | 12 | ||||
-rw-r--r-- | frontend/beta/js/Clipperz/PM/DataModel/User.js | 17 |
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 | |||
@@ -298,3 +298,6 @@ deferredResult.addErrback(MochiKit.Base.bind(function(res) {MochiKit.Logging.log | |||
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 | ||
@@ -303,2 +306,3 @@ deferredResult.addErrback(MochiKit.Base.bind(function(res) {MochiKit.Logging.log | |||
303 | } | 306 | } |
307 | |||
304 | result.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'connection_loggedIn'); | 308 | result.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'connection_loggedIn'); |
@@ -579,3 +583,4 @@ Clipperz.PM.Connection.SRP['1.1'].prototype = MochiKit.Base.update(new Clipperz. | |||
579 | Clipperz.PM.Connection.exception = { | 583 | Clipperz.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 | |||
@@ -641,7 +641,9 @@ console.log("Record.processData - currentVersionParameters", currentVersionParam | |||
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 | ||
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 | |||
@@ -287,5 +287,5 @@ MochiKit.Logging.logError("- User.errorHandler: " + anErrorString + " (" + anExc | |||
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; |
@@ -294,3 +294,3 @@ MochiKit.Logging.logError("- User.errorHandler: " + anErrorString + " (" + anExc | |||
294 | //console.log("User.saveRecords - someRecords", someRecords); | 294 | //console.log("User.saveRecords - someRecords", someRecords); |
295 | methodName = aMethodName || 'addNewRecords'; | 295 | // methodName = aMethodName || 'addNewRecords'; |
296 | 296 | ||
@@ -369,3 +369,3 @@ MochiKit.Logging.logDebug("--- User.saveRecords - 2"); | |||
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; |
@@ -378,3 +378,4 @@ MochiKit.Logging.logDebug("--- User.saveRecords - 2"); | |||
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;}); |
@@ -433,3 +434,4 @@ MochiKit.Logging.logDebug("--- User.saveRecords - 2"); | |||
433 | }, someRecords); | 434 | }, someRecords); |
434 | someParameters.recordReferences = recordReferences; | 435 | // someParameters.recordReferences = recordReferences; |
436 | someParameters['records'] = { 'deleted': recordReferences}; | ||
435 | 437 | ||
@@ -450,3 +452,4 @@ MochiKit.Logging.logDebug("--- User.saveRecords - 2"); | |||
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;}); |