Skip to content
Snippets Groups Projects
Commit 4d298b18 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Update code comments and add log warning to help debug

parent ffeb2778
Branches
Tags
No related merge requests found
...@@ -156,15 +156,19 @@ class Conf ...@@ -156,15 +156,19 @@ class Conf
if ($value && preg_match('/^MAIN_MODULE_/',$key)) if ($value && preg_match('/^MAIN_MODULE_/',$key))
{ {
// If this is constant for a new tab page activated by a module. // If this is constant for a new tab page activated by a module. It initializes modules_parts['tabs'].
if (preg_match('/^MAIN_MODULE_([0-9A-Z_]+)_TABS_/i',$key)) if (preg_match('/^MAIN_MODULE_([0-9A-Z_]+)_TABS_/i',$key))
{ {
$partname = 'tabs'; $partname = 'tabs';
$params=explode(':',$value,2); $params=explode(':',$value,2);
if (! isset($this->modules_parts[$partname]) || ! is_array($this->modules_parts[$partname])) { $this->modules_parts[$partname] = array(); } if (! isset($this->modules_parts[$partname]) || ! is_array($this->modules_parts[$partname])) { $this->modules_parts[$partname] = array(); }
$this->modules_parts[$partname][$params[0]][]=$value; $this->modules_parts[$partname][$params[0]][]=$value; // $value may be a string or an array
} }
// If this is constant for all generic part activated by a module // If this is constant for all generic part activated by a module. It initializes
// modules_parts['login'], modules_parts['menus'], modules_parts['substitutions'], modules_parts['triggers'], modules_parts['tpl'],
// modules_parts['models'], modules_parts['theme']
// modules_parts['sms'],
// modules_parts['css'], ...
elseif (preg_match('/^MAIN_MODULE_([0-9A-Z_]+)_([A-Z]+)$/i',$key,$reg)) elseif (preg_match('/^MAIN_MODULE_([0-9A-Z_]+)_([A-Z]+)$/i',$key,$reg))
{ {
$modulename = strtolower($reg[1]); $modulename = strtolower($reg[1]);
...@@ -176,7 +180,7 @@ class Conf ...@@ -176,7 +180,7 @@ class Conf
else if (in_array($partname,array('models','theme'))) $value = '/'.$modulename.'/'; else if (in_array($partname,array('models','theme'))) $value = '/'.$modulename.'/';
else if (in_array($partname,array('sms'))) $value = $modulename; else if (in_array($partname,array('sms'))) $value = $modulename;
else if ($value == 1) $value = '/'.$modulename.'/core/modules/'.$partname.'/'; // ex: partname = societe else if ($value == 1) $value = '/'.$modulename.'/core/modules/'.$partname.'/'; // ex: partname = societe
$this->modules_parts[$partname] = array_merge($this->modules_parts[$partname], array($modulename => $value)); $this->modules_parts[$partname] = array_merge($this->modules_parts[$partname], array($modulename => $value)); // $value may be a string or an array
} }
// If this is a module constant (must be at end) // If this is a module constant (must be at end)
elseif (preg_match('/^MAIN_MODULE_([0-9A-Z_]+)$/i',$key,$reg)) elseif (preg_match('/^MAIN_MODULE_([0-9A-Z_]+)$/i',$key,$reg))
......
...@@ -1047,6 +1047,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs ...@@ -1047,6 +1047,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
$filescss=(array) $filescss; // To be sure filecss is an array $filescss=(array) $filescss; // To be sure filecss is an array
foreach($filescss as $cssfile) foreach($filescss as $cssfile)
{ {
if (empty($cssfile)) dol_syslog("Warning: module ".$modcss." declared a css path file into its descriptor that is empty.", LOG_WARNING);
// cssfile is a relative path // cssfile is a relative path
print '<!-- Includes CSS added by module '.$modcss. ' -->'."\n".'<link rel="stylesheet" type="text/css" title="default" href="'.dol_buildpath($cssfile,1); print '<!-- Includes CSS added by module '.$modcss. ' -->'."\n".'<link rel="stylesheet" type="text/css" title="default" href="'.dol_buildpath($cssfile,1);
// We add params only if page is not static, because some web server setup does not return content type text/css if url has parameters, so browser cache is not used. // We add params only if page is not static, because some web server setup does not return content type text/css if url has parameters, so browser cache is not used.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment