WordPress.org

Make WordPress Core

Changeset 23371


Ignore:
Timestamp:
02/02/2013 01:31:06 AM (5 years ago)
Author:
azaozz
Message:

Posts screen: show when a post is "locked", hide the checkbox, Quick Edit and Trash links, props dh-shredder, see #23312

Location:
trunk/wp-admin
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/css/wp-admin.css

    r23370 r23371  
    25282528}
    25292529
     2530tr.wp-locked .locked-indicator {
     2531    background: url('../images/lock16.png') no-repeat;
     2532    margin: -2px 0 0 8px;
     2533    height: 16px;
     2534    width: 16px;
     2535}
     2536
     2537tr.wp-locked .check-column label,
     2538tr.wp-locked .check-column input[type="checkbox"],
     2539tr.wp-locked .row-actions .inline,
     2540tr.wp-locked .row-actions .trash,
     2541.lock-holder {
     2542    display: none;
     2543}
     2544
     2545tr.wp-locked .lock-holder {
     2546    display: inline;
     2547}
     2548
    25302549.fixed .column-comments .sorting-indicator {
    25312550    margin-top: 3px;
  • trunk/wp-admin/includes/class-wp-posts-list-table.php

    r23354 r23371  
    473473        $post_type_object = get_post_type_object( $post->post_type );
    474474        $can_edit_post = current_user_can( $post_type_object->cap->edit_post, $post->ID );
     475        $lock_holder_id = wp_check_post_lock( $post->ID );
     476        $lock_holder = '';
    475477
    476478        $alternate = 'alternate' == $alternate ? '' : 'alternate';
    477479        $classes = $alternate . ' iedit author-' . ( get_current_user_id() == $post->post_author ? 'self' : 'other' );
     480   
     481        if ( $lock_holder_id ) {
     482            $classes .= ' wp-locked';
     483            $lock_holder_data = get_user_by( 'id', $lock_holder_id );
     484
     485            if ( $lock_holder_data )
     486                $lock_holder = esc_html( sprintf( __('Currently edited by %s'), $lock_holder_data->data->display_name ) );
     487        }
    478488    ?>
    479489        <tr id="post-<?php echo $post->ID; ?>" class="<?php echo implode( ' ', get_post_class( $classes, $post->ID ) ); ?>" valign="top">
     
    496506            ?>
    497507            <th scope="row" class="check-column">
    498                 <?php if ( $can_edit_post ) { ?>
     508                <?php
     509                if ( $can_edit_post ) {
     510
     511                ?>
    499512                <label class="screen-reader-text" for="cb-select-<?php the_ID(); ?>"><?php printf( __( 'Select %s' ), $title ); ?></label>
    500513                <input id="cb-select-<?php the_ID(); ?>" type="checkbox" name="post[]" value="<?php the_ID(); ?>" />
    501                 <?php } ?>
     514                <div class="locked-indicator"></div>
     515                <?php
     516                }
     517                ?>
    502518            </th>
    503519            <?php
     
    526542
    527543                    $pad = str_repeat( '&#8212; ', $level );
    528 ?>
    529             <td <?php echo $attributes ?>><strong><?php if ( $can_edit_post && $post->post_status != 'trash' ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $title ) ); ?>"><?php echo $pad; echo $title ?></a><?php } else { echo $pad; echo $title; }; _post_states( $post ); echo isset( $parent_name ) ? ' | ' . $post_type_object->labels->parent_item_colon . ' ' . esc_html( $parent_name ) : ''; ?></strong>
    530 <?php
    531                 }
    532                 else {
     544
     545                    ?>
     546                    <td <?php echo $attributes ?>><strong><?php if ( $can_edit_post && $post->post_status != 'trash' ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $title ) ); ?>"><?php echo $pad; echo $title ?></a><?php } else { echo $pad; echo $title; }; _post_states( $post ); echo isset( $parent_name ) ? ' | ' . $post_type_object->labels->parent_item_colon . ' ' . esc_html( $parent_name ) : ''; ?></strong>
     547                    <?php
     548
     549                    if ( $can_edit_post && $post->post_status != 'trash' ) {
     550                        ?>
     551                        <span class="lock-holder"><?php echo $lock_holder; ?></span>
     552                        <?php
     553                    }
     554                } else {
    533555                    $attributes = 'class="post-title page-title column-title"' . $style;
    534556
    535557                    $pad = str_repeat( '&#8212; ', $level );
    536 ?>
    537             <td <?php echo $attributes ?>><strong><?php if ( $can_edit_post && $post->post_status != 'trash' ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $title ) ); ?>"><?php echo $pad; echo $title ?></a><?php } else { echo $pad; echo $title; }; _post_states( $post ); ?></strong>
    538 <?php
     558
     559                    ?>
     560                    <td <?php echo $attributes ?>><strong><?php if ( $can_edit_post && $post->post_status != 'trash' ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $title ) ); ?>"><?php echo $pad; echo $title ?></a><?php } else { echo $pad; echo $title; }; _post_states( $post ); ?></strong>
     561                    <?php
     562
     563                    if ( $can_edit_post && $post->post_status != 'trash' ) {
     564                        ?>
     565                        <span class="lock-holder"><?php echo $lock_holder; ?></span>
     566                        <?php
     567                    }
     568
    539569                    if ( 'excerpt' == $mode && current_user_can( 'read_post', $post->ID ) )
    540570                        the_excerpt();
Note: See TracChangeset for help on using the changeset viewer.