From ec3421d59ef91610531f80041748381cfe16f33e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 8 Jan 2013 13:45:52 +0100 Subject: [PATCH] New: Add option MAIN_FORCETHEME (differs from MAIN_FORCETHEMEDIR) --- htdocs/core/class/conf.class.php | 6 ++++-- htdocs/core/lib/usergroups.lib.php | 4 ++-- htdocs/core/modules/DolibarrModules.class.php | 16 ++++++++-------- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 7f39af2dede..d3ad64871cc 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -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"; diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index 76a80ffe05d..5cfff43e63c 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -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=''; diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index ca51c0688f7..8e8dce0d338 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -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