Fix popup's window close

-Make sure window.close() closing the right egw window
-Make sure the modal popup has the opener
This commit is contained in:
Hadi Nategh 2014-12-12 14:21:04 +00:00
parent 3eab40a761
commit e07c11be85
5 changed files with 9 additions and 9 deletions

View File

@ -884,7 +884,7 @@ window.egw_LAB.wait(function() {
{ {
if (!$msg) $msg = lang('%1 contact(s) %2',$success,$action_msg); if (!$msg) $msg = lang('%1 contact(s) %2',$success,$action_msg);
$response->addScript("alert('".addslashes($msg)."')"); $response->addScript("alert('".addslashes($msg)."')");
$response->addScript('window.close();'); $response->addScript('egw(window).close();');
} }
} }

View File

@ -581,14 +581,14 @@ app.classes.addressbook = AppJS.extend(
if(!index) if(!index)
{ {
alert('Could not find index'); alert('Could not find index');
window.close(); egw(window).close();
return false; return false;
} }
var nm = index.widgetContainer.getWidgetById('nm'); var nm = index.widgetContainer.getWidgetById('nm');
if(!index) if(!index)
{ {
window.opener.egw.message('Could not find list', 'error'); window.opener.egw.message('Could not find list', 'error');
window.close(); egw(window).close();
return false; return false;
} }
// Reset filters first // Reset filters first

View File

@ -979,7 +979,7 @@ app.classes.calendar = AppJS.extend(
alert(this.egw.lang('The original calendar edit popup is closed!')); alert(this.egw.lang('The original calendar edit popup is closed!'));
} }
} }
window.close(); egw(window).close();
}, },
/** /**

View File

@ -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))) 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'); 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))) 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; $err=null;
$rememberServerID = $this->mail_bo->profileID; $rememberServerID = $this->mail_bo->profileID;

View File

@ -1420,7 +1420,7 @@ app.classes.mail = AppJS.extend(
//alert(_action.id+','+ msg); //alert(_action.id+','+ msg);
if (!calledFromPopup) this.mail_setRowClass(_elems,'deleted'); if (!calledFromPopup) this.mail_setRowClass(_elems,'deleted');
this.mail_deleteMessages(msg,'no',calledFromPopup); 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() print_for_compose: function()
{ {
var afterprint = function (){ var afterprint = function (){
window.close(); egw(window).close();
}; };
if (!window.onafterprint) if (!window.onafterprint)
{ {
// For browsers which does not support onafterprint event, eg. Chrome // For browsers which does not support onafterprint event, eg. Chrome
setTimeout(function() { setTimeout(function() {
window.close(); egw(window).close();
}, 2000); }, 2000);
} }
else else