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:
Denis Flaven
2011-04-22 15:44:50 +00:00
parent fb87911677
commit c6493f6cdc
14 changed files with 20 additions and 116 deletions

View File

@@ -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)
{