mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
Added support for environment switching
SVN:trunk[1777]
This commit is contained in:
@@ -754,6 +754,7 @@ EOF
|
||||
}
|
||||
|
||||
$sEnvironment = utils::GetCurrentEnvironment();
|
||||
$sBackButton = utils::GetEnvironmentBackButton();
|
||||
if($sEnvironment != 'production')
|
||||
{
|
||||
$sEnvLabel = trim(MetaModel::GetConfig()->Get('app_env_label'));
|
||||
@@ -761,7 +762,7 @@ EOF
|
||||
{
|
||||
$sEnvLabel = $sEnvironment;
|
||||
}
|
||||
$sApplicationBanner .= '<div id="admin-banner"><span style="padding:5px;">'.Dict::Format('UI:ApplicationEnvironment', $sEnvLabel).'<span></div>';
|
||||
$sApplicationBanner .= '<div id="admin-banner"><span style="padding:5px;">'.Dict::Format('UI:ApplicationEnvironment', $sEnvLabel).$sBackButton.'<span></div>';
|
||||
}
|
||||
|
||||
$sOnlineHelpUrl = MetaModel::GetConfig()->Get('online_help');
|
||||
|
||||
@@ -27,7 +27,13 @@ require_once(APPROOT.'/core/cmdbobject.class.inc.php');
|
||||
require_once(APPROOT.'/application/utils.inc.php');
|
||||
session_name('itop-'.md5(APPROOT));
|
||||
session_start();
|
||||
if (isset($_SESSION['itop_env']))
|
||||
if (isset($_REQUEST['switch_env']))
|
||||
{
|
||||
$sEnv = $_REQUEST['switch_env'];
|
||||
$_SESSION['itop_env'] = $sEnv;
|
||||
// TODO: reset the credentials as well ??
|
||||
}
|
||||
else if (isset($_SESSION['itop_env']))
|
||||
{
|
||||
$sEnv = $_SESSION['itop_env'];
|
||||
}
|
||||
|
||||
@@ -726,6 +726,29 @@ class utils
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the "Back" button to go out of the current environment
|
||||
*/
|
||||
public static function GetEnvironmentBackButton()
|
||||
{
|
||||
if (isset($_SESSION['itop_return_env']))
|
||||
{
|
||||
if (isset($_SESSION['itop_return_url']))
|
||||
{
|
||||
$sReturnUrl = $_SESSION['itop_return_url'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$sReturnUrl = utils::GetAbsoluteUrlAppRoot().'pages/UI.php?switch_env='.$_SESSION['itop_return_env'];
|
||||
}
|
||||
return ' <button onclick="window;location.href=\''.addslashes($sReturnUrl).'\'">'.Dict::S('UI:Button:Back').'</button>';
|
||||
}
|
||||
else
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get target configuration file name (including full path)
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user