using egw_refresh to allow fmail to ignore the saved/deleted message

This commit is contained in:
Ralf Becker 2011-06-06 15:11:25 +00:00
parent 1821e03ef9
commit ed8c386a12
2 changed files with 9 additions and 7 deletions

View File

@ -1366,6 +1366,7 @@ class infolog_ui
} }
if (($button == 'save' || $button == 'apply') && (!$info_id || $edit_acl || $status_only || $undelete)) if (($button == 'save' || $button == 'apply') && (!$info_id || $edit_acl || $status_only || $undelete))
{ {
$operation = $info_id ? 'update' : 'add';
if ($content['info_contact']) if ($content['info_contact'])
{ {
$old_link_id = (int)$content['info_link_id']; $old_link_id = (int)$content['info_link_id'];
@ -1395,7 +1396,7 @@ class infolog_ui
else else
{ {
$content['msg'] = lang('InfoLog entry saved'); $content['msg'] = lang('InfoLog entry saved');
$content['js'] = "opener.location.search += (opener.location.search ? '&msg=' : '?msg=')+'{$content['msg']}';"; $content['js'] = "opener.egw_refresh('".str_replace("'","\\'",$content['msg'])."','infolog',$info_id,'$operation');";
} }
$content[$tabs] = $active_tab; $content[$tabs] = $active_tab;
if ((int) $content['pm_id'] != (int) $content['old_pm_id']) if ((int) $content['pm_id'] != (int) $content['old_pm_id'])
@ -1458,12 +1459,12 @@ class infolog_ui
); );
if (!($content['msg'] = $this->delete($info_id,$referer,'edit'))) return; // checks ACL first if (!($content['msg'] = $this->delete($info_id,$referer,'edit'))) return; // checks ACL first
$content['js'] = "opener.location.href='".egw::link($referer,array('msg' => $content['msg']))."';"; $content['js'] = "opener.egw_refresh('".str_replace("'","\\'",$content['msg'])."','infolog',$info_id,'delete');";
} }
// called again after delete confirmation dialog // called again after delete confirmation dialog
elseif ($button == 'deleted' && $content['msg']) elseif ($button == 'deleted' && $content['msg'])
{ {
$content['js'] = "opener.location.href='".egw::link($referer,array('msg' => $content['msg']))."';"; $content['js'] = "opener.egw_refresh('".str_replace("'","\\'",$content['msg'])."','infolog',$info_id,'delete');";
} }
if ($button == 'save' || $button == 'cancel' || $button == 'delete' || $button == 'deleted') if ($button == 'save' || $button == 'cancel' || $button == 'delete' || $button == 'deleted')
{ {

View File

@ -190,19 +190,20 @@ function egw_getApp(_name)
} }
/** /**
* Refresh given application _app display of entry _id, incl. outputting _msg * Refresh given application _targetapp display of entry _app _id, incl. outputting _msg
* *
* Default implementation here only reloads window with it's current url with an added msg=_msg attached * Default implementation here only reloads window with it's current url with an added msg=_msg attached
* *
* @param string _msg message (already translated) to show, eg. 'Entry deleted' * @param string _msg message (already translated) to show, eg. 'Entry deleted'
* @param string _app application name * @param string _app application name
* @param string|int _id=null id of entry to refresh * @param string|int _id=null id of entry to refresh
* @param _type=null either 'edit', 'delete', 'add' or null * @param string _type=null either 'edit', 'delete', 'add' or null
* @param string _targetapp which app's window should be refreshed, default current
*/ */
function egw_refresh(_msg, _app, _id, _type) function egw_refresh(_msg, _app, _id, _type, _target)
{ {
//alert("egw_refresh(\'"+_msg+"\',\'"+_app+"\',\'"+_id+"\',\'"+_type+"\')"); //alert("egw_refresh(\'"+_msg+"\',\'"+_app+"\',\'"+_id+"\',\'"+_type+"\')");
var win = egw_appWindow(_app); var win = typeof _targetapp != 'undefined' ? egw_appWindow(_targetapp) : window;
// if window defines an app_refresh method, just call it // if window defines an app_refresh method, just call it
if (typeof win.app_refresh != 'undefined') if (typeof win.app_refresh != 'undefined')