Some better handling of app.appname.funcname style onclick / onchange when set in the template

This commit is contained in:
Nathan Gray 2013-10-01 16:52:38 +00:00
parent 04ce0638a9
commit 791bf29e60

View File

@ -124,7 +124,12 @@
// Generate the function itself, if it fails, log the error message and // Generate the function itself, if it fails, log the error message and
// return a function which always returns false // return a function which always returns false
try { try {
var func = new Function('egw', 'widget', 'window', 'document', _code); // 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 += '(egw,widget,window,document)';
}
func = new Function('egw', 'widget', 'window', 'document', _code);
} catch(e) { } catch(e) {
_widget.egw().debug('error', 'Error while compiling JS code ', _code); _widget.egw().debug('error', 'Error while compiling JS code ', _code);
return (function() {return false;}); return (function() {return false;});