2
0
forked from Wavyzz/dolibarr

New: Add option MAIN_FORCETHEME (differs from MAIN_FORCETHEMEDIR)

This commit is contained in:
Laurent Destailleur
2013-01-08 13:45:52 +01:00
parent 1f320dc1e7
commit ec3421d59e
3 changed files with 14 additions and 12 deletions

View File

@@ -168,7 +168,8 @@ class Conf
if (! isset($this->modules_parts[$partname]) || ! is_array($this->modules_parts[$partname])) { $this->modules_parts[$partname] = array(); }
$arrValue = json_decode($value,true);
if (is_array($arrValue) && ! empty($arrValue)) $value = $arrValue;
else if (in_array($partname,array('login','menus','substitutions','triggers','tpl','theme'))) $value = '/'.$modulename.'/core/'.$partname.'/';
else if (in_array($partname,array('login','menus','substitutions','triggers','tpl'))) $value = '/'.$modulename.'/core/'.$partname.'/';
else if (in_array($partname,array('theme'))) $value = '/'.$modulename.'/'.$partname.'/';
else if (in_array($partname,array('models'))) $value = '/'.$modulename.'/';
else if (in_array($partname,array('sms'))) $value = $modulename;
else if ($value == 1) $value = '/'.$modulename.'/core/modules/'.$partname.'/'; // ex: partname = societe
@@ -191,7 +192,7 @@ class Conf
$db->free($resql);
}
//var_dump($this->modules);
//var_dump($this->modules_parts);
//var_dump($this->modules_parts['theme']);
// Object $mc
if (! defined('NOREQUIREMC') && ! empty($this->multicompany->enabled))
@@ -357,6 +358,7 @@ class Conf
// conf->theme et $this->css
if (empty($this->global->MAIN_THEME)) $this->global->MAIN_THEME="eldy";
if (! empty($this->global->MAIN_FORCETHEME)) $this->global->MAIN_THEME=$this->global->MAIN_FORCETHEME;
$this->theme=$this->global->MAIN_THEME;
$this->css = "/theme/".$this->theme."/style.css.php";

View File

@@ -225,8 +225,8 @@ function show_theme($fuser,$edit=0,$foruserprofile=false)
$forcethemedir=(! empty($conf->global->MAIN_FORCETHEMEDIR) ? $conf->global->MAIN_FORCETHEMEDIR : '');
$dirthemes=array($forcethemedir.'/theme');
if (! empty($conf->modules_parts['themes'])) {
$dirthemes=array_merge(array($forcethemedir.'/theme'),(array) $conf->modules_parts['themes']);
if (! empty($conf->modules_parts['theme'])) {
$dirthemes=array_merge(array($forcethemedir.'/theme'),(array) $conf->modules_parts['theme']);
}
$selected_theme='';

View File

@@ -1221,14 +1221,14 @@ abstract class DolibarrModules
/**
* Insert activation of generic parts from modules in llx_const
* Input entry use $this->module_parts = array(
* 'triggers' => 0, // Set this to 1 if module has its own trigger directory (core/triggers)
* 'login' => 0, // Set this to 1 if module has its own login method directory (core/login)
* 'substitutions' => 0, // Set this to 1 if module has its own substitution function file (core/substitutions)
* 'menus' => 0, // Set this to 1 if module has its own menus handler directory (core/menus)
* 'theme' => 0, // Set this to 1 if module has its own theme directory (core/theme)
* 'tpl' => 0, // Set this to 1 if module overwrite template dir (core/tpl)
* 'barcode' => 0, // Set this to 1 if module has its own barcode directory (core/modules/barcode)
* 'models' => 0, // Set this to 1 if module has its own models directory (core/modules/xxx)
* 'triggers' => 0, // Set this to 1 if module has its own trigger directory (/mymodule/core/triggers)
* 'login' => 0, // Set this to 1 if module has its own login method directory (/mymodule/core/login)
* 'substitutions' => 0, // Set this to 1 if module has its own substitution function file (/mymodule/core/substitutions)
* 'menus' => 0, // Set this to 1 if module has its own menus handler directory (/mymodule/core/menus)
* 'theme' => 0, // Set this to 1 if module has its own theme directory (/mymodule/theme)
* 'tpl' => 0, // Set this to 1 if module overwrite template dir (/mymodule/core/tpl)
* 'barcode' => 0, // Set this to 1 if module has its own barcode directory (/mymodule/core/modules/barcode)
* 'models' => 0, // Set this to 1 if module has its own models directory (/mymodule/core/modules/xxx)
* 'css' => '/mymodule/css/mymodule.css.php', // Set this to relative path of css file if module has its own css file
* 'js' => '/mymodule/js/mymodule.js', // Set this to relative path of js file if module must load a js on all pages
* 'hooks' => array('hookcontext1','hookcontext2') // Set here all hooks context managed by module