Changeset 8973
- Timestamp:
- 09/25/08 13:42:34 (2 months ago)
- Files:
-
- trunk/wp-admin/admin-ajax.php (modified) (1 diff)
- trunk/wp-admin/categories.php (modified) (1 diff)
- trunk/wp-admin/css/global.css (modified) (1 diff)
- trunk/wp-admin/edit-comments.php (modified) (1 diff)
- trunk/wp-admin/edit-link-categories.php (modified) (1 diff)
- trunk/wp-admin/edit-pages.php (modified) (4 diffs)
- trunk/wp-admin/edit-post-rows.php (modified) (1 diff)
- trunk/wp-admin/edit-tags.php (modified) (1 diff)
- trunk/wp-admin/edit.php (modified) (6 diffs)
- trunk/wp-admin/inbox.php (modified) (1 diff)
- trunk/wp-admin/includes/post.php (modified) (1 diff)
- trunk/wp-admin/includes/template.php (modified) (16 diffs)
- trunk/wp-admin/js/inline-edit.js (modified) (7 diffs)
- trunk/wp-admin/link-manager.php (modified) (1 diff)
- trunk/wp-admin/plugins.php (modified) (2 diffs)
- trunk/wp-admin/upload.php (modified) (1 diff)
- trunk/wp-admin/users.php (modified) (1 diff)
- trunk/wp-admin/wp-admin.css (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/wp-admin/admin-ajax.php
r8943 r8973 732 732 check_ajax_referer( 'inlineeditnonce', '_inline_edit' ); 733 733 734 if ( ! isset($_POST['post_ID']) )734 if ( ! isset($_POST['post_ID']) || ! ( $id = (int) $_POST['post_ID'] ) ) 735 735 exit; 736 737 if ( $last = wp_check_post_lock( $id ) ) { 738 $last_user = get_userdata( $last ); 739 $last_user_name = $last_user ? $last_user->display_name : __( 'Someone' ); 740 echo '<tr><td colspan="8"><div class="error"><p>' . sprintf( $_POST['post_type'] == 'page' ? __( 'Saving is disabled: %s is currently editing this page.' ) : __( 'Saving is disabled: %s is currently editing this post.' ), wp_specialchars( $last_user_name ) ) . '</p></div></td></tr>'; 741 exit; 742 } 736 743 737 744 inline_save_row( $_POST ); trunk/wp-admin/categories.php
r8948 r8973 179 179 <option value="delete"><?php _e('Delete'); ?></option> 180 180 </select> 181 <input type="submit" value="<?php _e('Apply'); ?>" name="doaction" class="button-secondary action" />181 <input type="submit" value="<?php _e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" /> 182 182 <?php wp_nonce_field('bulk-categories'); ?> 183 183 </div> trunk/wp-admin/css/global.css
r8787 r8973 205 205 } 206 206 */ 207 .widefat .num { 207 .widefat .num, 208 .widefat .column-comments { 208 209 text-align: center; 209 210 } trunk/wp-admin/edit-comments.php
r8867 r8973 196 196 <option value="delete"><?php _e('Delete'); ?></option> 197 197 </select> 198 <input type="submit" name="doaction" value="<?php _e('Apply'); ?>" class="button-secondary apply" />198 <input type="submit" name="doaction" id="doaction" value="<?php _e('Apply'); ?>" class="button-secondary apply" /> 199 199 <?php wp_nonce_field('bulk-comments'); ?> 200 200 <?php if ( isset($_GET['apage']) ) { ?> trunk/wp-admin/edit-link-categories.php
r8948 r8973 119 119 <option value="delete"><?php _e('Delete'); ?></option> 120 120 </select> 121 <input type="submit" value="<?php _e('Apply'); ?>" name="doaction" class="button-secondary action" />121 <input type="submit" value="<?php _e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" /> 122 122 <?php wp_nonce_field('bulk-link-categories'); ?> 123 123 </div> trunk/wp-admin/edit-pages.php
r8948 r8973 10 10 require_once('admin.php'); 11 11 12 // Handle bulk deletes 13 if ( isset($_GET['action']) && isset($_GET['post']) && isset($_GET['doaction']) ) { 14 check_admin_referer('bulk-pages'); 15 if ( $_GET['action'] == 'delete' ) { 16 foreach( (array) $_GET['post'] as $post_id_del ) { 17 $post_del = & get_post($post_id_del); 18 19 if ( !current_user_can('delete_page', $post_id_del) ) 20 wp_die( __('You are not allowed to delete this page.') ); 21 22 if ( $post_del->post_type == 'attachment' ) { 23 if ( ! wp_delete_attachment($post_id_del) ) 24 wp_die( __('Error in deleting...') ); 25 } else { 26 if ( !wp_delete_post($post_id_del) ) 27 wp_die( __('Error in deleting...') ); 12 // Handle bulk actions 13 if ( isset($_GET['action']) && $_GET['action'] != -1 ) { 14 switch ( $_GET['action'] ) { 15 case 'delete': 16 if ( isset($_GET['post']) && isset($_GET['doaction']) ) { 17 check_admin_referer('bulk-pages'); 18 foreach( (array) $_GET['post'] as $post_id_del ) { 19 $post_del = & get_post($post_id_del); 20 21 if ( !current_user_can('delete_page', $post_id_del) ) 22 wp_die( __('You are not allowed to delete this page.') ); 23 24 if ( $post_del->post_type == 'attachment' ) { 25 if ( ! wp_delete_attachment($post_id_del) ) 26 wp_die( __('Error in deleting...') ); 27 } else { 28 if ( !wp_delete_post($post_id_del) ) 29 wp_die( __('Error in deleting...') ); 30 } 31 } 28 32 } 29 } 30 31 $sendback = wp_get_referer(); 32 if (strpos($sendback, 'page.php') !== false) $sendback = admin_url('page-new.php'); 33 elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php'); 34 $sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback); 35 36 wp_redirect($sendback); 37 exit(); 33 break; 34 case 'edit': 35 if ( isset($_GET['post']) ) { 36 check_admin_referer('bulk-pages'); 37 $_GET['post_status'] = $_GET['_status']; 38 39 if ( -1 == $_GET['post_author'] ) 40 unset($_GET['post_author']); 41 42 $done = bulk_edit_posts($_GET); 43 } 44 break; 38 45 } 46 $sendback = wp_get_referer(); 47 if (strpos($sendback, 'page.php') !== false) $sendback = admin_url('page-new.php'); 48 elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php'); 49 $sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback); 50 if ( isset($done) ) { 51 $done['upd'] = count( $done['upd'] ); 52 $done['skip'] = count( $done['skip'] ); 53 $sendback = add_query_arg( $done, $sendback ); 54 unset($done); 55 } 56 wp_redirect($sendback); 57 exit(); 39 58 } elseif ( !empty($_GET['_wp_http_referer']) ) { 40 59 wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']))); … … 86 105 </form> 87 106 107 <?php if ( isset($_GET['upd']) && (int) $_GET['upd'] ) { ?> 108 <div id="message" class="updated fade"><p> 109 <?php printf( __ngettext( '%d page updated.', '%d pages updated.', $_GET['upd'] ), number_format_i18n( $_GET['upd'] ) ); 110 unset($_GET['upd']); 111 112 if ( isset($_GET['skip']) && (int) $_GET['skip'] ) { 113 printf( __ngettext( ' %d page not updated. Somebody is editing it.', ' %d pages not updated. Somebody is editing them.', $_GET['skip'] ), number_format_i18n( $_GET['skip'] ) ); 114 unset($_GET['skip']); 115 } ?> 116 </p></div> 117 <?php } ?> 118 88 119 <div class="wrap"> 89 120 <form id="adv-settings" action="" method="get"> … … 176 207 <option value="delete"><?php _e('Delete'); ?></option> 177 208 </select> 178 <input type="submit" value="<?php _e('Apply'); ?>" name="doaction" class="button-secondary action" />209 <input type="submit" value="<?php _e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" /> 179 210 <?php wp_nonce_field('bulk-pages'); ?> 180 211 </div> … … 198 229 </thead> 199 230 <tbody> 200 <?php inline_edit_row( 'page' ) ?>201 231 <?php page_rows($posts, $pagenum, $per_page); ?> 202 232 </tbody> 203 233 </table> 204 234 </form> 235 236 <?php inline_edit_row( 'page' ) ?> 205 237 206 238 <div id="ajax-response"></div> trunk/wp-admin/edit-post-rows.php
r8943 r8973 16 16 </thead> 17 17 <tbody> 18 19 <?php inline_edit_row( 'post' ) ?>20 18 21 19 <?php trunk/wp-admin/edit-tags.php
r8948 r8973 185 185 <option value="delete"><?php _e('Delete'); ?></option> 186 186 </select> 187 <input type="submit" value="<?php _e('Apply'); ?>" name="doaction" class="button-secondary action" />187 <input type="submit" value="<?php _e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" /> 188 188 <?php wp_nonce_field('bulk-tags'); ?> 189 189 </div> trunk/wp-admin/edit.php
r8948 r8973 11 11 12 12 // Handle bulk actions 13 if ( isset($_GET['action']) && $_GET['action'] != -1 && isset($_GET['doaction'])) {13 if ( isset($_GET['action']) && $_GET['action'] != -1 ) { 14 14 switch ( $_GET['action'] ) { 15 15 case 'delete': 16 if ( isset($_GET['post']) ) {16 if ( isset($_GET['post']) && isset($_GET['doaction']) ) { 17 17 check_admin_referer('bulk-posts'); 18 18 foreach( (array) $_GET['post'] as $post_id_del ) { … … 33 33 break; 34 34 case 'edit': 35 // TODO: Decide what to do here - add bulk edit feature, or just disallow if >1 post selected 35 if ( isset($_GET['post']) ) { 36 check_admin_referer('bulk-posts'); 37 $_GET['post_status'] = $_GET['_status']; 38 39 if ( -1 == $_GET['post_author'] ) 40 unset($_GET['post_author']); 41 42 $done = bulk_edit_posts($_GET); 43 } 36 44 break; 37 45 } 46 38 47 $sendback = wp_get_referer(); 39 48 if (strpos($sendback, 'post.php') !== false) $sendback = admin_url('post-new.php'); 40 49 elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php'); 41 50 $sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback); 42 51 if ( isset($done) ) { 52 $done['upd'] = count( $done['upd'] ); 53 $done['skip'] = count( $done['skip'] ); 54 $sendback = add_query_arg( $done, $sendback ); 55 unset($done); 56 } 43 57 wp_redirect($sendback); 44 58 exit(); … … 79 93 </p> 80 94 </form> 95 96 <?php if ( isset($_GET['posted']) && $_GET['posted'] ) : $_GET['posted'] = (int) $_GET['posted']; ?> 97 <div id="message" class="updated fade"><p><strong><?php _e('Your post has been saved.'); ?></strong> <a href="<?php echo get_permalink( $_GET['posted'] ); ?>"><?php _e('View post'); ?></a> | <a href="<?php echo get_edit_post_link( $_GET['posted'] ); ?>"><?php _e('Edit post'); ?></a></p></div> 98 <?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('posted'), $_SERVER['REQUEST_URI']); 99 endif; ?> 100 101 <?php if ( isset($_GET['upd']) && (int) $_GET['upd'] ) { ?> 102 <div id="message" class="updated fade"><p> 103 <?php printf( __ngettext( '%d post updated.', '%d posts updated.', $_GET['upd'] ), number_format_i18n( $_GET['upd'] ) ); 104 unset($_GET['upd']); 105 106 if ( isset($_GET['skip']) && (int) $_GET['skip'] ) { 107 printf( __ngettext( ' %d post not updated. Somebody is editing it.', ' %d posts not updated. Somebody is editing them.', $_GET['skip'] ), number_format_i18n( $_GET['skip'] ) ); 108 unset($_GET['skip']); 109 } ?> 110 </p></div> 111 <?php } ?> 81 112 82 113 <div class="wrap"> … … 155 186 <?php if ( isset($_GET['post_status'] ) ) : ?> 156 187 <input type="hidden" name="post_status" value="<?php echo attribute_escape($_GET['post_status']) ?>" /> 157 <?php endif; 158 159 if ( isset($_GET['posted']) && $_GET['posted'] ) : $_GET['posted'] = (int) $_GET['posted']; ?> 160 <div id="message" class="updated fade"><p><strong><?php _e('Your post has been saved.'); ?></strong> <a href="<?php echo get_permalink( $_GET['posted'] ); ?>"><?php _e('View post'); ?></a> | <a href="<?php echo get_edit_post_link( $_GET['posted'] ); ?>"><?php _e('Edit post'); ?></a></p></div> 161 <?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('posted'), $_SERVER['REQUEST_URI']); 162 endif; 163 ?> 164 188 <?php endif; ?> 165 189 <input type="hidden" name="mode" value="<?php echo $mode; ?>" /> 166 190 … … 190 214 <option value="delete"><?php _e('Delete'); ?></option> 191 215 </select> 192 <input type="submit" value="<?php _e('Apply'); ?>" name="doaction" class="button-secondary action" />216 <input type="submit" value="<?php _e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" /> 193 217 <?php wp_nonce_field('bulk-posts'); ?> 194 218 <?php … … 243 267 244 268 </form> 269 270 <?php inline_edit_row( 'post' ); ?> 245 271 246 272 <div id="ajax-response"></div> trunk/wp-admin/inbox.php
r8845 r8973 32 32 <option value="archive"><?php _e('Archive'); ?></option> 33 33 </select> 34 <input type="submit" value="<?php _e('Apply'); ?>" name="doaction" class="button-secondary action" />34 <input type="submit" value="<?php _e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" /> 35 35 </div> 36 36 <br class="clear" /> trunk/wp-admin/includes/post.php
r8912 r8973 176 176 177 177 return $post_ID; 178 } 179 180 function bulk_edit_posts( $post_data = null ) { 181 182 if ( empty($post_data) ) 183 $post_data = &$_POST; 184 185 if ( 'page' == $post_data['post_type'] ) { 186 if ( ! current_user_can( 'edit_pages' ) ) 187 wp_die( __('You are not allowed to edit pages.') ); 188 } else { 189 if ( ! current_user_can( 'edit_posts' ) ) 190 wp_die( __('You are not allowed to edit posts.') ); 191 } 192 193 $post_IDs = array_map( intval, (array) $post_data['post'] ); 194 195 if ( isset($post_data['post_category']) ) { 196 if ( is_array($post_data['post_category']) && ! empty($post_data['post_category']) ) 197 $new_cats = array_map( absint, $post_data['post_category'] ); 198 else 199 unset($post_data['post_category']); 200 } 201 202 if ( isset($post_data['tags_input']) ) { 203 if ( ! empty($post_data['tags_input']) ) { 204 $new_tags = preg_replace( '/\s*,\s*/', ',', rtrim($post_data['tags_input'], ' ,') ); 205 $new_tags = explode(',', $new_tags); 206 } else { 207 unset($post_data['tags_input']); 208 } 209 } 210 211 $reset = array( 'post_author', 'post_status', 'post_password', 'post_parent', 'page_template', 'comment_status', 'ping_status', 'keep_private' ); 212 foreach ( $reset as $field ) { 213 if ( isset($post_data[$field]) && '' == $post_data[$field] ) 214 unset($post_data[$field]); 215 } 216 217 $updated = $skipped = array(); 218 foreach ( $post_IDs as $post_ID ) { 219 220 if ( wp_check_post_lock( $post_ID ) ) { 221 $skipped[] = $post_ID; 222 continue; 223 } 224 225 if ( isset($new_cats) ) { 226 $cats = (array) wp_get_post_categories($post_ID); 227 $post_data['post_category'] = array_unique( array_merge($cats, $new_cats) ); 228 } 229 230 if ( isset($new_tags) ) { 231 $tags = wp_get_post_tags($post_ID, array('fields' => 'names')); 232 $post_data['tags_input'] = array_unique( array_merge($tags, $new_tags) ); 233 } 234 235 $post_data['ID'] = $post_ID; 236 $updated[] = wp_update_post( $post_data ); 237 } 238 239 return array( 'upd' => $updated, 'skip' => $skipped ); 178 240 } 179 241 trunk/wp-admin/includes/template.php
r8967 r8973 623 623 $col_count = count($columns) - $hidden_count; 624 624 $m = ( isset($mode) && 'excerpt' == $mode ) ? 'excerpt' : 'list'; 625 ?> 626 <tr title="<?php _e('Double-click to cancel'); ?>" id="inline-edit" style="display: none"><td colspan="<?php echo $col_count; ?>"> 625 $can_publish = current_user_can('publish_posts'); ?> 626 627 <form method="get" action=""><table style="display: none"><tbody id="inlineedit"> 628 <?php 629 $bulk = 0; 630 while ( $bulk < 2 ) { ?> 631 632 <tr title="<?php _e('Double-click to cancel'); ?>" id="<?php echo $bulk ? 'bulk-edit' : 'inline-edit'; ?>" style="display: none"><td colspan="<?php echo $col_count; ?>"> 627 633 <?php 628 634 foreach($columns as $column_name=>$column_display_name) { … … 641 647 case 'modified': 642 648 case 'date': 643 ?>649 if ( ! $bulk ) { ?> 644 650 <div <?php echo $attributes; ?> title="<?php _e('Timestamp'); ?>"> 645 651 <div class="title"><?php _e('Timestamp'); ?></div> … … 649 655 </div> 650 656 <?php 657 } 651 658 break; 652 659 653 660 case 'title': 654 661 $attributes = "class=\"$type-title column-title quick-edit-div\"" . $style; ?> 662 <?php if ( $bulk ) { ?> 663 <div <?php echo $attributes; ?> id="bulk-title-div" title="<?php $is_page ? _e('Selected pages') : _e('Selected posts'); ?>"> 664 <div class="title"><?php $is_page ? _e('Selected pages') : _e('Selected posts'); ?></div> 665 <div class="in"> 666 <div id="bulk-titles"></div> 667 </div> 668 </div> 669 <?php } else { ?> 655 670 <div <?php echo $attributes ?>> 656 671 <div class="title"><?php _e('Title'); ?></div> … … 661 676 </div> 662 677 </div> 678 <?php } ?> 679 663 680 <?php if ( $is_page ) { ?> 664 681 <div class="parent quick-edit-div" title="<?php _e('Page Parent'); ?>"> … … 666 683 <div class="in"> 667 684 <select name="post_parent"> 685 <?php if ( $bulk ) { ?> 686 <option value=""><?php _e('- No Change -'); ?></option> 687 <?php } ?> 668 688 <option value="0"><?php _e('Main Page (no parent)'); ?></option> 669 689 <?php parent_dropdown(); ?> … … 671 691 </div> 672 692 </div> 693 673 694 <div class="template quick-edit-div" title="<?php _e('Page Template'); ?>"> 674 695 <div class="title"><?php _e('Page Template'); ?></div> 675 696 <div class="in"> 676 697 <select name="page_template"> 677 <option value='default'><?php _e('Default Template'); ?></option> 698 <?php if ( $bulk ) { ?> 699 <option value=""><?php _e('- No Change -'); ?></option> 700 <?php } ?> 701 <option value="default"><?php _e('Default Template'); ?></option> 678 702 <?php page_template_dropdown() ?> 679 703 </select> 680 704 </div> 681 705 </div> 706 707 <?php if ( ! $bulk ) { ?> 682 708 <div class="order quick-edit-div" title="<?php _e('Page Order'); ?>"> 683 709 <div class="title"><?php _e('Page Order'); ?></div> … … 687 713 </div> 688 714 <?php } 715 } 689 716 690 717 break; 691 718 692 719 case 'categories': ?> 720 <?php if ( ! $bulk ) { ?> 693 721 <div <?php echo $attributes ?> title="<?php _e('Categories'); ?>"> 694 722 <div class="title"><?php _e('Categories'); ?> … … 699 727 </ul> 700 728 </div> 701 <?php 729 <?php } 702 730 break; 703 731 704 732 case 'tags': ?> 733 <?php if ( ! $bulk ) { ?> 705 734 <div <?php echo $attributes ?> title="<?php _e('Tags'); ?>"> 706 735 <div class="title"><?php _e('Tags'); ?></div> … … 709 738 </div> 710 739 </div> 711 <?php 740 <?php } 712 741 break; 713 742 714 743 case 'comments': 715 $attributes = 'class="comments column-comments num quick-edit-div"' . $style;?>744 ?> 716 745 <div <?php echo $attributes ?> title="<?php _e('Comments and Pings'); ?>"> 717 746 <div class="title"><?php _e('Comments and Pings'); ?></div> 718 747 <div class="in"> 748 <?php if ( $bulk ) { ?> 749 <select name="comment_status"> 750 <option value=""><?php _e('- No Change -'); ?></option> 751 <option value="open"><?php _e('Allow Comments'); ?></option> 752 <option value="closed"><?php _e('Disallow Comments'); ?></option> 753 </select> 754 <select name="ping_status"> 755 <option value=""><?php _e('- No Change -'); ?></option> 756 <option value="open"><?php _e('Allow Pings'); ?></option> 757 <option value="closed"><?php _e('Disallow Pings'); ?></option> 758 </select> 759 <?php } else { ?> 719 760 <label><input type="checkbox" name="comment_status" value="open" /> 720 761 <?php _e('Allow Comments'); ?></label><br /> 721 762 <label><input type="checkbox" name="ping_status" value="open" /> 722 763 <?php _e('Allow Pings'); ?></label> 764 <?php } ?> 723 765 </div> 724 766 </div> … … 732 774 <div class="title"><?php _e('Author'); ?></div> 733 775 <div class="in"> 734 <?php wp_dropdown_users( array('include' => $authors, 'name' => 'post_author', 'class'=> 'authors', 'selected' => $post->post_author) ); ?> 776 <?php 777 $users_opt = array('include' => $authors, 'name' => 'post_author', 'class'=> 'authors'); 778 if ( $bulk ) $users_opt['show_option_none'] = __('- No Change -'); 779 wp_dropdown_users( $users_opt ); ?> 735 780 </div> 736 781 </div> 737 782 <?php } ?> 738 783 784 <?php if ( ! $bulk ) { ?> 739 785 <div class="password quick-edit-div" title="<?php _e('Password'); ?>"> 740 786 <div class="title"><?php _e('Password'); ?></div> 741 787 <div class="in"> 742 <input type="text" name="post_password" value=" <?php the_post_password(); ?>" />788 <input type="text" name="post_password" value="" /> 743 789 <label title="<?php _e('Privacy'); ?>"> 744 790 <input type="checkbox" name="keep_private" value="private" <?php checked($post->post_status, 'private'); ?> /> <?php echo $is_page ? __('Keep this page private') : __('Keep this post private'); ?></label> 745 791 </div> 746 792 </div> 747 <?php 793 <?php } 748 794 break; 749 795 … … 753 799 <div class="in"> 754 800 <select name="_status"> 755 <?php if ( current_user_can('publish_posts') ) { // Contributors only get "Unpublished" and "Pending Review" ?> 756 <option value='publish'><?php _e('Published') ?></option> 757 <option value='future'><?php _e('Scheduled') ?></option> 801 <?php if ( $bulk ) { ?> 802 <option value=""><?php _e('- No Change -'); ?></option> 803 <?php if ( $can_publish ) { ?> 804 <option value="private"><?php _e('Private') ?></option> 805 <?php } ?> 758 806 <?php } ?> 759 <option value='pending'><?php _e('Pending Review') ?></option> 760 <option value='draft'><?php _e('Unpublished') ?></option> 807 <?php if ( $can_publish ) { // Contributors only get "Unpublished" and "Pending Review" ?> 808 <option value="publish"><?php _e('Published') ?></option> 809 <option value="future"><?php _e('Scheduled') ?></option> 810 <?php } ?> 811 <option value="pending"><?php _e('Pending Review') ?></option> 812 <option value="draft"><?php _e('Unpublished') ?></option> 761 813 </select> 762 814 </div> 763 815 </div> 764 816 765 <?php if ( current_user_can( 'edit_others_posts' ) && ! $is_page) { ?>817 <?php if ( ! $is_page && ! $bulk && current_user_can( 'edit_others_posts' ) ) { ?> 766 818 <div class="sticky quick-edit-div" <?php echo $style; ?> title="<?php _e('Sticky') ?>"> 767 819 <div class="title"><?php _e('Sticky'); ?></div> … … 774 826 break; 775 827 776 case 'control_view': ?> 777 <div><a href="<?php the_permalink(); ?>" rel="permalink" class="view"><?php _e('View'); ?></a></div> 778 <?php 779 break; 780 781 case 'control_edit': ?> 782 <div><?php if ( current_user_can('edit_post',$post->ID) ) { echo "<a href='post.php?action=edit&post=$id' class='edit'>" . __('Edit') . "</a>"; } ?></div> 783 <?php 784 break; 785 786 case 'control_delete': ?> 787 <div><?php if ( current_user_can('delete_post',$post->ID) ) { echo "<a href='" . wp_nonce_url("post.php?action=delete&post=$id", 'delete-post_' . $post->ID) . "' class='delete'>" . __('Delete') . "</a>"; } ?></div> 788 <?php 789 break; 790 791 default: ?> 792 <div><?php do_action('manage_posts_custom_column', $column_name, $post->ID); ?></div> 793 <?php 828 default: 829 if ( $bulk ) 830 do_action('bulk_edit_custom_box', $column_name, $type); 831 else 832 do_action('quick_edit_custom_box', $column_name, $type); 833 794 834 break; 795 835 } … … 800 840 <a accesskey="c" href="#inline-edit" title="<?php _e('Cancel'); ?>" class="button-secondary cancel"><?php _e('Cancel'); ?></a> 801 841 <a accesskey="s" href="#inline-edit" title="<?php _e('Save'); ?>" class="button-secondary save"><?php _e('Save'); ?></a> 802 <?php wp_nonce_field( 'inlineeditnonce', '_inline_edit', false )?>842 <?php if ( ! $bulk ) wp_nonce_field( 'inlineeditnonce', '_inline_edit', false ); ?> 803 843 <input type="hidden" name="post_view" value="<?php echo $m; ?>" /> 804 844 </div> 805 845 </td></tr> 846 <?php 847 $bulk++; 848 } ?> 849 </tbody></table></form> 806 850 <?php 807 851 } … … 845 889 846 890 echo ' 847 <div id="inline_' . $post->ID . '">848 < input type="hidden" name="" class="post_title" value="' . $title . '" />849 < input type="hidden" name="" class="post_name" value="' . $post->post_name . '" />850 < input type="hidden" name="" class="post_author" value="' . $post->post_author . '" />851 < input type="hidden" name="" class="comment_status" value="' . $post->comment_status . '" />852 < input type="hidden" name="" class="ping_status" value="' . $post->ping_status . '" />853 < input type="hidden" name="" class="_status" value="' . $post->post_status . '" />854 < input type="hidden" name="" class="jj" value="' . mysql2date( 'd', $post->post_date ) . '" />855 < input type="hidden" name="" class="mm" value="' . mysql2date( 'm', $post->post_date ) . '" />856 < input type="hidden" name="" class="aa" value="' . mysql2date( 'Y', $post->post_date ) . '" />857 < input type="hidden" name="" class="hh" value="' . mysql2date( 'H', $post->post_date ) . '" />858 < input type="hidden" name="" class="mn" value="' . mysql2date( 'i', $post->post_date ) . '" />859 < input type="hidden" name="" class="post_password" value="' . wp_specialchars($post->post_password, 1) . '" />';891 <div class="hidden" id="inline_' . $post->ID . '"> 892 <div class="post_title">' . $title . '</div> 893 <div class="post_name">' . $post->post_name . '</div> 894 <div class="post_author">' . $post->post_author . '</div> 895 <div class="comment_status">' . $post->comment_status . '</div> 896 <div class="ping_status">' . $post->ping_status . '</div> 897 <div class="_status">' . $post->post_status . '</div> 898 <div class="jj">' . mysql2date( 'd', $post->post_date ) . '</div> 899 <div class="mm">' . mysql2date( 'm', $post->post_date ) . '</div> 900 <div class="aa">' . mysql2date( 'Y', $post->post_date ) . '</div> 901 <div class="hh">' . mysql2date( 'H', $post->post_date ) . '</div> 902 <div class="mn">' . mysql2date( 'i', $post->post_date ) . '</div> 903 <div class="post_password">' . wp_specialchars($post->post_password, 1) . '</div>'; 860 904 861 905 if( $post->post_type == 'page' ) 862 906 echo ' 863 < input type="hidden" name="" class="post_parent" value="' . $post->post_parent . '" />864 < input type="hidden" name="" class="page_template" value="' . wp_specialchars(get_post_meta( $post->ID, '_wp_page_template', true ), 1) . '" />865 < input type="hidden" name="" class="menu_order" value="' . $post->menu_order . '" />';907 <div class="post_parent">' . $post->post_parent . '</div> 908 <div class="page_template">' . wp_specialchars(get_post_meta( $post->ID, '_wp_page_template', true ), 1) . '</div> 909 <div class="menu_order">' . $post->menu_order . '</div>'; 866 910 867 911 if( $post->post_type == 'post' ) 868 912 echo ' 869 < input type="hidden" name="" class="tags_input" value="' . wp_specialchars( str_replace( ',', ', ', get_tags_to_edit($post->ID) ), 1) . '" />870 < input type="hidden" name="" class="post_category" value="' . implode( ',', wp_get_post_categories( $post->ID ) ) . '" />871 < input type="hidden" name="" class="sticky" value="' . (is_sticky($post->ID) ? 'sticky' : '') . '" />';913 <div class="tags_input">' . wp_specialchars( str_replace( ',', ', ', get_tags_to_edit($post->ID) ), 1) . '</div> 914 <div class="post_category">' . implode( ',', wp_get_post_categories( $post->ID ) ) . '</div> 915 <div class="sticky">' . (is_sticky($post->ID) ? 'sticky' : '') . '</div>'; 872 916 873 917 echo '</div>'; … … 1036 1080 1037 1081 case 'comments': 1038 $attributes = 'class="comments column-comments num"' . $style;1039 1082 ?> 1040 1083 <td <?php echo $attributes ?>><div class="post-com-count-wrapper"> … … 1211 1254 1212 1255 case 'comments': 1213 $attributes = 'class="comments column-comments num"' . $style;1214 1256 ?> 1215 1257 <td <?php echo $attributes ?>><div class="post-com-count-wrapper"> trunk/wp-admin/js/inline-edit.js
r8951 r8973 2 2 (function($) { 3 3 inlineEdit = { 4 type : '',5 rows : '',6 4 7 5 init : function() { 8 var t = this, blankRow = $('#inline-edit');6 var t = this, qeRow = $('#inline-edit'), bulkRow = $('#bulk-edit'); 9 7 10 8 t.type = $('table.widefat').hasClass('page') ? 'page' : 'post'; 9 t.what = '#'+t.type+'-'; 11 10 12 11 // get all editable rows … … 14 13 15 14 // prepare the edit row 16 blankRow.dblclick(function() { inlineEdit.toggle(this); }) 17 .keyup(function(e) { if(e.which == 27) return inlineEdit.revert(this); }); 18 19 $('a.cancel', blankRow).click(function() { return inlineEdit.revert(this); }); 20 $('a.save', blankRow).click(function() { return inlineEdit.save(this); }); 15 qeRow.dblclick(function() { inlineEdit.toggle(this); }) 16 .keyup(function(e) { if(e.which == 27) return inlineEdit.revert(); }); 17 18 bulkRow.dblclick(function() { inlineEdit.revert(); }) 19 .keyup(function(e) { if (e.which == 27) return inlineEdit.revert(); }); 20 21 $('a.cancel', qeRow).click(function() { return inlineEdit.revert(); }); 22 $('a.save', qeRow).click(function() { return inlineEdit.save(this); }); 23 24 $('a.cancel', bulkRow).click(function() { return inlineEdit.revert(); }); 25 $('a.save', bulkRow).click(function() { return inlineEdit.saveBulk(); }); 21 26 22 27 // add events 23 28 t.rows.dblclick(function() { inlineEdit.toggle(this); }); 24 29 t.addEvents(t.rows); 30 31 $('#bulk-title-div').after( 32 $('#inline-edit div.categories').clone(), 33 $('#inline-edit div.tags').clone() 34 ); 35 36 // categories expandable? 37 $('span.catshow').click(function() { 38 $('.inline-editor ul.cat-checklist').addClass("cat-hover"); 39 $('.inline-editor span.cathide').show(); 40 $(this).hide(); 41 }); 42 43 $('span.cathide').click(function() { 44 $('.inline-editor ul.cat-checklist').removeClass("cat-hover"); 45 $('.inline-editor span.catshow').show(); 46 $(this).hide(); 47 }); 48 49 $('select[name="_status"] option[value="future"]', bulkRow).remove(); 50 51 $('#doaction').click(function(e){ 52 if ( $('select[name="action"]').val() == 'edit' ) { 53 e.preventDefault(); 54 t.setBulk(); 55 } else if ( $('form#posts-filter tr.inline-editor').length > 0 ) { 56 t.revert(); 57 } 58 }); 59 60 $('#post-query-submit').click(function(e){ 61 if ( $('form#posts-filter tr.inline-editor').length > 0 ) 62 t.revert(); 63 }); 64 25 65 }, 26 66 … … 28 68 var t = this; 29 69 30 $( '#'+t.type+'-'+t.getId(el)).css('display') == 'none' ? t.revert(el) : t.edit(el);70 $(t.what+t.getId(el)).css('display') == 'none' ? t.revert() : t.edit(el); 31 71 }, 32 72 … … 39 79 }, 40 80 81 setBulk : function() { 82 var te = '', c = ''; 83 this.revert(); 84 85 $('table.widefat tbody').prepend( $('#bulk-edit') ); 86 $('#bulk-edit').addClass('inline-editor').show(); 87 88 $('tbody th.check-column input[type="checkbox"]').each(function(i){ 89 if ( $(this).attr('checked') ) { 90 var id = $(this).val(); 91 c = c == '' ? ' class="alternate"' : ''; 92 te += '<div'+c+'>'+$('#inline_'+id+' .post_title').text()+'</div>'; 93 } 94 }); 95 96 $('#bulk-titles').html(te); 97 98 // enable autocomplete for tags 99 if ( this.type == 'post' ) 100 $('tr.inline-editor textarea[name="tags_input"]').suggest( 'admin-ajax.php?action=ajax-tag-search', { delay: 500, minchars: 2, multiple: true, multipleSep: ", " } ); 101 }, 102 41 103 edit : function(id) { 42 var t = this, type = t.type, old = $('tr.inline-editor').attr('id'); 43 44 if( typeof(id) == 'object' ) 104 var t = this; 105 t.revert(); 106 107 if ( typeof(id) == 'object' ) 45 108 id = t.getId(id); 46 109 47 if ( old ) {48 old = old.split('-')[1];49 t.revert(old);50 }51 52 110 var fields = ['post_title', 'post_name', 'post_author', '_status', 'jj', 'mm', 'aa', 'hh', 'mn', 'post_password']; 53 if ( t ype == 'page' ) fields.push('post_parent', 'menu_order', 'page_template');54 if ( t ype == 'post' ) fields.push('tags_input');111 if ( t.type == 'page' ) fields.push('post_parent', 'menu_order', 'page_template'); 112 if ( t.type == 'post' ) fields.push('tags_input'); 55 113 56 114 // add the new blank row 57 115 var editRow = $('#inline-edit').clone(true); 58 116 59 if ( $( '#'+type+'-'+id).hasClass('alternate') )117 if ( $(t.what+id).hasClass('alternate') ) 60 118 $(editRow).addClass('alternate'); 61 $( '#'+type+'-'+id).hide().after(editRow);119 $(t.what+id).hide().after(editRow); 62 120 63 121 // populate the data 64 122 var rowData = $('#inline_'+id); 65 123 for ( var f = 0; f < fields.length; f++ ) { 66 $(':input[name="'+fields[f]+'"]', editRow).val( $('.'+fields[f], rowData). val() );124 $(':input[name="'+fields[f]+'"]', editRow).val( $('.'+fields[f], rowData).text() ); 67 125 } 68 126 69 if ( $('.comment_status', rowData). val() == 'open' )127 if ( $('.comment_status', rowData).text() == 'open' ) 70 128 $('input[name="comment_status"]', editRow).attr("checked", "checked"); 71 if ( $('.ping_status', rowData). val() == 'open' )129 if ( $('.ping_status', rowData).text() == 'open' ) 72 130 $('input[name="ping_status"]', editRow).attr("checked", "checked"); 73 if ( $('.sticky', rowData). val() == 'sticky' )131 if ( $('.sticky', rowData).text() == 'sticky' ) 74 132 $('input[name="sticky"]', editRow).attr("checked", "checked"); 75 133 76 134 // categories 77 135 var cats; 78 if ( cats = $('.post_category', rowData). val() )79 $('ul.cat-checklist :checkbox' ).val(cats.split(','));136 if ( cats = $('.post_category',
