diff --git a/etemplate/js/etemplate2.js b/etemplate/js/etemplate2.js
index 5e1f93f19f..2bb5b6d396 100644
--- a/etemplate/js/etemplate2.js
+++ b/etemplate/js/etemplate2.js
@@ -643,6 +643,10 @@ function etemplate2_handle_load(_type, _response)
// handle egw_framework::window_close(), this will terminate execution
if (data['window-close'])
{
+ if (typeof data['window-close'] == 'string' && data['window-close'] !== 'true')
+ {
+ alert(data['window-close']);
+ }
window.close();
}
diff --git a/filemanager/inc/class.filemanager_ui.inc.php b/filemanager/inc/class.filemanager_ui.inc.php
index ecc95f6b35..60092337a4 100644
--- a/filemanager/inc/class.filemanager_ui.inc.php
+++ b/filemanager/inc/class.filemanager_ui.inc.php
@@ -1047,7 +1047,7 @@ class filemanager_ui
}
}
egw_framework::refresh_opener($msg, 'filemanager', $refresh_path ? $refresh_path : $path, 'edit', null, '&path=[^&]*');
- if ($button == 'save') egw_framework::window_close(true); // true = call common::egw_exit();
+ if ($button == 'save') egw_framework::window_close();
}
if ($content['is_link'] && !egw_vfs::stat($path))
{
diff --git a/infolog/inc/class.infolog_ui.inc.php b/infolog/inc/class.infolog_ui.inc.php
index e7a42a6413..0bf3548332 100644
--- a/infolog/inc/class.infolog_ui.inc.php
+++ b/infolog/inc/class.infolog_ui.inc.php
@@ -2475,10 +2475,7 @@ class infolog_ui
strtotime($mailcontent['headers']['DATE'])
));
}
- common::egw_header();
- echo "";
- common::egw_exit();
- exit;
+ egw_framework::window_close(lang('Error: no mail (Mailbox / UID) given!'));
}
@@ -2491,11 +2488,11 @@ class infolog_ui
*/
function custom_print($content,$added)
{
- $vars = array(
+ $vars = array(
'menuaction' => 'infolog.infolog_ui.edit',
'info_id' => $content['info_id'],
'print' => true,
- );
+ );
return "window.open('".egw::link('/index.php',$vars)."','_blank','width=700,height=700,scrollbars=yes,status=no');";
}
diff --git a/phpgwapi/inc/class.egw_framework.inc.php b/phpgwapi/inc/class.egw_framework.inc.php
index f97ef876b7..b8e248d7da 100644
--- a/phpgwapi/inc/class.egw_framework.inc.php
+++ b/phpgwapi/inc/class.egw_framework.inc.php
@@ -191,11 +191,13 @@ abstract class egw_framework
/**
* Close (popup) window, use to replace egw_framework::onload('window.close()') in a content security save way
+ *
+ * @param string $alert_msg='' optional message to display as alert, before closing the window
*/
- public static function window_close()
+ public static function window_close($alert_msg='')
{
//error_log(__METHOD__."()");
- self::$extra['window-close'] = true;
+ self::$extra['window-close'] = $alert_msg ? $alert_msg : true;
if ($_GET['menuaction'] === 'etemplate_new::ajax_process_content')
{
diff --git a/phpgwapi/js/jsapi/egw.js b/phpgwapi/js/jsapi/egw.js
index b8401efc18..b352f94f6c 100644
--- a/phpgwapi/js/jsapi/egw.js
+++ b/phpgwapi/js/jsapi/egw.js
@@ -99,12 +99,16 @@
// close window / call window.close(), if data-window-close is specified
var window_close = egw_script.getAttribute('data-window-close');
- if (window_close && JSON.parse(window_close))
+ if (window_close)
{
+ if (typeof window_close == 'string' && window_close !== 'true')
+ {
+ alert(window_close);
+ }
window.close();
}
- // close window / call window.focus(), if data-window-focus is specified
+ // focus window / call window.focus(), if data-window-focus is specified
var window_focus = egw_script.getAttribute('data-window-focus');
if (window_focus && JSON.parse(window_focus))
{
diff --git a/timesheet/inc/class.timesheet_ui.inc.php b/timesheet/inc/class.timesheet_ui.inc.php
index 2f5464da55..0ad47e41df 100644
--- a/timesheet/inc/class.timesheet_ui.inc.php
+++ b/timesheet/inc/class.timesheet_ui.inc.php
@@ -63,9 +63,7 @@ class timesheet_ui extends timesheet_bo
{
if (!$this->read((int)$_GET['ts_id']))
{
- common::egw_header();
- echo "\n";
- common::egw_exit();
+ egw_framework::window_close(lang('Permission denied!!!'));
}
if (!$view && !$this->check_acl(EGW_ACL_EDIT))
{