diff --git a/application/itopwebpage.class.inc.php b/application/itopwebpage.class.inc.php index a975c3853..559600b41 100644 --- a/application/itopwebpage.class.inc.php +++ b/application/itopwebpage.class.inc.php @@ -50,7 +50,7 @@ class iTopWebPage extends NiceWebPage $this->m_aTabs = array(); $this->m_sMenu = ""; $this->m_sMessage = ''; - $sAbsURLAppRoot = addslashes(utils::GetAbsoluteUrlAppRoot()); // Pass it to Javascript scripts + $this->SetRootUrl(utils::GetAbsoluteUrlAppRoot()); $oAppContext = new ApplicationContext(); $sExtraParams = $oAppContext->GetForLink(); $sAppContext = addslashes($sExtraParams); @@ -402,11 +402,6 @@ EOF } } - function GetAbsoluteUrlAppRoot() - { - return '$sAbsURLAppRoot'; - } - function AddAppContext(sURL) { var sContext = '$sAppContext'; @@ -546,6 +541,16 @@ EOF */ public function output() { + $sAbsURLAppRoot = addslashes($this->m_sRootUrl); + $this->add_script( +<<set_base($this->m_sRootUrl.'pages/'); $sForm = $this->GetSiloSelectionForm(); $this->DisplayMenu(); // Compute the menu diff --git a/application/loginwebpage.class.inc.php b/application/loginwebpage.class.inc.php index e5a454f15..95cca72e9 100644 --- a/application/loginwebpage.class.inc.php +++ b/application/loginwebpage.class.inc.php @@ -89,7 +89,6 @@ h1 { } EOF ); - $this->set_base(utils::GetAbsoluteUrlAppRoot().'pages/'); } public static function SetLoginFailedMessage($sMessage) diff --git a/application/nicewebpage.class.inc.php b/application/nicewebpage.class.inc.php index fd9f9795a..77659c02f 100644 --- a/application/nicewebpage.class.inc.php +++ b/application/nicewebpage.class.inc.php @@ -30,30 +30,30 @@ require_once(APPROOT."/application/webpage.class.inc.php"); class NiceWebPage extends WebPage { var $m_aReadyScripts; + var $m_sRootUrl; public function __construct($s_title) { parent::__construct($s_title); $this->m_aReadyScripts = array(); $this->add_linked_script("../js/jquery-1.4.2.min.js"); - //$this->add_linked_script("../js/jquery.history_remote.pack.js"); $this->add_linked_stylesheet('../css/ui-lightness/jquery-ui-1.8.2.custom.css'); $this->add_linked_script('../js/jquery-ui-1.8.2.custom.min.js'); - //$this->add_linked_script("../js/ui.resizable.js"); -// $this->add_linked_script("../js/ui.tabs.js"); $this->add_linked_script("../js/hovertip.js"); -// $this->add_linked_script("../js/jqModal.js"); $this->add_linked_stylesheet("../css/light-grey.css"); -// $this->add_linked_stylesheet("../js/themes/light/light.tabs.css"); - //$this->add_linked_stylesheet("../css/jquery.tabs-ie.css", "lte IE 7"); -// $this->add_linked_stylesheet("../css/jqModal.css"); - $this->add_ready_script(' window.setTimeout(hovertipInit, 1);'); + + $this->m_sRootUrl = '../'; } + public function SetRootUrl($sRootUrl) + { + $this->m_sRootUrl = $sRootUrl; + } + public function small_p($sText) { $this->add("

$sText

