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) (side-by-side diff)
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) (show 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
@@ -41,104 +41,110 @@ Clipperz.Async.Deferred = function(aName, args) {
this._name = aName || "Anonymous deferred";
this._count = 0;
this._shouldTrace = ((CLIPPERZ_DEFERRED_TRACING_ENABLED === true) || (args.trace === true));
this._vars = null;
return this;
}
//=============================================================================
Clipperz.Base.extend(Clipperz.Async.Deferred, MochiKit.Async.Deferred, {
'name': function () {
return this._name;
},
'args': function () {
return this._args;
},
//-----------------------------------------------------------------------------
'callback': function (aValue) {
if (this._shouldTrace) {
- Clipperz.log("CALLBACK " + this._name, aValue);
+ // Clipperz.log("CALLBACK " + this._name, aValue);
+ console.log("CALLBACK " + this._name, aValue);
}
if (this.chained == false) {
var message;
message = "ERROR [" + this._name + "]";
this.addErrback(function(aResult) {
if (! (aResult instanceof MochiKit.Async.CancelledError)) {
Clipperz.log(message, aResult);
}
return aResult;
});
if (this._shouldTrace) {
var resultMessage;
resultMessage = "RESULT " + this._name + " <==";
// this.addCallback(function(aResult) {
Clipperz.Async.Deferred.superclass.addCallback.call(this, function(aResult) {
- Clipperz.log(resultMessage, aResult);
+ // Clipperz.log(resultMessage, aResult);
+ console.log(resultMessage, aResult);
return aResult;
});
}
}
if (CLIPPERZ_DEFERRED_CALL_LOGGING_ENABLED === true) {
Clipperz.log("callback " + this._name, this);
}
return Clipperz.Async.Deferred.superclass.callback.apply(this, arguments);
},
//-----------------------------------------------------------------------------
'addCallback': function () {
var message;
if (this._shouldTrace) {
this._count ++;
message = "[" + this._count + "] " + this._name + " ";
// this.addBoth(function(aResult) {Clipperz.log(message + "-->", aResult); return aResult;});
this.addCallbacks(
- function(aResult) {Clipperz.log("-OK- " + message + "-->"/*, aResult*/); return aResult;},
- function(aResult) {Clipperz.log("FAIL " + message + "-->"/*, aResult*/); return aResult;}
+ // function(aResult) {Clipperz.log("-OK- " + message + "-->"/*, aResult*/); return aResult;},
+ function(aResult) {console.log("-OK- " + message + "-->"/*, aResult*/); return aResult;},
+ // function(aResult) {Clipperz.log("FAIL " + message + "-->"/*, aResult*/); return aResult;}
+ function(aResult) {console.log("FAIL " + message + "-->"/*, aResult*/); return aResult;}
);
}
Clipperz.Async.Deferred.superclass.addCallback.apply(this, arguments);
if (this._shouldTrace) {
// this.addBoth(function(aResult) {Clipperz.log(message + "<--", aResult); return aResult;});
this.addCallbacks(
- function(aResult) {Clipperz.log("-OK- " + message + "<--", aResult); return aResult;},
- function(aResult) {Clipperz.log("FAIL " + message + "<--", aResult); return aResult;}
+ // function(aResult) {Clipperz.log("-OK- " + message + "<--", aResult); return aResult;},
+ function(aResult) {console.log("-OK- " + message + "<--", aResult); return aResult;},
+ // function(aResult) {Clipperz.log("FAIL " + message + "<--", aResult); return aResult;}
+ function(aResult) {console.log("FAIL " + message + "<--", aResult); return aResult;}
);
}
},
//=============================================================================
'addCallbackPass': function() {
var passFunction;
passFunction = MochiKit.Base.partial.apply(null, arguments);
this.addCallback(function() {
var result;
result = arguments[arguments.length -1];
passFunction();
return result;
});
},
//-----------------------------------------------------------------------------
'addErrbackPass': function() {
@@ -385,48 +391,49 @@ MochiKit.Base.update(Clipperz.Async.DeferredSynchronizer.prototype, {
}
deferredResult.addBoth(MochiKit.Base.method(this, 'handleMethodCallDone', i));
deferredResults.push(deferredResult);
}
for (i=0; i<c; i++) {
deferredResults[i].callback(aValue);
}
return this.result();
},
//-----------------------------------------------------------------------------
'handleMethodCallDone': function(anIndexValue, aResult) {
this.incrementNumberOfMethodsDone();
this.methodResults()[anIndexValue] = aResult;
if (this.numberOfMethodsDone() < this.methods().length) {
// nothing to do here other than possibly log something
} else if (this.numberOfMethodsDone() == this.methods().length) {
this.result().callback();
} else if (this.numberOfMethodsDone() > this.methods().length) {
+ alert("Clipperz.Async.Deferred.handleMethodCallDone -> WTF!");
// WTF!!! :(
}
},
//-----------------------------------------------------------------------------
__syntaxFix__: "syntax fix"
});
//#############################################################################
MochiKit.Base.update(Clipperz.Async, {
'callbacks': function (aName, someFunctions, someArguments, aCallbackValue) {
var deferredResult;
var i, c;
deferredResult = new Clipperz.Async.Deferred(aName, someArguments);
c = someFunctions.length;
for (i=0; i<c; i++) {
deferredResult.addCallback(someFunctions[i]);
}
deferredResult.callback(aCallbackValue);