From 235f1ba8ec23ba565b2db85387d9d1fff515cfc1 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Mon, 17 May 2021 21:45:08 +0200 Subject: [PATCH] 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 --- api/js/etemplate/et2_core_legacyJSFunctions.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/api/js/etemplate/et2_core_legacyJSFunctions.js b/api/js/etemplate/et2_core_legacyJSFunctions.js index 26ae8281c2..8b4558428a 100644 --- a/api/js/etemplate/et2_core_legacyJSFunctions.js +++ b/api/js/etemplate/et2_core_legacyJSFunctions.js @@ -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.');