From e07c11be85a357a5df8353f9456c1ae54daf5c5e Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Fri, 12 Dec 2014 14:21:04 +0000 Subject: [PATCH] Fix popup's window close -Make sure window.close() closing the right egw window -Make sure the modal popup has the opener --- addressbook/inc/class.addressbook_ui.inc.php | 2 +- addressbook/js/app.js | 4 ++-- calendar/js/app.js | 2 +- mail/inc/class.mail_ui.inc.php | 4 ++-- mail/js/app.js | 6 +++--- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/addressbook/inc/class.addressbook_ui.inc.php b/addressbook/inc/class.addressbook_ui.inc.php index 5ac1394327..6e178ebcaf 100644 --- a/addressbook/inc/class.addressbook_ui.inc.php +++ b/addressbook/inc/class.addressbook_ui.inc.php @@ -884,7 +884,7 @@ window.egw_LAB.wait(function() { { if (!$msg) $msg = lang('%1 contact(s) %2',$success,$action_msg); $response->addScript("alert('".addslashes($msg)."')"); - $response->addScript('window.close();'); + $response->addScript('egw(window).close();'); } } diff --git a/addressbook/js/app.js b/addressbook/js/app.js index 68a72a15d9..dc05aee619 100644 --- a/addressbook/js/app.js +++ b/addressbook/js/app.js @@ -581,14 +581,14 @@ app.classes.addressbook = AppJS.extend( if(!index) { alert('Could not find index'); - window.close(); + egw(window).close(); return false; } var nm = index.widgetContainer.getWidgetById('nm'); if(!index) { window.opener.egw.message('Could not find list', 'error'); - window.close(); + egw(window).close(); return false; } // Reset filters first diff --git a/calendar/js/app.js b/calendar/js/app.js index 0d3a6e56fd..4a1dc7ade4 100644 --- a/calendar/js/app.js +++ b/calendar/js/app.js @@ -979,7 +979,7 @@ app.classes.calendar = AppJS.extend( alert(this.egw.lang('The original calendar edit popup is closed!')); } } - window.close(); + egw(window).close(); }, /** diff --git a/mail/inc/class.mail_ui.inc.php b/mail/inc/class.mail_ui.inc.php index bffbf1973e..319301b2d6 100644 --- a/mail/inc/class.mail_ui.inc.php +++ b/mail/inc/class.mail_ui.inc.php @@ -2582,7 +2582,7 @@ class mail_ui if (is_array($ids) && !egw_vfs::is_writable($path) || !is_array($ids) && !egw_vfs::is_writable(dirname($path))) { - return 'alert("'.addslashes(lang('%1 is NOT writable by you!',$path)).'"); window.close();'; + return 'alert("'.addslashes(lang('%1 is NOT writable by you!',$path)).'"); egw(window).close();'; } translation::add_app('mail'); @@ -2656,7 +2656,7 @@ class mail_ui if (is_array($ids) && !egw_vfs::is_writable($path) || !is_array($ids) && !egw_vfs::is_writable(dirname($path))) { - return 'alert("'.addslashes(lang('%1 is NOT writable by you!',$path)).'"); window.close();'; + return 'alert("'.addslashes(lang('%1 is NOT writable by you!',$path)).'"); egw(window).close();'; } $err=null; $rememberServerID = $this->mail_bo->profileID; diff --git a/mail/js/app.js b/mail/js/app.js index 9c75a2c00f..bf25a69539 100644 --- a/mail/js/app.js +++ b/mail/js/app.js @@ -1420,7 +1420,7 @@ app.classes.mail = AppJS.extend( //alert(_action.id+','+ msg); if (!calledFromPopup) this.mail_setRowClass(_elems,'deleted'); this.mail_deleteMessages(msg,'no',calledFromPopup); - if (calledFromPopup && this.mail_isMainWindow==false) window.close(); + if (calledFromPopup && this.mail_isMainWindow==false) egw(window).close(); }, /** @@ -3902,14 +3902,14 @@ app.classes.mail = AppJS.extend( print_for_compose: function() { var afterprint = function (){ - window.close(); + egw(window).close(); }; if (!window.onafterprint) { // For browsers which does not support onafterprint event, eg. Chrome setTimeout(function() { - window.close(); + egw(window).close(); }, 2000); } else