Fix: possibility to defined a specific path

This commit is contained in:
Regis Houssin 2012-02-23 16:20:15 +01:00
parent ab9c22f5f3
commit 2dabf0e185
2 changed files with 14 additions and 9 deletions

View File

@ -68,12 +68,14 @@ class modMyModule extends DolibarrModules
// If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module'
$this->picto='generic'; $this->picto='generic';
// Defined all module parts (triggers, login, substitutions, menus, etc...) (0=disable,1=enable) // Defined all module parts (triggers, login, substitutions, menus, css, etc...) (0=disable,1=enable default path, '/mymodule/path/to/parts' for specific path)
$this->module_parts = array(); $this->module_parts = array();
//$this->module_parts = array('triggers' => 1, //$this->module_parts = array( 'triggers' => 1,
// 'login' => 0, // 'login' => 0,
// 'substitutions' => 0, // 'substitutions' => '/specific/path/in/your/module',
// 'menus' => 0); // 'menus' => 0
// 'css' => '/css/mymodule.css.php'
// 'barcode => /path/to/your/parts');
// Data directories to create when module is enabled. // Data directories to create when module is enabled.
// Example: this->dirs = array("/mymodule/temp"); // Example: this->dirs = array("/mymodule/temp");

View File

@ -143,6 +143,7 @@ class Conf
if ($value && preg_match('/^MAIN_MODULE_/',$key)) if ($value && preg_match('/^MAIN_MODULE_/',$key))
{ {
// If this is constant for a css file activated by a module // If this is constant for a css file activated by a module
// TODO obsolete (see generic parts)
if (preg_match('/^MAIN_MODULE_([A-Z_]+)_CSS$/i',$key,$reg)) if (preg_match('/^MAIN_MODULE_([A-Z_]+)_CSS$/i',$key,$reg))
{ {
$modulename = strtolower($reg[1]); $modulename = strtolower($reg[1]);
@ -171,6 +172,7 @@ class Conf
$this->sms_engine_modules[$module]=$module; // Add this module in list of modules that provide SMS $this->sms_engine_modules[$module]=$module; // Add this module in list of modules that provide SMS
} }
// If this is constant for triggers activated by a module // If this is constant for triggers activated by a module
// TODO obsolete (see generic parts)
elseif (preg_match('/^MAIN_MODULE_([A-Z_]+)_BARCODE$/i',$key,$reg)) elseif (preg_match('/^MAIN_MODULE_([A-Z_]+)_BARCODE$/i',$key,$reg))
{ {
$modulename = strtolower($reg[1]); $modulename = strtolower($reg[1]);
@ -182,7 +184,8 @@ class Conf
$modulename = strtolower($reg[1]); $modulename = strtolower($reg[1]);
$partname = strtolower($reg[2]); $partname = strtolower($reg[2]);
$varname = $partname.'_modules'; $varname = $partname.'_modules';
$this->$varname = array_merge($this->$varname, array($modulename => '/'.$modulename.'/core/'.$partname.'/')); $value = ($value === 1 ? '/'.$modulename.'/core/'.$partname.'/' : '/'.$modulename.'/'.$value);
$this->$varname = array_merge($this->$varname, array($modulename => $value));
} }
// TODO All of this part could be mutualized into one generic part // TODO All of this part could be mutualized into one generic part