feature:2317 move order config to Admin->Config->Options
first try, may has issues with very specials params git-svn-id: http://piwigo.org/svn/trunk@11279 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
parent
193d1e4727
commit
f56fc4f36d
8 changed files with 230 additions and 11 deletions
|
|
@ -101,6 +101,12 @@ $display_info_checkboxes = array(
|
||||||
'privacy_level',
|
'privacy_level',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$order_options = array(
|
||||||
|
' ORDER BY date_available DESC, file ASC, id ASC' => 'date_available DESC, file ASC, id ASC',
|
||||||
|
' ORDER BY file DESC, date_available DESC' => 'file DESC, date_available DESC',
|
||||||
|
'custom' => l10n('Custom'),
|
||||||
|
);
|
||||||
|
|
||||||
//------------------------------ verification and registration of modifications
|
//------------------------------ verification and registration of modifications
|
||||||
if (isset($_POST['submit']))
|
if (isset($_POST['submit']))
|
||||||
{
|
{
|
||||||
|
|
@ -110,6 +116,56 @@ if (isset($_POST['submit']))
|
||||||
{
|
{
|
||||||
case 'main' :
|
case 'main' :
|
||||||
{
|
{
|
||||||
|
$order_regex = '#^(( *)(id|file|name|date_available|date_creation|hit|average_rate|comment|author|filesize|width|height|high_filesize|high_width|high_height) (ASC|DESC),{1}){1,}$#';
|
||||||
|
// process 'order_by_perso' string
|
||||||
|
if ($_POST['order_by'] == 'custom' AND !empty($_POST['order_by_perso']))
|
||||||
|
{
|
||||||
|
$_POST['order_by'] = str_ireplace(
|
||||||
|
array('order by ', 'asc', 'desc'),
|
||||||
|
array(null, 'ASC', 'DESC'),
|
||||||
|
trim($_POST['order_by_perso'])
|
||||||
|
);
|
||||||
|
|
||||||
|
if (preg_match($order_regex, $_POST['order_by'].','))
|
||||||
|
{
|
||||||
|
$_POST['order_by'] = ' ORDER BY '.$_POST['order_by'];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
array_push($page['errors'], l10n('Invalid order string').' « '.$_POST['order_by'].' »');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ($_POST['order_by'] == 'custom')
|
||||||
|
{
|
||||||
|
array_push($page['errors'], l10n('Invalid order string'));
|
||||||
|
}
|
||||||
|
// process 'order_by_inside_category_perso' string
|
||||||
|
if ($_POST['order_by_inside_category'] == 'as_order_by')
|
||||||
|
{
|
||||||
|
$_POST['order_by_inside_category'] = $_POST['order_by'];
|
||||||
|
}
|
||||||
|
else if ($_POST['order_by_inside_category'] == 'custom' AND !empty($_POST['order_by_inside_category_perso']))
|
||||||
|
{
|
||||||
|
$_POST['order_by_inside_category'] = str_ireplace(
|
||||||
|
array('order by ', 'asc', 'desc'),
|
||||||
|
array(null, 'ASC', 'DESC'),
|
||||||
|
trim($_POST['order_by_inside_category_perso'])
|
||||||
|
);
|
||||||
|
|
||||||
|
if (preg_match($order_regex, $_POST['order_by_inside_category'].','))
|
||||||
|
{
|
||||||
|
$_POST['order_by_inside_category'] = ' ORDER BY '.$_POST['order_by_inside_category'];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
array_push($page['errors'], l10n('Invalid order string').' « '.$_POST['order_by_inside_category'].' »');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ($_POST['order_by_inside_category'] == 'custom')
|
||||||
|
{
|
||||||
|
array_push($page['errors'], l10n('Invalid order string'));
|
||||||
|
}
|
||||||
|
|
||||||
if (empty($_POST['gallery_locked']) and $conf['gallery_locked'])
|
if (empty($_POST['gallery_locked']) and $conf['gallery_locked'])
|
||||||
{
|
{
|
||||||
$tpl_var = & $template->get_template_vars('header_msgs');
|
$tpl_var = & $template->get_template_vars('header_msgs');
|
||||||
|
|
@ -234,6 +290,34 @@ switch ($page['section'])
|
||||||
{
|
{
|
||||||
case 'main' :
|
case 'main' :
|
||||||
{
|
{
|
||||||
|
// process 'order_by' string
|
||||||
|
if (array_key_exists($conf['order_by'], $order_options))
|
||||||
|
{
|
||||||
|
$order_by_selected = $conf['order_by'];
|
||||||
|
$order_by_perso = null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$order_by_selected = 'custom';
|
||||||
|
$order_by_perso = str_replace(' ORDER BY ', null, $conf['order_by']);
|
||||||
|
}
|
||||||
|
// process 'order_by_inside_category' string
|
||||||
|
if ($conf['order_by_inside_category'] == $conf['order_by'])
|
||||||
|
{
|
||||||
|
$order_by_inside_category_selected = 'as_order_by';
|
||||||
|
$order_by_inside_category_perso = null;
|
||||||
|
}
|
||||||
|
else if (array_key_exists($conf['order_by_inside_category'], $order_options))
|
||||||
|
{
|
||||||
|
$order_by_inside_category_selected = $conf['order_by_inside_category'];
|
||||||
|
$order_by_inside_category_perso = null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$order_by_inside_category_selected = 'custom';
|
||||||
|
$order_by_inside_category_perso = str_replace(' ORDER BY ', null, $conf['order_by_inside_category']);
|
||||||
|
}
|
||||||
|
|
||||||
$template->assign(
|
$template->assign(
|
||||||
'main',
|
'main',
|
||||||
array(
|
array(
|
||||||
|
|
@ -245,6 +329,16 @@ switch ($page['section'])
|
||||||
'monday' => $lang['day'][1],
|
'monday' => $lang['day'][1],
|
||||||
),
|
),
|
||||||
'week_starts_on_options_selected' => $conf['week_starts_on'],
|
'week_starts_on_options_selected' => $conf['week_starts_on'],
|
||||||
|
'order_by_options' => $order_options,
|
||||||
|
'order_by_selected' => $order_by_selected,
|
||||||
|
'order_by_perso' => $order_by_perso,
|
||||||
|
'order_by_inside_category_options' =>
|
||||||
|
array_merge(
|
||||||
|
array('as_order_by'=>l10n('As default order')),
|
||||||
|
$order_options
|
||||||
|
),
|
||||||
|
'order_by_inside_category_selected' => $order_by_inside_category_selected,
|
||||||
|
'order_by_inside_category_perso' => $order_by_inside_category_perso,
|
||||||
));
|
));
|
||||||
|
|
||||||
foreach ($main_checkboxes as $checkbox)
|
foreach ($main_checkboxes as $checkbox)
|
||||||
|
|
|
||||||
|
|
@ -89,13 +89,50 @@
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
<label>
|
|
||||||
<span class="property">
|
<span class="property">
|
||||||
{'Week starts on'|@translate}
|
{'Week starts on'|@translate}
|
||||||
{html_options name="week_starts_on" options=$main.week_starts_on_options selected=$main.week_starts_on_options_selected}
|
{html_options name="week_starts_on" options=$main.week_starts_on_options selected=$main.week_starts_on_options_selected}
|
||||||
</span>
|
</span>
|
||||||
</label>
|
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
|
||||||
|
<span class="property">
|
||||||
|
{'Default photos order'|@translate}
|
||||||
|
{html_options name="order_by" options=$main.order_by_options selected=$main.order_by_selected}
|
||||||
|
<input type="text" name="order_by_perso" size="40" value="{$main.order_by_perso}"
|
||||||
|
{if $main.order_by_selected != 'custom'}style="display:none;"{/if}/>
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
|
||||||
|
<span class="property">
|
||||||
|
{'Default photos order inside album'|@translate}
|
||||||
|
{html_options name="order_by_inside_category" options=$main.order_by_inside_category_options selected=$main.order_by_inside_category_selected}
|
||||||
|
<input type="text" name="order_by_inside_category_perso" size="40" value="{$main.order_by_inside_category_perso}"
|
||||||
|
{if $main.order_by_inside_category_selected != 'custom'}style="display:none;"{/if}>
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
{footer_script require='jquery'}{literal}
|
||||||
|
jQuery(document).ready(function () {
|
||||||
|
$('select[name="order_by"]').change(function () {
|
||||||
|
if ($(this).val() == 'custom') {
|
||||||
|
$('input[name="order_by_perso"]').show();
|
||||||
|
} else {
|
||||||
|
$('input[name="order_by_perso"]').hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$('select[name="order_by_inside_category"]').change(function () {
|
||||||
|
if ($(this).val() == 'custom') {
|
||||||
|
$('input[name="order_by_inside_category_perso"]').show();
|
||||||
|
} else {
|
||||||
|
$('input[name="order_by_inside_category_perso"]').hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
{/literal}{/footer_script}
|
||||||
</ul>
|
</ul>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,8 @@ INSERT INTO piwigo_config (param,value,comment)
|
||||||
);
|
);
|
||||||
INSERT INTO piwigo_config (param,value,comment) VALUES ('week_starts_on','monday','Monday may not be the first day of the week');
|
INSERT INTO piwigo_config (param,value,comment) VALUES ('week_starts_on','monday','Monday may not be the first day of the week');
|
||||||
INSERT INTO piwigo_config (param,value,comment) VALUES ('updates_ignored','a:3:{s:7:"plugins";a:0:{}s:6:"themes";a:0:{}s:9:"languages";a:0:{}}','Extensions ignored for update');
|
INSERT INTO piwigo_config (param,value,comment) VALUES ('updates_ignored','a:3:{s:7:"plugins";a:0:{}s:6:"themes";a:0:{}s:9:"languages";a:0:{}}','Extensions ignored for update');
|
||||||
|
INSERT INTO piwigo_config (param,value,comment) VALUES ('order_by',' ORDER BY date_available DESC, file ASC, id ASC','default photo order');
|
||||||
|
INSERT INTO piwigo_config (param,value,comment) VALUES ('order_by_inside_category',' ORDER BY date_available DESC, file ASC, id ASC','default photo order inside category');
|
||||||
INSERT INTO piwigo_config (param,value) VALUES ('upload_form_websize_resize','true');
|
INSERT INTO piwigo_config (param,value) VALUES ('upload_form_websize_resize','true');
|
||||||
INSERT INTO piwigo_config (param,value) VALUES ('upload_form_websize_maxwidth','800');
|
INSERT INTO piwigo_config (param,value) VALUES ('upload_form_websize_maxwidth','800');
|
||||||
INSERT INTO piwigo_config (param,value) VALUES ('upload_form_websize_maxheight','600');
|
INSERT INTO piwigo_config (param,value) VALUES ('upload_form_websize_maxheight','600');
|
||||||
|
|
|
||||||
48
install/db/106-database.php
Normal file
48
install/db/106-database.php
Normal file
|
|
@ -0,0 +1,48 @@
|
||||||
|
<?php
|
||||||
|
// +-----------------------------------------------------------------------+
|
||||||
|
// | Piwigo - a PHP based photo gallery |
|
||||||
|
// +-----------------------------------------------------------------------+
|
||||||
|
// | Copyright(C) 2008-2011 Piwigo Team http://piwigo.org |
|
||||||
|
// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
|
||||||
|
// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
|
||||||
|
// +-----------------------------------------------------------------------+
|
||||||
|
// | This program is free software; you can redistribute it and/or modify |
|
||||||
|
// | it under the terms of the GNU General Public License as published by |
|
||||||
|
// | the Free Software Foundation |
|
||||||
|
// | |
|
||||||
|
// | This program is distributed in the hope that it will be useful, but |
|
||||||
|
// | WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
|
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
|
// | General Public License for more details. |
|
||||||
|
// | |
|
||||||
|
// | You should have received a copy of the GNU General Public License |
|
||||||
|
// | along with this program; if not, write to the Free Software |
|
||||||
|
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
|
||||||
|
// | USA. |
|
||||||
|
// +-----------------------------------------------------------------------+
|
||||||
|
|
||||||
|
if (!defined('PHPWG_ROOT_PATH'))
|
||||||
|
{
|
||||||
|
die('Hacking attempt!');
|
||||||
|
}
|
||||||
|
|
||||||
|
$upgrade_description = 'add order parameters to bdd';
|
||||||
|
|
||||||
|
$query = '
|
||||||
|
INSERT INTO '.PREFIX_TABLE.'config(param,value,comment)
|
||||||
|
VALUES (\'order_by\', \''.$conf['order_by'].'\', \'default photos order\')
|
||||||
|
;';
|
||||||
|
pwg_query($query);
|
||||||
|
|
||||||
|
$query = '
|
||||||
|
INSERT INTO '.PREFIX_TABLE.'config(param,value,comment)
|
||||||
|
VALUES (\'order_by_inside_category\', \''.$conf['order_by_inside_category'].'\', \'default photos order inside category\')
|
||||||
|
;';
|
||||||
|
pwg_query($query);
|
||||||
|
|
||||||
|
echo
|
||||||
|
"\n"
|
||||||
|
. $upgrade_description
|
||||||
|
."\n"
|
||||||
|
;
|
||||||
|
?>
|
||||||
|
|
@ -150,6 +150,7 @@ $lang['Apply to sub-albums'] = "Apply to sub-albums";
|
||||||
$lang['Are you sure to install this upgrade? You must verify if this version does not need uninstallation.'] = "Are you sure you want to install this upgrade? You must verify if this version does not need prior uninstallation.";
|
$lang['Are you sure to install this upgrade? You must verify if this version does not need uninstallation.'] = "Are you sure you want to install this upgrade? You must verify if this version does not need prior uninstallation.";
|
||||||
$lang['Are you sure you want to delete this plugin?'] = "Are you sure you want to delete this plugin?";
|
$lang['Are you sure you want to delete this plugin?'] = "Are you sure you want to delete this plugin?";
|
||||||
$lang['Are you sure you want to install this plugin?'] = "Are you sure you want to install this plugin?";
|
$lang['Are you sure you want to install this plugin?'] = "Are you sure you want to install this plugin?";
|
||||||
|
$lang['As default order'] = "As default order";
|
||||||
$lang['Associate to album'] = "Associate to album";
|
$lang['Associate to album'] = "Associate to album";
|
||||||
$lang['associate to group'] = "associate to group";
|
$lang['associate to group'] = "associate to group";
|
||||||
$lang['Associated'] = "Associated";
|
$lang['Associated'] = "Associated";
|
||||||
|
|
@ -202,6 +203,7 @@ $lang['Create the "%s" directory at the root of your Piwigo installation'] = 'Cr
|
||||||
$lang['Create this site'] = "Create this site";
|
$lang['Create this site'] = "Create this site";
|
||||||
$lang['created'] = "created";
|
$lang['created'] = "created";
|
||||||
$lang['Current name'] = "Current name";
|
$lang['Current name'] = "Current name";
|
||||||
|
$lang['Custom'] = "Custom";
|
||||||
$lang['Database synchronization with files'] = "Database synchronization with files";
|
$lang['Database synchronization with files'] = "Database synchronization with files";
|
||||||
$lang['Database'] = "Database";
|
$lang['Database'] = "Database";
|
||||||
$lang['Date'] = "Date";
|
$lang['Date'] = "Date";
|
||||||
|
|
@ -209,6 +211,8 @@ $lang['Day'] = "Day";
|
||||||
$lang['Deactivate'] = "Deactivate";
|
$lang['Deactivate'] = "Deactivate";
|
||||||
$lang['Deactivate all'] = "Deactivate all";
|
$lang['Deactivate all'] = "Deactivate all";
|
||||||
$lang['Default display'] = "Default display";
|
$lang['Default display'] = "Default display";
|
||||||
|
$lang['Default photos order'] = "Default photos order";
|
||||||
|
$lang['Default photos order inside album'] = "Default photos order inside album";
|
||||||
$lang['Default user cannot be deleted'] = "Default user cannot be deleted";
|
$lang['Default user cannot be deleted'] = "Default user cannot be deleted";
|
||||||
$lang['Default user does not exist'] = "The default user does not exist";
|
$lang['Default user does not exist'] = "The default user does not exist";
|
||||||
$lang['default values'] = "default values";
|
$lang['default values'] = "default values";
|
||||||
|
|
@ -358,6 +362,7 @@ $lang['Install'] = "Install";
|
||||||
$lang['Installed Languages'] = 'Installed Languages';
|
$lang['Installed Languages'] = 'Installed Languages';
|
||||||
$lang['Installed Themes'] = "Installed Themes";
|
$lang['Installed Themes'] = "Installed Themes";
|
||||||
$lang['Instructions to use Piwigo'] = "Instructions to use Piwigo";
|
$lang['Instructions to use Piwigo'] = "Instructions to use Piwigo";
|
||||||
|
$lang['Invalid order string'] = 'Invalid order string';
|
||||||
$lang['Invert'] = 'Invert';
|
$lang['Invert'] = 'Invert';
|
||||||
$lang['IP'] = "IP";
|
$lang['IP'] = "IP";
|
||||||
$lang['JPEG files or ZIP archives with JPEG files inside please.'] = 'JPEG files or ZIP archives with JPEG files inside please.';
|
$lang['JPEG files or ZIP archives with JPEG files inside please.'] = 'JPEG files or ZIP archives with JPEG files inside please.';
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,20 @@ page.</li>
|
||||||
|
|
||||||
<li><strong>Email admins when a new user registers</strong>: administrators will be notified by mail for each registration.</li>
|
<li><strong>Email admins when a new user registers</strong>: administrators will be notified by mail for each registration.</li>
|
||||||
|
|
||||||
|
<li><strong>Default photos order</strong>: You can define a personalized order by selecting «Personalized» in the drop-down menu. This field must respect the SQL syntax, example: <i>date_available DESC, file ASC, id ASC</i><br>
|
||||||
|
Available fields:
|
||||||
|
<ul style="font-size:0.85em;">
|
||||||
|
<li><b>date_available</b>: date of the adding to the gallery</li>
|
||||||
|
<li><b>file</b>: name of the file</li>
|
||||||
|
<li><b>id</b>: identifier</li>
|
||||||
|
<li><b>date_creation</b>: date of element creation</li>
|
||||||
|
<li><b>name</b>: name of the picture</li>
|
||||||
|
<li><b>hit</b>: number of visits</li>
|
||||||
|
<li><b>average_rate</b>: average rate on the picture</li>
|
||||||
|
</ul>
|
||||||
|
Don't forgot to specify the order for each field with these keywords : <i>ASC</i> and <i>DESC</i>
|
||||||
|
</li>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<h3>History</h3>
|
<h3>History</h3>
|
||||||
|
|
|
||||||
|
|
@ -842,9 +842,14 @@ $lang['Height'] = 'Hauteur';
|
||||||
$lang['Follow Orientation'] = "Respecter l'orientation";
|
$lang['Follow Orientation'] = "Respecter l'orientation";
|
||||||
$lang['If you want to regenerate thumbnails, please go to the <a href="%s">Batch Manager</a>.'] = 'Si vous voulez régénérer des miniatures, merci de vous rendre dans la <a href="%s">Gestion par lot</a>.';
|
$lang['If you want to regenerate thumbnails, please go to the <a href="%s">Batch Manager</a>.'] = 'Si vous voulez régénérer des miniatures, merci de vous rendre dans la <a href="%s">Gestion par lot</a>.';
|
||||||
$lang['Graphics Library'] = 'Bibliothèque graphique';
|
$lang['Graphics Library'] = 'Bibliothèque graphique';
|
||||||
$lang['Show menubar'] = "Afficher le menu";
|
$lang['Show menubar'] = 'Afficher le menu';
|
||||||
$lang['No results'] = "Pas de résultat";
|
$lang['No results'] = 'Pas de résultat';
|
||||||
$lang['Type in a search term'] = "Entrez un terme de recherche";
|
$lang['Type in a search term'] = 'Entrez un terme de recherche';
|
||||||
$lang['Searching...'] = "Recherche...";
|
$lang['Searching...'] = 'Recherche...';
|
||||||
$lang['new'] = "nouveau";
|
$lang['new'] = 'nouveau';
|
||||||
|
$lang['Default photos order'] = "Ordre par défaut des photos";
|
||||||
|
$lang['Default photos order inside album'] = "Ordre par défaut des photos dans un album";
|
||||||
|
$lang['Invalid order string'] = 'Chaîne SQL incorrecte';
|
||||||
|
$lang['As default order'] = "Comme l'ordre par défaut";
|
||||||
|
$lang['Custom'] = "Personnalisé";
|
||||||
?>
|
?>
|
||||||
|
|
@ -34,6 +34,20 @@ galerie.</li>
|
||||||
|
|
||||||
<li><strong>Notifier les administrateurs lors de l'inscription d'un utilisateur</strong>: Les administrateurs recevront un courriel à chaque inscription.</li>
|
<li><strong>Notifier les administrateurs lors de l'inscription d'un utilisateur</strong>: Les administrateurs recevront un courriel à chaque inscription.</li>
|
||||||
|
|
||||||
|
<li><strong>Ordre par défaut des photos</strong>: Vous pouvez définir un ordre personnalisé et selectionant «Personnalisé» dans la liste déroulante. Ce champ doit respecter la syntaxe SQL, exemple: <i>date_available DESC, file ASC, id ASC</i><br>
|
||||||
|
Liste des champs utilisables :
|
||||||
|
<ul style="font-size:0.85em;">
|
||||||
|
<li><b>date_available</b>: date d'ajout à la galerie</li>
|
||||||
|
<li><b>file</b>: nom du fichier</li>
|
||||||
|
<li><b>id</b>: identifiant</li>
|
||||||
|
<li><b>date_creation</b>: date de création</li>
|
||||||
|
<li><b>name</b>: nom de l'image</li>
|
||||||
|
<li><b>hit</b>: nombre de visites</li>
|
||||||
|
<li><b>average_rate</b>: note globale</li>
|
||||||
|
</ul>
|
||||||
|
N'oubliez pas pour chaque champ de spécifier l'ordre avec les mots clefs <i>ASC</i> et <i>DESC</i>
|
||||||
|
</li>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<h3>Historique</h3>
|
<h3>Historique</h3>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue