From d3d8ff349356a17dcf5664794215bcb791aaaf0e Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Tue, 25 May 2021 18:25:11 +0200 Subject: [PATCH] * Mail/Admin: fix not working mail wizard caused by loading app.js again and therefore this.et2 is not set --> only load / use egw.applyFunc() if not already set --- api/js/etemplate/et2_core_legacyJSFunctions.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/api/js/etemplate/et2_core_legacyJSFunctions.js b/api/js/etemplate/et2_core_legacyJSFunctions.js index 39aad039b7..2e59020c8c 100644 --- a/api/js/etemplate/et2_core_legacyJSFunctions.js +++ b/api/js/etemplate/et2_core_legacyJSFunctions.js @@ -150,11 +150,18 @@ // 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) { - return function(ev, widget) + const parts = _code.split('.'); + const app = _widget.getInstanceManager().app_obj; + // check if we need to load the object + if (parts.length === 3 && typeof app[parts[1]] === 'undefined') { - const app = widget.getInstanceManager().app_obj; - return egw.applyFunc(_code, [ev, _widget], context); + return function (ev, widget) + { + return egw.applyFunc(_code, [ev, widget]); + } } + // Code is app.appname.function, add the arguments so it can be executed + _code += '(ev,widget)'; } // use app object from etemplate2, which might be private and not just window.app _code = _code.replace(/(window\.)?app\./, 'widget.getInstanceManager().app_obj.');