- Add a "Bound Template" column for template extensions.

git-svn-id: http://piwigo.org/svn/trunk@2923 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
patdenice 2008-12-06 02:28:54 +00:00
parent 0479bcde10
commit 6873537fe6
16 changed files with 53 additions and 15 deletions

View file

@ -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,)
);
}
}

View file

@ -7,7 +7,7 @@ TABLE.table2 {
padding: 0;
}
TABLE.table2 TD {
TABLE.table2 TD, TABLE.table2 TH {
padding: 0 5px;
}

View file

@ -9,6 +9,7 @@
<th>{'Replacers'|@translate}</th>
<th>{'Original templates'|@translate}</th>
<th>{'Optional URL keyword'|@translate}</th>
<th>{'Bound template'|@translate}</th>
</tr>
{foreach from=$extents item=tpl name=extent_loop}
<tr class="{if $smarty.foreach.extent_loop.index is odd}row1{else}row2{/if}">
@ -22,6 +23,9 @@
<td>
{html_options name=url[] output=$tpl.url_parameter values=$tpl.url_parameter selected=$tpl.selected_url}
</td>
<td>
{html_options name=bound[] output=$tpl.bound_tpl values=$tpl.bound_tpl selected=$tpl.selected_bound}
</td>
</tr>
{/foreach}
</table>

View file

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

View file

@ -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';
?>

View file

@ -64,8 +64,10 @@ class="Dateiname">template-extension/my-extension/video.tpl</span>.</p>
werden jeweils nur auf Seiten mit diesem Keyword. Zum Beispiel: <span
class="pwgScreen">index.php? /<strong> most_visited</strong></span></p>
<p>Advanced-User nutzen werden Dauerlinks als <strong>optional URL
Keyword</strong>.</p>
<p>Advanced-User nutzen werden Dauerlinks als <strong>optional URL Keyword</strong>.</p>
<!-- TODO -->
<p>If you select a <strong>Bound template</strong> then replacements will be operate only on this template.</p>
<h3>Wie kann ich deaktivieren meine "replacers"?</h3>
<ul>

View file

@ -644,4 +644,5 @@ $lang['Note: Only deletes photos added with pLoader'] = 'Note: Only deletes phot
$lang['Delete selected photos'] = 'Delete selected photos';
$lang['%d photo was deleted'] = '%d photo was deleted';
$lang['%d photos were deleted'] = '%d photos were deleted';
$lang['Bound template'] = 'Bound template';
?>

View file

@ -64,8 +64,10 @@ class="filename">template-extension/my-extension/video.tpl</span>.</p>
will be operate only on pages with this keyword. For example: <span
class="pwgScreen">index.php?/<strong>most_visited</strong></span></p>
<p>Advanced users will use permalinks as <strong>optional URL
keyword</strong>. </p>
<p>Advanced users will use permalinks as <strong>optional URL keyword</strong>. </p>
<p>If you select a <strong>Bound template</strong> then replacements will be operate only on this template.</p>
<h3>How can I deactivate my "replacers"?</h3>
<ul>
<li>Unselect related "Original templates".</li>

View file

@ -641,4 +641,5 @@ $lang['Note: Only deletes photos added with pLoader'] = 'Nota: las únicas las f
$lang['Delete selected photos'] = 'Suprimir las fotos';
$lang['%d photo was deleted'] = '%d foto ha sido suprimida';
$lang['%d photos were deleted'] = '%d fotos han sido suprimidas';
/* TODO */ $lang['Bound template'] = 'Bound template';
?>

View file

@ -70,6 +70,9 @@ class="filename">template-extension/my-extension/video.tpl</span>.</p>
<p>Los usuarios avanzados utilizarán el permalinks (permaliens, lazos permanentes) como strong> parámetro facultativo del URL </strong>. </p>
<!-- TODO -->
<p>If you select a <strong>Bound template</strong> then replacements will be operate only on this template.</p>
<h3>¿ Cómo puedo desactivar mi "sustitutos"?</h3>
<ul>
<li>Deselectionner " template de origen ".</li>

View file

@ -643,4 +643,5 @@ $lang['Note: Only deletes photos added with pLoader'] = 'Note: seules les photos
$lang['Delete selected photos'] = 'Supprimer les photos';
$lang['%d photo was deleted'] = '%d photo a été supprimée';
$lang['%d photos were deleted'] = '%d photos ont été supprimées';
$lang['Bound template'] = 'Template rattaché';
?>

View file

@ -67,6 +67,8 @@ ne seront réalisés que sur les pages utilisant ce mot clé. Par exemple: <span
<p>Les utilisateurs avancés utiliseront les permalinks (permaliens, liens permanents) en tant que
<strong>paramètre facultatif de l'URL</strong>. </p>
<p>Si vous sélectionnez un <strong>Template rattaché</strong> alors les remplacements ne seront réalisés que sur ce template.</p>
<h3>Comment puis-je désactiver mes "replacers"?</h3>
<ul>
<li>Déselectionner le "template d'origine".</li>

View file

@ -643,4 +643,5 @@ $lang['Note: Only deletes photos added with pLoader'] = 'Nota: solo le foto agiu
$lang['Delete selected photos'] = 'Cancellare le foto';
$lang['%d photo was deleted'] = '%d foto cancellata';
$lang['%d photos were deleted'] = '%d foto cancellate';
/* TODO */ $lang['Bound template'] = 'Bound template';
?>

View file

@ -65,6 +65,9 @@ unicamente sulle pagine con questa parola chiave. Per esempio: <span
<p>Gli utenti esperti useranno i permalinks come <strong>parametro facoltativo del URL</strong>. </p>
<!-- TODO -->
<p>If you select a <strong>Bound template</strong> then replacements will be operate only on this template.</p>
<h3>Come posso disattivare mio "rimpiazzante"?</h3>
<ul>
<li>Deselezzionare il "templete originale".</li>

View file

@ -639,4 +639,5 @@ $lang['edit category informations'] = 'bewerk categorie informatie';
/* TODO */ $lang['Delete selected photos'] = 'Delete selected photos';
/* TODO */ $lang['%d photo was deleted'] = '%d photo was deleted';
/* TODO */ $lang['%d photos were deleted'] = '%d photos were deleted';
/* TODO */ $lang['Bound template'] = 'Bound template';
?>

View file

@ -64,8 +64,10 @@ class="filename">template-extension/my-extension/video.tpl</span>.</p>
will be operate only on pages with this keyword. For example: <span
class="pwgScreen">index.php?/<strong>most_visited</strong></span></p>
<p>Advanced users will use permalinks as <strong>optional URL
keyword</strong>. </p>
<p>Advanced users will use permalinks as <strong>optional URL keyword</strong>. </p>
<p>If you select a <strong>Bound template</strong> then replacements will be operate only on this template.</p>
<h3>How can I deactivate my "replacers"?</h3>
<ul>
<li>Unselect related "Original templates".</li>