mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-03-28 17:42:57 +01:00
feaure:2379 option to display user comments sorted new>old instead of old>new
git-svn-id: http://piwigo.org/svn/trunk@12894 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
@@ -419,7 +419,10 @@ switch ($page['section'])
|
||||
'comments',
|
||||
array(
|
||||
'NB_COMMENTS_PAGE'=>$conf['nb_comment_page'],
|
||||
));
|
||||
'comments_order'=>$conf['comments_order'],
|
||||
'comments_order_options'=> $sort_directions
|
||||
)
|
||||
);
|
||||
|
||||
foreach ($comments_checkboxes as $checkbox)
|
||||
{
|
||||
|
||||
@@ -203,6 +203,13 @@ jQuery(document).ready(function () {
|
||||
</span>
|
||||
<input type="text" size="3" maxlength="4" name="nb_comment_page" id="nb_comment_page" value="{$comments.NB_COMMENTS_PAGE}">
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<span class="property">{'Default comments order'|@translate}</span>
|
||||
<select name="comments_order">
|
||||
{html_options options=$comments.comments_order_options selected=$comments.comments_order}
|
||||
</select>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<label>
|
||||
|
||||
@@ -125,6 +125,32 @@ SELECT
|
||||
|
||||
if ($row['nb_comments'] > 0)
|
||||
{
|
||||
// comments order (get, session, conf)
|
||||
if (!empty($_GET['comments_order']))
|
||||
{
|
||||
if (in_array(strtoupper($_GET['comments_order']), array('ASC', 'DESC')))
|
||||
{
|
||||
$comments_order = $_GET['comments_order'];
|
||||
pwg_set_session_var('comments_order', $comments_order);
|
||||
}
|
||||
else
|
||||
{
|
||||
$comments_order = $conf['comments_order'];
|
||||
}
|
||||
}
|
||||
else if (pwg_get_session_var('comments_order') !== null)
|
||||
{
|
||||
$comments_order = pwg_get_session_var('comments_order');
|
||||
}
|
||||
else
|
||||
{
|
||||
$comments_order = $conf['comments_order'];
|
||||
}
|
||||
$template->assign(array(
|
||||
'COMMENTS_ORDER_URL' => duplicate_picture_url().'&comments_order='.($comments_order == 'ASC' ? 'DESC' : 'ASC'),
|
||||
'COMMENTS_ORDER_TITLE' => $comments_order == 'ASC' ? l10n('ascending') : l10n('descending'),
|
||||
));
|
||||
|
||||
$query = '
|
||||
SELECT
|
||||
com.id,
|
||||
@@ -140,7 +166,7 @@ SELECT
|
||||
ON u.'.$conf['user_fields']['id'].' = author_id
|
||||
WHERE image_id = '.$page['image_id'].'
|
||||
'.$validated_clause.'
|
||||
ORDER BY date ASC
|
||||
ORDER BY date '.$comments_order.'
|
||||
LIMIT '.$conf['nb_comment_page'].' OFFSET '.$page['start'].'
|
||||
;';
|
||||
$result = pwg_query( $query );
|
||||
|
||||
@@ -5,6 +5,7 @@ INSERT INTO piwigo_config (param,value,comment) VALUES ('nb_comment_page','10','
|
||||
INSERT INTO piwigo_config (param,value,comment) VALUES ('log','true','keep an history of visits on your website');
|
||||
INSERT INTO piwigo_config (param,value,comment) VALUES ('comments_validation','false','administrators validate users comments before becoming visible');
|
||||
INSERT INTO piwigo_config (param,value,comment) VALUES ('comments_forall','false','even guest not registered can post comments');
|
||||
INSERT INTO piwigo_config (param,value,comment) VALUES ('comments_order','ASC','comments order on picture page and cie');
|
||||
INSERT INTO piwigo_config (param,value,comment) VALUES ('user_can_delete_comment','false','administrators can allow user delete their own comments');
|
||||
INSERT INTO piwigo_config (param,value,comment) VALUES ('user_can_edit_comment','false','administrators can allow user edit their own comments');
|
||||
INSERT INTO piwigo_config (param,value,comment) VALUES ('email_admin_on_comment_edition','false','Send an email to the administrators when a comment is modified');
|
||||
|
||||
38
install/db/115-database.php
Normal file
38
install/db/115-database.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?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 = 'New setting for comments order on picture page';
|
||||
|
||||
conf_update_param('comments_order', 'ASC');
|
||||
|
||||
echo
|
||||
"\n"
|
||||
. $upgrade_description
|
||||
."\n"
|
||||
;
|
||||
?>
|
||||
@@ -223,6 +223,7 @@ $lang['Date'] = "Date";
|
||||
$lang['Day'] = "Day";
|
||||
$lang['Deactivate all'] = "Deactivate all";
|
||||
$lang['Deactivate'] = "Deactivate";
|
||||
$lang['Default comments order'] = 'Default comments order';
|
||||
$lang['Default display'] = "Default display";
|
||||
$lang['Default photos order'] = "Default photos order";
|
||||
$lang['Default user cannot be deleted'] = "Default user cannot be deleted";
|
||||
|
||||
@@ -846,5 +846,6 @@ $lang['An error has occured during extract. Please check files permissions of yo
|
||||
$lang['Piwigo cannot retrieve upgrade file from server'] = 'Piwigo ne peut pas récupérer le fichier de mise à jour depuis le serveur';
|
||||
$lang['Send connection settings by email'] = 'Envoyer les identifiants par email';
|
||||
$lang['Activate comments'] = 'Activer les commentaires';
|
||||
$lang['Default comments order'] = 'Ordre par défaut des commentaires';
|
||||
|
||||
?>
|
||||
@@ -845,5 +845,6 @@ $lang['Photo Sizes'] = 'Tailles de photo';
|
||||
$lang['Original Size'] = 'Taille originale';
|
||||
$lang['Send connection settings by email'] = 'Envoyer les identifiants par email';
|
||||
$lang['Activate comments'] = 'Activer les commentaires';
|
||||
$lang['Default comments order'] = 'Ordre par défaut des commentaires';
|
||||
|
||||
?>
|
||||
@@ -274,10 +274,14 @@ y.callService(
|
||||
</div>
|
||||
|
||||
{if isset($COMMENT_COUNT)}
|
||||
<a name="comments"></a>
|
||||
<div id="comments">
|
||||
{if $COMMENT_COUNT > 0}
|
||||
<h3>{$pwg->l10n_dec('%d comment', '%d comments',$COMMENT_COUNT)}</h3>
|
||||
{/if}
|
||||
{if $COMMENT_COUNT > 2}
|
||||
{'Sort order'|@translate} : <a href="{$COMMENTS_ORDER_URL}#comments">{$COMMENTS_ORDER_TITLE}</a>
|
||||
{/if}
|
||||
{if !empty($navbar)}{include file='navigation_bar.tpl'|@get_extent:'navbar'}{/if}
|
||||
|
||||
{if isset($comments)}
|
||||
|
||||
Reference in New Issue
Block a user