Skip to content
Permalink
Browse files
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
  • Loading branch information
mistic100 committed Jan 15, 2012
1 parent 24eafad commit e673454e05e910de3553103d6f41695c5388ffbc
@@ -419,7 +419,10 @@ function order_by_is_local()
'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 @@

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().'&amp;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 @@
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');
@@ -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['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['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['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)}

0 comments on commit e673454

Please sign in to comment.