Browse Source

Management of environments: the banner must be injected by the mean of iPageUIExtension

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@2844 a333f486-631f-4898-b8df-5754b55c2be0
romainq 11 years ago
parent
commit
95b1a93a0c
2 changed files with 3 additions and 37 deletions
  1. 0 12
      application/itopwebpage.class.inc.php
  2. 3 25
      application/utils.inc.php

+ 0 - 12
application/itopwebpage.class.inc.php

@@ -736,18 +736,6 @@ EOF
 				$sApplicationBanner .= '<div id="admin-banner"><span style="padding:5px;">'.$this->m_sMessage.'<span></div>';
 			}
 
-			$sEnvironment = utils::GetCurrentEnvironment();
-			$sBackButton = utils::GetEnvironmentBackButton();
-			if($sEnvironment != 'production')
-			{
-				$sEnvLabel = trim(MetaModel::GetConfig()->Get('app_env_label'));
-				if (strlen($sEnvLabel) == 0)
-				{
-						$sEnvLabel = $sEnvironment;
-				}
-				$sApplicationBanner .= '<div id="admin-banner"><span style="padding:5px;">'.Dict::Format('UI:ApplicationEnvironment', $sEnvLabel).$sBackButton.'<span></div>';
-			}
-			
 			$sApplicationBanner .= $sBannerExtraHtml;
 			
 			if (!empty($sNorthPane))

+ 3 - 25
application/utils.inc.php

@@ -768,29 +768,6 @@ 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 '&nbsp;<button onclick="window;location.href=\''.addslashes($sReturnUrl).'\'">'.Dict::S('UI:Button:Back').'</button>';
-		}
-		else
-		{
-			return '';
-		}
-	}
-	
-	/**
-	 * Get the "Back" button to go out of the current environment
-	 */
 	public static function GetPopupMenuItems($oPage, $iMenuId, $param, &$aActions)
 	{
 		foreach (MetaModel::EnumPlugins('iPopupMenuExtension') as $oExtensionInstance)
@@ -849,12 +826,13 @@ class utils
      *      
      * @return string ...
      */                   
-	static public function GetAbsoluteUrlModulePage($sModule, $sPage, $aArguments = array())
+	static public function GetAbsoluteUrlModulePage($sModule, $sPage, $aArguments = array(), $sEnvironment = null)
 	{
+		$sEnvironment = is_null($sEnvironment) ? self::GetCurrentEnvironment() : $sEnvironment;
 		$aArgs = array();
 		$aArgs[] = 'exec_module='.$sModule;
 		$aArgs[] = 'exec_page='.$sPage;
-		$aArgs[] = 'exec_env='.self::GetCurrentEnvironment();
+		$aArgs[] = 'exec_env='.$sEnvironment;
 		foreach($aArguments as $sName => $sValue)
 		{
 			if (($sName == 'exec_module')||($sName == 'exec_page')||($sName == 'exec_env'))