dynamic load app.js file for "app.$app.$func" type handlers, if not already loaded

so eg. a config.xet run by admin app could call a handler from the apps own app.js
This commit is contained in:
Ralf Becker 2021-05-17 21:45:08 +02:00
parent a4199de696
commit fcbe746755

View File

@ -150,7 +150,11 @@
// Code is app.appname.function, add the arguments so it can be executed
if (typeof _code == 'string' && _code.indexOf('app') == 0 && _code.split('.').length >= 3 && _code.indexOf('(') == -1)
{
_code += '(ev,widget)';
return function(ev)
{
const app = widget.getInstanceManager().app_obj;
return egw.applyFunc(_code, [ev, _widget], context);
}
}
// use app object from etemplate2, which might be private and not just window.app
_code = _code.replace(/(window\.)?app\./, 'widget.getInstanceManager().app_obj.');