mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-07 16:44:20 +01:00
restoring current app/tab, if pressing save or cancel, to do so let server know which is current app and run under that appname (otherwise redirect will happen to currently views app
This commit is contained in:
parent
cfefedc8f7
commit
b2c563e5aa
@ -455,11 +455,12 @@ class egw extends egw_minimal
|
||||
*
|
||||
* @param string $string The url the link is for
|
||||
* @param string/array $extravars Extra params to be passed to the url
|
||||
* @param string $link_app=null if appname or true, some templates generate a special link-handler url
|
||||
* @return string The full url after processing
|
||||
*/
|
||||
static function redirect_link($url, $extravars='')
|
||||
static function redirect_link($url, $extravars='', $link_app=null)
|
||||
{
|
||||
return $GLOBALS['egw']->framework->redirect_link($url, $extravars);
|
||||
return $GLOBALS['egw']->framework->redirect_link($url, $extravars, $link_app);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -854,7 +854,7 @@ function egw_preferences(name, apps)
|
||||
}
|
||||
break;
|
||||
}
|
||||
egw_link_handler(egw_webserverUrl+url, current_app);
|
||||
egw_link_handler(egw_webserverUrl+url+'¤t_app='+current_app, current_app);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,8 @@ class preferences_settings
|
||||
$tpl = new etemplate_new('preferences.settings');
|
||||
if (!is_array($content))
|
||||
{
|
||||
$appname = isset($_GET['appname']) && $_GET['appname'] != 'preferences' ? $_GET['appname'] : 'common';
|
||||
$appname = isset($_GET['appname']) && $_GET['appname'] != 'preferences' &&
|
||||
isset($GLOBALS['egw_info']['user']['apps'][$_GET['appname']]) ? $_GET['appname'] : 'common';
|
||||
$type = 'user';
|
||||
$account_id = $GLOBALS['egw_info']['user']['account_id'];
|
||||
if ($GLOBALS['egw_info']['user']['apps']['admin'] &&
|
||||
@ -56,6 +57,7 @@ class preferences_settings
|
||||
$account_id = (int)$_GET['account_id'];
|
||||
$type = $_GET['account_id'] < 0 ? 'group' : 'user';
|
||||
}
|
||||
$content['current_app'] = isset($GLOBALS['egw_info']['user']['apps'][$_GET['current_app']]) ? $_GET['current_app'] : $appname;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -92,22 +94,23 @@ class preferences_settings
|
||||
$msg = lang('Preferences saved.');
|
||||
}
|
||||
}
|
||||
if(in_array($button, array('save','cancel')))
|
||||
if (in_array($button, array('save','cancel')))
|
||||
{
|
||||
if($appname != 'common')
|
||||
if ($content['current_app'] && ($app_data = $GLOBALS['egw_info']['user']['apps'][$content['current_app']]))
|
||||
{
|
||||
$extra = egw_link::get_registry($appname, 'list');
|
||||
if(!$extra)
|
||||
if ($app_data['index'])
|
||||
{
|
||||
$extra = egw_link::get_registry($appname,'view_list');
|
||||
egw::redirect_link('/index.php', 'menuaction='.$app_data['index']);
|
||||
}
|
||||
else
|
||||
{
|
||||
egw::redirect_link('/'.$content['current_app'].'/index.php');
|
||||
}
|
||||
egw_framework::redirect_link(egw_framework::link('/index.php'),$extra);
|
||||
}
|
||||
else
|
||||
{
|
||||
egw_framework::window_close();
|
||||
egw::redirect_link('/index.php');
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
$appname = $content['appname'] ? $content['appname'] : 'common';
|
||||
@ -126,6 +129,10 @@ class preferences_settings
|
||||
{
|
||||
$old_tab = $content['tabs'];
|
||||
}
|
||||
// we need to run under calling app, to be able to restore it to it's index page after
|
||||
$GLOBALS['egw_info']['flags']['currentapp'] = $preserve['current_app'] = $content['current_app'];
|
||||
egw_framework::includeCSS('preferences','app');
|
||||
|
||||
$content = $this->get_content($appname, $type, $sel_options, $readonlys, $preserve['types'], $tpl);
|
||||
$preserve['appname'] = $preserve['old_appname'] = $content['appname'];
|
||||
$preserve['type'] = $preserve['old_type'] = $content['type'];
|
||||
@ -138,13 +145,6 @@ class preferences_settings
|
||||
$msg = $this->process_array($GLOBALS['egw']->preferences->$attribute,
|
||||
(array)$GLOBALS['egw']->preferences->{$attribute}[$appname], $preserve['types'], $appname, $attribute, true);
|
||||
}
|
||||
// get sidebox menu of given app
|
||||
if ($appname != 'common')
|
||||
{
|
||||
$GLOBALS['egw_info']['flags']['currentapp'] = $appname;
|
||||
// need to include our css
|
||||
egw_framework::includeCSS('preferences','app');
|
||||
}
|
||||
if ($msg) egw_framework::message($msg, $msg_type ? $msg_type : 'error');
|
||||
|
||||
$tpl->exec('preferences.preferences_settings.index', $content, $sel_options, $readonlys, $preserve);
|
||||
|
Loading…
Reference in New Issue
Block a user