Index: branches/5.1.x/core/admin_templates/incs/close_popup.tpl =================================================================== diff -u -N -r13086 -r14210 --- branches/5.1.x/core/admin_templates/incs/close_popup.tpl (.../close_popup.tpl) (revision 13086) +++ branches/5.1.x/core/admin_templates/incs/close_popup.tpl (.../close_popup.tpl) (revision 14210) @@ -30,7 +30,11 @@ if ($opener) { // using popups & close_popup called (from anywhere) try { - window_close( function() { onAfterWindowClose($opener); } ); + window_close( + function() { + $opener.onAfterWindowClose($redirect_url, truefalse, truefalse); + } + ); } catch (err) { // another website is opened in parent window @@ -43,32 +47,6 @@ } } - function onAfterWindowClose($opener) { - - var $ru = $redirect_url; - - // setTimeout allows to call method indirectly. Without it whole idea won't work 2nd time (try adding 2 relations one after another) - $opener.setTimeout( - function() { - $opener.openSelector('adm', $ru.replace('%5C', '\\') + '&merge_opener_stack=1'); - }, - 200 - ); - - - var $skip_refresh = true; - - var $skip_refresh = isset($opener.$skip_refresh) && $opener.$skip_refresh ? true : false; - - - $opener.focus(); - - if (!$skip_refresh) { - $opener.location.href = $redirect_url.replace('%5C', '\\'); - } - - } - // copied from "js/script.js" because it's not included here due performance reasons function getFrame($name) { var $main_window = window; Index: branches/5.1.x/core/admin_templates/js/script.js =================================================================== diff -u -N -r14147 -r14210 --- branches/5.1.x/core/admin_templates/js/script.js (.../script.js) (revision 14147) +++ branches/5.1.x/core/admin_templates/js/script.js (.../script.js) (revision 14210) @@ -1785,6 +1785,28 @@ return getFrame('main').TB.remove(); } +function onAfterWindowClose($redirect_url, $open_new_window, $force_skip_refresh) { + if ($open_new_window) { + var $ru = $redirect_url; + + // setTimeout allows to call method indirectly. Without it whole idea won't work 2nd time (try adding 2 relations one after another) + setTimeout( + function() { + openSelector('adm', $ru.replace('%5C', '\\') + '&merge_opener_stack=1'); + }, + 200 + ); + + return ; + } + + window.focus(); + + if ( !(($force_skip_refresh === true) || (typeof $skip_refresh != 'undefined' && $skip_refresh)) ) { + window.location.href = $redirect_url.replace('%5C', '\\'); + } +} + function get_control($mask, $field, $append, $prepend) { $append = $append !== undefined ? '_' + $append : ''; $prepend = $prepend !== undefined ? $prepend + '_' : '';