\n"); - } + } // By Rom, used by CSVImport and Advanced search public function MakeClassesSelect($sName, $sDefaultValue, $iWidthPx, $iActionCode = null) @@ -100,6 +100,16 @@ class NiceWebPage extends WebPage */ public function output() { + $sAbsURLAppRoot = addslashes($this->m_sRootUrl); + $this->add_script( +<<set_base($this->m_sRootUrl.'pages/'); if (count($this->m_aReadyScripts)>0) { $this->add_script("\$(document).ready(function() {\n".implode("\n", $this->m_aReadyScripts)."\n});"); diff --git a/core/bulkchange.class.inc.php b/core/bulkchange.class.inc.php index ccbd2e912..290f65578 100644 --- a/core/bulkchange.class.inc.php +++ b/core/bulkchange.class.inc.php @@ -917,7 +917,7 @@ class BulkChange $aDetails = array(); while ($oChange = $oBulkChanges->Fetch()) { - $sDate = ''.$oChange->Get('date').''; + $sDate = ''.$oChange->Get('date').''; $sUser = $oChange->GetUserName(); if (preg_match('/^(.*)\\(CSV\\)$/i', $oChange->Get('userinfo'), $aMatches)) { diff --git a/pages/audit.php b/pages/audit.php index 68c1a3dcd..a10806387 100644 --- a/pages/audit.php +++ b/pages/audit.php @@ -203,7 +203,7 @@ try if ($iCount == 0) { // nothing to check, really ! - $aRow['nb_errors'] = "GetKey()."&rule=".$oAuditRule->GetKey()."\">0"; + $aRow['nb_errors'] = "GetKey()."&rule=".$oAuditRule->GetKey()."\">0"; $aRow['percent_ok'] = '100.00'; $aRow['class'] = GetReportColor($iCount, 0); } @@ -218,7 +218,7 @@ try { $aObjectsWithErrors[$oObj->GetKey()] = true; } - $aRow['nb_errors'] = ($iErrorsCount == 0) ? '0' : "GetKey()."&rule=".$oAuditRule->GetKey()."&".$oAppContext->GetForLink()."\">$iErrorsCount"; + $aRow['nb_errors'] = ($iErrorsCount == 0) ? '0' : "GetKey()."&rule=".$oAuditRule->GetKey()."&".$oAppContext->GetForLink()."\">$iErrorsCount"; $aRow['percent_ok'] = sprintf('%.2f', 100.0 * (($iCount - $iErrorsCount) / $iCount)); $aRow['class'] = GetReportColor($iCount, $iErrorsCount); } diff --git a/pages/schema.php b/pages/schema.php index 34642935e..025cfb28c 100644 --- a/pages/schema.php +++ b/pages/schema.php @@ -38,7 +38,7 @@ LoginWebPage::DoLogin(true); // Check user rights and prompt if needed (must be */ function MakeClassHLink($sClass, $sContext) { - return "".MetaModel::GetName($sClass).""; + return "".MetaModel::GetName($sClass).""; } /** @@ -47,7 +47,7 @@ function MakeClassHLink($sClass, $sContext) function MakeRelationHLink($sRelCode, $sContext) { $sDesc = MetaModel::GetRelationDescription($sRelCode); - return "".$sRelCode.""; + return "".$sRelCode.""; } /** @@ -363,7 +363,7 @@ function DisplayClassDetails($oPage, $sClass, $sContext) { $sParents = ''; } - $oPage->p("[".Dict::S('UI:Schema:AllClasses')."] $sParents"); + $oPage->p("[".Dict::S('UI:Schema:AllClasses')."] $sParents"); if (MetaModel::HasChildrenClasses($sClass)) { diff --git a/setup/index.php b/setup/index.php index 4c72b8962..1200d83e3 100644 --- a/setup/index.php +++ b/setup/index.php @@ -660,7 +660,7 @@ function LicenceAcknowledgement($oP, $aParamValues, $iCurrentStep) $oP->set_title('License agreement'); $oP->add('

iTop is released by Combodo SARL under the terms of the GPL V3 license. In order to use iTop you must accept the terms of this license.

'); - $oP->add("\n"); + $oP->add("\n"); $oP->add("
\n"); AddParamsToForm($oP, $aParamValues, array('licence_ok')); @@ -1151,6 +1151,7 @@ function DisplaySummary(SetupPage $oP, $aParamValues, $iCurrentStep, Config $oCo } } $oP->set_title('Installation Summary'); + $oP->SetRootUrl($aParamValues['application_path']); $oP->add("

iTop version ".$aAvailableModules[ROOT_MODULE]['version_code']." will be installed.

