Changeset 23681
- Timestamp:
- 03/13/2013 12:28:07 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 2 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/css/wp-admin.css
r23661 r23681 2426 2426 .fixed .column-date, 2427 2427 .fixed .column-parent, 2428 .fixed .column-links { 2428 .fixed .column-links, 2429 .fixed .column-author, 2430 .fixed .column-format { 2429 2431 width: 10%; 2430 2432 } 2431 2433 2432 2434 .fixed .column-response, 2433 .fixed .column-author,2434 2435 .fixed .column-categories, 2435 2436 .fixed .column-tags, … … 2530 2531 2531 2532 tr.wp-locked .locked-indicator { 2532 background: url('../images/lock 16.png') no-repeat;2533 margin: -2px 0 0 8px;2533 background: url('../images/lock.png') no-repeat; 2534 margin: -2px 0 0 6px; 2534 2535 height: 16px; 2535 2536 width: 16px; … … 2539 2540 tr.wp-locked .check-column input[type="checkbox"], 2540 2541 tr.wp-locked .row-actions .inline, 2541 tr.wp-locked .row-actions .trash, 2542 .lock-holder { 2542 tr.wp-locked .row-actions .trash { 2543 2543 display: none; 2544 }2545 2546 tr.wp-locked .lock-holder {2547 display: inline;2548 2544 } 2549 2545 … … 9035 9031 } 9036 9032 9033 tr.wp-locked .locked-indicator { 9034 background-image: url('../images/lock-2x.png'); 9035 background-size: 16px 16px; 9036 } 9037 9037 9038 th .comment-grey-bubble { 9038 9039 background-image: url('../images/comment-grey-bubble-2x.png'); -
trunk/wp-admin/edit.php
r23563 r23681 146 146 147 147 wp_enqueue_script('inline-edit-post'); 148 wp_enqueue_script('edit-post');149 148 150 149 $title = $post_type_object->labels->name; -
trunk/wp-admin/includes/class-wp-posts-list-table.php
r23560 r23681 554 554 echo "</strong>\n"; 555 555 556 if ( $lock_holder && $can_edit_post && $post->post_status != 'trash' ) { 557 printf( '<span class="lock-holder">%s</span>', 558 esc_html( sprintf( __( '%s is currently editing' ), $lock_holder->display_name ) ) ); 556 if ( $can_edit_post && $post->post_status != 'trash' ) { 557 if ( $lock_holder ) { 558 $locked_avatar = get_avatar( $lock_holder->ID, 18 ); 559 $locked_text = esc_html( sprintf( __( '%s is currently editing' ), $lock_holder->display_name ) ); 560 } else { 561 $locked_avatar = $locked_text = ''; 562 } 563 564 echo '<span class="locked-avatar">' . $locked_avatar . '</span> <span class="locked-text">' . $locked_text . "</span>\n"; 559 565 } 560 566 -
trunk/wp-admin/includes/misc.php
r23661 r23681 567 567 * @since 3.6 568 568 */ 569 function wp_check_locked_posts( $response, $data ) {569 function wp_check_locked_posts( $response, $data, $screen_id ) { 570 570 $checked = array(); 571 571 572 if ( array_key_exists( 'wp-check-locked', $data ) && is_array( $data['wp-check-locked'] ) ) {572 if ( 'edit-post' == $screen_id && array_key_exists( 'wp-check-locked', $data ) && is_array( $data['wp-check-locked'] ) ) { 573 573 foreach ( $data['wp-check-locked'] as $key ) { 574 574 $post_id = (int) substr( $key, 5 ); 575 575 576 if ( current_user_can( 'edit_post', $post_id ) && ( $user_id = wp_check_post_lock( $post_id ) ) ) { 577 if ( $user = get_userdata( $user_id ) ) 578 $checked[$key] = sprintf( __( '%s is currently editing' ), $user->display_name ); 576 if ( current_user_can( 'edit_post', $post_id ) && ( $user_id = wp_check_post_lock( $post_id ) ) && ( $user = get_userdata( $user_id ) ) ) { 577 $send = array(); 578 579 if ( ( $avatar = get_avatar( $user->ID, 18 ) ) && preg_match( "|src='([^']+)'|", $avatar, $matches ) ) 580 $send['avatar_src'] = $matches[1]; 581 582 $send['text'] = sprintf( __( '%s is currently editing' ), $user->display_name ); 583 $checked[$key] = $send; 579 584 } 580 585 } … … 586 591 return $response; 587 592 } 588 add_filter( 'heartbeat_received', 'wp_check_locked_posts', 10, 2);593 add_filter( 'heartbeat_received', 'wp_check_locked_posts', 10, 3 ); 589 594 590 595 /** -
trunk/wp-admin/js/inline-edit-post.js
r23444 r23681 291 291 }; 292 292 293 $(document).ready(function(){inlineEditPost.init();}); 294 })(jQuery); 293 $( document ).ready( function(){ inlineEditPost.init(); } ); 294 295 // Show/hide locks on posts 296 $( document ).on( 'heartbeat-tick.wp-check-locked', function( e, data ) { 297 var locked = data['wp-check-locked'] || {}; 298 299 $('#the-list tr').each( function(i, el) { 300 var key = el.id, row = $(el), lock_data, avatar; 301 302 if ( locked.hasOwnProperty( key ) ) { 303 if ( ! row.hasClass('wp-locked') ) { 304 lock_data = locked[key]; 305 row.addClass('wp-locked').find('.column-title .locked-text').text( lock_data.text ); 306 row.find('.check-column checkbox').prop('checked', false); 307 308 if ( lock_data.avatar_src ) { 309 avatar = $('<img class="avatar avatar-18 photo" width="18" height="18" />').attr( 'src', lock_data.avatar_src.replace(/&/g, '&') ); 310 row.find('.column-title .locked-avatar').empty().append( avatar ); 311 } 312 } 313 } else if ( row.hasClass('wp-locked') ) { 314 row.removeClass('wp-locked').find('.column-title .locked-text').empty(); 315 row.find('.column-title .locked-avatar').empty(); 316 } 317 }); 318 }).on( 'heartbeat-send.wp-check-locked', function( e, data ) { 319 var check = []; 320 321 $('#the-list tr').each( function(i, el) { 322 check.push( el.id ); 323 }); 324 325 data['wp-check-locked'] = check; 326 }); 327 328 }(jQuery)); -
trunk/wp-includes/script-loader.php
r23589 r23681 420 420 $scripts->add( 'theme-preview', "/wp-admin/js/theme-preview$suffix.js", array( 'thickbox', 'jquery' ), false, 1 ); 421 421 422 $scripts->add( 'edit-post', "/wp-admin/js/edit-post$suffix.js", array( 'heartbeat' ), false, 1 ); 423 424 $scripts->add( 'inline-edit-post', "/wp-admin/js/inline-edit-post$suffix.js", array( 'jquery', 'suggest' ), false, 1 ); 422 $scripts->add( 'inline-edit-post', "/wp-admin/js/inline-edit-post$suffix.js", array( 'jquery', 'suggest', 'heartbeat' ), false, 1 ); 425 423 did_action( 'init' ) && $scripts->localize( 'inline-edit-post', 'inlineEditL10n', array( 426 424 'error' => __('Error while saving the changes.'),
Note: See TracChangeset
for help on using the changeset viewer.