New: Support module_parts['theme']

This commit is contained in:
Laurent Destailleur 2013-01-08 15:21:56 +01:00
parent ec3421d59e
commit 9d47b812b9
6 changed files with 48 additions and 12 deletions

View File

@ -169,8 +169,7 @@ class Conf
$arrValue = json_decode($value,true);
if (is_array($arrValue) && ! empty($arrValue)) $value = $arrValue;
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('models','theme'))) $value = '/'.$modulename.'/';
else if (in_array($partname,array('sms'))) $value = $modulename;
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));

View File

@ -175,8 +175,21 @@ function dol_loginfunction($langs,$conf,$mysoc)
}
}
$conf->css = "/theme/".(GETPOST('theme')?GETPOST('theme','alpha'):$conf->theme)."/style.css.php?lang=".$langs->defaultlang;
$conf_css = DOL_URL_ROOT.$conf->css;
// Note: $conf->css looks like '/theme/eldy/style.css.php'
$conf->css = "/theme/".(GETPOST('theme')?GETPOST('theme','alpha'):$conf->theme)."/style.css.php";
$themepath=dol_buildpath((empty($conf->global->MAIN_FORCETHEMEDIR)?'':$conf->global->MAIN_FORCETHEMEDIR).$conf->css,1);
if (! empty($conf->modules_parts['theme'])) // This slow down
{
foreach($conf->modules_parts['theme'] as $reldir)
{
if (file_exists(dol_buildpath($reldir.$conf->css, 0)))
{
$themepath=dol_buildpath($reldir.$conf->css, 1);
break;
}
}
}
$conf_css = $themepath."?lang=".$langs->defaultlang;
// Set cookie for timeout management
$prefix=dol_getprefix();

View File

@ -22,7 +22,7 @@ header("Content-type: text/html; charset=".$conf->file->character_set_client);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- BEGIN PHP TEMPLATE -->
<!-- BEGIN PHP TEMPLATE LOGIN.TPL.PHP -->
<html>
<?php

View File

@ -22,7 +22,7 @@ header("Content-type: text/html; charset=".$conf->file->character_set_client);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- BEGIN PHP TEMPLATE -->
<!-- BEGIN PHP TEMPLATE PASSWORDFORGOTTEN.TPL.PHP -->
<html>
<?php

View File

@ -910,15 +910,26 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
}
print '<!-- Includes for Dolibarr, modules or specific pages-->'."\n";
// Output style sheets (optioncss='print' or '')
// Output style sheets (optioncss='print' or ''). Note: $conf->css looks like '/theme/eldy/style.css.php'
$themepath=dol_buildpath((empty($conf->global->MAIN_FORCETHEMEDIR)?'':$conf->global->MAIN_FORCETHEMEDIR).$conf->css,1);
if (! empty($conf->modules_parts['theme'])) // This slow down
{
foreach($conf->modules_parts['theme'] as $reldir)
{
if (file_exists(dol_buildpath($reldir.$conf->css, 0)))
{
$themepath=dol_buildpath($reldir.$conf->css, 1);
break;
}
}
}
$themeparam='?lang='.$langs->defaultlang.'&amp;theme='.$conf->theme.(GETPOST('optioncss')?'&amp;optioncss='.GETPOST('optioncss','alpha',1):'').'&amp;userid='.$user->id.'&amp;entity='.$conf->entity;
if (! empty($_SESSION['dol_resetcache'])) $themeparam.='&amp;dol_resetcache='.$_SESSION['dol_resetcache'];
//print 'themepath='.$themepath.' themeparam='.$themeparam;exit;
//print 'themepath='.$themepath.' themeparam='.$themeparam;exit;
print '<link rel="stylesheet" type="text/css" title="default" href="'.$themepath.$themeparam.'">'."\n";
// CSS forced by modules (relative url starting with /)
if (isset($conf->modules_parts['css']))
if (! empty($conf->modules_parts['css']))
{
$arraycss=(array) $conf->modules_parts['css'];
foreach($arraycss as $modcss => $filescss)
@ -1078,7 +1089,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
}
// JS forced by modules (relative url starting with /)
if (isset($conf->modules_parts['js'])) // $conf->modules_parts['js'] is array('module'=>array('file1','file2'))
if (! empty($conf->modules_parts['js'])) // $conf->modules_parts['js'] is array('module'=>array('file1','file2'))
{
$arrayjs=(array) $conf->modules_parts['js'];
foreach($arrayjs as $modjs => $filesjs)

View File

@ -174,8 +174,21 @@ else
}
}
$conf->css = "/theme/".$conf->theme."/style.css.php?lang=".$langs->defaultlang;
$conf_css = DOL_URL_ROOT.$conf->css;
// Note: $conf->css looks like '/theme/eldy/style.css.php'
$conf->css = "/theme/".(GETPOST('theme')?GETPOST('theme','alpha'):$conf->theme)."/style.css.php";
$themepath=dol_buildpath((empty($conf->global->MAIN_FORCETHEMEDIR)?'':$conf->global->MAIN_FORCETHEMEDIR).$conf->css,1);
if (! empty($conf->modules_parts['theme'])) // This slow down
{
foreach($conf->modules_parts['theme'] as $reldir)
{
if (file_exists(dol_buildpath($reldir.$conf->css, 0)))
{
$themepath=dol_buildpath($reldir.$conf->css, 1);
break;
}
}
}
$conf_css = $themepath."?lang=".$langs->defaultlang;
$jquerytheme = 'smoothness';
if (! empty($conf->global->MAIN_USE_JQUERY_THEME)) $jquerytheme = $conf->global->MAIN_USE_JQUERY_THEME;