- Timestamp:
- Oct 22, 2013, 10:39:10 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin.php
r24834 r25084 207 207 if ($conf['activate_comments']) 208 208 { 209 $template->assign('U_PENDING_COMMENTS', $link_start.'comments'); 209 $template->assign('U_COMMENTS', $link_start.'comments'); 210 211 // pending comments 212 $query = ' 213 SELECT COUNT(*) 214 FROM '.COMMENTS_TABLE.' 215 WHERE validated=\'false\' 216 ;'; 217 list($nb_comments) = pwg_db_fetch_row(pwg_query($query)); 218 219 if ($nb_comments > 0) 220 { 221 $template->assign('NB_PENDING_COMMENTS', $nb_comments); 222 } 210 223 } 211 224 -
trunk/admin/comments.php
r25018 r25084 98 98 // +-----------------------------------------------------------------------+ 99 99 100 $list = array(); 100 $nb_total = 0; 101 $nb_pending = 0; 101 102 102 103 $query = ' 103 SELECT c.id, c.image_id, c.date, c.author, '. 104 $conf['user_fields']['username'].' AS username, c.content, i.path, i.representative_ext 104 SELECT 105 COUNT(*) AS counter, 106 validated 107 FROM '.COMMENTS_TABLE.' 108 GROUP BY validated 109 ;'; 110 $result = pwg_query($query); 111 while ($row = pwg_db_fetch_assoc($result)) 112 { 113 $nb_total+= $row['counter']; 114 115 if ('false' == $row['validated']) 116 { 117 $nb_pending = $row['counter']; 118 } 119 } 120 121 if (!isset($_GET['filter']) and $nb_pending > 0) 122 { 123 $page['filter'] = 'pending'; 124 } 125 else 126 { 127 $page['filter'] = 'all'; 128 } 129 130 if (isset($_GET['filter']) and 'pending' == $_GET['filter']) 131 { 132 $page['filter'] = $_GET['filter']; 133 } 134 135 $template->assign( 136 array( 137 'nb_total' => $nb_total, 138 'nb_pending' => $nb_pending, 139 'filter' => $page['filter'], 140 ) 141 ); 142 143 $where_clauses = array('1=1'); 144 145 if ('pending' == $page['filter']) 146 { 147 $where_clauses[] = 'validated=\'false\''; 148 } 149 150 $query = ' 151 SELECT 152 c.id, 153 c.image_id, 154 c.date, 155 c.author, 156 '.$conf['user_fields']['username'].' AS username, 157 c.content, 158 i.path, 159 i.representative_ext, 160 validated 105 161 FROM '.COMMENTS_TABLE.' AS c 106 162 INNER JOIN '.IMAGES_TABLE.' AS i … … 108 164 LEFT JOIN '.USERS_TABLE.' AS u 109 165 ON u.'.$conf['user_fields']['id'].' = c.author_id 110 WHERE validated = \'false\'166 WHERE '.implode(' AND ', $where_clauses).' 111 167 ORDER BY c.date DESC 112 168 ;'; … … 136 192 'AUTHOR' => trigger_event('render_comment_author', $author_name), 137 193 'DATE' => format_date($row['date'], true), 138 'CONTENT' => trigger_event('render_comment_content',$row['content']) 194 'CONTENT' => trigger_event('render_comment_content',$row['content']), 195 'IS_PENDING' => ('false' == $row['validated']), 139 196 ) 140 197 ); … … 143 200 } 144 201 145 $template->assign('LIST', implode(',', $list) );146 147 202 // +-----------------------------------------------------------------------+ 148 203 // | sending html code | -
trunk/admin/include/add_core_tabs.inc.php
r23382 r25084 60 60 61 61 case 'comments': 62 $sheets[''] = array('caption' => l10n('User comments validation'), 'url' => '');62 $sheets[''] = array('caption' => l10n('User comments'), 'url' => ''); 63 63 break; 64 64 -
trunk/admin/themes/default/template/admin.tpl
r23382 r25084 73 73 <li><a class="icon-signal" href="{$U_HISTORY_STAT}">{'History'|@translate}</a></li> 74 74 <li><a class="icon-tools" href="{$U_MAINTENANCE}">{'Maintenance'|@translate}</a></li> 75 {if isset($U_ PENDING_COMMENTS)}76 <li><a class="icon-chat" href="{$U_ PENDING_COMMENTS}">{'Pending Comments'|@translate}</a></li>75 {if isset($U_COMMENTS)} 76 <li><a class="icon-chat" href="{$U_COMMENTS}">{'Comments'|@translate}{if $NB_PENDING_COMMENTS > 0}<span class="adminMenubarCounter" title="{'%d waiting for validation'|translate:$NB_PENDING_COMMENTS}">{$NB_PENDING_COMMENTS}</span>{/if}</a></li> 77 77 {/if} 78 78 <li><a class="icon-arrows-cw" href="{$U_UPDATES}">{'Updates'|@translate}</a></li> -
trunk/admin/themes/default/template/comments.tpl
r22812 r25084 44 44 {/literal}{/footer_script} 45 45 46 <h2>{'Pending Comments'|@translate} {$TABSHEET_TITLE}</h2> 46 <h2>{'User comments'|@translate} {$TABSHEET_TITLE}</h2> 47 48 <p style="text-align:left;margin-left:1em;"> 49 <a href="{$F_ACTION}&filter=all" class="{if $filter == 'all'}commentFilterSelected{/if}">{'All'|@translate}</a> ({$nb_total}) 50 | <a href="{$F_ACTION}&filter=pending" class="{if $filter == 'pending'}commentFilterSelected{/if}">{'Waiting'|@translate}</a> ({$nb_pending}) 51 </p> 47 52 48 53 {if !empty($comments) } … … 58 63 <div class="comment"> 59 64 <a class="illustration" href="{$comment.U_PICTURE}"><img src="{$comment.TN_SRC}"></a> 60 <p class="commentHeader"> <strong>{$comment.AUTHOR}</strong> - <em>{$comment.DATE}</em></p>65 <p class="commentHeader">{if $comment.IS_PENDING}<span class="pendingFlag">{'Waiting'|@translate}</span> - {/if}<strong>{$comment.AUTHOR}</strong> - <em>{$comment.DATE}</em></p> 61 66 <blockquote>{$comment.CONTENT}</blockquote> 62 67 </div>
Note: See TracChangeset
for help on using the changeset viewer.