allow for objectified egw functions like app.APPLICATION.

This commit is contained in:
Klaus Leithoff 2013-04-09 14:39:56 +00:00
parent cd25f3e625
commit 91dc1f9df9

View File

@ -472,6 +472,25 @@ egw_json_request.prototype.handleResponse = function(data, textStatus, XMLHttpRe
_egw_json_debug_log(e, {'Function': res.data.func, 'Parameters': res.data.parms});
}
hasResponse = true;
} else if (typeof res.data.func == "string" &&
res.data.func.substr(0,4) == "app." && window.app)
{
var parts = res.data.func.split(".");
if(parts.length == 3 && typeof window.app[parts[1]] == "object" &&
typeof window.app[parts[1]][parts[2]] == "function")
{
try
{
this.context = window.app[parts[1]][parts[2]].apply(window.app[parts[1]], res.data.parms);
}
catch (e)
{
_egw_json_debug_log(e, {'Function': res.data.func, 'Parameters': res.data.parms});
}
}
hasResponse = true;
} else
throw 'Invalid parameters';
break;