WordPress.org

Make WordPress Core

Changeset 24304


Ignore:
Timestamp:
05/20/13 19:36:29 (11 months ago)
Author:
azaozz
Message:

Post locks:

  • Change from IDs to classes for the notification-dialog divs so they can be reused.
  • Do not check post locks if the dialog's html is not present.
  • Do not check post locks if there is only one user on a single site install.

See #23697.

Location:
trunk/wp-admin
Files:
4 edited

Legend:

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

    r24294 r24304  
    33923392} 
    33933393 
    3394 #notification-dialog { 
     3394.notification-dialog { 
    33953395    position: fixed; 
    33963396    top: 30%; 
     
    34033403} 
    34043404 
    3405 #notification-dialog-background { 
     3405.notification-dialog-background { 
    34063406    position: fixed; 
    34073407    top: 0; 
     
    34153415} 
    34163416 
    3417 #notification-dialog .post-locked-message, 
    3418 #notification-dialog .post-taken-over { 
     3417#post-lock-dialog .post-locked-message, 
     3418#post-lock-dialog .post-taken-over { 
    34193419    margin: 25px; 
    34203420} 
    34213421 
    3422 #notification-dialog .post-locked-message a.button { 
     3422#post-lock-dialog .post-locked-message a.button { 
    34233423    margin-right: 10px; 
    34243424} 
    34253425 
    3426 #notification-dialog .post-locked-avatar { 
     3426#post-lock-dialog .post-locked-avatar { 
    34273427    float: left; 
    34283428    margin: 0 20px 20px 0; 
    34293429} 
    34303430 
    3431 #notification-dialog .wp-tab-first { 
     3431#post-lock-dialog .wp-tab-first { 
    34323432    outline: 0; 
    34333433} 
    34343434 
    3435 #notification-dialog .locked-saving img { 
     3435#post-lock-dialog .locked-saving img { 
    34363436    float: left; 
    34373437    margin-right: 3px; 
    34383438} 
    34393439 
    3440 #notification-dialog-wrap.saving .locked-saving, 
    3441 #notification-dialog-wrap.saved .locked-saved { 
     3440#post-lock-dialog.saving .locked-saving, 
     3441#post-lock-dialog.saved .locked-saved { 
    34423442    display: inline; 
    34433443} 
  • trunk/wp-admin/includes/post.php

    r24206 r24304  
    12031203    } 
    12041204 
    1205     $class = $locked ? '' : ' class="hidden"'; 
     1205    $hidden = $locked ? '' : ' hidden'; 
    12061206 
    12071207    ?> 
    1208     <div id="notification-dialog-wrap"<?php echo $class; ?>> 
    1209     <div id="notification-dialog-background"></div> 
    1210     <div id="notification-dialog"> 
     1208    <div id="post-lock-dialog" class="notification-dialog-wrap<?php echo $hidden; ?>"> 
     1209    <div class="notification-dialog-background"></div> 
     1210    <div class="notification-dialog"> 
    12111211    <?php 
    12121212 
  • trunk/wp-admin/js/post.js

    r24303 r24304  
    257257        send = {}; 
    258258 
    259     if ( !post_id ) 
     259    if ( ! post_id || ! $('#post-lock-dialog').length ) 
    260260        return; 
    261261 
     
    277277        if ( received.lock_error ) { 
    278278            // show "editing taken over" message 
    279             wrap = $('#notification-dialog-wrap'); 
     279            wrap = $('#post-lock-dialog'); 
    280280 
    281281            if ( wrap.length && ! wrap.is(':visible') ) { 
     
    306306            $('#active_post_lock').val( received.new_lock ); 
    307307        } 
    308  
    309         if ( received.update_nonces ) { 
    310             $.each( received.update_nonces, function( selector, value ) { 
    311                 if ( selector.match(/^replace-/) ) 
    312                     $( '#' + selector.replace('replace-', '') ).val( value ); 
    313             }); 
    314         } 
    315308    } 
    316309}); 
     
    360353 
    361354    // Post locks: contain focus inside the dialog. If the dialog is shown, focus the first item. 
    362     $('#notification-dialog').on( 'keydown', function(e) { 
     355    $('#post-lock-dialog .notification-dialog').on( 'keydown', function(e) { 
    363356        if ( e.which != 9 ) 
    364357            return; 
  • trunk/wp-admin/post.php

    r24201 r24304  
    177177    } 
    178178 
    179     add_action( 'admin_footer', '_admin_notice_post_locked' ); 
     179    if ( is_multisite() ) { 
     180        add_action( 'admin_footer', '_admin_notice_post_locked' ); 
     181    } else { 
     182        $check_users = get_users( array( 'fields' => 'ID', 'number' => 2 ) ); 
     183 
     184        if ( count( $check_users ) > 1 ) 
     185            add_action( 'admin_footer', '_admin_notice_post_locked' ); 
     186 
     187        unset( $check_users ); 
     188    } 
    180189 
    181190    $title = $post_type_object->labels->edit_item; 
Note: See TracChangeset for help on using the changeset viewer.