Get legacy JS parser to understand functions that don't start with "app." and don't have brackets in the attribute.

This covers widget or other non-app static functions (eg: et2_avatar.uploadAvatar_onFinish)
This commit is contained in:
nathangray
2020-04-23 11:33:24 -06:00
parent b7ec2a9b91
commit eaafd5eb1f
3 changed files with 23 additions and 8 deletions

View File

@ -123,6 +123,28 @@
context = _widget.getDOMNode();
}
// Check to see if it's referring to an existing function with no arguments specified.
// If so, bind context & use it directly
var parts = _code.split(".");
var existing_func = parts.pop();
var parent = _widget.egw().window;
for(var i=0; i < parts.length; ++i)
{
if (typeof parent[parts[i]] !== "undefined")
{
parent = parent[parts[i]];
}
// Nope
else
{
break;
}
}
if (typeof parent[existing_func] === "function")
{
return parent[existing_func].bind(context);
}
// Generate the function itself, if it fails, log the error message and
// return a function which always returns false
try {