"); $oP->add('
'); @@ -1325,7 +1326,7 @@ function DisplaySummary(SetupPage $oP, $aParamValues, $iCurrentStep, Config $oCo $oP->add("\n"); $oP->add("
\n"); - $oP->add_linked_script('./jquery.progression.js'); + $oP->add_linked_script('../setup/jquery.progression.js'); PopulateDataFilesList($oP, $aParamValues, $oConfig); $oP->add_ready_script( <<Preparing data model...
0%

'}); - $('#progress').progression( {Current:5, Maximum: 100, aBackgroundImg: 'orange-progress.gif', aTextColor: '#000000'} ); + $('#progress').progression( {Current:5, Maximum: 100, aBackgroundImg: GetAbsoluteUrlAppRoot()+'setup/orange-progress.gif', aTextColor: '#000000'} ); var sSelectedModules = GetSelectedModules(); var sMode = $(':input[name=mode]').val(); @@ -171,7 +171,7 @@ function DoCompileDataModel() var sTargetDir = $(':input[name=target_dir]').val(); // Call the asynchronous page that performs the compilation of the data model and the creation of the configuration file - AsyncCompileDataModel(sSelectedModules, sMode, sSourceDir, sTargetDir, function(response, status, xhr) { + AsyncCompileDataModel(sSelectedModules, sMode, sSourceDir, sTargetDir, '', function(response, status, xhr) { $('#log').html(response); DoUpdateDBSchema(); }); @@ -181,7 +181,7 @@ function DoUpdateDBSchema() { $('#log').html(''); $('#setup').block({message: '

Updating DB schema...

5%

