Changeset 7082
- Timestamp:
- 02/28/2008 06:50:25 AM (17 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-ajax.php
r6983 r7082 355 355 $search = isset($_POST['s']) ? $_POST['s'] : false; 356 356 $start = isset($_POST['page']) ? intval($_POST['page']) * 25 - 1: 24; 357 358 list($comments, $total) = _wp_get_comment_list( $search, $start, 1 ); 357 $status = isset($_POST['comment_status']) ? $_POST['comment_status'] : false; 358 $mode = isset($_POST['mode']) ? $_POST['mode'] : 'detail'; 359 360 list($comments, $total) = _wp_get_comment_list( $status, $search, $start, 1 ); 359 361 360 362 if ( !$comments ) … … 364 366 get_comment( $comment ); 365 367 ob_start(); 366 _wp_comment_ list_item( $comment->comment_ID);368 _wp_comment_row( $comment->comment_ID, $mode ); 367 369 $comment_list_item = ob_get_contents(); 368 370 ob_end_clean(); -
trunk/wp-admin/edit-comments.php
r7057 r7082 52 52 else 53 53 $comment_status = ''; 54 55 if ( isset($_GET['s']) ) 56 $search_dirty = $_GET['s']; 57 else 58 $search_dirty = ''; 59 $search = attribute_escape( $search ); 54 60 ?> 55 61 <?php … … 106 112 107 113 <p id="post-search"> 108 <input type="text" id="post-search-input" name="s" value="<?php if (isset($_GET['s'])) echo attribute_escape($_GET['s']); ?>" />114 <input type="text" id="post-search-input" name="s" value="<?php echo $search; ?>" /> 109 115 <input type="submit" value="<?php _e( 'Search Comments' ); ?>" class="button" /> 110 116 </p> … … 112 118 <input type="hidden" name="mode" value="<?php echo $mode; ?>" /> 113 119 <input type="hidden" name="comment_status" value="<?php echo $comment_status; ?>" /> 120 </form> 114 121 115 122 <ul class="view-switch"> … … 127 134 $start = $offset = ( $page - 1 ) * 20; 128 135 129 list($_comments, $total) = _wp_get_comment_list( $comment_status, isset($_GET['s']) ? $_GET['s'] : false, $start, 25 ); // Grab a few extra136 list($_comments, $total) = _wp_get_comment_list( $comment_status, $search_dirty, $start, 25 ); // Grab a few extra 130 137 131 138 $comments = array_slice($_comments, 0, 20); … … 140 147 141 148 ?> 149 150 <form id="comments-form" action="" method="post"> 142 151 143 152 <div class="tablenav"> … … 176 185 <tbody id="the-comment-list" class="list:comment"> 177 186 <?php 178 foreach ($comments as $comment) { 179 $post = get_post($comment->comment_post_ID); 180 $authordata = get_userdata($post->post_author); 181 $the_comment_status = wp_get_comment_status($comment->comment_ID); 182 $class = ('unapproved' == $the_comment_status) ? 'unapproved' : ''; 183 $post_link = '<a href="' . get_comment_link() . '">' . get_the_title($comment->comment_post_ID) . '</a>'; 184 $author_url = get_comment_author_url(); 185 if ( 'http://' == $author_url ) 186 $author_url = ''; 187 $author_url_display = $author_url; 188 if ( strlen($author_url_display) > 50 ) 189 $author_url_display = substr($author_url_display, 0, 49) . '...'; 190 $ptime = get_post_time('G', true); 191 if ( ( abs(time() - $ptime) ) < 86400 ) 192 $ptime = sprintf( __('%s ago'), human_time_diff( $ptime ) ); 193 else 194 $ptime = mysql2date(__('Y/m/d \a\t g:i A'), $post->post_date); 195 196 $delete_url = clean_url( wp_nonce_url( "comment.php?action=deletecomment&p=$comment->comment_post_ID&c=$comment->comment_ID", "delete-comment_$comment->comment_ID" ) ); 197 $approve_url = clean_url( wp_nonce_url( "comment.php?action=approvecomment&p=$comment->comment_post_ID&c=$comment->comment_ID", "approve-comment_$comment->comment_ID" ) ); 198 $spam_url = clean_url( wp_nonce_url( "comment.php?action=deletecomment&dt=spam&p=$comment->comment_post_ID&c=$comment->comment_ID", "delete-comment_$comment->comment_ID" ) ); 199 200 ?> 201 <tr id="comment-<?php echo $comment->comment_ID; ?>" class='<?php echo $class; ?>'> 202 <td style="text-align: center;"><?php if ( current_user_can('edit_post', $comment->comment_post_ID) ) { ?><input type="checkbox" name="delete_comments[]" value="<?php echo $comment->comment_ID; ?>" /><?php } ?></td> 203 <td class="comment"> 204 <p class="comment-author"><strong><a class="row-title" href="comment.php?action=editcomment&c=<?php echo $comment->comment_ID?>"><?php comment_author(); ?></a></strong><br /> 205 <?php if ( !empty($author_url) ) : ?> 206 <a href="<?php echo $author_url ?>"><?php echo $author_url_display; ?></a> | 207 <?php endif; ?> 208 <?php if ( !empty($comment->comment_author_email) ): ?> 209 <?php comment_author_email_link() ?> | 210 <?php endif; ?> 211 <a href="edit-comments.php?s=<?php comment_author_IP() ?>&mode=detail"><?php comment_author_IP() ?></a> 212 </p> 213 <p><?php if ( 'list' == $mode ) comment_excerpt(); else comment_text(); ?></p> 214 <p><?php printf(__('From %1$s, %2$s'), $post_link, $ptime) ?></p> 215 </td> 216 <td><?php comment_date(__('Y/m/d')); ?></td> 217 <td> 218 <?php if ( current_user_can('edit_post', $comment->comment_post_ID) ) { 219 if ( 'approved' != $the_comment_status ) { 220 if ( $comment_status ) // we're looking at list of only approved or only unapproved comments 221 echo "<a href='$approve_url' class='delete:the-comment-list:comment-$comment->comment_ID:33FF33:action=dim-comment' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a> | '; 222 else // we're looking at all comments 223 echo "<span class='approve'><a href='$approve_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:none:33FF33' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a> | </span>'; 224 } 225 echo "<a href='$spam_url' class='delete:the-comment-list:comment-$comment->comment_ID::spam=1' title='" . __( 'Mark this comment as spam' ) . "'>" . __( 'Spam' ) . '</a> | '; 226 echo "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID delete'>" . __('Delete') . '</a>'; 227 } 228 ?> 229 </td> 230 </tr> 231 <?php 232 } // end foreach 233 ?></tbody> 187 foreach ($comments as $comment) 188 _wp_comment_row( $comment->comment_ID, $mode ); 189 ?> 190 </tbody> 191 <tbody id="the-extra-comment-list" class="list:comment" style="display: none;"> 192 <?php 193 foreach ($extra_comments as $comment) 194 _wp_comment_row( $comment->comment_ID, $mode ); 195 ?> 196 </tbody> 234 197 </table> 198 199 </form> 200 201 <form id="get-extra-comments" method="post" action="" class="add:the-extra-comment-list:" style="display: none;"> 202 <input type="hidden" name="s" value="<?php echo $search; ?>" /> 203 <input type="hidden" name="mode" value="<?php echo $mode; ?>" /> 204 <input type="hidden" name="comment_status" value="<?php echo $comment_status; ?>" /> 205 <input type="hidden" name="page" value="<?php echo isset($_REQUEST['page']) ? absint( $_REQUEST['page'] ) : 1; ?>" /> 206 <?php wp_nonce_field( 'add-comment', '_ajax_nonce', false ); ?> 207 </form> 235 208 236 209 <div id="ajax-response"></div> … … 252 225 </div> 253 226 227 </div> 228 254 229 <?php include('admin-footer.php'); ?> -
trunk/wp-admin/edit-pages.php
r7079 r7082 165 165 166 166 <?php 167 if ( 1 == count($posts) && isset( $_GET['page_id'] ) ) { 167 168 if ( 1 == count($posts) && isset( $_GET['page_id'] ) ) : 168 169 169 170 $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved != 'spam' ORDER BY comment_date"); 170 if ( $comments) {171 if ( $comments ) : 171 172 // Make sure comments, post, and post_author are cached 172 173 update_comment_cache($comments); … … 174 175 $authordata = get_userdata($post->post_author); 175 176 ?> 176 <h3 id="comments"><?php _e('Comments') ?></h3> 177 <ol id="the-comment-list" class="list:comment commentlist"> 178 <?php 179 $i = 0; 180 foreach ( $comments as $comment ) { 181 _wp_comment_list_item( $comment->comment_ID, ++$i ); 182 } 183 echo '</ol>'; 184 } // end if comments 185 ?> 186 <?php } ?> 177 178 <br class="clear" /> 179 180 <table class="widefat" style="margin-top: .5em"> 181 <thead> 182 <tr> 183 <th scope="col"><?php _e('Comment') ?></th> 184 <th scope="col"><?php _e('Date') ?></th> 185 <th scope="col"><?php _e('Actions') ?></th> 186 </tr> 187 </thead> 188 <tbody id="the-comment-list" class="list:comment"> 189 <?php 190 foreach ($comments as $comment) 191 _wp_comment_row( $comment->comment_ID, 'detail', false ); 192 ?> 193 </tbody> 194 </table> 195 196 <?php 197 198 endif; // comments 199 endif; // posts; 200 201 ?> 187 202 188 203 </div> -
trunk/wp-admin/edit.php
r7057 r7082 185 185 echo "<div class='tablenav-pages'>$page_links</div>"; 186 186 ?> 187 <br style="clear:both;" />188 </div> 189 190 <?php 191 192 if ( 1 == count($posts) && isset( $_GET['p'] ) ) {187 <br class="clear" /> 188 </div> 189 190 <?php 191 192 if ( 1 == count($posts) && isset( $_GET['p'] ) ) : 193 193 194 194 $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved != 'spam' ORDER BY comment_date"); 195 if ( $comments) {195 if ( $comments ) : 196 196 // Make sure comments, post, and post_author are cached 197 197 update_comment_cache($comments); … … 199 199 $authordata = get_userdata($post->post_author); 200 200 ?> 201 <h3 id="comments"><?php _e('Comments') ?></h3> 202 <ol id="the-comment-list" class="list:comment commentlist"> 203 <?php 204 $i = 0; 205 foreach ( $comments as $comment ) { 206 _wp_comment_list_item( $comment->comment_ID, ++$i ); 207 } 208 echo '</ol>'; 209 } // end if comments 210 ?> 211 <?php } ?> 201 202 <br class="clear" /> 203 204 <table class="widefat" style="margin-top: .5em"> 205 <thead> 206 <tr> 207 <th scope="col"><?php _e('Comment') ?></th> 208 <th scope="col"><?php _e('Date') ?></th> 209 <th scope="col"><?php _e('Actions') ?></th> 210 </tr> 211 </thead> 212 <tbody id="the-comment-list" class="list:comment"> 213 <?php 214 foreach ($comments as $comment) 215 _wp_comment_row( $comment->comment_ID, 'detail', false ); 216 ?> 217 </tbody> 218 </table> 219 220 <?php 221 222 endif; // comments 223 endif; // posts; 224 225 ?> 226 212 227 </div> 213 228 -
trunk/wp-admin/includes/template.php
r7078 r7082 593 593 } 594 594 595 function _wp_comment_list_item( $id, $alt = 0 ) { 596 global $authordata, $comment; 597 $comment =& get_comment( $id ); 598 $id = (int) $comment->comment_ID; 599 $class = ''; 595 function _wp_comment_row( $comment_id, $mode, $checkbox = true ) { 596 global $comment, $post; 597 $comment = get_comment( $comment_id ); 600 598 $post = get_post($comment->comment_post_ID); 601 599 $authordata = get_userdata($post->post_author); 602 $comment_status = wp_get_comment_status($id); 603 if ( 'unapproved' == $comment_status ) 604 $class .= ' unapproved'; 605 if ( $alt % 2 ) 606 $class .= ' alternate'; 607 echo "<li id='comment-$id' class='$class'>"; 600 $the_comment_status = wp_get_comment_status($comment->comment_ID); 601 $class = ('unapproved' == $the_comment_status) ? 'unapproved' : ''; 602 $post_link = '<a href="' . get_comment_link() . '">' . get_the_title($comment->comment_post_ID) . '</a>'; 603 $author_url = get_comment_author_url(); 604 if ( 'http://' == $author_url ) 605 $author_url = ''; 606 $author_url_display = $author_url; 607 if ( strlen($author_url_display) > 50 ) 608 $author_url_display = substr($author_url_display, 0, 49) . '...'; 609 $ptime = get_post_time('G', true); 610 if ( ( abs(time() - $ptime) ) < 86400 ) 611 $ptime = sprintf( __('%s ago'), human_time_diff( $ptime ) ); 612 else 613 $ptime = mysql2date(__('Y/m/d \a\t g:i A'), $post->post_date); 614 615 $delete_url = clean_url( wp_nonce_url( "comment.php?action=deletecomment&p=$comment->comment_post_ID&c=$comment->comment_ID", "delete-comment_$comment->comment_ID" ) ); 616 $approve_url = clean_url( wp_nonce_url( "comment.php?action=approvecomment&p=$comment->comment_post_ID&c=$comment->comment_ID", "approve-comment_$comment->comment_ID" ) ); 617 $spam_url = clean_url( wp_nonce_url( "comment.php?action=deletecomment&dt=spam&p=$comment->comment_post_ID&c=$comment->comment_ID", "delete-comment_$comment->comment_ID" ) ); 618 608 619 ?> 609 <p><strong class="comment-author"><?php comment_author(); ?></strong> <?php if ($comment->comment_author_email) { ?>| <?php comment_author_email_link() ?> <?php } if ($comment->comment_author_url && 'http://' != $comment->comment_author_url) { ?> | <?php comment_author_url_link() ?> <?php } ?>| <?php _e('IP:') ?> <a href="http://ws.arin.net/cgi-bin/whois.pl?queryinput=<?php comment_author_IP() ?>"><?php comment_author_IP() ?></a></p> 610 611 <?php comment_text() ?> 612 613 <p><?php comment_date(__('M j, g:i A')); ?> — [ 614 <?php 615 if ( current_user_can('edit_post', $comment->comment_post_ID) ) { 616 echo " <a href='comment.php?action=editcomment&c=$id'>" . __('Edit') . '</a>'; 617 $url = clean_url( wp_nonce_url( "comment.php?action=deletecomment&p=$comment->comment_post_ID&c=$id", "delete-comment_$id" ) ); 618 echo " | <a href='$url' class='delete:the-comment-list:comment-$id'>" . __('Delete') . '</a> '; 619 if ( ('none' != $comment_status) && ( current_user_can('moderate_comments') ) ) { 620 $url = clean_url( wp_nonce_url( "comment.php?action=unapprovecomment&p=$comment->comment_post_ID&c=$id", "unapprove-comment_$id" ) ); 621 echo "<span class='unapprove'> | <a href='$url' class='dim:the-comment-list:comment-$id:unapproved:FFFF33'>" . __('Unapprove') . '</a> </span>'; 622 $url = clean_url( wp_nonce_url( "comment.php?action=approvecomment&p=$comment->comment_post_ID&c=$id", "approve-comment_$id" ) ); 623 echo "<span class='approve'> | <a href='$url' class='dim:the-comment-list:comment-$id:unapproved:33FF33:33FF33'>" . __('Approve') . '</a> </span>'; 624 } 625 $url = clean_url( wp_nonce_url( "comment.php?action=deletecomment&dt=spam&p=$comment->comment_post_ID&c=$id", "delete-comment_$id" ) ); 626 echo " | <a href='$url' class='delete:the-comment-list:comment-$id::spam=1'>" . __('Spam') . '</a> '; 627 } 628 if ( !is_single() ) { 629 $post = get_post($comment->comment_post_ID, OBJECT, 'display'); 630 $post_title = wp_specialchars( $post->post_title, 'double' ); 631 $post_title = ('' == $post_title) ? "# $comment->comment_post_ID" : $post_title; 632 ?> 633 ] — <a href="<?php echo get_permalink($comment->comment_post_ID); ?>"><?php echo $post_title; ?></a> 634 <?php } ?> 635 </p> 636 </li> 637 <?php 620 <tr id="comment-<?php echo $comment->comment_ID; ?>" class='<?php echo $class; ?>'> 621 <?php if ( $checkbox ) : ?> 622 <td style="text-align: center;"><?php if ( current_user_can('edit_post', $comment->comment_post_ID) ) { ?><input type="checkbox" name="delete_comments[]" value="<?php echo $comment->comment_ID; ?>" /><?php } ?></td> 623 <?php endif; ?> 624 <td class="comment"> 625 <p class="comment-author"><strong><a class="row-title" href="comment.php?action=editcomment&c=<?php echo $comment->comment_ID?>"><?php comment_author(); ?></a></strong><br /> 626 <?php if ( !empty($author_url) ) : ?> 627 <a href="<?php echo $author_url ?>"><?php echo $author_url_display; ?></a> | 628 <?php endif; ?> 629 <?php if ( !empty($comment->comment_author_email) ): ?> 630 <?php comment_author_email_link() ?> | 631 <?php endif; ?> 632 <a href="edit-comments.php?s=<?php comment_author_IP() ?>&mode=detail"><?php comment_author_IP() ?></a> 633 </p> 634 <p><?php if ( 'list' == $mode ) comment_excerpt(); else comment_text(); ?></p> 635 <p><?php printf(__('From %1$s, %2$s'), $post_link, $ptime) ?></p> 636 </td> 637 <td><?php comment_date(__('Y/m/d')); ?></td> 638 <td> 639 <?php if ( current_user_can('edit_post', $comment->comment_post_ID) ) { 640 if ( 'approved' != $the_comment_status ) { 641 if ( $comment_status ) // we're looking at list of only approved or only unapproved comments 642 echo "<a href='$approve_url' class='delete:the-comment-list:comment-$comment->comment_ID:33FF33:action=dim-comment' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a> | '; 643 else // we're looking at all comments 644 echo "<span class='approve'><a href='$approve_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:none:33FF33' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a> | </span>'; 645 } 646 echo "<a href='$spam_url' class='delete:the-comment-list:comment-$comment->comment_ID::spam=1' title='" . __( 'Mark this comment as spam' ) . "'>" . __( 'Spam' ) . '</a> | '; 647 echo "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID delete'>" . __('Delete') . '</a>'; 648 } 649 ?> 650 </td> 651 </tr> 652 <?php 638 653 } 639 654 -
trunk/wp-admin/js/edit-comments.js
r7075 r7082 1 var list; var extra;1 var theList; var theExtraList; 2 2 jQuery(function($) { 3 3 … … 25 25 }); 26 26 27 if ( extra.size() == 0 || extra.children().size() == 0 ) {27 if ( theExtraList.size() == 0 || theExtraList.children().size() == 0 ) { 28 28 return; 29 29 } 30 30 31 list[0].wpList.add( extra.children(':eq(0)').remove().clone() );31 theList.get(0).wpList.add( theExtraList.children(':eq(0)').remove().clone() ); 32 32 $('#get-extra-comments').submit(); 33 33 } 34 34 35 extra= $('#the-extra-comment-list').wpList( { alt: '', delColor: 'none', addColor: 'none' } );36 list = $('#the-comment-list').wpList( { dimAfter : dimAfter, delAfter: delAfter, addColor: 'none' } );35 theExtraList = $('#the-extra-comment-list').wpList( { alt: '', delColor: 'none', addColor: 'none' } ); 36 theList = $('#the-comment-list').wpList( { alt: '', dimAfter: dimAfter, delAfter: delAfter, addColor: 'none' } ); 37 37 38 38 } ); -
trunk/wp-includes/js/wp-lists.js
r7050 r7082 63 63 64 64 parseClass: function(e,t) { 65 var c = []; try { c = $(e).attr('class').match(new RegExp(t+':[A-Za-z0-9:_=-]+'))[0].split(':'); } catch(r) {} 65 var c = [], cl; 66 try { 67 cl = $(e).attr('class') || ''; 68 cl = cl.match(new RegExp(t+':[A-Za-z0-9:_=-]+')); 69 if ( cl ) { c = cl[0].split(':'); } 70 } catch(r) {} 66 71 return c; 67 72 }, … … 88 93 var list = this; e = $(e); s = s || {}; 89 94 var cls = wpList.parseClass(e,'add'); 90 s = $.extend(s, {91 element: s.element || cls[2] || e.attr( 'id' ) || null,92 addColor: s.addColor || '#' + ( cls[3] || 'FFFF33' )93 } );94 95 s = wpList.pre.call( list, e, s, 'add' ); 96 97 s.element = cls[2] || e.attr( 'id' ) || s.element || null; 98 if ( cls[3] ) { s.addColor = '#' + cls[3]; } 99 else { s.addColor = s.addColor || '#FFFF33'; } 100 95 101 if ( !s ) { return false; } 96 102 … … 151 157 var list = this; e = $(e); s = s || {}; 152 158 var cls = wpList.parseClass(e,'delete'); 153 s = $.extend(s, {154 element: s.element || cls[2] || null,155 delColor: s.delColor || '#' + ( cls[3] || 'FF3333' )156 } );157 159 s = wpList.pre.call( list, e, s, 'delete' ); 160 161 s.element = cls[2] || s.element || null; 162 if ( cls[3] ) { s.delColor = '#' + cls[3]; } 163 else { s.delColor = s.delColor || '#FF3333'; } 164 158 165 if ( !s || !s.element ) { return false; } 159 166 … … 209 216 var list = this; e = $(e); s = s || {}; 210 217 var cls = wpList.parseClass(e,'dim'); 211 s = $.extend(s, {212 element: s.element || cls[2] || null,213 dimClass: s.dimClass || cls[3] || null,214 dimAddColor: s.dimAddColor || '#' + ( cls[4] || 'FFFF33' ),215 dimDelColor: s.dimDelColor || '#' + ( cls[5] || 'FF3333' )216 } );217 218 s = wpList.pre.call( list, e, s, 'dim' ); 219 220 s.element = cls[2] || s.element || null; 221 s.dimClass = cls[3] || s.dimClass || null; 222 if ( cls[4] ) { s.dimAddColor = '#' + cls[4]; } 223 else { s.dimAddColor = s.dimAddColor || '#FFFF33'; } 224 if ( cls[5] ) { s.dimDelColor = '#' + cls[5]; } 225 else { s.dimDelColor = s.dimDelColor || '#FF3333'; } 226 218 227 if ( !s || !s.element || !s.dimClass ) { return true; } 219 228 … … 281 290 282 291 add: function( e, s ) { 283 list = $(this);292 var list = $(this); 284 293 e = $(e); 285 294 -
trunk/wp-includes/script-loader.php
r7075 r7082 62 62 ) ); 63 63 64 $this->add( 'wp-lists', '/wp-includes/js/wp-lists.js', array('jquery'), '2008022 6' );64 $this->add( 'wp-lists', '/wp-includes/js/wp-lists.js', array('jquery'), '20080228' ); 65 65 $this->localize( 'wp-lists', 'wpListL10n', array( 66 66 'url' => get_option( 'siteurl' ) . '/wp-admin/admin-ajax.php' … … 126 126 'strong' => __('Strong') 127 127 ) ); 128 $this->add( 'admin-comments', '/wp-admin/js/edit-comments.js', array('wp-lists'), '2008022 7' );128 $this->add( 'admin-comments', '/wp-admin/js/edit-comments.js', array('wp-lists'), '20080228' ); 129 129 $this->add( 'admin-users', '/wp-admin/js/users.js', array('wp-lists'), '20070823' ); 130 130 $this->add( 'admin-forms', '/wp-admin/js/forms.js', false, '20080108' );
Note: See TracChangeset
for help on using the changeset viewer.