mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-21 23:43:17 +01:00
optional parameter for egw_framework::window_close() to specify an alert message, which get shown/alerted, before closing the window
This commit is contained in:
parent
8d9118a4cb
commit
aa8a848871
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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))
|
||||
{
|
||||
|
@ -2475,10 +2475,7 @@ class infolog_ui
|
||||
strtotime($mailcontent['headers']['DATE'])
|
||||
));
|
||||
}
|
||||
common::egw_header();
|
||||
echo "<script> window.close(); alert('Error: no mail (Mailbox / UID) given!');</script>";
|
||||
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');";
|
||||
}
|
||||
|
||||
|
@ -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')
|
||||
{
|
||||
|
@ -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))
|
||||
{
|
||||
|
@ -63,9 +63,7 @@ class timesheet_ui extends timesheet_bo
|
||||
{
|
||||
if (!$this->read((int)$_GET['ts_id']))
|
||||
{
|
||||
common::egw_header();
|
||||
echo "<script>alert('".lang('Permission denied!!!')."'); window.close();</script>\n";
|
||||
common::egw_exit();
|
||||
egw_framework::window_close(lang('Permission denied!!!'));
|
||||
}
|
||||
if (!$view && !$this->check_acl(EGW_ACL_EDIT))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user