summaryrefslogtreecommitdiff
path: root/frontend/gamma/js/Clipperz/Async.js
authorGiulio Cesare Solaroli <giulio.cesare@clipperz.com>2011-10-23 17:36:57 (UTC)
committer Giulio Cesare Solaroli <giulio.cesare@clipperz.com>2011-10-23 17:36:57 (UTC)
commit67455b069c4c9ec493f9cef76017e172a430a7d4 (patch) (unidiff)
tree0b287debfeeb0819b3df9dd02860cd84103e25b3 /frontend/gamma/js/Clipperz/Async.js
parentb312e037ebba7c94abea9661bcf62c52b7d73fbf (diff)
downloadclipperz-67455b069c4c9ec493f9cef76017e172a430a7d4.zip
clipperz-67455b069c4c9ec493f9cef76017e172a430a7d4.tar.gz
clipperz-67455b069c4c9ec493f9cef76017e172a430a7d4.tar.bz2
Integration of PHP backend with /beta and /gamma front ends
Fixed PHP backend and /beta code to handle request and data format compatible with /gamma. At the moment adding/deleting/editing records seem to work fine.
Diffstat (limited to 'frontend/gamma/js/Clipperz/Async.js') (more/less context) (ignore whitespace changes)
-rw-r--r--frontend/gamma/js/Clipperz/Async.js19
1 files changed, 13 insertions, 6 deletions
diff --git a/frontend/gamma/js/Clipperz/Async.js b/frontend/gamma/js/Clipperz/Async.js
index 7c9d783..97d8ecf 100644
--- a/frontend/gamma/js/Clipperz/Async.js
+++ b/frontend/gamma/js/Clipperz/Async.js
@@ -53,80 +53,86 @@ Clipperz.Base.extend(Clipperz.Async.Deferred, MochiKit.Async.Deferred, {
53 'name': function () { 53 'name': function () {
54 return this._name; 54 return this._name;
55 }, 55 },
56 56
57 'args': function () { 57 'args': function () {
58 return this._args; 58 return this._args;
59 }, 59 },
60 60
61 //----------------------------------------------------------------------------- 61 //-----------------------------------------------------------------------------
62 62
63 'callback': function (aValue) { 63 'callback': function (aValue) {
64 if (this._shouldTrace) { 64 if (this._shouldTrace) {
65 Clipperz.log("CALLBACK " + this._name, aValue); 65 //Clipperz.log("CALLBACK " + this._name, aValue);
66 console.log("CALLBACK " + this._name, aValue);
66 } 67 }
67 68
68 if (this.chained == false) { 69 if (this.chained == false) {
69 var message; 70 var message;
70 71
71 message = "ERROR [" + this._name + "]"; 72 message = "ERROR [" + this._name + "]";
72 this.addErrback(function(aResult) { 73 this.addErrback(function(aResult) {
73 if (! (aResult instanceof MochiKit.Async.CancelledError)) { 74 if (! (aResult instanceof MochiKit.Async.CancelledError)) {
74 Clipperz.log(message, aResult); 75 Clipperz.log(message, aResult);
75 } 76 }
76 return aResult; 77 return aResult;
77 }); 78 });
78 79
79 if (this._shouldTrace) { 80 if (this._shouldTrace) {
80 var resultMessage; 81 var resultMessage;
81 82
82 resultMessage = "RESULT " + this._name + " <=="; 83 resultMessage = "RESULT " + this._name + " <==";
83 // this.addCallback(function(aResult) { 84 // this.addCallback(function(aResult) {
84 Clipperz.Async.Deferred.superclass.addCallback.call(this, function(aResult) { 85 Clipperz.Async.Deferred.superclass.addCallback.call(this, function(aResult) {
85 Clipperz.log(resultMessage, aResult); 86 //Clipperz.log(resultMessage, aResult);
87 console.log(resultMessage, aResult);
86 88
87 return aResult; 89 return aResult;
88 }); 90 });
89 } 91 }
90 } 92 }
91 93
92 if (CLIPPERZ_DEFERRED_CALL_LOGGING_ENABLED === true) { 94 if (CLIPPERZ_DEFERRED_CALL_LOGGING_ENABLED === true) {
93 Clipperz.log("callback " + this._name, this); 95 Clipperz.log("callback " + this._name, this);
94 } 96 }
95 97
96 return Clipperz.Async.Deferred.superclass.callback.apply(this, arguments); 98 return Clipperz.Async.Deferred.superclass.callback.apply(this, arguments);
97 }, 99 },
98 100
99 //----------------------------------------------------------------------------- 101 //-----------------------------------------------------------------------------
100 102
101 'addCallback': function () { 103 'addCallback': function () {
102 var message; 104 var message;
103 105
104 if (this._shouldTrace) { 106 if (this._shouldTrace) {
105 this._count ++; 107 this._count ++;
106 message = "[" + this._count + "] " + this._name + " "; 108 message = "[" + this._count + "] " + this._name + " ";
107 // this.addBoth(function(aResult) {Clipperz.log(message + "-->", aResult); return aResult;}); 109 // this.addBoth(function(aResult) {Clipperz.log(message + "-->", aResult); return aResult;});
108 this.addCallbacks( 110 this.addCallbacks(
109 function(aResult) {Clipperz.log("-OK- " + message + "-->"/*, aResult*/); return aResult;}, 111 //function(aResult) {Clipperz.log("-OK- " + message + "-->"/*, aResult*/); return aResult;},
110 function(aResult) {Clipperz.log("FAIL " + message + "-->"/*, aResult*/); return aResult;} 112 function(aResult) {console.log("-OK- " + message + "-->"/*, aResult*/); return aResult;},
113 //function(aResult) {Clipperz.log("FAIL " + message + "-->"/*, aResult*/); return aResult;}
114 function(aResult) {console.log("FAIL " + message + "-->"/*, aResult*/); return aResult;}
111 ); 115 );
112 } 116 }
113 117
114 Clipperz.Async.Deferred.superclass.addCallback.apply(this, arguments); 118 Clipperz.Async.Deferred.superclass.addCallback.apply(this, arguments);
115 119
116 if (this._shouldTrace) { 120 if (this._shouldTrace) {
117 // this.addBoth(function(aResult) {Clipperz.log(message + "<--", aResult); return aResult;}); 121 // this.addBoth(function(aResult) {Clipperz.log(message + "<--", aResult); return aResult;});
118 this.addCallbacks( 122 this.addCallbacks(
119 function(aResult) {Clipperz.log("-OK- " + message + "<--", aResult); return aResult;}, 123 //function(aResult) {Clipperz.log("-OK- " + message + "<--", aResult); return aResult;},
120 function(aResult) {Clipperz.log("FAIL " + message + "<--", aResult); return aResult;} 124 function(aResult) {console.log("-OK- " + message + "<--", aResult); return aResult;},
125 //function(aResult) {Clipperz.log("FAIL " + message + "<--", aResult); return aResult;}
126 function(aResult) {console.log("FAIL " + message + "<--", aResult); return aResult;}
121 ); 127 );
122 } 128 }
123 }, 129 },
124 130
125 //============================================================================= 131 //=============================================================================
126 132
127 'addCallbackPass': function() { 133 'addCallbackPass': function() {
128 var passFunction; 134 var passFunction;
129 135
130 passFunction = MochiKit.Base.partial.apply(null, arguments); 136 passFunction = MochiKit.Base.partial.apply(null, arguments);
131 137
132 this.addCallback(function() { 138 this.addCallback(function() {
@@ -397,24 +403,25 @@ MochiKit.Base.update(Clipperz.Async.DeferredSynchronizer.prototype, {
397 403
398 //----------------------------------------------------------------------------- 404 //-----------------------------------------------------------------------------
399 405
400 'handleMethodCallDone': function(anIndexValue, aResult) { 406 'handleMethodCallDone': function(anIndexValue, aResult) {
401 this.incrementNumberOfMethodsDone(); 407 this.incrementNumberOfMethodsDone();
402 this.methodResults()[anIndexValue] = aResult; 408 this.methodResults()[anIndexValue] = aResult;
403 409
404 if (this.numberOfMethodsDone() < this.methods().length) { 410 if (this.numberOfMethodsDone() < this.methods().length) {
405 //nothing to do here other than possibly log something 411 //nothing to do here other than possibly log something
406 } else if (this.numberOfMethodsDone() == this.methods().length) { 412 } else if (this.numberOfMethodsDone() == this.methods().length) {
407 this.result().callback(); 413 this.result().callback();
408 } else if (this.numberOfMethodsDone() > this.methods().length) { 414 } else if (this.numberOfMethodsDone() > this.methods().length) {
415 alert("Clipperz.Async.Deferred.handleMethodCallDone -> WTF!");
409 //WTF!!! :( 416 //WTF!!! :(
410 } 417 }
411 418
412 }, 419 },
413 420
414 //----------------------------------------------------------------------------- 421 //-----------------------------------------------------------------------------
415 422
416 __syntaxFix__: "syntax fix" 423 __syntaxFix__: "syntax fix"
417}); 424});
418 425
419//############################################################################# 426//#############################################################################
420 427