diff --git a/preferences/inc/class.bosettings.inc.php b/preferences/inc/class.bosettings.inc.php index 448274c76a..766aeefedc 100644 --- a/preferences/inc/class.bosettings.inc.php +++ b/preferences/inc/class.bosettings.inc.php @@ -50,7 +50,7 @@ $this->appname = $appname; } - function save_session($appname,$type,$show_help,$prefix,$notifies='') + function save_session($appname,$type,$show_help,$prefix,$notifies='',$referer='') { $GLOBALS['egw']->session->appsession('session_data','preferences',array( 'type' => $type, // save our state in the app-session @@ -58,6 +58,7 @@ 'prefix' => $prefix, 'appname' => $appname, // we use this to reset prefix on appname-change 'notifies' => $notifies, + 'referer' => $referer ? $referer : $this->session_data['referer'], )); } diff --git a/preferences/inc/class.uisettings.inc.php b/preferences/inc/class.uisettings.inc.php index 2efb793949..89af4a10df 100755 --- a/preferences/inc/class.uisettings.inc.php +++ b/preferences/inc/class.uisettings.inc.php @@ -33,9 +33,21 @@ function index() { + // make preferences called via sidebox menu of an app, to behave like a part of that app + list(,$referer) = explode($GLOBALS['egw_info']['server']['webserver_url'],$_SERVER['HTTP_REFERER']); + if (!$referer) $referer = '/preferences/index.php'; + if (!preg_match('/(preferences.php|menuaction=preferences.uisettings.index)+/i',$referer)) + { + $this->bo->session_data['referer'] = $referer; + } +echo '
'."referer='{$this->bo->session_data['referer']}'
\n"; + if (substr($this->bo->session_data['referer'],0,strlen('/preferences')) != '/preferences') + { + $GLOBALS['egw_info']['flags']['currentapp'] = $_GET['appname']; + } if($_POST['cancel']) { - $GLOBALS['egw']->redirect_link('/preferences/index.php'); + $GLOBALS['egw']->redirect_link($this->bo->session_data['referer']); } if (substr($_SERVER['PHP_SELF'],-15) == 'preferences.php') { @@ -117,7 +129,7 @@ if(!$this->is_admin() || $error) { - $GLOBALS['egw']->redirect_link('/preferences/index.php'); + $GLOBALS['egw']->redirect_link($this->bo->session_data['referer']); } if($GLOBALS['type'] == 'user' && $_GET['appname'] == 'preferences' && $user['show_help'] != '') @@ -126,7 +138,7 @@ } if($_POST['save']) { - $GLOBALS['egw']->redirect_link('/preferences/index.php'); + $GLOBALS['egw']->redirect_link($this->bo->session_data['referer']); } }