Hi,
I pushed my latest modifications to the trunk. The WiringEditor don't use SMD and YUI-RPC anymore.
Instead, you might create an "adapter" object and pass it as the "adapter" option to the WiringEditor.
An WiringEditor adapter is a javascript object that must contain 3 methods called:
saveWiring, deleteWiring, and listWirings.
Here is how the default adapter looks like:
/**
* JsonRpc Adapter (using ajax)
* @static
*/
WireIt.WiringEditor.adapters.JsonRpc = {
saveWiring: function(val, callbacks) {
this._sendJsonRpcRequest("saveWiring", val, callbacks);
},
deleteWiring: function(val, callbacks) {
this._sendJsonRpcRequest("deleteWiring", val, callbacks);
},
listWirings: function(val, callbacks) {
this._sendJsonRpcRequest("listWirings", val, callbacks);
},
// private method to send a json-rpc request using ajax
_sendJsonRpcRequest: function(method, value, callbacks) {
var postData = YAHOO.lang.JSON.stringify({"id":(this._requestId++),"method":method,"params":value,"version":"json-rpc-2.0"});
YAHOO.util.Connect.asyncRequest('POST', '../../backend/php/WiringEditor.php', {
success: function(o) {
var s = o.responseText,
r = YAHOO.lang.JSON.parse(s);
callbacks.success.call(callbacks.scope, r);
},
failure: function() {
callbacks.failure.call(callbacks.scope, r);
}
},postData);
},
_requestId: 1
};
--
Eric Abouaf
eric....@gmail.comTél: 06 29 86 37 89