Make sure if the refresh is done, then give up not to reload the whole page

This commit is contained in:
Hadi Nategh 2014-05-22 11:27:29 +00:00
parent 4b9078eb7d
commit b3ee7bc605

View File

@ -250,10 +250,11 @@ function egw_refresh(_msg, _app, _id, _type, _targetapp, _replace, _with, _msg_t
// etemplate2 specific to avoid reloading whole page // etemplate2 specific to avoid reloading whole page
if(typeof etemplate2 != "undefined" && etemplate2.getByApplication) if(typeof etemplate2 != "undefined" && etemplate2.getByApplication)
{ {
var refresh_done = false;
var et2 = etemplate2.getByApplication(_app); var et2 = etemplate2.getByApplication(_app);
for(var i = 0; i < et2.length; i++) for(var i = 0; i < et2.length; i++)
{ {
et2[i].refresh(_msg,_app,_id,_type); refresh_done = et2[i].refresh(_msg,_app,_id,_type);
} }
// Refresh target or current app too // Refresh target or current app too
@ -262,12 +263,11 @@ function egw_refresh(_msg, _app, _id, _type, _targetapp, _replace, _with, _msg_t
var et2t = etemplate2.getByApplication(_targetapp || egw_appName); var et2t = etemplate2.getByApplication(_targetapp || egw_appName);
for(var i = 0; i < et2t.length; i++) for(var i = 0; i < et2t.length; i++)
{ {
et2t[i].refresh(_msg,_app,_id,_type); refresh_done = et2t[i].refresh(_msg,_app,_id,_type);
} }
} }
//In case that we have etemplate2 ready but it's empty //In case that we have etemplate2 ready but it's empty and refresh is not done
if (et2.length >= 1) if (et2.length >= 1 && refresh_done) return;
return;
} }
var href = win.location.href; var href = win.location.href;