mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
Dictionary files that follow the naming convention <Lang>.dict.<ModuleName>.php are now loaded automatically without the need to specify them explicitely in the module definition file.
SVN:trunk[1228]
This commit is contained in:
@@ -287,7 +287,7 @@ h3.clickable.open {
|
||||
'mandatory' => 'boolean',
|
||||
'visible' => 'boolean',
|
||||
'datamodel' => 'array of data model files',
|
||||
'dictionary' => 'array of dictionary files',
|
||||
//'dictionary' => 'array of dictionary files', // No longer mandatory, now automated
|
||||
'data.struct' => 'array of structural data files',
|
||||
'data.sample' => 'array of sample data files',
|
||||
'doc.manual_setup' => 'url',
|
||||
@@ -330,10 +330,28 @@ h3.clickable.open {
|
||||
// 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;
|
||||
self::$m_aModules[$sId][$sAttribute][$idx] = self::$m_sModulePath.'/'.$sRelativePath;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Populate automatically the list of dictionary files
|
||||
if(preg_match('|^([^/]+)|', $sId, $aMatches)) // ModuleName = everything before the first forward slash
|
||||
{
|
||||
$sModuleName = $aMatches[1];
|
||||
$sDir = dirname($sFilePath);
|
||||
if ($hDir = opendir($sDir))
|
||||
{
|
||||
while (($sFile = readdir($hDir)) !== false)
|
||||
{
|
||||
$aMatches = array();
|
||||
if (preg_match("/^[^\\.]+.dict.$sModuleName.php$/i", $sFile, $aMatches)) // Dictionary files are name <Lang>.dict.<ModuleName>.php
|
||||
{
|
||||
self::$m_aModules[$sId]['dictionary'][] = self::$m_sModulePath.'/'.$sFile;
|
||||
}
|
||||
}
|
||||
closedir($hDir);
|
||||
}
|
||||
}
|
||||
}
|
||||
public static function GetModules($oP = null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user