'}); - $('#progress').progression( {Current:10, Maximum: 100, aBackgroundImg: 'orange-progress.gif', aTextColor: '#000000'} ); + $('#progress').progression( {Current:10, Maximum: 100, aBackgroundImg: GetAbsoluteUrlAppRoot()+'setup/orange-progress.gif', aTextColor: '#000000'} ); var sSelectedModules = GetSelectedModules(); var sMode = $(':input[name=mode]').val(); @@ -204,7 +204,7 @@ function DoUpdateProfiles() { $('#log').html(''); $('#setup_msg').text('Updating Profiles...'); - $('#progress').progression( {Current:40, Maximum: 100, aBackgroundImg: 'orange-progress.gif', aTextColor: '#000000'} ); + $('#progress').progression( {Current:40, Maximum: 100, aBackgroundImg: GetAbsoluteUrlAppRoot()+'setup/orange-progress.gif', aTextColor: '#000000'} ); var sSelectedModules = GetSelectedModules(); var sMode = $(':input[name=mode]').val(); @@ -249,7 +249,7 @@ function DoLoadDataAsynchronous(response, status, xhr) { $('#log').html(''); $('#setup_msg').text('Loading data...'); - $('#progress').progression( {Current: 60, Maximum: 100, aBackgroundImg: 'orange-progress.gif', aTextColor: '#000000'} ); + $('#progress').progression( {Current: 60, Maximum: 100, aBackgroundImg: GetAbsoluteUrlAppRoot()+'setup/orange-progress.gif', aTextColor: '#000000'} ); // $('#log').ajaxError( // function(e, xhr, settings, exception) // { @@ -297,9 +297,9 @@ function LoadNextDataFile(response, status, xhr) iPercent = 60+Math.round((40.0 * (1+iCounter)) / aFilesToLoad.length); sFileName = aFilesToLoad[iCounter]; //alert('Loading file '+sFileName+' ('+iPercent+' %) - '+sSessionStatus); - $("#progress").progression({ Current: iPercent, Maximum: 100, aBackgroundImg: 'orange-progress.gif', aTextColor: '#000000' }); + $("#progress").progression({ Current: iPercent, Maximum: 100, aBackgroundImg: GetAbsoluteUrlAppRoot()+'setup/orange-progress.gif', aTextColor: '#000000' }); iCounter++; - $('#log').load( 'ajax.dataloader.php', + $('#log').load( GetAbsoluteUrlAppRoot()+'setup/ajax.dataloader.php', { 'selected_modules': GetSelectedModules(), 'db_server': $(':input[name=db_server]').val(), @@ -319,7 +319,7 @@ function LoadNextDataFile(response, status, xhr) else { // We're done - $("#progress").progression({ Current: 100, Maximum: 100, aBackgroundImg: 'orange-progress.gif', aTextColor: '#000000' }); + $("#progress").progression({ Current: 100, Maximum: 100, aBackgroundImg: GetAbsoluteUrlAppRoot()+'setup/orange-progress.gif', aTextColor: '#000000' }); //$('#setup').unblock(); $('#GoToNextStep').submit(); // Use the hidden form to navigate to the next step } diff --git a/setup/setup_environment.js b/setup/setup_environment.js index d3cfbc265..a14435e8a 100644 --- a/setup/setup_environment.js +++ b/setup/setup_environment.js @@ -7,17 +7,18 @@ * @param string sTargetDir The target directory (is created if needed) for compiled modules * @return void */ -function AsyncCompileDataModel(sSelectedModules, sMode, sSourceDir, sTargetDir, OnCompleteFn) +function AsyncCompileDataModel(sSelectedModules, sMode, sSourceDir, sTargetDir, sWorkspaceDir, OnCompleteFn) { try { - $.post( 'ajax.dataloader.php', + $.post( GetAbsoluteUrlAppRoot()+'setup/ajax.dataloader.php', { 'operation': 'compile_data_model', 'selected_modules': sSelectedModules, 'mode': sMode, 'source_dir': sSourceDir, - 'target_dir': sTargetDir + 'target_dir': sTargetDir, + 'workspace_dir': sWorkspaceDir }, OnCompleteFn, 'html'); } @@ -45,7 +46,7 @@ function AsyncUpdateDBSchema(sSelectedModules, sMode, sModulesDir, sDBServer, sD { try { - $.post( 'ajax.dataloader.php', + $.post( GetAbsoluteUrlAppRoot()+'setup/ajax.dataloader.php', { 'operation': 'update_db_schema', 'selected_modules': sSelectedModules, @@ -86,7 +87,7 @@ function AsyncUpdateProfiles(sSelectedModules, sMode, sModulesDir, sDBServer, sD { try { - $.post( 'ajax.dataloader.php', + $.post( GetAbsoluteUrlAppRoot()+'setup/ajax.dataloader.php', { 'operation': 'after_db_create', 'selected_modules': sSelectedModules, diff --git a/setup/setuppage.class.inc.php b/setup/setuppage.class.inc.php index 4b5104d65..87117b4f5 100644 --- a/setup/setuppage.class.inc.php +++ b/setup/setuppage.class.inc.php @@ -40,8 +40,8 @@ class SetupPage extends NiceWebPage { parent::__construct($sTitle); $this->add_linked_script("../js/jquery.blockUI.js"); - $this->add_linked_script("./setup.js"); - $this->add_linked_script("./setup_environment.js"); + $this->add_linked_script("../setup/setup.js"); + $this->add_linked_script("../setup/setup_environment.js"); $this->add_style(" body { background-color: #eee; @@ -425,7 +425,7 @@ function InitDataModel($oConfig, $bModelOnly = true, $bUseCache = false) SetupPage::log_info("MetaModel::Startup (ModelOnly = $bModelOnly)"); } - if ($bUseCache) + if (!$bUseCache) { // Reset the cache for the first use ! MetaModel::ResetCache($oConfig); diff --git a/webservices/soapserver.php b/webservices/soapserver.php index 28d67c794..f2da61f9c 100644 --- a/webservices/soapserver.php +++ b/webservices/soapserver.php @@ -34,7 +34,7 @@ require_once(APPROOT.'/application/startup.inc.php'); $sWsdlUri = 'http'.((isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS']!='off')) ? 's' : '').'://'.$_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'].dirname($_SERVER['SCRIPT_NAME']).'/../webservices/itop.wsdl.php'; if (isset($_REQUEST['service_category']) && (!empty($_REQUEST['service_category']))) { - $sWsdlUri .= "?service_category=".$_REQUEST['service_category']; + $sWsdlUri .= "soapserver.php?service_category=".$_REQUEST['service_category']; }