Changeset 75 for comment


Ignore:
Timestamp:
28/11/06 04:15:05 (5 years ago)
Author:
nigel
Message:

Added the More comments ability to block

File:
1 edited

Legend:

Unmodified
Added
Removed
  • comment/comment.module

    r74 r75  
    104104    $items[] = array('path' => 'admin/comment', 'title' => t('comments'), 
    105105      'callback' => 'comment_admin_overview', 'access' => $access); 
     106    $items[] = array('path' => 'comment', 'title' => t('comments'), 
     107      'callback' => 'comment_page', 'access' => $access); 
    106108 
    107109    // Tabs: 
     
    167169    $block['subject'] = t('Recent comments'); 
    168170    $block['content'] = theme('comment_block'); 
     171    $block['content'] .= '<div class="more-link">'. l(t('more'), 'comment', array('title' => t('Read the latest comments.'))) .'</div>'; 
    169172    return $block; 
    170173  } 
     
    17701773  return base_convert(substr($c, 1), 36, 10); 
    17711774} 
     1775 
     1776/** 
     1777 * Show all recent comments 
     1778 */ 
     1779function comment_page(){ 
     1780  $result = pager_query(db_rewrite_sql('SELECT c.nid, c.* FROM {comments} c WHERE c.status = 0 ORDER BY c.timestamp DESC', 'c'), variable_get('default_morecomments', 10)); 
     1781  $output = ''; 
     1782  while ($comment = db_fetch_object($result)) { 
     1783    $output .= theme('morecomments', $comment, ''); 
     1784  } 
     1785  $output .= theme('pager', NULL, variable_get('default_morecomments', 10)); 
     1786  print theme('page', $output); 
     1787} 
     1788 
     1789function theme_morecomments($comment, $links = 0) { 
     1790  $output  = "<div class=\"comment\">\n"; 
     1791  $output .= '<div class="subject">'. l($comment->subject, "node/$comment->nid", NULL, NULL, "comment-$comment->cid") . ' ' . theme('mark', $comment->new) ."</div>\n"; 
     1792  $output .= '<div class="moderation">'. $comment->moderation ."</div>\n"; 
     1793  $output .= '<div class="credit">'. t('by %a on %b', array('%a' => theme('username', $comment), '%b' => format_date($comment->timestamp))) ."</div>\n"; 
     1794  $output .= "<div class=\"body\">$comment->comment</div>\n"; 
     1795  $output .= "<div class=\"links\">$links</div>\n"; 
     1796  $output .= "</div>\n"; 
     1797  return $output; 
     1798} 
     1799 
     1800 
Note: See TracChangeset for help on using the changeset viewer.