Fixed problem with registered data callbacks, when the window the callback belongs to is closed

This commit is contained in:
Andreas Stöckel 2012-03-23 13:39:27 +00:00
parent 00cd1f1e2f
commit eadeb57f28
2 changed files with 23 additions and 5 deletions

View File

@ -818,6 +818,19 @@ abstract class egw_framework
// add link registry to non-popup windows, if explicit requested (idots_framework::navbar() loads it, if not explicit specified!)
if ($GLOBALS['egw_info']['flags']['js_link_registry'])
{
$langs = array();
// load translations
translation::add_app('etemplate');
foreach(translation::$loaded_apps as $app => $lang)
{
$langs[] = array(
"app" => $app,
"lang" => $lang
);
}
$java_script .= "egw.langRequire(window, ".json_encode($langs).");\n";
$java_script .= 'egw.set_preferences('.json_encode($GLOBALS['egw_info']['user']['preferences']['common']).', "common");'."\n";
$java_script .= 'egw.set_user('.$GLOBALS['egw']->accounts->json($GLOBALS['egw_info']['user']['account_id']).');'."\n";
}

View File

@ -344,12 +344,17 @@ egw.extend("data_storage", egw.MODULE_GLOBAL, function (_app, _wnd) {
// those.
if (typeof registeredCallbacks[_uid] != "undefined")
{
for (var i = 0; i < registeredCallbacks[_uid].length; i++)
for (var i = registeredCallbacks[_uid].length - 1; i >= 0; i--)
{
registeredCallbacks[_uid][i].callback.call(
registeredCallbacks[_uid][i].context,
_data
);
try {
registeredCallbacks[_uid][i].callback.call(
registeredCallbacks[_uid][i].context,
_data
);
} catch (e) {
// Remove this callback from the list
registeredCallbacks[_uid].splice(i, 1);
}
}
}
},