SuperX-Kernmodul
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
2.5 KiB

/*
Copyright (c) 2004-2006, The Dojo Foundation
All Rights Reserved.
Licensed under the Academic Free License version 2.1 or above OR the
modified BSD license. For more information on Dojo licensing, see:
http://dojotoolkit.org/community/licensing.shtml
*/
dojo.provide("memtext.widget.TreeLoadingControllerSx");
dojo.require("dojo.widget.TreeLoadingControllerV3");
dojo.require("dojo.widget.TreeBasicControllerV3");
dojo.require("dojo.event.*");
dojo.require("dojo.json");
dojo.require("dojo.io.*");
dojo.require("dojo.Deferred");
dojo.require("dojo.DeferredList");
dojo.declare("dojo.Error", Error, function (message, extra) {
this.message = message;
this.extra = extra;
this.stack = (new Error()).stack;
});
dojo.declare("dojo.CommunicationError", dojo.Error, function () {
this.name = "CommunicationError";
});
dojo.declare("dojo.LockedError", dojo.Error, function () {
this.name = "LockedError";
});
dojo.declare("dojo.FormatError", dojo.Error, function () {
this.name = "FormatError";
});
dojo.declare("dojo.RpcError", dojo.Error, function () {
this.name = "RpcError";
});
//Aenderung: RpcActionParam
dojo.widget.defineWidget("memtext.widget.TreeLoadingControllerSx", dojo.widget.TreeLoadingControllerV3,
{RpcUrl:"", RpcActionParam:"",
setRpcActionParam:function(param)
{
this.RpcActionParam=param;
dojo.debug("param5:"+param);
}
, loadRemote:function (node, sync) {
var _this = this;
var params = {node:this.getInfo(node), tree:this.getInfo(node.tree)};
//MB Aenderung node.objectId
var deferred = this.runRpc({url:this.getRpcUrl(node.objectId), sync:sync, params:params});
// wird nur bei Erfolg aufgerufen
deferred.addCallback(function (res) {
return _this.loadProcessResponse(node, res);
});
return deferred;
}
// Method: post!
, runRpc:function (kw) {
var _this = this;
var deferred = new dojo.Deferred();
//text/json-comment-filtered -> in deferredBindHandler eingebaut
dojo.io.bind({url:kw.url, method:"post",handle:this.getDeferredBindHandler(deferred), mimetype:"text/plain", preventCache:this.preventCache, sync:kw.sync, content:{data:dojo.json.serialize(kw.params)}});
return deferred;
}, // json-comment-filtered!!
getDeferredBindHandler:function (deferred) {
return dojo.lang.hitch(this, function (type, obj) {
if (obj) obj=obj.substring(obj.indexOf("\/\*")+2, obj.lastIndexOf("\*\/"));
obj=eval(obj);
var error = this.checkValidRpcResponse.apply(this, arguments);
if (error) {
deferred.errback(error);
return;
}
deferred.callback(obj);
});
}
//extra
});