New data model integration: fully modular setup based on the "modules"

SVN:trunk[511]
This commit is contained in:
Denis Flaven
2010-06-30 15:40:18 +00:00
parent 2938a8d41e
commit f5b40898a3
15 changed files with 536 additions and 156 deletions

View File

@@ -105,10 +105,31 @@ class Config
public function __construct($sConfigFile, $bLoadConfig = true)
{
$this->m_sFile = $sConfigFile;
$this->m_aAppModules = array();
$this->m_aAppModules = array(
// Some default modules, always present can be move to an official iTop Module later if needed
'../application/transaction.class.inc.php',
'../application/menunode.class.inc.php',
'../application/user.preferences.class.inc.php',
'../application/audit.rule.class.inc.php',
// Romain - That's dirty, because those 3 classes are in fact part of the core
// but I needed those classes to be derived from cmdbAbstractObject
// (to be managed via the GUI) and this class in not really known from
// the core, PLUS I needed the includes to be there also for the setup
// to create the tables.
'../core/event.class.inc.php',
'../core/action.class.inc.php',
'../core/trigger.class.inc.php',
);
$this->m_aDataModels = array();
$this->m_aAddons = array();
$this->m_aDictionaries = array();
$this->m_aAddons = array(
// Default AddOn, always present can be moved to an official iTop Module later if needed
'user rights' => '../addons/userrights/userrightsprofile.class.inc.php',
);
$this->m_aDictionaries = array(
// Default dictionaries, always present can be moved to an official iTop Module later if needed
'../dictionaries/dictionary.itop.core.php',
'../dictionaries/dictionary.itop.ui.php',
);
$this->m_sDBHost = '';
$this->m_sDBUser = '';
@@ -244,21 +265,37 @@ class Config
{
return $this->m_aAppModules;
}
public function SetAppModules($aAppModules)
{
$this->m_aAppModules = $aAppModules;
}
public function GetDataModels()
{
return $this->m_aDataModels;
}
public function SetDataModels($aDataModels)
{
$this->m_aDataModels = $aDataModels;
}
public function GetAddons()
{
return $this->m_aAddons;
}
public function SetAddons($aAddons)
{
$this->m_aAddons = $aAddons;
}
public function GetDictionaries()
{
return $this->m_aDictionaries;
}
public function SetDictionaries($aDictionaries)
{
$this->m_aDictionaries = $aDictionaries;
}
public function GetDBHost()
{
@@ -466,33 +503,28 @@ class Config
fwrite($hFile, " */\n");
fwrite($hFile, "\$MyModules = array(\n");
fwrite($hFile, "\t'application' => array (\n");
fwrite($hFile, "\t\t'../application/transaction.class.inc.php',\n");
fwrite($hFile, "\t\t'../application/menunode.class.inc.php',\n");
fwrite($hFile, "\t\t'../application/user.preferences.class.inc.php',\n");
fwrite($hFile, "\t\t'../application/audit.rule.class.inc.php',\n");
// Romain - That's dirty, because those 3 classes are in fact part of the core
// but I needed those classes to be derived from cmdbAbstractObject
// (to be managed via the GUI) and this class in not really known from
// the core, PLUS I needed the includes to be there also for the setup
// to create the tables.
fwrite($hFile, "\t\t'../core/event.class.inc.php',\n");
fwrite($hFile, "\t\t'../core/action.class.inc.php',\n");
fwrite($hFile, "\t\t'../core/trigger.class.inc.php',\n");
fwrite($hFile, "\t\t// to be continued...\n");
foreach($this->m_aAppModules as $sFile)
{
fwrite($hFile, "\t\t'$sFile',\n");
}
fwrite($hFile, "\t),\n");
fwrite($hFile, "\t'business' => array (\n");
fwrite($hFile, "\t\t'../business/itop.business.class.inc.php'\n");
fwrite($hFile, "\t\t// to be continued...\n");
foreach($this->m_aDataModels as $sFile)
{
fwrite($hFile, "\t\t'$sFile',\n");
}
fwrite($hFile, "\t),\n");
fwrite($hFile, "\t'addons' => array (\n");
fwrite($hFile, "\t\t'user rights' => '../addons/userrights/userrightsprofile.class.inc.php',\n");
fwrite($hFile, "\t\t// other modules to come later\n");
foreach($this->m_aAddons as $sKey => $sFile)
{
fwrite($hFile, "\t\t'$sKey' => '$sFile',\n");
}
fwrite($hFile, "\t),\n");
fwrite($hFile, "\t'dictionaries' => array (\n");
fwrite($hFile, "\t\t'../dictionaries/dictionary.itop.model.php',\n");
fwrite($hFile, "\t\t'../dictionaries/dictionary.itop.core.php',\n");
fwrite($hFile, "\t\t'../dictionaries/dictionary.itop.ui.php',\n");
fwrite($hFile, "\t\t// to be continued...\n");
foreach($this->m_aDictionaries as $sFile)
{
fwrite($hFile, "\t\t'$sFile',\n");
}
fwrite($hFile, "\t),\n");
fwrite($hFile, ");\n");
fwrite($hFile, '?'.'>'); // Avoid perturbing the syntax highlighting !

View File

@@ -1294,10 +1294,10 @@ abstract class MetaModel
return self::$m_Category2Class[$sCategory];
}
if (count(self::$m_Category2Class) > 0)
{
throw new CoreException("unkown class category '$sCategory', expecting a value in {".implode(', ', array_keys(self::$m_Category2Class))."}");
}
//if (count(self::$m_Category2Class) > 0)
//{
// throw new CoreException("unkown class category '$sCategory', expecting a value in {".implode(', ', array_keys(self::$m_Category2Class))."}");
//}
return array();
}