Przeglądaj źródła

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.

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@1228 a333f486-631f-4898-b8df-5754b55c2be0
dflaven 14 lat temu
rodzic
commit
49a1cae13b

+ 0 - 8
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',
 		),

+ 0 - 8
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',
 		),

+ 0 - 8
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',
 		),

+ 0 - 10
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',
 		),

+ 0 - 10
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',
 		),

+ 0 - 10
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',

+ 0 - 10
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',
 		),

+ 0 - 10
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',
 		),

+ 0 - 5
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',
 		),

+ 0 - 10
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',

+ 0 - 10
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',
 		),

+ 0 - 10
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',
 		),

+ 0 - 5
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',
 		),

+ 20 - 2
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 <Lang>.dict.<ModuleName>.php
+					{
+						self::$m_aModules[$sId]['dictionary'][] = self::$m_sModulePath.'/'.$sFile;
+					}
+				}
+				closedir($hDir);
+			}
+		}
 	}
 	public static function GetModules($oP = null)
 	{