From 76181e5a495a21a2bfae205fcfa89062f0cc9eeb Mon Sep 17 00:00:00 2001 From: patdenice Date: Sat, 6 Dec 2008 02:31:02 +0000 Subject: merge -c2923 from trunk to branch 2.0. - Add a "Bound Template" column for template extensions. git-svn-id: http://piwigo.org/svn/branches/2.0@2924 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/extend_for_templates.php | 27 +++++++++++++++++++-------- admin/template/goto/default-layout.css | 2 +- admin/template/goto/extend_for_templates.tpl | 4 ++++ include/template.class.php | 3 +++ language/de_DE/admin.lang.php | 1 + language/de_DE/help/extend_for_templates.html | 6 ++++-- language/en_UK/admin.lang.php | 1 + language/en_UK/help/extend_for_templates.html | 6 ++++-- language/es_ES/admin.lang.php | 1 + language/es_ES/help/extend_for_templates.html | 3 +++ language/fr_FR/admin.lang.php | 1 + language/fr_FR/help/extend_for_templates.html | 2 ++ language/it_IT/admin.lang.php | 1 + language/it_IT/help/extend_for_templates.html | 3 +++ language/nl_NL/admin.lang.php | 1 + language/nl_NL/help/extend_for_templates.html | 6 ++++-- 16 files changed, 53 insertions(+), 15 deletions(-) diff --git a/admin/extend_for_templates.php b/admin/extend_for_templates.php index 30b21f277..01a24b478 100644 --- a/admin/extend_for_templates.php +++ b/admin/extend_for_templates.php @@ -102,7 +102,13 @@ $eligible_templates = array( 'slideshow.tpl' => 'slideshow', 'tags.tpl' => 'tags', 'upload.tpl' => 'upload',); - $flip_templates = array_flip($eligible_templates); + +$flip_templates = array_flip($eligible_templates); + +$available_templates = array_merge( + array('N/A' => '----------'), + get_dirs(PHPWG_ROOT_PATH.'template')); + // +-----------------------------------------------------------------------+ // | selected templates | // +-----------------------------------------------------------------------+ @@ -118,9 +124,11 @@ if (isset($_POST['submit']) and !is_adviser()) $handle = $eligible_templates[$original]; $url_keyword = $_POST['url'][$i]; if ($url_keyword == '----------') $url_keyword = 'N/A'; + $bound_tpl = $_POST['bound'][$i]; + if ($bound_tpl == '----------') $bound_tpl = 'N/A'; if ($handle != 'N/A') { - $replacements[$newtpl] = array($handle, $url_keyword); + $replacements[$newtpl] = array($handle, $url_keyword, $bound_tpl); } $i++; } @@ -150,7 +158,7 @@ foreach ($tpl_extension as $file => $conditions) } foreach ($new_extensions as $file) { - $tpl_extension[$file] = array('N/A', 'N/A'); + $tpl_extension[$file] = array('N/A', 'N/A', 'N/A'); } $template->set_filenames(array('extend_for_templates' @@ -167,14 +175,17 @@ foreach ($tpl_extension as $file => $conditions) { $handle = $conditions[0]; $url_keyword = $conditions[1]; + $bound_tpl = $conditions[2]; { $template->append('extents', array( - 'replacer' => $file, - 'url_parameter' => $relevant_parameters, - 'original_tpl' => array_keys($eligible_templates), - 'selected_tpl' => $flip_templates[$handle], - 'selected_url' => $url_keyword,) + 'replacer' => $file, + 'url_parameter' => $relevant_parameters, + 'original_tpl' => array_keys($eligible_templates), + 'bound_tpl' => $available_templates, + 'selected_tpl' => $flip_templates[$handle], + 'selected_url' => $url_keyword, + 'selected_bound' => $bound_tpl,) ); } } diff --git a/admin/template/goto/default-layout.css b/admin/template/goto/default-layout.css index fc5cb3c2a..05ca38cf1 100644 --- a/admin/template/goto/default-layout.css +++ b/admin/template/goto/default-layout.css @@ -7,7 +7,7 @@ TABLE.table2 { padding: 0; } -TABLE.table2 TD { +TABLE.table2 TD, TABLE.table2 TH { padding: 0 5px; } diff --git a/admin/template/goto/extend_for_templates.tpl b/admin/template/goto/extend_for_templates.tpl index 2e9c4766b..dae6903a5 100644 --- a/admin/template/goto/extend_for_templates.tpl +++ b/admin/template/goto/extend_for_templates.tpl @@ -9,6 +9,7 @@ {'Replacers'|@translate} {'Original templates'|@translate} {'Optional URL keyword'|@translate} + {'Bound template'|@translate} {foreach from=$extents item=tpl name=extent_loop} @@ -22,6 +23,9 @@ {html_options name=url[] output=$tpl.url_parameter values=$tpl.url_parameter selected=$tpl.selected_url} + + {html_options name=bound[] output=$tpl.bound_tpl values=$tpl.bound_tpl selected=$tpl.selected_bound} + {/foreach} diff --git a/include/template.class.php b/include/template.class.php index e641d3cb8..86d5a1062 100644 --- a/include/template.class.php +++ b/include/template.class.php @@ -186,11 +186,13 @@ class Template { { $handle = $value[0]; $param = $value[1]; + $tpl = $value[2]; } elseif (is_string($value)) { $handle = $value; $param = 'N/A'; + $tpl = 'N/A'; } else { @@ -198,6 +200,7 @@ class Template { } if ((stripos(implode('/',array_flip($_GET)), $param) > 0 or $param == 'N/A') + and (preg_match('/'.preg_quote($tpl,'/').'$/', $this->get_template_dir()) or $tpl == 'N/A') and (!isset($this->extents[$handle]) or $overwrite) and file_exists($dir . $filename)) { diff --git a/language/de_DE/admin.lang.php b/language/de_DE/admin.lang.php index 56cf48dc0..7a6a7849c 100644 --- a/language/de_DE/admin.lang.php +++ b/language/de_DE/admin.lang.php @@ -644,4 +644,5 @@ $lang['Note: Only deletes photos added with pLoader'] = 'Bitte beachten: Nur üb $lang['Delete selected photos'] = 'Fotos löschen'; $lang['%d photo was deleted'] = '%d Foto wurde gelöscht'; $lang['%d photos were deleted'] = '%d Fotos wurden gelöscht'; +/* TODO */ $lang['Bound template'] = 'Bound template'; ?> diff --git a/language/de_DE/help/extend_for_templates.html b/language/de_DE/help/extend_for_templates.html index f0cb68bdb..c75842a0e 100644 --- a/language/de_DE/help/extend_for_templates.html +++ b/language/de_DE/help/extend_for_templates.html @@ -64,8 +64,10 @@ class="Dateiname">template-extension/my-extension/video.tpl.

werden jeweils nur auf Seiten mit diesem Keyword. Zum Beispiel: index.php? / most_visited

-

Advanced-User nutzen werden Dauerlinks als optional URL - Keyword.

+

Advanced-User nutzen werden Dauerlinks als optional URL Keyword.

+ + +

If you select a Bound template then replacements will be operate only on this template.

Wie kann ich deaktivieren meine "replacers"?