diff --git a/api/js/etemplate/et2_core_legacyJSFunctions.js b/api/js/etemplate/et2_core_legacyJSFunctions.js index e312fe0f4d..d08077ff5e 100644 --- a/api/js/etemplate/et2_core_legacyJSFunctions.js +++ b/api/js/etemplate/et2_core_legacyJSFunctions.js @@ -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 { diff --git a/api/js/etemplate/et2_widget_file.js b/api/js/etemplate/et2_widget_file.js index 5eecde31a3..39f145f27f 100644 --- a/api/js/etemplate/et2_widget_file.js +++ b/api/js/etemplate/et2_widget_file.js @@ -481,9 +481,6 @@ var et2_file = /** @class */ (function (_super) { if (typeof this.onFinishOne == 'function') { this.onFinishOne(event, response, name); } - else if (this.options.onFinishOne) { - et2_call(this.options.onFinishOne, event, response, name); - } return true; }; /** diff --git a/api/js/etemplate/et2_widget_file.ts b/api/js/etemplate/et2_widget_file.ts index 02e3a45d82..5410f9c485 100644 --- a/api/js/etemplate/et2_widget_file.ts +++ b/api/js/etemplate/et2_widget_file.ts @@ -665,14 +665,10 @@ export class et2_file extends et2_inputWidget event.data = this; // Callback - if(typeof this.onFinishOne == 'function' && !this.options.onFinishOne) + if(typeof this.onFinishOne == 'function') { this.onFinishOne(event, response, name); } - else if (this.options.onFinishOne) - { - et2_call(this.options.onFinishOne,event,response,name); - } return true; }