Check app_refresh to not get an error if an application overrides app_refresh() instead of using register_app_refresh()

This commit is contained in:
Nathan Gray 2013-02-14 11:11:17 +00:00
parent 588c6141c9
commit 547d125a30

View File

@ -234,8 +234,9 @@ function egw_refresh(_msg, _app, _id, _type, _targetapp, _replace, _with)
//alert("egw_refresh(\'"+_msg+"\',\'"+_app+"\',\'"+_id+"\',\'"+_type+"\')");
var win = typeof _targetapp != 'undefined' ? egw_appWindow(_targetapp) : window;
// if window defines an app_refresh method, just call it
if (typeof win.app_refresh == "function" || typeof win.app_refresh.registered == "function" && win.app_refresh.registered(_app))
// if window registered an app_refresh method or overwritten app_refresh, just call it
if(typeof win.app_refresh == "function" && typeof win.app_refresh.registered == "undefined" ||
typeof win.app_refresh != "undefined" && win.app_refresh.registered(_app))
{
win.app_refresh(_msg, _app, _id, _type);
return;
@ -247,7 +248,7 @@ function egw_refresh(_msg, _app, _id, _type, _targetapp, _replace, _with)
var et2 = etemplate2.getByApplication(_app);
for(var i = 0; i < et2.length; i++)
{
et2[i].refresh(_msg,_id,_type);
et2[i].refresh(_msg,_app,_id,_type);
}
return;
}