aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2008-09-09 09:53:31 +0000
committerrvelices <rv-github@modusoptimus.com>2008-09-09 09:53:31 +0000
commit9aec2fb5e728a37026adc0d5246e1cfe7d226cb9 (patch)
tree61cd3a69456a91747317de8db797db56e01157f7
parent26474d349f6f03b3f74beb91ef680f0c634e05d5 (diff)
- fix typing error in index.tpl
- added template smarty function known_script (e.g.{known_script id="x" src"y.js"}) - useful to avoid double inclusion of a script such as prototype,jquery,... when a template and plugin need it independently (see the use in admin.tpl for example) - removed unused themeconf.template_dir git-svn-id: http://piwigo.org/svn/trunk@2513 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--admin/template/yoga/admin.tpl14
-rw-r--r--admin/template/yoga/header.tpl3
-rw-r--r--admin/template/yoga/theme/admin/themeconf.inc.php18
-rw-r--r--include/template.class.php32
-rw-r--r--picture.php9
-rw-r--r--template/yoga/index.tpl2
-rw-r--r--template/yoga/theme/Sylvia/themeconf.inc.php3
-rw-r--r--template/yoga/theme/clear/themeconf.inc.php3
-rw-r--r--template/yoga/theme/dark/themeconf.inc.php3
-rw-r--r--template/yoga/theme/p0w0/themeconf.inc.php3
-rw-r--r--template/yoga/theme/wipi/themeconf.inc.php3
11 files changed, 56 insertions, 37 deletions
diff --git a/admin/template/yoga/admin.tpl b/admin/template/yoga/admin.tpl
index e1d30f36e..7aae91c39 100644
--- a/admin/template/yoga/admin.tpl
+++ b/admin/template/yoga/admin.tpl
@@ -1,4 +1,18 @@
{* $Id$ *}
+{known_script id="jquery" src=$ROOT_URL|@cat:"template-common/lib/jquery.packed.js"}
+{known_script id="jquery.ui" src=$ROOT_URL|@cat:"template-common/lib/ui/ui.core.packed.js" }
+{known_script id="jquery.ui.accordion" src=$ROOT_URL|@cat:"template-common/lib/ui/ui.accordion.packed.js" }
+
+<script type="text/javascript">
+jQuery().ready(function(){ldelim}
+ jQuery('#menubar').accordion({ldelim}
+ header: "dt.rdion",
+ event: "click",
+ active: {$themeconf.selected_admin_menu}
+ });
+});
+</script>
+
<div id="menubar">
<dl class="first">
<dt class="rdion"><span>{'Links'|@translate}&nbsp;</span></dt>
diff --git a/admin/template/yoga/header.tpl b/admin/template/yoga/header.tpl
index b6169df99..607f31529 100644
--- a/admin/template/yoga/header.tpl
+++ b/admin/template/yoga/header.tpl
@@ -3,7 +3,7 @@
Warning : This is the admin pages header only
- don't be confusing with the public page header
+ don't confuse with the public page header
*}
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
@@ -22,6 +22,7 @@
<link rel="stylesheet" type="text/css" media="print" href="{$ROOT_URL}template/{$themeconf.template}/print.css">
<link rel="stylesheet" type="text/css" href="{$ROOT_URL}admin/template/{$themeconf.template}/default-colors.css">
<link rel="stylesheet" type="text/css" href="{$ROOT_URL}admin/template/{$themeconf.template}/theme/{$themeconf.theme}/theme.css">
+{known_script id="jquery" src=$ROOT_URL|@cat:"template-common/lib/jquery.packed.js" now=1} {*jQuery is always available by default*}
{$themeconf.local_head}
<script type="text/javascript" src="{$ROOT_URL}template-common/scripts.js"></script>
<!--[if lt IE 7]>
diff --git a/admin/template/yoga/theme/admin/themeconf.inc.php b/admin/template/yoga/theme/admin/themeconf.inc.php
index 8ba054ec9..61c090ebf 100644
--- a/admin/template/yoga/theme/admin/themeconf.inc.php
+++ b/admin/template/yoga/theme/admin/themeconf.inc.php
@@ -51,24 +51,10 @@ function selected_admin_menu()
$themeconf = array(
'template' => 'yoga',
'theme' => 'admin',
- 'template_dir' => 'admin/template/yoga',
'icon_dir' => 'template/yoga/icon',
'admin_icon_dir' => 'template/yoga/icon/admin',
'mime_icon_dir' => 'template/yoga/icon/mimetypes/',
- 'local_head' => '
-<!-- New template location for admin -->
-<!-- Admin Accordion Menus -->
- <script type="text/javascript" src="template-common/lib/jquery.packed.js"></script>
- <script type="text/javascript" src="template-common/lib/ui/ui.core.packed.js"></script>
- <script type="text/javascript" src="template-common/lib/ui/ui.accordion.packed.js"></script>
- <script type="text/javascript">
- jQuery().ready(function(){
- jQuery(\'#menubar\').accordion({
- header: "dt.rdion",
- event: "click",
- active: '. selected_admin_menu() . '
- });
- });
- </script>'
+ 'selected_admin_menu' => selected_admin_menu(),
+ 'local_head' => '',
);
?>
diff --git a/include/template.class.php b/include/template.class.php
index 7b4e4caf1..25389b8fa 100644
--- a/include/template.class.php
+++ b/include/template.class.php
@@ -62,6 +62,7 @@ class Template {
$this->smarty->register_modifier( 'translate', array('Template', 'mod_translate') );
$this->smarty->register_modifier( 'explode', array('Template', 'mod_explode') );
$this->smarty->register_block('html_head', array(&$this, 'block_html_head') );
+ $this->smarty->register_function('known_script', array(&$this, 'func_known_script'), false );
$this->smarty->register_prefilter( array('Template', 'prefilter_white_space') );
if ( $conf['compiled_template_cache_language'] )
{
@@ -339,6 +340,37 @@ class Template {
}
}
+ /**
+ * This smarty "known_script" functions allows to insert well known java scripts
+ * such as prototype, jquery, etc... only once. Examples:
+ * {known_script id="jquery" src="{$ROOT_URL}template-common/lib/jquery.packed.js"}
+ */
+ function func_known_script($params, &$smarty )
+ {
+ if (!isset($params['id']))
+ {
+ $smarty->trigger_error("known_script: missing 'id' parameter");
+ return;
+ }
+ $id = $params['id'];
+ if (! isset( $this->known_scripts[$id] ) )
+ {
+ if (!isset($params['src']))
+ {
+ $smarty->trigger_error("known_script: missing 'src' parameter");
+ return;
+ }
+ $this->known_scripts[$id] = $params['src'];
+ $content = '<script type="text/javascript" src="'.$params['src'].'"></script>';
+ if (isset($params['now']) and $params['now'] and empty($this->output) )
+ {
+ return $content;
+ }
+ $repeat = false;
+ $this->block_html_head(null, $content, $smarty, $repeat);
+ }
+ }
+
/*static */ function prefilter_white_space($source, &$smarty)
{
$ld = $smarty->left_delimiter;
diff --git a/picture.php b/picture.php
index 31a53cbde..6f0af4d6c 100644
--- a/picture.php
+++ b/picture.php
@@ -622,15 +622,6 @@ foreach (array('first','previous','next','last', 'current') as $which_image)
if ($page['slideshow'])
{
- // Add local-slideshow.css file if exists
- // Not only for ligth
- $css = PHPWG_ROOT_PATH . get_themeconf('template_dir') . '/theme/'
- . get_themeconf('theme') . '/local-slideshow.css';
- if (file_exists($css))
- {
- //TODO CORRECT THIS $template->assign_block_vars('slideshow', array());
- }
-
$tpl_slideshow = array();
//slideshow end
diff --git a/template/yoga/index.tpl b/template/yoga/index.tpl
index 814cce81f..b6ddd131b 100644
--- a/template/yoga/index.tpl
+++ b/template/yoga/index.tpl
@@ -10,7 +10,7 @@
{'Sort order'|@translate}:
<select onchange="document.location = this.options[this.selectedIndex].value;">
{foreach from=$image_orders item=image_order }
- <option value="{$image_order.URL}"{if $image_order.SELECTED} selected="selected"{/if}}>{$image_order.DISPLAY}</option>
+ <option value="{$image_order.URL}"{if $image_order.SELECTED} selected="selected"{/if}>{$image_order.DISPLAY}</option>
{/foreach}
</select>
</li>
diff --git a/template/yoga/theme/Sylvia/themeconf.inc.php b/template/yoga/theme/Sylvia/themeconf.inc.php
index 90e3c4e90..f165bef36 100644
--- a/template/yoga/theme/Sylvia/themeconf.inc.php
+++ b/template/yoga/theme/Sylvia/themeconf.inc.php
@@ -2,10 +2,9 @@
$themeconf = array(
'template' => 'yoga',
'theme' => 'Sylvia',
- 'template_dir' => 'template/yoga',
'icon_dir' => 'template/yoga/icon',
'admin_icon_dir' => 'template/yoga/icon/admin',
'mime_icon_dir' => 'template/yoga/icon/mimetypes/',
- 'local_head' => '<!-- no theme specific head content -->',
+ 'local_head' => '',
);
?>
diff --git a/template/yoga/theme/clear/themeconf.inc.php b/template/yoga/theme/clear/themeconf.inc.php
index 5e3aef9a0..4858b7b50 100644
--- a/template/yoga/theme/clear/themeconf.inc.php
+++ b/template/yoga/theme/clear/themeconf.inc.php
@@ -2,10 +2,9 @@
$themeconf = array(
'template' => 'yoga',
'theme' => 'clear',
- 'template_dir' => 'template/yoga',
'icon_dir' => 'template/yoga/icon',
'admin_icon_dir' => 'template/yoga/icon/admin',
'mime_icon_dir' => 'template/yoga/icon/mimetypes/',
- 'local_head' => '<!-- no theme specific head content -->',
+ 'local_head' => '',
);
?>
diff --git a/template/yoga/theme/dark/themeconf.inc.php b/template/yoga/theme/dark/themeconf.inc.php
index bdee2e443..d59843ba8 100644
--- a/template/yoga/theme/dark/themeconf.inc.php
+++ b/template/yoga/theme/dark/themeconf.inc.php
@@ -2,10 +2,9 @@
$themeconf = array(
'template' => 'yoga',
'theme' => 'dark',
- 'template_dir' => 'template/yoga',
'icon_dir' => 'template/yoga/icon',
'admin_icon_dir' => 'template/yoga/icon/admin',
'mime_icon_dir' => 'template/yoga/icon/mimetypes/',
- 'local_head' => '<!-- no theme specific head content -->',
+ 'local_head' => '',
);
?>
diff --git a/template/yoga/theme/p0w0/themeconf.inc.php b/template/yoga/theme/p0w0/themeconf.inc.php
index d24b701ca..063a60bc8 100644
--- a/template/yoga/theme/p0w0/themeconf.inc.php
+++ b/template/yoga/theme/p0w0/themeconf.inc.php
@@ -2,10 +2,9 @@
$themeconf = array(
'template' => 'yoga',
'theme' => 'p0w0',
- 'template_dir' => 'template/yoga',
'icon_dir' => 'template/yoga/icon',
'admin_icon_dir' => 'template/yoga/icon/admin',
'mime_icon_dir' => 'template/yoga/icon/mimetypes/',
- 'local_head' => '<!-- no theme specific head content -->',
+ 'local_head' => '',
);
?>
diff --git a/template/yoga/theme/wipi/themeconf.inc.php b/template/yoga/theme/wipi/themeconf.inc.php
index 4ac750e46..6644a7590 100644
--- a/template/yoga/theme/wipi/themeconf.inc.php
+++ b/template/yoga/theme/wipi/themeconf.inc.php
@@ -2,11 +2,10 @@
$themeconf = array(
'template' => 'yoga',
'theme' => 'wipi',
- 'template_dir' => 'template/yoga',
'icon_dir' => 'template/yoga/icon',
'admin_icon_dir' => 'template/yoga/icon/admin',
'mime_icon_dir' => 'template/yoga/icon/mimetypes/',
- 'local_head' => '<!-- no theme specific head content -->',
+ 'local_head' => '',
);
if ( !isset($lang['Theme: wipi']) )
{