Changeset 18927


Ignore:
Timestamp:
Nov 4, 2012, 3:59:38 PM (8 years ago)
Author:
mistic100
Message:

update with Piwigo 2.5 features (website url, email, mandatory email and username)

Location:
extensions/Comments_on_Albums
Files:
1 added
1 deleted
8 edited

Legend:

Unmodified
Added
Removed
  • extensions/Comments_on_Albums/include/coa_albums.php

    r14528 r18927  
    22/* Code adapted from include/picture_comment.inc.php and picture.php */
    33if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
     4
     5global $conf, $user;
    46
    57// +-----------------------------------------------------------------------+
     
    122124    die('Session expired');
    123125  }
    124 
     126 
    125127  $comm = array(
    126128    'author' => trim( @$_POST['author'] ),
    127129    'content' => trim( $_POST['content'] ),
     130    'website_url' => trim( $_POST['website_url'] ),
     131    'email' => trim( @$_POST['email'] ),
    128132    'category_id' => $category['id'],
    129   );
     133   );
    130134
    131135  include_once(COA_PATH.'include/functions_comment.inc.php'); // custom fonctions
    132136 
    133   $comment_action = insert_user_comment_albums($comm, @$_POST['key'], $page['infos']);
     137  $comment_action = insert_user_comment_albums($comm, @$_POST['key'], $page['errors']);
    134138
    135139  switch ($comment_action)
     
    231235    com.author,
    232236    com.author_id,
    233     '.$conf['user_fields']['username'].' AS username,
     237    u.'.$conf['user_fields']['username'].' AS username,
     238    u.'.$conf['user_fields']['email'].' AS user_email,
     239    com.email,
    234240    com.date,
     241    com.website_url,
    235242    com.category_id,
    236243    com.content,
     
    248255    while ($row = pwg_db_fetch_assoc($result))
    249256    {
    250       // author
    251       if (!empty($row['author']))
    252       {
    253         $author = $row['author'];
    254         if ($author == 'guest')
    255         {
    256           $author = l10n('guest');
    257         }
    258       }
    259       else
    260       {
    261         $author = stripslashes($row['username']);
     257      if ($row['author'] == 'guest')
     258      {
     259        $row['author'] = l10n('guest');
     260      }
     261     
     262      $email = null;
     263      if (!empty($row['user_email']))
     264      {
     265        $email = $row['user_email'];
     266      }
     267      else if (!empty($row['email']))
     268      {
     269        $email = $row['email'];
    262270      }
    263271     
     
    265273      $tpl_comment = array(
    266274        'ID' => $row['id'],
    267         'AUTHOR' => trigger_event('render_comment_author', $author),
     275        'AUTHOR' => trigger_event('render_comment_author', $row['author']),
    268276        'DATE' => format_date($row['date'], true),
     277        'WEBSITE_URL' => $row['website_url'],
    269278        'CONTENT' => trigger_event('render_comment_content', $row['content'], 'album'),
    270279        );
     
    300309        }
    301310      }
    302       if (is_admin() AND $row['validated'] != 'true')
    303       {
    304         $tpl_comment['U_VALIDATE'] = add_url_params(
    305           $url_self,
    306           array(
    307             'action' => 'validate_comment',
    308             'comment_to_validate' => $row['id'],
    309             'pwg_token' => get_pwg_token(),
    310             )
    311           );
     311      if (is_admin())
     312      {
     313        $tpl_comment['EMAIL'] = $email;
     314       
     315        if ($row['validated'] != 'true')
     316        {
     317          $tpl_comment['U_VALIDATE'] = add_url_params(
     318            $url_self,
     319            array(
     320              'action' => 'validate_comment',
     321              'comment_to_validate' => $row['id'],
     322              'pwg_token' => get_pwg_token(),
     323              )
     324            );
     325        }
    312326      }
    313327     
     
    330344  {
    331345    $key = get_ephemeral_key(3, $category['id']);
    332     $content = null;
    333     if ('reject'===@$comment_action)
    334     {
    335       $content = htmlspecialchars(stripslashes($comm['content']));
    336     }
     346   
    337347    $template->assign('comment_add',
    338348      array(
    339         'F_ACTION' => $url_self,
    340         'KEY' => $key,
    341         'CONTENT' => $content,
    342         'SHOW_AUTHOR' => !is_classic_user(),
     349        'F_ACTION' =>         $url_self,
     350        'KEY' =>              $key,
     351        'CONTENT' =>          stripslashes(@$_POST['content']),
     352        'SHOW_AUTHOR' =>      !is_classic_user(),
     353        'AUTHOR_MANDATORY' => $conf['comments_author_mandatory'],
     354        'AUTHOR' =>           stripslashes(@$_POST['author']),
     355        'WEBSITE_URL' =>      stripslashes(@$_POST['website_url']),
     356        'SHOW_EMAIL' =>       !is_classic_user() or empty($user['email']),
     357        'EMAIL_MANDATORY' =>  $conf['comments_email_mandatory'],
     358        'EMAIL' =>            stripslashes(@$_POST['email']),
    343359        )
    344360      );
  • extensions/Comments_on_Albums/include/coa_comments_page.php

    r15640 r18927  
    55
    66// +-----------------------------------------------------------------------+
    7 // |                             main page                                 |
     7// |                    add a button for switch page                       |
    88// +-----------------------------------------------------------------------+
    9 
    10 if ( !isset($_GET['display_mode']) or $_GET['display_mode'] != 'albums' )
    11 
    12   // adds a button for switch page
    13   $template->set_prefilter('comments', 'coa_add_button');
    14  
    15   function coa_add_button($content, &$smarty)
    16   {   
    17     $search ='<form class="filter" action="{$F_ACTION}" method="get">';
    18     $replacement = '
     9$template->assign('COA_MODE', (isset($_GET['display_mode']) and $_GET['display_mode'] == 'albums') ? 'albums' : 'photos');
     10$template->set_prefilter('comments', 'coa_add_button');
     11
     12function coa_add_button($content, &$smarty)
     13{   
     14  $search ='<form class="filter" action="{$F_ACTION}" method="get">';
     15  $replacement = '
    1916<form class="filter">
    2017<fieldset>
    21   <legend>{\'Display comments on\'|@translate}</legend>
    22   <span style="font-size:1.1em;"><a href="#" style="font-weight:bold;">{\'Photos\'|@translate}</a> | <a href="comments.php?display_mode=albums">{\'Albums\'|@translate}</a></span>
     18<legend>{\'Display comments on\'|@translate}</legend>
     19<span style="font-size:1.1em;"><a href="comments.php" {if $COA_MODE=="photos"}style="font-weight:bold;"{/if}>{\'Photos\'|@translate}</a> |
     20<a href="comments.php?display_mode=albums" {if $COA_MODE=="albums"}style="font-weight:bold;"{/if}>{\'Albums\'|@translate}</a></span>
    2321</fieldset>
    2422</form>';
    2523
    26     return str_replace($search, $replacement.$search, $content);
    27   }
    28  
    29  
     24  return str_replace($search, $replacement.$search, $content);
     25}
     26
     27
    3028// +-----------------------------------------------------------------------+
    3129//                        comments on albums page                          |
    3230// +-----------------------------------------------------------------------+
    33 
    34 }
    35 else if ($_GET['display_mode'] == 'albums')
     31 if ( isset($_GET['display_mode']) and $_GET['display_mode'] == 'albums' )
    3632{
    3733  include_once(COA_PATH.'include/functions_comment.inc.php'); // custom functions
     
    167163    com.author,
    168164    com.author_id,
    169     '.$conf['user_fields']['username'].' AS username,
     165    u.'.$conf['user_fields']['username'].' AS username,
     166    u.'.$conf['user_fields']['email'].' AS user_email,
     167    com.email,
    170168    com.date,
     169    com.website_url,
    171170    com.content,
    172171    com.validated
     
    246245          )
    247246        );
     247       
     248      $email = null;
     249      if (!empty($comment['user_email']))
     250      {
     251        $email = $comment['user_email'];
     252      }
     253      else if (!empty($comment['email']))
     254      {
     255        $email = $comment['email'];
     256      }
    248257     
    249258      // comment content
     
    254263        'src_image' => $comment['src_image'],
    255264        'AUTHOR' => trigger_event('render_comment_author', $comment['author']),
     265        'WEBSITE_URL' => $comment['website_url'],
    256266        'DATE' => format_date($comment['date'], true),
    257267        'CONTENT' => trigger_event('render_comment_content', $comment['content'], 'album'),
    258268        );
     269       
     270      if (is_admin())
     271      {
     272        $tpl_comment['EMAIL'] = $email;
     273      }
    259274
    260275      // rights
     
    309324  // |                            template                                   |
    310325  // +-----------------------------------------------------------------------+
    311   $template->set_filenames(array('comments'=> dirname(__FILE__).'/../template/comments_page.tpl'));
    312  
    313326  // add a line to display category name
    314327  $template->set_prefilter('comments', 'coa_change_comments_list');
    315328 
    316329  function coa_change_comments_list($content, &$smarty) {
    317     $search = '<img src="{$pwg->derivative_url($derivative_params, $comment.src_image)}" alt="{$comment.ALT}">';
    318     $replacement = $search.'<br/>{$comment.ALT}';
     330    $search = '<a href="{$comment.U_PICTURE}">';
     331    $replacement = $search.'{$comment.ALT}<br/>';
    319332    return str_replace($search, $replacement, $content);
    320333  }
  • extensions/Comments_on_Albums/include/functions_comment.inc.php

    r15999 r18927  
    3939    if ( empty($comm['author']) )
    4040    {
     41      if ($conf['comments_author_mandatory'])
     42      {
     43        array_push($infos, l10n('Username is mandatory') );
     44        $comment_action='reject';
     45      }
    4146      $comm['author'] = 'guest';
    4247    }
     
    7580  }
    7681 
     82  // website
     83  if (!empty($comm['website_url']))
     84  {
     85    if (!preg_match('/^https?/i', $comm['website_url']))
     86    {
     87      $comm['website_url'] = 'http://'.$comm['website_url'];
     88    }
     89    if (!url_check_format($comm['website_url']))
     90    {
     91      array_push($infos, l10n('Your website URL is invalid'));
     92      $comment_action='reject';
     93    }
     94  }
     95 
     96  // email
     97  if (empty($comm['email']))
     98  {
     99    if (!empty($user['email']))
     100    {
     101      $comm['email'] = $user['email'];
     102    }
     103    else if ($conf['comments_email_mandatory'])
     104    {
     105      array_push($infos, l10n('Email address is missing. Please specify an email address.') );
     106      $comment_action='reject';
     107    }
     108  }
     109  else if (!email_check_format($comm['email']))
     110  {
     111    array_push($infos, l10n('mail address must be like xxx@yyy.eee (example : jack@altern.org)'));
     112    $comment_action='reject';
     113  }
     114 
    77115  // anonymous id = ip address
    78116  $ip_components = explode('.', $comm['ip']);
     
    116154    $query = '
    117155INSERT INTO '.COA_TABLE.'
    118   (author, author_id, content, date, validated, validation_date, category_id)
     156  (author, author_id, anonymous_id, content, date, validated, validation_date, category_id, website_url, email)
    119157  VALUES (
    120158    \''.$comm['author'].'\',
    121159    '.$comm['author_id'].',
     160    \''.$comm['anonymous_id'].'\',
    122161    \''.$comm['content'].'\',
    123162    NOW(),
    124163    \''.($comment_action=='validate' ? 'true':'false').'\',
    125164    '.($comment_action=='validate' ? 'NOW()':'NULL').',
    126     '.$comm['category_id'].'
     165    '.$comm['category_id'].',
     166    '.(!empty($comm['website_url']) ? '\''.$comm['website_url'].'\'' : 'NULL').',
     167    '.(!empty($comm['email']) ? '\''.$comm['email'].'\'' : 'NULL').'
    127168  )
    128169';
     
    142183      (
    143184        get_l10n_args('Author: %s', stripslashes($comm['author']) ),
     185        get_l10n_args('Email: %s', stripslashes($comm['email']) ),
    144186        get_l10n_args('Comment: %s', stripslashes($comm['content']) ),
    145187        get_l10n_args('', ''),
  • extensions/Comments_on_Albums/main.inc.php

    r15999 r18927  
    1616//          Global variables
    1717// +-----------------------------------------------------------------------+
    18 define('COA_DIR' , basename(dirname(__FILE__)));
    19 define('COA_PATH' , PHPWG_PLUGINS_PATH . COA_DIR . '/');
    20 define('COA_TABLE' , $prefixeTable . 'comments_categories');
    21 define('COA_ADMIN', get_root_url().'admin.php?page=plugin-' . COA_DIR);
     18defined('COA_ID') or define('COA_ID', basename(dirname(__FILE__)));
     19define('COA_PATH' ,   PHPWG_PLUGINS_PATH . COA_ID . '/');
     20define('COA_TABLE' ,  $prefixeTable . 'comments_categories');
     21define('COA_ADMIN',   get_root_url().'admin.php?page=plugin-' . COA_ID);
     22define('COA_VERSION', 'auto');
    2223
    2324
     
    2829function coa_init()
    2930{
    30   global $user;
     31  global $user, $conf, $pwg_loaded_plugins;
    3132 
    3233  // luciano doesn't use comments
     
    3435  if ($user['theme'] == 'luciano' or $user['theme'] == 'stripped_black_bloc') return;
    3536 
    36   add_event_handler('loc_after_page_header', 'COA_albums');
    37   add_event_handler('loc_after_page_header', 'COA_comments_page');
    38   add_event_handler('loc_begin_admin_page', 'COA_admin_intro');
    39   add_event_handler('loc_end_admin', 'COA_admin_comments');
    40   add_event_handler('get_stuffs_modules', 'COA_register_stuffs_module');
     37  // apply upgrade if needed
     38  if (
     39    COA_VERSION == 'auto' or
     40    $pwg_loaded_plugins[COA_ID]['version'] == 'auto' or
     41    version_compare($pwg_loaded_plugins[COA_ID]['version'], COA_VERSION, '<')
     42  )
     43  {
     44    // call install function
     45    include_once(COA_PATH . 'include/install.inc.php');
     46    coa_install();
     47   
     48    // update plugin version in database
     49    if ( $pwg_loaded_plugins[COA_ID]['version'] != 'auto' and COA_VERSION != 'auto' )
     50    {
     51      $query = '
     52UPDATE '. PLUGINS_TABLE .'
     53SET version = "'. COA_VERSION .'"
     54WHERE id = "'. COA_ID .'"';
     55      pwg_query($query);
     56     
     57      $pwg_loaded_plugins[COA_ID]['version'] = COA_VERSION;
     58     
     59      if (defined('IN_ADMIN'))
     60      {
     61        $_SESSION['page_infos'][] = 'Comments on Albums updated to version '. COA_VERSION;
     62      }
     63    }
     64  }
     65 
     66  // add events handlers
     67  if (defined('IN_ADMIN'))
     68  {
     69    add_event_handler('loc_begin_admin_page', 'coa_admin_intro');
     70    add_event_handler('loc_end_admin', 'coa_admin_comments');
     71  }
     72  else
     73  {
     74    add_event_handler('loc_after_page_header', 'coa_albums');
     75    add_event_handler('loc_after_page_header', 'coa_comments_page');
     76  } 
     77  add_event_handler('get_stuffs_modules', 'coa_register_stuffs_module');
    4178}
    4279
     
    4683// +-----------------------------------------------------------------------+
    4784
    48 function COA_albums()
     85function coa_albums()
    4986{
    5087  global $template, $page, $conf, $pwg_loaded_plugins;
     
    5794}
    5895
    59 function COA_comments_page()
     96function coa_comments_page()
    6097{
    6198  global $template, $page, $conf, $user;
     
    67104}
    68105
    69 function COA_admin_intro()
     106function coa_admin_intro()
    70107{
    71108  global $page;
     
    77114}
    78115
    79 function COA_admin_comments()
     116function coa_admin_comments()
    80117{
    81118  global $page;
     
    87124}
    88125
    89 function COA_register_stuffs_module($modules)
     126function coa_register_stuffs_module($modules)
    90127{
    91128  load_language('plugin.lang', COA_PATH);
  • extensions/Comments_on_Albums/maintain.inc.php

    r15995 r18927  
    22if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    33
     4defined('COA_ID') or define('COA_ID', basename(dirname(__FILE__)));
     5include_once(PHPWG_PLUGINS_PATH . COA_ID . '/include/install.inc.php');
     6
    47function plugin_install()
    58{
    6   global $prefixeTable;
    7 
    8   pwg_query("
    9 CREATE TABLE `" . $prefixeTable . "comments_categories` (
    10   `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
    11   `category_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
    12   `date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
    13   `author` varchar(255) DEFAULT NULL,
    14   `author_id` smallint(5) DEFAULT NULL,
    15   `anonymous_id` varchar(45) NOT NULL,
    16   `content` longtext,
    17   `validated` enum('true','false') NOT NULL DEFAULT 'false',
    18   `validation_date` datetime DEFAULT NULL,
    19   PRIMARY KEY (`id`)
    20 ) DEFAULT CHARSET=utf8
    21 ;");
     9  coa_install();
     10  define('coa_installed', true);
    2211}
    2312
    2413function plugin_activate()
    2514{
    26   global $conf, $prefixeTable;
    27  
    28   if (isset($conf['comments_on_albums']))
     15  if (!defined('coa_installed'))
    2916  {
    30     pwg_query('DELETE FROM '.CONFIG_TABLE.' WHERE param="comments_on_albums" LIMIT 1;');
    31   }
    32  
    33   $query = 'SHOW COLUMNS FROM `' . $prefixeTable . 'comments_categories`;';
    34   $columns = hash_from_query($query, 'Field');
    35   if (!isset($columns['anonymous_id']))
    36   {
    37     pwg_query('ALTER TABLE `' . $prefixeTable . 'comments_categories` ADD `anonymous_id` VARCHAR( 45 ) DEFAULT NULL;');
     17    coa_install();
    3818  }
    3919}
     
    4323  global $prefixeTable;
    4424
    45   pwg_query("DROP TABLE `" . $prefixeTable . "comments_categories`;");
     25  pwg_query('DROP TABLE `' . $prefixeTable . 'comments_categories`;');
    4626}
     27
    4728?>
  • extensions/Comments_on_Albums/stuffs_module/config.tpl

    r12381 r18927  
    11<table>
    2         <tr>
    3                 <td align="right"><br>{'lastcoms_nb_comments'|@translate} &nbsp;&nbsp;</td>
    4                 <td><br>
    5                 <input type="text" size="3" maxlength="2" value="{$NB_COMMENTS}" name="nb_comments"/></td>
    6         </tr>
    7         <tr>
    8                 <td align="right"><br>{'lastcoms_show_buttons'|@translate} &nbsp;&nbsp;</td>
    9                 <td><br>
    10                 <input type="checkbox" name="show_admin_buttons" value="on" {$SHOW_ADMIN_BUTTONS}/></td>
    11         </tr>
    122  <tr>
    13                 <td align="right"><br>{'lastcoms_nb_cadres'|@translate} &nbsp;&nbsp;</td>
    14                 <td><br>
     3    <td align="right"><br>{'lastcoms_nb_comments'|@translate} &nbsp;&nbsp;</td>
     4    <td><br>
     5    <input type="text" size="3" maxlength="2" value="{$NB_COMMENTS}" name="nb_comments"/></td>
     6  </tr>
     7  <tr>
     8    <td align="right"><br>{'lastcoms_show_buttons'|@translate} &nbsp;&nbsp;</td>
     9    <td><br>
     10    <input type="checkbox" name="show_admin_buttons" value="on" {$SHOW_ADMIN_BUTTONS}/></td>
     11  </tr>
     12  <tr>
     13    <td align="right"><br>{'lastcoms_nb_cadres'|@translate} &nbsp;&nbsp;</td>
     14    <td><br>
    1515    {html_options name=nb_cadres options=$nb_cadres.OPTIONS selected=$nb_cadres.SELECTED}
    1616    </td>
    17         </tr>
     17  </tr>
    1818  <tr>
    19                 <td align="right"><br>{'lastcoms_dim'|@translate} : &nbsp;&nbsp; {'lastcoms_width'|@translate} &nbsp;&nbsp;</td>
    20                 <td><br>
    21                 <input type="text" size="3" maxlength="3" value="{$WIDTH}" name="width"/>&nbsp;px</td>
    22         </tr>
    23         <tr>
    24                 <td align="right">{'lastcoms_height'|@translate} &nbsp;&nbsp;</td>
    25                 <td>
    26                 <input type="text" size="3" maxlength="3" value="{$HEIGHT}" name="height"/>&nbsp;px</td>
    27         </tr>
     19    <td align="right"><br>{'lastcoms_dim'|@translate} : &nbsp;&nbsp; {'lastcoms_width'|@translate} &nbsp;&nbsp;</td>
     20    <td><br>
     21    <input type="text" size="3" maxlength="3" value="{$WIDTH}" name="width"/>&nbsp;px</td>
     22  </tr>
     23  <tr>
     24    <td align="right">{'lastcoms_height'|@translate} &nbsp;&nbsp;</td>
     25    <td>
     26    <input type="text" size="3" maxlength="3" value="{$HEIGHT}" name="height"/>&nbsp;px</td>
     27  </tr>
    2828</table>
    2929<br>
  • extensions/Comments_on_Albums/stuffs_module/stuffs_lastcoms.tpl

    r12381 r18927  
    33{foreach from=$block.comments item=comment}
    44<li {if isset($comment.CLASS)}class="{$comment.CLASS}"{/if}>
    5         <div class="thumbnailCategory">
     5  <div class="thumbnailCategory">
    66    {if isset($comment.TN_SRC)}
    77    <div class="illustration">
  • extensions/Comments_on_Albums/template/albums.tpl

    r14528 r18927  
    88#commentAdd, #pictureCommentList {ldelim} float:none; display:inline-block; width:47.5%; vertical-align:top;}
    99#commentsSwitcher {ldelim} float:none; display:inline-block; margin: 2px 0; cursor:pointer;}
    10 .noCommentContent #commentsSwitcher     {ldelim} display: none;}
     10.noCommentContent #commentsSwitcher  {ldelim} display: none;}
    1111.switchArrow{ldelim} width: 16px; height: 16px; margin: 5px;}
    1212.commentshidden #pictureComments {ldelim} display: none;}
    13 .commentContent .comments_toggle        {ldelim} cursor: pointer;}
     13.commentContent .comments_toggle   {ldelim} cursor: pointer;}
    1414{/if}
    1515{if $themeconf.name == 'Sylvia'}
     
    2929{if $COMMENTS_ON_TOP}
    3030{footer_script}{literal}
    31         // comments show/hide
    32         var commentsswicther=jQuery("#commentsSwitcher");
    33         var comments=jQuery("#theCategoryPage #comments");
    34        
    35         commentsswicther.html("<div class=\"switchArrow\">&nbsp;</div>");
    36   {/literal}{if $themeconf.name != 'elegant'}switcharrow = commentsswicther.children(".switchArrow");{else}switcharrow = $("<div></div>");{/if}{literal}
    37        
    38         if (comments.length == 1) {
    39                 var comments_button=jQuery("#comments h3");
     31  // comments show/hide
     32  var commentsswicther=jQuery("#commentsSwitcher");
     33  var comments=jQuery("#theCategoryPage #comments");
     34 
     35  commentsswicther.html('<div class="switchArrow">&nbsp;</div>');
     36  {/literal}{if $themeconf.name != 'elegant'}switcharrow = commentsswicther.children(".switchArrow");{else}switcharrow = $('<div></div>');{/if}{literal}
     37 
     38  if (comments.length == 1) {
     39    var comments_button=jQuery("#comments h3");
    4040
    41                 if (comments_button.length == 0) {
    42                         jQuery("#addComment").before("<h3>Comments</h3>");
    43                         comments_button=jQuery("#comments h3");
    44                 }
    45        
     41    if (comments_button.length == 0) {
     42      jQuery("#addComment").before('<h3>Comments</h3>');
     43      comments_button=jQuery("#comments h3");
     44    }
     45 
    4646    {/literal}{if $DISPLAY_COMMENTS_BLOCK}
    47                 comments.addClass("commentsshown");
    48                 comments_button.addClass("comments_toggle").addClass("comments_toggle_on");
     47    comments.addClass("commentsshown");
     48    comments_button.addClass("comments_toggle").addClass("comments_toggle_on");
    4949    switcharrow.html("&uarr;");
    5050    {else}
    5151    comments.addClass("commentshidden");
    52                 comments_button.addClass("comments_toggle").addClass("comments_toggle_off");
     52    comments_button.addClass("comments_toggle").addClass("comments_toggle_off");
    5353    switcharrow.html("&darr;");
    54                 {/if}{literal}
     54    {/if}{literal}
    5555   
    56                 comments_button.click(function() { commentsToggle() });
    57                 commentsswicther.click(function() { commentsToggle() });
    58        
    59         }
     56    comments_button.click(function() { commentsToggle() });
     57    commentsswicther.click(function() { commentsToggle() });
     58 
     59  }
    6060 
    6161  function commentsToggle() {
     
    8383  <div id="pictureComments"><fieldset>
    8484    {if isset($comment_add)}
    85                 <div id="commentAdd">
    86                         <h4>{'Add a comment'|@translate}</h4>
    87                         <form method="post" action="{$comment_add.F_ACTION}" id="addComment">
    88                                 {if $comment_add.SHOW_AUTHOR}
    89                                         <p><label>{'Author'|@translate} :</label></p>
    90                                         <p><input type="text" name="author"></p>
    91                                         <p><label>{'Comment'|@translate} :</label></p>
    92                                 {/if}
    93                                 <p><textarea name="content" id="contentid" rows="5" cols="50">{$comment_add.CONTENT}</textarea></p>
    94                                 <p><input type="hidden" name="key" value="{$comment_add.KEY}">
    95                                         <input type="submit" value="{'Submit'|@translate}"></p>
    96                         </form>
    97                 </div>
     85    <div id="commentAdd">
     86      <h4>{'Add a comment'|@translate}</h4>
     87      <form method="post" action="{$comment_add.F_ACTION}" id="addComment">
     88        {if $comment_add.SHOW_AUTHOR}
     89          <p><label for="author">{'Author'|@translate}{if $comment_add.AUTHOR_MANDATORY} ({'mandatory'|@translate}){/if} :</label></p>
     90          <p><input type="text" name="author" id="author" value="{$comment_add.AUTHOR}"></p>
     91        {/if}
     92        {if $comment_add.SHOW_EMAIL}
     93          <p><label for="email">{'Email'|@translate}{if $comment_add.EMAIL_MANDATORY} ({'mandatory'|@translate}){/if} :</label></p>
     94          <p><input type="text" name="email" id="email" value="{$comment_add.EMAIL}"></p>
     95        {/if}
     96        <p><label for="website_url">{'Website'|@translate} :</label></p>
     97        <p><input type="text" name="website_url" id="website_url" value="{$comment_add.WEBSITE_URL}"></p>
     98        <p><label for="contentid">{'Comment'|@translate} ({'mandatory'|@translate}) :</label></p>
     99        <p><textarea name="content" id="contentid" rows="5" cols="50">{$comment_add.CONTENT}</textarea></p>
     100        <p><input type="hidden" name="key" value="{$comment_add.KEY}">
     101          <input type="submit" value="{'Submit'|@translate}"></p>
     102      </form>
     103    </div>
    98104    {/if}
    99105    {if isset($comments)}
    100                 <div id="pictureCommentList">
    101                         {if (($COMMENT_COUNT > 2) || !empty($comment_navbar))}
    102                                 <div id="pictureCommentNavBar">
    103                                         {if $COMMENT_COUNT > 2}
    104                                                 <a href="{$COMMENTS_ORDER_URL}#comments" rel="nofollow" class="commentsOrder">{$COMMENTS_ORDER_TITLE}</a>
    105                                         {/if}
    106                                         {if !empty($comment_navbar) }{include file=$COA_ABSOLUTE_PATH|@cat:'template/navigation_bar.tpl'|@get_extent:'navbar'}{/if}
    107                                 </div>
    108                         {/if}
     106    <div id="pictureCommentList">
     107      {if (($COMMENT_COUNT > 2) || !empty($comment_navbar))}
     108        <div id="pictureCommentNavBar">
     109          {if $COMMENT_COUNT > 2}
     110            <a href="{$COMMENTS_ORDER_URL}#comments" rel="nofollow" class="commentsOrder">{$COMMENTS_ORDER_TITLE}</a>
     111          {/if}
     112          {if !empty($comment_navbar) }{include file=$COA_ABSOLUTE_PATH|@cat:'template/navigation_bar.tpl'|@get_extent:'navbar'}{/if}
     113        </div>
     114      {/if}
    109115      {include file='comment_list.tpl'}
    110                 </div>
    111                 {/if}
    112                 {if not $COMMENTS_ON_TOP}<div style="clear:both"></div>{/if}
    113         </fieldset></div>
     116    </div>
     117    {/if}
     118    {if not $COMMENTS_ON_TOP}<div style="clear:both"></div>{/if}
     119  </fieldset></div>
    114120
    115121</div>
Note: See TracChangeset for help on using the changeset viewer.