Make WordPress Core

Changeset 10102


Ignore:
Timestamp:
12/07/2008 07:10:47 AM (16 years ago)
Author:
markjaquith
Message:

Much better In Response To column, with pretty comment bubble

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/edit-comments.php

    r10082 r10102  
    191191list($_comments, $total) = _wp_get_comment_list( $comment_status, $search_dirty, $start, $comments_per_page + 5, $post_id, $comment_type ); // Grab a few extra
    192192
     193$_comment_post_ids = array();
     194foreach ( $_comments as $_c ) {
     195    $_comment_post_ids[] = $_c->comment_post_ID;
     196}
     197$_comment_pending_count_temp = (array) get_pending_comments_num($_comment_post_ids);
     198foreach ( (array) $_comment_post_ids as $_cpid )
     199    $_comment_pending_count[$_cpid] = isset( $_comment_pending_count_temp[$_cpid] ) ? $_comment_pending_count_temp[$_cpid] : 0;
     200if ( empty($_comment_pending_count) )
     201    $_comment_pending_count = array();
     202
    193203$comments = array_slice($_comments, 0, $comments_per_page);
    194204$extra_comments = array_slice($_comments, $comments_per_page);
  • trunk/wp-admin/includes/template.php

    r10092 r10102  
    19451945 */
    19461946function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true, $from_ajax = false ) {
    1947     global $comment, $post;
     1947    global $comment, $post, $_comment_pending_count;
    19481948    $comment = get_comment( $comment_id );
    19491949    $post = get_post($comment->comment_post_ID);
    19501950    $the_comment_status = wp_get_comment_status($comment->comment_ID);
    1951 
    1952     if ( current_user_can( 'edit_post', $post->ID ) ) {
    1953         $post_link = "<a href='" . get_edit_post_link($post->ID) . "'>";
    1954         $post_link .= get_the_title($comment->comment_post_ID) . '</a>';
    1955     } else {
    1956         $post_link = get_the_title($comment->comment_post_ID);
    1957     }
    19581951
    19591952    $author_url = get_comment_author_url();
     
    19721965        $ptime = mysql2date(__('Y/m/d \a\t g:i A'), $comment->comment_date );
    19731966
    1974     $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" ) );
    1975     $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" ) );
    1976     $unapprove_url = clean_url( wp_nonce_url( "comment.php?action=unapprovecomment&p=$comment->comment_post_ID&c=$comment->comment_ID", "unapprove-comment_$comment->comment_ID" ) );
    1977     $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" ) );
     1967    $delete_url = clean_url( wp_nonce_url( "comment.php?action=deletecomment&p=$post->ID&c=$comment->comment_ID", "delete-comment_$comment->comment_ID" ) );
     1968    $approve_url = clean_url( wp_nonce_url( "comment.php?action=approvecomment&p=$post->ID&c=$comment->comment_ID", "approve-comment_$comment->comment_ID" ) );
     1969    $unapprove_url = clean_url( wp_nonce_url( "comment.php?action=unapprovecomment&p=$post->ID&c=$comment->comment_ID", "unapprove-comment_$comment->comment_ID" ) );
     1970    $spam_url = clean_url( wp_nonce_url( "comment.php?action=deletecomment&dt=spam&p=$post->ID&c=$comment->comment_ID", "delete-comment_$comment->comment_ID" ) );
    19781971
    19791972    echo "<tr id='comment-$comment->comment_ID' class='$the_comment_status'>";
     
    19931986                if ( !$checkbox ) break;
    19941987                echo '<th scope="row" class="check-column">';
    1995                 if ( current_user_can('edit_post', $comment->comment_post_ID) ) echo "<input type='checkbox' name='delete_comments[]' value='$comment->comment_ID' />";
     1988                if ( current_user_can('edit_post', $post->ID) ) echo "<input type='checkbox' name='delete_comments[]' value='$comment->comment_ID' />";
    19961989                echo '</th>';
    19971990                break;
     
    20122005                $actions = array();
    20132006
    2014                 if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
     2007                if ( current_user_can('edit_post', $post->ID) ) {
    20152008                    $actions['approve'] = "<a href='$approve_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=approved vim-a' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>';
    20162009                    $actions['unapprove'] = "<a href='$unapprove_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved vim-u' title='" . __( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>';
     
    20732066            case 'response':
    20742067                if ( 'single' !== $mode ) {
     2068                    if ( isset( $_comment_pending_count[$post->ID] ) ) {
     2069                        $pending_comments = absint( $_comment_pending_count[$post->ID] );
     2070                    } else {
     2071                        $_comment_pending_count_temp = (array) get_pending_comments_num( array( $post->ID ) );
     2072                        $pending_comments = $_comment_pending_count[$post->ID] = $_comment_pending_count_temp[$post->ID];
     2073                    }
     2074                    if ( current_user_can( 'edit_post', $post->ID ) ) {
     2075                        $post_link = "<a href='" . get_edit_post_link($post->ID) . "'>";
     2076                        $post_link .= get_the_title($post->ID) . '</a>';
     2077                    } else {
     2078                        $post_link = get_the_title($post->ID);
     2079                    }
    20752080                    echo "<td $attributes>\n";
    2076                     echo "&quot;$post_link&quot; ";
    2077                     echo '<a href="edit-comments.php?p=' . $post->ID;
    2078                     if ( !empty($_GET['comment_type']) ) echo '&amp;comment_type=' . htmlspecialchars( $_GET['comment_type'] );
    2079                     echo '">' . sprintf ( __ngettext('(%s)', '(%s)', $post->comment_count), number_format_i18n($post->comment_count) ) . '</a> <a href="' . get_permalink($post->ID) . '">#</a><br />';
    2080                     echo get_the_time(__('Y/m/d \a\t g:ia'));
     2081                    echo "&#8220;$post_link&#8221;<br />";
     2082
     2083                    echo '<span class="post-com-count-wrapper">';
     2084                    $pending_phrase = sprintf( __('%s pending'), number_format( $pending_comments ) );
     2085                    if ( $pending_comments )
     2086                        echo '<strong>';
     2087                    comments_number("<a href='edit-comments.php?p=$post->ID' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('0') . '</span></a>', "<a href='edit-comments.php?p=$post->ID' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('1') . '</span></a>', "<a href='edit-comments.php?p=$post->ID' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('%') . '</span></a>');
     2088                    if ( $pending_comments )
     2089                        echo '</strong>';
     2090                    echo '</span> ';
     2091                    echo "<a href='" . get_permalink( $post->ID ) . "'>#</a>";
    20812092                    echo '</td>';
    20822093                }
  • trunk/wp-admin/wp-admin.css

    r10089 r10102  
    10951095}
    10961096
     1097.column-response .post-com-count-wrapper {
     1098}
     1099
     1100.column-response .post-com-count {
     1101    float: left;
     1102    margin-right: 5px;
     1103    text-align: center;
     1104}
     1105
    10971106/* end menu stuff */
    10981107
  • trunk/wp-includes/script-loader.php

    r10101 r10102  
    303303    $rtl_styles = array( 'global', 'colors', 'dashboard', 'ie', 'install', 'login', 'media', 'theme-editor', 'upload', 'widgets', 'press-this', 'plugin-install', 'farbtastic' );
    304304
    305     $styles->add( 'wp-admin', '/wp-admin/wp-admin.css', array(), '20081206' );
     305    $styles->add( 'wp-admin', '/wp-admin/wp-admin.css', array(), '20081207' );
    306306    $styles->add_data( 'wp-admin', 'rtl', '/wp-admin/rtl.css' );
    307307
Note: See TracChangeset for help on using the changeset viewer.