make preferences called via sidebox menu of an app, to behave like a part of that app

This commit is contained in:
Ralf Becker 2005-11-08 09:42:42 +00:00
parent 709ef070c9
commit 6d33f91046
2 changed files with 17 additions and 4 deletions

View File

@ -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'],
));
}

View File

@ -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 '<p align="right">'."referer='{$this->bo->session_data['referer']}'</p>\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']);
}
}