Changeset 12894


Ignore:
Timestamp:
Jan 15, 2012, 6:05:30 PM (9 years ago)
Author:
mistic100
Message:

feaure:2379 option to display user comments sorted new>old instead of old>new

Location:
trunk
Files:
1 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/configuration.php

    r12887 r12894  
    420420      array(
    421421        'NB_COMMENTS_PAGE'=>$conf['nb_comment_page'],
    422         ));
     422        'comments_order'=>$conf['comments_order'],
     423        'comments_order_options'=> $sort_directions
     424        )
     425      );
    423426
    424427    foreach ($comments_checkboxes as $checkbox)
  • trunk/admin/themes/default/template/configuration.tpl

    r12892 r12894  
    204204      <input type="text" size="3" maxlength="4" name="nb_comment_page" id="nb_comment_page" value="{$comments.NB_COMMENTS_PAGE}">
    205205    </li>
     206   
     207    <li>
     208      <span class="property">{'Default comments order'|@translate}</span>
     209      <select name="comments_order">
     210        {html_options options=$comments.comments_order_options selected=$comments.comments_order}
     211      </select>
     212    </li>
    206213
    207214    <li>
  • trunk/include/picture_comment.inc.php

    r12767 r12894  
    126126  if ($row['nb_comments'] > 0)
    127127  {
     128    // comments order (get, session, conf)
     129    if (!empty($_GET['comments_order']))
     130    {
     131      if (in_array(strtoupper($_GET['comments_order']), array('ASC', 'DESC')))
     132      {
     133        $comments_order = $_GET['comments_order'];
     134        pwg_set_session_var('comments_order', $comments_order);
     135      }
     136      else
     137      {
     138        $comments_order = $conf['comments_order'];
     139      }
     140    }
     141    else if (pwg_get_session_var('comments_order') !== null)
     142    {
     143      $comments_order = pwg_get_session_var('comments_order');
     144    }
     145    else
     146    {
     147      $comments_order = $conf['comments_order'];
     148    }
     149    $template->assign(array(
     150      'COMMENTS_ORDER_URL' => duplicate_picture_url().'&amp;comments_order='.($comments_order == 'ASC' ? 'DESC' : 'ASC'),
     151      'COMMENTS_ORDER_TITLE' => $comments_order == 'ASC' ? l10n('ascending') : l10n('descending'),
     152      ));
     153       
    128154    $query = '
    129155SELECT
     
    141167  WHERE image_id = '.$page['image_id'].'
    142168    '.$validated_clause.'
    143   ORDER BY date ASC
     169  ORDER BY date '.$comments_order.'
    144170  LIMIT '.$conf['nb_comment_page'].' OFFSET '.$page['start'].'
    145171;';
  • trunk/install/config.sql

    r12887 r12894  
    66INSERT INTO piwigo_config (param,value,comment) VALUES ('comments_validation','false','administrators validate users comments before becoming visible');
    77INSERT INTO piwigo_config (param,value,comment) VALUES ('comments_forall','false','even guest not registered can post comments');
     8INSERT INTO piwigo_config (param,value,comment) VALUES ('comments_order','ASC','comments order on picture page and cie');
    89INSERT INTO piwigo_config (param,value,comment) VALUES ('user_can_delete_comment','false','administrators can allow user delete their own comments');
    910INSERT INTO piwigo_config (param,value,comment) VALUES ('user_can_edit_comment','false','administrators can allow user edit their own comments');
  • trunk/language/en_UK/admin.lang.php

    r12887 r12894  
    224224$lang['Deactivate all'] = "Deactivate all";
    225225$lang['Deactivate'] = "Deactivate";
     226$lang['Default comments order'] = 'Default comments order';
    226227$lang['Default display'] = "Default display";
    227228$lang['Default photos order'] = "Default photos order";
  • trunk/language/fr_CA/admin.lang.php

    r12888 r12894  
    847847$lang['Send connection settings by email'] = 'Envoyer les identifiants par email';
    848848$lang['Activate comments'] = 'Activer les commentaires';
     849$lang['Default comments order'] = 'Ordre par défaut des commentaires';
    849850
    850851?>
  • trunk/language/fr_FR/admin.lang.php

    r12888 r12894  
    846846$lang['Send connection settings by email'] = 'Envoyer les identifiants par email';
    847847$lang['Activate comments'] = 'Activer les commentaires';
     848$lang['Default comments order'] = 'Ordre par défaut des commentaires';
    848849
    849850?>
  • trunk/local

    • Property svn:ignore
      •  

        old new  
         1GThumb
         2combined
         3i
        14personal
  • trunk/themes/default/template/picture.tpl

    r12881 r12894  
    275275
    276276{if isset($COMMENT_COUNT)}
     277<a name="comments"></a>
    277278<div id="comments">
    278279        {if $COMMENT_COUNT > 0}
    279280                <h3>{$pwg->l10n_dec('%d comment', '%d comments',$COMMENT_COUNT)}</h3>
    280281        {/if}
     282  {if $COMMENT_COUNT > 2}
     283    {'Sort order'|@translate} : <a href="{$COMMENTS_ORDER_URL}#comments">{$COMMENTS_ORDER_TITLE}</a>
     284  {/if}
    281285        {if !empty($navbar)}{include file='navigation_bar.tpl'|@get_extent:'navbar'}{/if}
    282286
Note: See TracChangeset for help on using the changeset viewer.