From ed8c386a1263c7e325560692cc04a03e16a24d6f Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Mon, 6 Jun 2011 15:11:25 +0000 Subject: [PATCH] using egw_refresh to allow fmail to ignore the saved/deleted message --- infolog/inc/class.infolog_ui.inc.php | 7 ++++--- phpgwapi/js/jsapi/jsapi.js | 9 +++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/infolog/inc/class.infolog_ui.inc.php b/infolog/inc/class.infolog_ui.inc.php index 9966e3b582..79f63dcf34 100644 --- a/infolog/inc/class.infolog_ui.inc.php +++ b/infolog/inc/class.infolog_ui.inc.php @@ -1366,6 +1366,7 @@ class infolog_ui } if (($button == 'save' || $button == 'apply') && (!$info_id || $edit_acl || $status_only || $undelete)) { + $operation = $info_id ? 'update' : 'add'; if ($content['info_contact']) { $old_link_id = (int)$content['info_link_id']; @@ -1395,7 +1396,7 @@ class infolog_ui else { $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; 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 - $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 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') { diff --git a/phpgwapi/js/jsapi/jsapi.js b/phpgwapi/js/jsapi/jsapi.js index fa1c2fff57..e9f77b6a95 100644 --- a/phpgwapi/js/jsapi/jsapi.js +++ b/phpgwapi/js/jsapi/jsapi.js @@ -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 * * @param string _msg message (already translated) to show, eg. 'Entry deleted' * @param string _app application name * @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+"\')"); - 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 (typeof win.app_refresh != 'undefined')