From c6493f6cdcd5d358a237c2e0023df73a49be716c Mon Sep 17 00:00:00 2001 From: Denis Flaven Date: Fri, 22 Apr 2011 15:44:50 +0000 Subject: [PATCH] Dictionary files that follow the naming convention .dict..php are now loaded automatically without the need to specify them explicitely in the module definition file. SVN:trunk[1228] --- .../module.authent-external.php | 8 ------- modules/authent-ldap/module.authent-ldap.php | 8 ------- .../authent-local/module.authent-local.php | 8 ------- .../module.itop-change-mgmt.php | 10 --------- .../module.itop-config-mgmt.php | 10 --------- .../module.itop-incident-mgmt.php | 10 --------- .../module.itop-knownerror-mgmt.php | 10 --------- .../module.itop-problem-mgmt.php | 10 --------- .../module.itop-profiles-itil.php | 5 ----- .../module.itop-request-mgmt.php | 10 --------- .../module.itop-service-mgmt.php | 10 --------- .../module.itop-tickets.php | 10 --------- .../module.itop-welcome-itil.php | 5 ----- setup/setuppage.class.inc.php | 22 +++++++++++++++++-- 14 files changed, 20 insertions(+), 116 deletions(-) diff --git a/modules/authent-external/module.authent-external.php b/modules/authent-external/module.authent-external.php index 6c7aafe2b..2a9e68456 100644 --- a/modules/authent-external/module.authent-external.php +++ b/modules/authent-external/module.authent-external.php @@ -45,14 +45,6 @@ SetupWebPage::AddModule( 'datamodel' => array( 'model.authent-external.php', ), - 'dictionary' => array( - 'en.dict.authent-external.php', - 'fr.dict.authent-external.php', - 'de.dict.authent-external.php', - 'ru.dict.authent-external.php', - 'tr.dict.authent-external.php', - 'zh.dict.authent-external.php', - ), 'data.struct' => array( //'data.struct.authent-ldap.xml', ), diff --git a/modules/authent-ldap/module.authent-ldap.php b/modules/authent-ldap/module.authent-ldap.php index bdece9037..ce59a22e8 100644 --- a/modules/authent-ldap/module.authent-ldap.php +++ b/modules/authent-ldap/module.authent-ldap.php @@ -28,14 +28,6 @@ SetupWebPage::AddModule( 'datamodel' => array( 'model.authent-ldap.php', ), - 'dictionary' => array( - 'en.dict.authent-ldap.php', - 'fr.dict.authent-ldap.php', - 'de.dict.authent-ldap.php', - 'ru.dict.authent-ldap.php', - 'tr.dict.authent-ldap.php', - 'zh.dict.authent-ldap.php', - ), 'data.struct' => array( //'data.struct.authent-ldap.xml', ), diff --git a/modules/authent-local/module.authent-local.php b/modules/authent-local/module.authent-local.php index 1334968c6..93b940e7c 100644 --- a/modules/authent-local/module.authent-local.php +++ b/modules/authent-local/module.authent-local.php @@ -22,14 +22,6 @@ SetupWebPage::AddModule( 'datamodel' => array( 'model.authent-local.php', ), - 'dictionary' => array( - 'en.dict.authent-local.php', - 'fr.dict.authent-local.php', - 'de.dict.authent-local.php', - 'ru.dict.authent-local.php', - 'tr.dict.authent-local.php', - 'zh.dict.authent-local.php', - ), 'data.struct' => array( //'data.struct.authent-local.xml', ), diff --git a/modules/itop-change-mgmt-1.0.0/module.itop-change-mgmt.php b/modules/itop-change-mgmt-1.0.0/module.itop-change-mgmt.php index 7bab8682b..1655d2281 100644 --- a/modules/itop-change-mgmt-1.0.0/module.itop-change-mgmt.php +++ b/modules/itop-change-mgmt-1.0.0/module.itop-change-mgmt.php @@ -24,16 +24,6 @@ SetupWebPage::AddModule( 'datamodel' => array( 'model.itop-change-mgmt.php', ), - 'dictionary' => array( - 'en.dict.itop-change-mgmt.php', - 'fr.dict.itop-change-mgmt.php', - 'es_cr.dict.itop-change-mgmt.php', - 'de.dict.itop-change-mgmt.php', - 'pt_br.dict.itop-change-mgmt.php', - 'ru.dict.itop-change-mgmt.php', - 'tr.dict.itop-change-mgmt.php', - 'zh.dict.itop-change-mgmt.php', - ), 'data.struct' => array( //'data.struct.itop-change-mgmt.xml', ), diff --git a/modules/itop-config-mgmt-1.0.0/module.itop-config-mgmt.php b/modules/itop-config-mgmt-1.0.0/module.itop-config-mgmt.php index 084fcedf2..0d7e6ad7d 100644 --- a/modules/itop-config-mgmt-1.0.0/module.itop-config-mgmt.php +++ b/modules/itop-config-mgmt-1.0.0/module.itop-config-mgmt.php @@ -23,16 +23,6 @@ SetupWebPage::AddModule( 'datamodel' => array( 'model.itop-config-mgmt.php', ), - 'dictionary' => array( - 'en.dict.itop-config-mgmt.php', - 'fr.dict.itop-config-mgmt.php', - 'es_cr.dict.itop-config-mgmt.php', - 'de.dict.itop-config-mgmt.php', - 'pt_br.dict.itop-config-mgmt.php', - 'ru.dict.itop-config-mgmt.php', - 'tr.dict.itop-config-mgmt.php', - 'zh.dict.itop-config-mgmt.php', - ), 'data.struct' => array( 'data.struct.Audit.xml', ), diff --git a/modules/itop-incident-mgmt-1.0.0/module.itop-incident-mgmt.php b/modules/itop-incident-mgmt-1.0.0/module.itop-incident-mgmt.php index 1b4dea666..2dd4ddea2 100644 --- a/modules/itop-incident-mgmt-1.0.0/module.itop-incident-mgmt.php +++ b/modules/itop-incident-mgmt-1.0.0/module.itop-incident-mgmt.php @@ -25,16 +25,6 @@ SetupWebPage::AddModule( 'datamodel' => array( 'model.itop-incident-mgmt.php', ), - 'dictionary' => array( - 'en.dict.itop-incident-mgmt.php', - 'fr.dict.itop-incident-mgmt.php', - 'es_cr.dict.itop-incident-mgmt.php', - 'de.dict.itop-incident-mgmt.php', - 'pt_br.dict.itop-incident-mgmt.php', - 'ru.dict.itop-incident-mgmt.php', - 'tr.dict.itop-incident-mgmt.php', - 'zh.dict.itop-incident-mgmt.php', - ), 'data.struct' => array( 'data.struct.ta-triggers.xml', 'data.struct.ta-links.xml', diff --git a/modules/itop-knownerror-mgmt-1.0.0/module.itop-knownerror-mgmt.php b/modules/itop-knownerror-mgmt-1.0.0/module.itop-knownerror-mgmt.php index f9b203c68..469729ea5 100644 --- a/modules/itop-knownerror-mgmt-1.0.0/module.itop-knownerror-mgmt.php +++ b/modules/itop-knownerror-mgmt-1.0.0/module.itop-knownerror-mgmt.php @@ -25,16 +25,6 @@ SetupWebPage::AddModule( 'datamodel' => array( 'model.itop-knownerror-mgmt.php', ), - 'dictionary' => array( - 'en.dict.itop-knownerror-mgmt.php', - 'es_cr.dict.itop-knownerror-mgmt.php', - 'fr.dict.itop-knownerror-mgmt.php', - 'de.dict.itop-knownerror-mgmt.php', - 'pt_br.dict.itop-knownerror-mgmt.php', - 'ru.dict.itop-knownerror-mgmt.php', - 'tr.dict.itop-knownerror-mgmt.php', - 'zh.dict.itop-knownerror-mgmt.php', - ), 'data.struct' => array( //'data.struct.itop-knownerror-mgmt.xml', ), diff --git a/modules/itop-problem-mgmt-1.0.0/module.itop-problem-mgmt.php b/modules/itop-problem-mgmt-1.0.0/module.itop-problem-mgmt.php index 1058009cd..b16b50501 100644 --- a/modules/itop-problem-mgmt-1.0.0/module.itop-problem-mgmt.php +++ b/modules/itop-problem-mgmt-1.0.0/module.itop-problem-mgmt.php @@ -25,16 +25,6 @@ SetupWebPage::AddModule( 'datamodel' => array( 'model.itop-problem-mgmt.php', ), - 'dictionary' => array( - 'en.dict.itop-problem-mgmt.php', - 'es_cr.dict.itop-problem-mgmt.php', - 'fr.dict.itop-problem-mgmt.php', - 'de.dict.itop-problem-mgmt.php', - 'pt_br.dict.itop-problem-mgmt.php', - 'ru.dict.itop-problem-mgmt.php', - 'tr.dict.itop-problem-mgmt.php', - 'zh.dict.itop-problem-mgmt.php', - ), 'data.struct' => array( //'data.struct.itop-problem-mgmt.xml', ), diff --git a/modules/itop-profiles-itil/module.itop-profiles-itil.php b/modules/itop-profiles-itil/module.itop-profiles-itil.php index c361e78eb..937975a21 100644 --- a/modules/itop-profiles-itil/module.itop-profiles-itil.php +++ b/modules/itop-profiles-itil/module.itop-profiles-itil.php @@ -39,11 +39,6 @@ SetupWebPage::AddModule( 'webservice' => array( //'webservices.itop-profiles-itil.php', ), - 'dictionary' => array( - //'en.dict.itop-profiles-itil.php', - //'fr.dict.itop-profiles-itil.php', - //'de.dict.itop-profiles-itil.php', - ), 'data.struct' => array( //'data.struct.itop-profiles-itil.xml', ), diff --git a/modules/itop-request-mgmt-1.0.0/module.itop-request-mgmt.php b/modules/itop-request-mgmt-1.0.0/module.itop-request-mgmt.php index b974e0c4a..97e02d4d1 100644 --- a/modules/itop-request-mgmt-1.0.0/module.itop-request-mgmt.php +++ b/modules/itop-request-mgmt-1.0.0/module.itop-request-mgmt.php @@ -24,16 +24,6 @@ SetupWebPage::AddModule( 'datamodel' => array( 'model.itop-request-mgmt.php', ), - 'dictionary' => array( - 'en.dict.itop-request-mgmt.php', - 'fr.dict.itop-request-mgmt.php', - 'es_cr.dict.itop-request-mgmt.php', - 'de.dict.itop-request-mgmt.php', - 'pt_br.dict.itop-request-mgmt.php', - 'ru.dict.itop-request-mgmt.php', - 'tr.dict.itop-request-mgmt.php', - 'zh.dict.itop-request-mgmt.php', - ), 'data.struct' => array( 'data.struct.ta-triggers.xml', 'data.struct.ta-links.xml', diff --git a/modules/itop-service-mgmt-1.0.0/module.itop-service-mgmt.php b/modules/itop-service-mgmt-1.0.0/module.itop-service-mgmt.php index 9595d620f..57086158e 100644 --- a/modules/itop-service-mgmt-1.0.0/module.itop-service-mgmt.php +++ b/modules/itop-service-mgmt-1.0.0/module.itop-service-mgmt.php @@ -23,16 +23,6 @@ SetupWebPage::AddModule( 'datamodel' => array( 'model.itop-service-mgmt.php', ), - 'dictionary' => array( - 'en.dict.itop-service-mgmt.php', - 'fr.dict.itop-service-mgmt.php', - 'es_cr.dict.itop-service-mgmt.php', - 'de.dict.itop-service-mgmt.php', - 'pt_br.dict.itop-service-mgmt.php', - 'ru.dict.itop-service-mgmt.php', - 'tr.dict.itop-service-mgmt.php', - 'zh.dict.itop-service-mgmt.php', - ), 'data.struct' => array( //'data.struct.itop-service-mgmt.xml', ), diff --git a/modules/itop-tickets-1.0.0/module.itop-tickets.php b/modules/itop-tickets-1.0.0/module.itop-tickets.php index 24d4f5747..6737fd33f 100644 --- a/modules/itop-tickets-1.0.0/module.itop-tickets.php +++ b/modules/itop-tickets-1.0.0/module.itop-tickets.php @@ -23,16 +23,6 @@ SetupWebPage::AddModule( 'datamodel' => array( 'model.itop-tickets.php', ), - 'dictionary' => array( - 'en.dict.itop-tickets.php', - 'fr.dict.itop-tickets.php', - 'es_cr.dict.itop-tickets.php', - 'de.dict.itop-tickets.php', - 'pt_br.dict.itop-tickets.php', - 'ru.dict.itop-tickets.php', - 'tr.dict.itop-tickets.php', - 'zh.dict.itop-tickets.php', - ), 'data.struct' => array( 'data.struct.ta-actions.xml', ), diff --git a/modules/itop-welcome-itil/module.itop-welcome-itil.php b/modules/itop-welcome-itil/module.itop-welcome-itil.php index 7064a7912..25c1e57d2 100644 --- a/modules/itop-welcome-itil/module.itop-welcome-itil.php +++ b/modules/itop-welcome-itil/module.itop-welcome-itil.php @@ -26,11 +26,6 @@ SetupWebPage::AddModule( 'webservice' => array( //'webservices.itop-welcome-itil.php', ), - 'dictionary' => array( - //'en.dict.itop-welcome-itil.php', - //'fr.dict.itop-welcome-itil.php', - //'de.dict.itop-welcome-itil.php', - ), 'data.struct' => array( //'data.struct.itop-welcome-itil.xml', ), diff --git a/setup/setuppage.class.inc.php b/setup/setuppage.class.inc.php index 21ca64ac7..a98d58f64 100644 --- a/setup/setuppage.class.inc.php +++ b/setup/setuppage.class.inc.php @@ -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 .dict..php + { + self::$m_aModules[$sId]['dictionary'][] = self::$m_sModulePath.'/'.$sFile; + } + } + closedir($hDir); + } + } } public static function GetModules($oP = null) {