Partially de-hardcoded against the subdirectory "modules", so that 1.2.1 should be compatible with modules running under 2.0.

SVN:1.2[1778]
This commit is contained in:
Romain Quetiez
2012-01-17 15:26:02 +00:00
parent 7fadb5e08b
commit 3f381a3530
6 changed files with 22 additions and 4 deletions

View File

@@ -407,6 +407,11 @@ EOF
return '$sAbsURLAppRoot';
}
function GetAbsoluteUrlModulesRoot()
{
return '$sAbsURLAppRoot'+'modules/';
}
function AddAppContext(sURL)
{
var sContext = '$sAppContext';

View File

@@ -169,7 +169,7 @@ EOF
function GetAbsoluteUrlAppRoot()
{
return '$sAbsURLAppRoot';
return '$sAbsURLAppRoot'+'modules/';
}
function AddAppContext(sURL)

View File

@@ -460,8 +460,6 @@ class utils
/**
* Returns the absolute URL to the server's root path
* @param $sCurrentRelativePath string NO MORE USED, kept for backward compatibility only !
* @param $bForceHTTPS bool True to force HTTPS, false otherwise
* @return string The absolute URL to the server's root, without the first slash
*/
static public function GetAbsoluteUrlAppRoot()
@@ -550,6 +548,17 @@ class utils
return $sAppRootUrl;
}
/**
* Returns the absolute URL to the modules root path
* Hardcoded here for compatibility with iTop 2.0 modules
* @return string The absolute URL to the modules
*/
static public function GetAbsoluteUrlModulesRoot()
{
$sUrl = self::GetAbsoluteUrlAppRoot().'modules/';
return $sUrl;
}
/**
* Tells whether or not log off operation is supported.
* Actually in only one case:

View File

@@ -1,5 +1,6 @@
<?php
define('APPROOT', dirname(__FILE__).'/');
define('MODULESROOT', APPROOT.'modules/');
if (function_exists('microtime'))
{
$fItopStarted = microtime(true);

View File

@@ -4600,6 +4600,9 @@ if (!array_key_exists($sAttCode, self::$m_aAttribDefs[$sClass]))
*/
static public function ApplyParams($aInput, $aParams)
{
$aParams['APP_URL'] = utils::GetAbsoluteUrlAppRoot();
$aParams['MODULES_URL'] = utils::GetAbsoluteUrlModulesRoot();
$aSearches = array();
$aReplacements = array();
foreach($aParams as $sSearch => $replace)

View File

@@ -188,7 +188,7 @@ class Incident extends ResponseTicket
$sIcon = '';
if ($sIconName != '')
{
$sPath = '../modules/itop-incident-mgmt-1.0.0/images/'.$sIconName;
$sPath = utils::GetAbsoluteUrlModulesRoot().'itop-incident-mgmt-1.0.0/images/'.$sIconName;
if ($bImgTag)
{
$sIcon = "<img src=\"$sPath\" style=\"vertical-align:middle;\"/>";