Improved Web services: opened to services coming from an optional module

SVN:trunk[965]
This commit is contained in:
Romain Quetiez
2010-11-23 16:16:01 +00:00
parent 9dd2061f60
commit fcbd9b8911
13 changed files with 722 additions and 186 deletions

View File

@@ -668,23 +668,38 @@ function BuildConfig(SetupWebpage $oP, Config &$oConfig, $aParamValues)
$aAddOns = $oConfig->GetAddOns();
$aAppModules = $oConfig->GetAppModules();
$aDataModels = $oConfig->GetDataModels();
$aWebServiceCategories = $oConfig->GetWebServiceCategories();
$aDictionaries = $oConfig->GetDictionaries();
// Merge the values with the ones provided by the modules
// Make sure when don't load the same file twice...
foreach($aParamValues['module'] as $sModuleId)
{
$oP->log('Installed iTop module: '. $sModuleId);
$aDataModels = array_unique(array_merge($aDataModels, $aAvailableModules[$sModuleId]['datamodel']));
$aDictionaries = array_unique(array_merge($aDictionaries, $aAvailableModules[$sModuleId]['dictionary']));
foreach($aAvailableModules[$sModuleId]['settings'] as $sProperty => $value)
if (isset($aAvailableModules[$sModuleId]['datamodel']))
{
list($sName, $sVersion) = GetModuleName($sModuleId);
$oConfig->SetModuleSetting($sName, $sProperty, $value);
$aDataModels = array_unique(array_merge($aDataModels, $aAvailableModules[$sModuleId]['datamodel']));
}
if (isset($aAvailableModules[$sModuleId]['webservice']))
{
$aWebServiceCategories = array_unique(array_merge($aWebServiceCategories, $aAvailableModules[$sModuleId]['webservice']));
}
if (isset($aAvailableModules[$sModuleId]['dictionary']))
{
$aDictionaries = array_unique(array_merge($aDictionaries, $aAvailableModules[$sModuleId]['dictionary']));
}
if (isset($aAvailableModules[$sModuleId]['settings']))
{
foreach($aAvailableModules[$sModuleId]['settings'] as $sProperty => $value)
{
list($sName, $sVersion) = GetModuleName($sModuleId);
$oConfig->SetModuleSetting($sName, $sProperty, $value);
}
}
}
$oConfig->SetAddOns($aAddOns);
$oConfig->SetAppModules($aAppModules);
$oConfig->SetDataModels($aDataModels);
$oConfig->SetWebServiceCategories($aWebServiceCategories);
$oConfig->SetDictionaries($aDictionaries);
}

View File

@@ -259,7 +259,7 @@ table.formTable {
static $m_aModules = array();
// All the entries below are list of file paths relative to the module directory
static $m_aFilesList = array('datamodel', 'dictionary', 'data.struct', 'data.sample');
static $m_aFilesList = array('datamodel', 'webservice', 'dictionary', 'data.struct', 'data.sample');
static $m_sModulePath = null;
public function SetModulePath($sModulePath)
@@ -281,11 +281,14 @@ table.formTable {
foreach(self::$m_aFilesList as $sAttribute)
{
// All the items below are list of files, that are relative to the current file
// being loaded, let's update their path to store path relative to the application directory
foreach(self::$m_aModules[$sId][$sAttribute] as $idx => $sRelativePath)
if (isset(self::$m_aModules[$sId][$sAttribute]))
{
// All the items below are list of files, that are relative to the current file
// being loaded, let's update their path to store path relative to the application directory
foreach(self::$m_aModules[$sId][$sAttribute] as $idx => $sRelativePath)
{
self::$m_aModules[$sId][$sAttribute][$idx] = self::$m_sModulePath.'/'.$sRelativePath;
}
}
}
}