feature 1502: Add $themeconf['load_parent_css'] parameter

git-svn-id: http://piwigo.org/svn/trunk@5991 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
patdenice 2010-04-29 12:45:27 +00:00
commit a2ccb9a5c9
3 changed files with 15 additions and 4 deletions

View file

@ -14,8 +14,10 @@
<link rel="shortcut icon" type="image/x-icon" href="{$ROOT_URL}{$themeconf.icon_dir}/favicon.ico"> <link rel="shortcut icon" type="image/x-icon" href="{$ROOT_URL}{$themeconf.icon_dir}/favicon.ico">
{foreach from=$themes item=theme} {foreach from=$themes item=theme}
{if isset($theme.local_head)}{include file=$theme.local_head}{/if} {if $theme.load_css}
<link rel="stylesheet" type="text/css" href="{$ROOT_URL}admin/themes/{$theme.id}/theme.css"> <link rel="stylesheet" type="text/css" href="{$ROOT_URL}admin/themes/{$theme.id}/theme.css">
{/if}
{if isset($theme.local_head)}{include file=$theme.local_head}{/if}
{/foreach} {/foreach}
{known_script id="jquery" src=$ROOT_URL|@cat:"themes/default/js/jquery.packed.js" now=1} {*jQuery is always available by default*} {known_script id="jquery" src=$ROOT_URL|@cat:"themes/default/js/jquery.packed.js" now=1} {*jQuery is always available by default*}

View file

@ -102,7 +102,7 @@ class Template {
/** /**
* Load theme's parameters. * Load theme's parameters.
*/ */
function set_theme($root, $theme, $path) function set_theme($root, $theme, $path, $load_css=true)
{ {
$this->set_template_dir($root.'/'.$theme.'/'.$path); $this->set_template_dir($root.'/'.$theme.'/'.$path);
@ -110,10 +110,17 @@ class Template {
if (isset($themeconf['parent']) and $themeconf['parent'] != $theme) if (isset($themeconf['parent']) and $themeconf['parent'] != $theme)
{ {
$this->set_theme($root, $themeconf['parent'], $path); if (!isset($themeconf['load_parent_css']))
{
$themeconf['load_parent_css'] = true;
}
$this->set_theme($root, $themeconf['parent'], $path, $themeconf['load_parent_css']);
} }
$tpl_var = array('id' => $theme); $tpl_var = array(
'id' => $theme,
'load_css' => $load_css,
);
if (!empty($themeconf['local_head']) ) if (!empty($themeconf['local_head']) )
{ {
$tpl_var['local_head'] = realpath($root.'/'.$theme.'/'.$themeconf['local_head'] ); $tpl_var['local_head'] = realpath($root.'/'.$theme.'/'.$themeconf['local_head'] );

View file

@ -31,7 +31,9 @@
{if isset($U_UP) }<link rel="up" title="{'Thumbnails'|@translate}" href="{$U_UP}" >{/if} {if isset($U_UP) }<link rel="up" title="{'Thumbnails'|@translate}" href="{$U_UP}" >{/if}
{foreach from=$themes item=theme} {foreach from=$themes item=theme}
{if $theme.load_css}
<link rel="stylesheet" type="text/css" href="{$ROOT_URL}themes/{$theme.id}/theme.css"> <link rel="stylesheet" type="text/css" href="{$ROOT_URL}themes/{$theme.id}/theme.css">
{/if}
{if isset($theme.local_head)}{include file=$theme.local_head}{/if} {if isset($theme.local_head)}{include file=$theme.local_head}{/if}
{/foreach} {/foreach}
{* the next css is used to fix khtml (Konqueror/Safari) issue the "text/nonsense" prevents gecko based browsers to load it *} {* the next css is used to fix khtml (Konqueror/Safari) issue the "text/nonsense" prevents gecko based browsers to load it *}