Changeset 11327


Ignore:
Timestamp:
Jun 12, 2011, 12:29:11 AM (9 years ago)
Author:
mistic100
Message:

correct link in notification mail, add album thumbnail on comments list (both public and admin side)

Location:
extensions/Comments_on_Albums
Files:
5 edited

Legend:

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

    r11267 r11327  
    33if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    44
    5 global $template, $conf;
     5global $template, $conf, $user;
    66load_language('plugin.lang', COA_PATH);
    77
     
    1111include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
    1212
    13 $tabs = array(
    14   array(
    15     'code' => 'pictures',
    16     'label' => l10n('COA_comments_photos'),
    17     ),
    18   array(
    19     'code' => 'albums',
    20     'label' => l10n('COA_comments_albums'),
    21     ),
    22   );
    23 
    24 $tab_codes = array_map(create_function('$a', 'return $a["code"];'), $tabs);
    25 
    26 if (isset($_GET['section']) and in_array($_GET['section'], $tab_codes))
     13if (isset($_GET['section']) and $_GET['section'] == 'albums')
    2714{
    28   $page['tab'] = $_GET['section'];
     15  $page['tab'] = 'albums';
    2916}
    3017else
    3118{
    32   $page['tab'] = $tabs[0]['code'];
     19  $page['tab'] = 'pictures';
    3320}
    3421
    3522$tabsheet = new tabsheet();
    36 foreach ($tabs as $tab)
    37 {
    38   $tabsheet->add(
    39     $tab['code'],
    40     $tab['label'],
    41     get_root_url().'admin.php?page=comments&section='.$tab['code']
    42     );
    43 }
     23$tabsheet->add('pictures', l10n('COA_comments_photos'), get_root_url().'admin.php?page=comments');
     24$tabsheet->add('albums', l10n('COA_comments_albums'), get_root_url().'admin.php?page=comments&section=albums');
    4425$tabsheet->select($page['tab']);
    4526$tabsheet->assign();
     
    134115    com.date,
    135116    com.author,
    136     '.$conf['user_fields']['username'].' AS username,
     117    u.'.$conf['user_fields']['username'].' AS username,
    137118    com.content,
    138     cat.name
     119    cat.name,
     120    img.id AS image_id,
     121    img.path,
     122    img.tn_ext
    139123  FROM '.COA_TABLE.' AS com
    140     INNER JOIN '.CATEGORIES_TABLE.' AS cat
     124    LEFT JOIN '.CATEGORIES_TABLE.' AS cat
    141125      ON cat.id = com.category_id
    142126    LEFT JOIN '.USERS_TABLE.' AS u
    143127      ON u.'.$conf['user_fields']['id'].' = com.author_id
     128    LEFT JOIN '.USER_CACHE_CATEGORIES_TABLE.' AS ucc
     129      ON ucc.cat_id = com.category_id AND ucc.user_id = '.$user['id'].'
     130    LEFT JOIN '.IMAGES_TABLE.' AS img
     131      ON img.id = ucc.user_representative_picture_id
    144132  WHERE validated = \'false\'
    145133  ORDER BY com.date DESC
     
    159147    }
    160148   
     149    // thumbnail
     150    $row['thumb'] = get_thumbnail_url(
     151      array(
     152        'id' => $row['image_id'],
     153        'path' => $row['path'],
     154        'tn_ext' => @$row['tn_ext'],
     155        )
     156     );
     157   
    161158    // comment content
    162159    $template->append(
    163160      'comments',
    164161      array(
     162        'ID' => $row['id'],
    165163        'CAT_URL' => PHPWG_ROOT_PATH.'admin.php?page=cat_modify&cat_id='.$row['category_id'],
    166         'CAT_NAME' => $row['name'],
    167         'ID' => $row['id'],
     164        'CAT_NAME' => trigger_event('render_category_name', $row['name']),
     165        'TN_SRC' => $row['thumb'],
    168166        'AUTHOR' => trigger_event('render_comment_author', $author_name),
    169167        'DATE' => format_date($row['date'], true),
  • extensions/Comments_on_Albums/include/coa_comments_page.php

    r11267 r11327  
    197197    com.validated
    198198  FROM '.COA_TABLE.' AS com
    199   LEFT JOIN '.USERS_TABLE.' As u
    200     ON u.'.$conf['user_fields']['id'].' = com.author_id
     199    LEFT JOIN '.USERS_TABLE.' As u
     200      ON u.'.$conf['user_fields']['id'].' = com.author_id
    201201  WHERE '.implode('
    202202    AND ', $page['where_clauses']).'
     
    234234    cat.permalink,
    235235    cat.uppercats,
    236     com.id as comment_id
     236    com.id as comment_id,
     237    img.id AS image_id,
     238    img.path,
     239    img.tn_ext
    237240  FROM '.CATEGORIES_TABLE.' AS cat
    238   LEFT JOIN '.COA_TABLE.' AS com
    239     ON cat.id=com.category_id
     241    LEFT JOIN '.COA_TABLE.' AS com
     242      ON com.category_id = cat.id
     243    LEFT JOIN '.USER_CACHE_CATEGORIES_TABLE.' AS ucc
     244      ON ucc.cat_id = cat.id AND ucc.user_id = '.$user['id'].'
     245    LEFT JOIN '.IMAGES_TABLE.' AS img
     246      ON img.id = ucc.user_representative_picture_id
    240247  '.get_sql_condition_FandF(
    241248    array(
     
    251258    foreach ($comments as $comment)
    252259    {
    253       // category
    254       $name = $categories[$comment['comment_id']]['name'];
    255       $url = duplicate_index_url(
     260      // category url
     261      $comment['cat_url'] = duplicate_index_url(
    256262        array(
    257263          'category' => array(
     
    263269          )
    264270        );
     271       
     272      // category thumbnail
     273      $comment['thumb'] = get_thumbnail_url(
     274        array(
     275          'id' => $categories[$comment['comment_id']]['image_id'],
     276          'path' => $categories[$comment['comment_id']]['path'],
     277          'tn_ext' => @$categories[$comment['comment_id']]['tn_ext'],
     278          )
     279       );
    265280     
    266281      // comment content
    267282      $tpl_comment = array(
    268283        'ID' => $comment['comment_id'],
    269         'CAT_URL' => $url,
    270         'CAT_NAME' => $name,
     284        'U_PICTURE' => $comment['cat_url'],
     285        'ALT' => trigger_event('render_category_name', $categories[$comment['comment_id']]['name']),
     286        'TN_SRC' => $comment['thumb'],
    271287        'AUTHOR' => trigger_event('render_comment_author', $comment['author']),
    272288        'DATE' => format_date($comment['date'], true),
     
    341357 
    342358  function coa_change_comments_list($content, &$smarty) {
    343     $search = '<div class="description"{if isset($comment.IN_EDIT)} style="height:200px"{/if}>';
    344 
    345     $replacement = '<div class="category-title">
    346   <a href="{$comment.CAT_URL}">{$comment.CAT_NAME}</a>
    347 </div>
    348 '.$search;
    349 
     359    $search = '<img src="{$comment.TN_SRC}" alt="{$comment.ALT}">';
     360    $replacement = $search.'<br/>{$comment.ALT}';
    350361    return str_replace($search, $replacement, $content);
    351362  }
  • extensions/Comments_on_Albums/include/functions_comment.inc.php

    r11267 r11327  
    154154      include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
    155155
    156       $comment_url = get_absolute_root_url().'comments.php?comment_id='.$comm['id'];
     156      $comment_url = get_absolute_root_url().'comments.php?display_mode=albums&amp;comment_id='.$comm['id'];
    157157
    158158      $keyargs_content = array
     
    273273      include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
    274274
    275       $comment_url = get_absolute_root_url().'comments.php?display_mode=albums&comment_id='.$comment['comment_id'];
     275      $comment_url = get_absolute_root_url().'comments.php?display_mode=albums&amp;comment_id='.$comment['comment_id'];
    276276
    277277      $keyargs_content = array
  • extensions/Comments_on_Albums/main.inc.php

    r11291 r11327  
    6565function COA_comments_page()
    6666{
    67   global $template, $page, $conf;
     67  global $template, $page, $conf, $user;
    6868 
    6969  if (isset($page['body_id']) AND $page['body_id'] == 'theCommentsPage')
  • extensions/Comments_on_Albums/template/admin_comments.tpl

    r11267 r11327  
    4545      <td>
    4646        <div class="comment">
    47           <a class="illustration" href="{$comment.CAT_URL}">{$comment.CAT_NAME}</a>
     47          <a class="illustration" href="{$comment.CAT_URL}"><img src="{$comment.TN_SRC}"><br/>{$comment.CAT_NAME}</a>
    4848          <p class="commentHeader"><strong>{$comment.AUTHOR}</strong> - <em>{$comment.DATE}</em></p>
    4949          <blockquote>{$comment.CONTENT}</blockquote>
Note: See TracChangeset for help on using the changeset viewer.