Update code comments and add log warning to help debug

This commit is contained in:
Laurent Destailleur 2014-01-12 20:02:41 +01:00
parent 51b455b85a
commit 0990ef3961
2 changed files with 10 additions and 5 deletions

View File

@ -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
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))

View File

@ -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.
@ -1060,7 +1061,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
{ {
foreach($arrayofcss as $cssfile) foreach($arrayofcss as $cssfile)
{ {
print '<!-- Includes CSS added by page -->'."\n".'<link rel="stylesheet" type="text/css" title="default" href="'.dol_buildpath($cssfile,1); print '<!-- Includes CSS added by page -->'."\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 and 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 and browser cache is not used.
if (!preg_match('/\.css$/i',$cssfile)) print $themeparam; if (!preg_match('/\.css$/i',$cssfile)) print $themeparam;
print '">'."\n"; print '">'."\n";