diff --git wp-admin/edit.php wp-admin/edit.php
index 39424ac..1427ef8 100644
|
|
if ( 'post' != $post_type ) { |
47 | 47 | |
48 | 48 | $doaction = $wp_list_table->current_action(); |
49 | 49 | |
50 | | if ( $doaction ) { |
| 50 | if ( $doaction && ! $wp_list_table->is_bulk_edit_form() ) { |
51 | 51 | check_admin_referer('bulk-posts'); |
52 | 52 | |
53 | 53 | $sendback = remove_query_arg( array('trashed', 'untrashed', 'deleted', 'ids'), wp_get_referer() ); |
… |
… |
if ( $doaction ) { |
66 | 66 | $post_ids = explode( ',', $_REQUEST['ids'] ); |
67 | 67 | } elseif ( !empty( $_REQUEST['post'] ) ) { |
68 | 68 | $post_ids = array_map('intval', $_REQUEST['post']); |
| 69 | } elseif ( ! empty( $_REQUEST['bulk_post'] ) ) { |
| 70 | $post_ids = array_map( 'intval', $_REQUEST['bulk_post'] ); |
69 | 71 | } |
70 | | |
| 72 | |
71 | 73 | if ( !isset( $post_ids ) ) { |
72 | 74 | wp_redirect( $sendback ); |
73 | 75 | exit; |
… |
… |
if ( $doaction ) { |
86 | 88 | $trashed++; |
87 | 89 | } |
88 | 90 | $sendback = add_query_arg( array('trashed' => $trashed, 'ids' => join(',', $post_ids) ), $sendback ); |
| 91 | $sendback = remove_query_arg( array( 'updated' ), $sendback ); |
89 | 92 | break; |
90 | 93 | case 'untrash': |
91 | 94 | $untrashed = 0; |
… |
… |
if ( $doaction ) { |
127 | 130 | $done['skipped'] = count( $done['skipped'] ); |
128 | 131 | $done['locked'] = count( $done['locked'] ); |
129 | 132 | $sendback = add_query_arg( $done, $sendback ); |
| 133 | $sendback = remove_query_arg( array( 'bulk_post' ), $sendback ); |
130 | 134 | } |
| 135 | |
131 | 136 | break; |
132 | 137 | } |
133 | 138 | |
134 | 139 | $sendback = remove_query_arg( array('action', 'action2', 'tags_input', 'post_author', 'comment_status', 'ping_status', '_status', 'post', 'bulk_edit', 'post_view'), $sendback ); |
135 | | |
136 | 140 | wp_redirect($sendback); |
137 | 141 | exit(); |
138 | 142 | } elseif ( ! empty($_REQUEST['_wp_http_referer']) ) { |
… |
… |
$_SERVER['REQUEST_URI'] = remove_query_arg( array('locked', 'skipped', 'updated' |
256 | 260 | |
257 | 261 | <?php |
258 | 262 | if ( $wp_list_table->has_items() ) |
259 | | $wp_list_table->inline_edit(); |
| 263 | if ( $wp_list_table->is_bulk_edit_form() ) { |
| 264 | $wp_list_table->inline_edit( 'inline' ); |
| 265 | } else { |
| 266 | $wp_list_table->inline_edit(); |
| 267 | } |
260 | 268 | ?> |
261 | 269 | |
262 | 270 | <div id="ajax-response"></div> |
diff --git wp-admin/includes/class-wp-list-table.php wp-admin/includes/class-wp-list-table.php
index bd5c546..0ac1e17 100644
|
|
class WP_List_Table { |
714 | 714 | </tr> |
715 | 715 | </tfoot> |
716 | 716 | |
| 717 | <?php do_action( 'wp_list_table_tbody' ); ?> |
| 718 | |
717 | 719 | <tbody id="the-list"<?php if ( $singular ) echo " class='list:$singular'"; ?>> |
718 | 720 | <?php $this->display_rows_or_placeholder(); ?> |
719 | 721 | </tbody> |
diff --git wp-admin/includes/class-wp-posts-list-table.php wp-admin/includes/class-wp-posts-list-table.php
index e623ab5..76ee6f8 100644
|
|
class WP_Posts_List_Table extends WP_List_Table { |
17 | 17 | * @access protected |
18 | 18 | */ |
19 | 19 | var $hierarchical_display; |
| 20 | |
| 21 | /** |
| 22 | * Whether the bulk edit form should be displayed (when JavaScript is disabled) |
| 23 | * |
| 24 | * @since 3.1.0 |
| 25 | * @var bool |
| 26 | * @access protected |
| 27 | */ |
| 28 | var $bulk_edit_display = false; |
20 | 29 | |
21 | 30 | /** |
22 | 31 | * Holds the number of pending comments for each post |
… |
… |
class WP_Posts_List_Table extends WP_List_Table { |
84 | 93 | |
85 | 94 | return current_user_can( $post_type_object->cap->edit_posts ); |
86 | 95 | } |
| 96 | |
| 97 | function is_bulk_edit_form() { |
| 98 | return $this->bulk_edit_display; |
| 99 | } |
| 100 | |
| 101 | function display_bulk_edit_form() { |
| 102 | $this->inline_edit( 'bulk' ); |
| 103 | } |
87 | 104 | |
88 | 105 | function prepare_items() { |
89 | 106 | global $post_type_object, $post_type, $avail_post_stati, $wp_query, $per_page, $mode; |
… |
… |
class WP_Posts_List_Table extends WP_List_Table { |
237 | 254 | if ( isset( $_REQUEST['delete_all'] ) || isset( $_REQUEST['delete_all2'] ) ) |
238 | 255 | return 'delete_all'; |
239 | 256 | |
240 | | return parent::current_action(); |
| 257 | if ( isset( $_REQUEST['bulk_post'] ) ) { |
| 258 | return 'edit'; |
| 259 | } |
| 260 | |
| 261 | $action = parent::current_action(); |
| 262 | |
| 263 | if ( $action == 'edit' && ! isset( $_REQUEST['bulk_edit']) ) { |
| 264 | $this->bulk_edit_display = true; |
| 265 | add_action( 'wp_list_table_tbody', array( &$this, 'display_bulk_edit_form' ) ); |
| 266 | } |
| 267 | |
| 268 | return $action; |
241 | 269 | } |
242 | 270 | |
243 | 271 | function pagination( $which ) { |
… |
… |
class WP_Posts_List_Table extends WP_List_Table { |
496 | 524 | switch ( $column_name ) { |
497 | 525 | |
498 | 526 | case 'cb': |
| 527 | $checked = ( isset( $_REQUEST['post'] ) && in_array( $post->ID, $_REQUEST['post'] ) ) ? ' checked="checked"' : ''; |
499 | 528 | ?> |
500 | | <th scope="row" class="check-column"><?php if ( $can_edit_post ) { ?><input type="checkbox" name="post[]" value="<?php the_ID(); ?>" /><?php } ?></th> |
| 529 | <th scope="row" class="check-column"><?php if ( $can_edit_post ) { ?><input type="checkbox" name="post[]" value="<?php the_ID(); ?>"<?php echo $checked; ?> /><?php } ?></th> |
501 | 530 | <?php |
502 | 531 | break; |
503 | 532 | |
… |
… |
class WP_Posts_List_Table extends WP_List_Table { |
684 | 713 | } |
685 | 714 | |
686 | 715 | /** |
687 | | * Outputs the hidden row displayed when inline editing |
| 716 | * Outputs inline editing forms |
688 | 717 | * |
689 | 718 | * @since 3.1.0 |
| 719 | * |
| 720 | * @param string $which Specify which form to be output. Can be one of the following: 'inline', 'bulk', or 'both' |
690 | 721 | */ |
691 | | function inline_edit() { |
| 722 | function inline_edit( $which = 'both' ) { |
692 | 723 | global $mode; |
693 | 724 | |
694 | 725 | $screen = get_current_screen(); |
… |
… |
class WP_Posts_List_Table extends WP_List_Table { |
714 | 745 | $m = ( isset( $mode ) && 'excerpt' == $mode ) ? 'excerpt' : 'list'; |
715 | 746 | $can_publish = current_user_can( $post_type_object->cap->publish_posts ); |
716 | 747 | $core_columns = array( 'cb' => true, 'date' => true, 'title' => true, 'categories' => true, 'tags' => true, 'comments' => true, 'author' => true ); |
717 | | |
| 748 | $as_tbody = ( $which == 'bulk' && $this->bulk_edit_display ); |
| 749 | |
| 750 | if ( $as_tbody && empty( $_REQUEST['post'] ) ) |
| 751 | return; |
| 752 | |
| 753 | $style = ( $as_tbody ) ? '' : ' style="display:none;"'; |
718 | 754 | ?> |
719 | 755 | |
720 | | <form method="get" action=""><table style="display: none"><tbody id="inlineedit"> |
| 756 | <?php if ( ! $as_tbody ): ?> |
| 757 | <form method="get" action=""><table<?php echo $style; ?>><?php endif; ?> |
| 758 | <tbody id="inlineedit"> |
721 | 759 | <?php |
722 | 760 | $hclass = count( $hierarchical_taxonomies ) ? 'post' : 'page'; |
723 | 761 | $bulk = 0; |
724 | | while ( $bulk < 2 ) { ?> |
725 | | |
726 | | <tr id="<?php echo $bulk ? 'bulk-edit' : 'inline-edit'; ?>" class="inline-edit-row inline-edit-row-<?php echo "$hclass inline-edit-$screen->post_type "; |
| 762 | $max = 2; |
| 763 | |
| 764 | if ( $which == 'bulk' ) |
| 765 | $bulk = 1; |
| 766 | |
| 767 | if ( $which == 'inline' ) |
| 768 | $max = 1; |
| 769 | |
| 770 | while ( $bulk < $max ) { ?> |
| 771 | |
| 772 | <tr id="<?php echo $bulk ? 'bulk-edit' : 'inline-edit'; ?>" class="inline-editor inline-edit-row inline-edit-row-<?php echo "$hclass inline-edit-$screen->post_type "; |
727 | 773 | echo $bulk ? "bulk-edit-row bulk-edit-row-$hclass bulk-edit-$screen->post_type" : "quick-edit-row quick-edit-row-$hclass inline-edit-$screen->post_type"; |
728 | | ?>" style="display: none"><td colspan="<?php echo $this->get_column_count(); ?>" class="colspanchange"> |
| 774 | ?>"<?php echo $style; ?>><td colspan="<?php echo $this->get_column_count(); ?>" class="colspanchange"> |
729 | 775 | |
730 | 776 | <fieldset class="inline-edit-col-left"><div class="inline-edit-col"> |
731 | 777 | <h4><?php echo $bulk ? __( 'Bulk Edit' ) : __( 'Quick Edit' ); ?></h4> |
… |
… |
class WP_Posts_List_Table extends WP_List_Table { |
734 | 780 | if ( post_type_supports( $screen->post_type, 'title' ) ) : |
735 | 781 | if ( $bulk ) : ?> |
736 | 782 | <div id="bulk-title-div"> |
737 | | <div id="bulk-titles"></div> |
| 783 | <div id="bulk-titles"> |
| 784 | <?php |
| 785 | if ( $as_tbody ) { |
| 786 | $post_ids = $_REQUEST['post']; |
| 787 | |
| 788 | foreach ( $post_ids as $post_id ) { |
| 789 | $post = get_post( $post_id ); |
| 790 | $title = esc_html( apply_filters( 'the_title', $post->post_title ) ); |
| 791 | $delete_link = add_query_arg( array( 'post' => array_diff( $post_ids, array( $post_id ) ) ), $_SERVER['REQUEST_URI'] ); |
| 792 | ?> |
| 793 | <div id="ttle<?php echo $post_id; ?>"> |
| 794 | <a id="_<?php echo $post_id; ?>" class="ntdelbutton" title="Remove From Bulk Edit" href="<?php echo $delete_link; ?>">X</a> |
| 795 | <?php echo $title; ?> |
| 796 | <input type="hidden" name="bulk_post[]" value="<?php echo $post_id; ?>" /> |
| 797 | </div> |
| 798 | <?php |
| 799 | } |
| 800 | } |
| 801 | ?> |
| 802 | </div> |
738 | 803 | </div> |
739 | 804 | |
740 | 805 | <?php else : // $bulk ?> |
… |
… |
class WP_Posts_List_Table extends WP_List_Table { |
812 | 877 | |
813 | 878 | </div></fieldset> |
814 | 879 | |
815 | | <?php if ( count( $hierarchical_taxonomies ) && !$bulk ) : ?> |
| 880 | <?php if ( count( $hierarchical_taxonomies ) && ( !$bulk || $as_tbody ) ) : ?> |
816 | 881 | |
817 | 882 | <fieldset class="inline-edit-col-center inline-edit-categories"><div class="inline-edit-col"> |
818 | 883 | |
… |
… |
class WP_Posts_List_Table extends WP_List_Table { |
831 | 896 | |
832 | 897 | </div></fieldset> |
833 | 898 | |
834 | | <?php endif; // count( $hierarchical_taxonomies ) && !$bulk ?> |
| 899 | <?php endif; // count( $hierarchical_taxonomies ) && ( !$bulk || $as_tbody ) ?> |
835 | 900 | |
836 | 901 | <fieldset class="inline-edit-col-right"><div class="inline-edit-col"> |
837 | 902 | |
838 | | <?php |
839 | | if ( post_type_supports( $screen->post_type, 'author' ) && $bulk ) |
840 | | echo $authors_dropdown; |
841 | | ?> |
842 | | |
843 | 903 | <?php if ( $post_type_object->hierarchical ) : ?> |
844 | 904 | |
845 | 905 | <label> |
… |
… |
class WP_Posts_List_Table extends WP_List_Table { |
878 | 938 | endif; // post_type_supports page-attributes |
879 | 939 | endif; // $post_type_object->hierarchical ?> |
880 | 940 | |
881 | | <?php if ( count( $flat_taxonomies ) && !$bulk ) : ?> |
| 941 | <?php if ( count( $flat_taxonomies ) && ( !$bulk || $as_tbody ) ) : ?> |
882 | 942 | |
883 | 943 | <?php foreach ( $flat_taxonomies as $taxonomy ) : ?> |
884 | 944 | |
… |
… |
class WP_Posts_List_Table extends WP_List_Table { |
889 | 949 | |
890 | 950 | <?php endforeach; //$flat_taxonomies as $taxonomy ?> |
891 | 951 | |
892 | | <?php endif; // count( $flat_taxonomies ) && !$bulk ?> |
| 952 | <?php endif; // count( $flat_taxonomies ) && ( !$bulk || $as_tbody ) ?> |
| 953 | |
| 954 | <?php |
| 955 | if ( post_type_supports( $screen->post_type, 'author' ) && $bulk ) |
| 956 | echo $authors_dropdown; |
| 957 | ?> |
893 | 958 | |
894 | 959 | <?php if ( post_type_supports( $screen->post_type, 'comments' ) || post_type_supports( $screen->post_type, 'trackbacks' ) ) : |
895 | 960 | if ( $bulk ) : ?> |
… |
… |
class WP_Posts_List_Table extends WP_List_Table { |
992 | 1057 | } |
993 | 1058 | ?> |
994 | 1059 | <p class="submit inline-edit-save"> |
995 | | <a accesskey="c" href="#inline-edit" title="<?php _e( 'Cancel' ); ?>" class="button-secondary cancel alignleft"><?php _e( 'Cancel' ); ?></a> |
| 1060 | <a accesskey="c" href="<?php echo esc_url( remove_query_arg( 'post', wp_get_referer() ) ); ?>" title="<?php _e( 'Cancel' ); ?>" class="button-secondary cancel alignleft"><?php _e( 'Cancel' ); ?></a> |
996 | 1061 | <?php if ( ! $bulk ) { |
997 | 1062 | wp_nonce_field( 'inlineeditnonce', '_inline_edit', false ); |
998 | 1063 | $update_text = __( 'Update' ); |
… |
… |
class WP_Posts_List_Table extends WP_List_Table { |
1002 | 1067 | <?php } else { |
1003 | 1068 | submit_button( __( 'Update' ), 'button-primary alignright', 'bulk_edit', false, array( 'accesskey' => 's' ) ); |
1004 | 1069 | } ?> |
| 1070 | |
1005 | 1071 | <input type="hidden" name="post_view" value="<?php echo esc_attr( $m ); ?>" /> |
1006 | 1072 | <input type="hidden" name="screen" value="<?php echo esc_attr( $screen->id ); ?>" /> |
1007 | 1073 | <br class="clear" /> |
… |
… |
class WP_Posts_List_Table extends WP_List_Table { |
1011 | 1077 | $bulk++; |
1012 | 1078 | } |
1013 | 1079 | ?> |
1014 | | </tbody></table></form> |
| 1080 | </tbody> |
| 1081 | <?php if ( ! $as_tbody ): ?> </table></form> <?php endif; ?> |
1015 | 1082 | <?php |
1016 | 1083 | } |
1017 | 1084 | } |
diff --git wp-admin/includes/post.php wp-admin/includes/post.php
index 510d59f..f595f2b 100644
|
|
function bulk_edit_posts( $post_data = null ) { |
255 | 255 | if ( empty($post_data) ) |
256 | 256 | $post_data = &$_POST; |
257 | 257 | |
| 258 | if ( isset( $post_data['bulk_post'] ) ) { |
| 259 | $post_data['post'] = array_unique( array_merge( $post_data['post'], $post_data['bulk_post'] ) ); |
| 260 | } |
| 261 | |
258 | 262 | if ( isset($post_data['post_type']) ) |
259 | 263 | $ptype = get_post_type_object($post_data['post_type']); |
260 | 264 | else |
diff --git wp-admin/js/inline-edit-post.dev.js wp-admin/js/inline-edit-post.dev.js
index 96b36fe..8f6fbf5 100644
|
|
|
1 | 1 | (function($) { |
2 | 2 | inlineEditPost = { |
| 3 | bulkEditing : false, |
3 | 4 | |
4 | 5 | init : function(){ |
5 | 6 | var t = this, qeRow = $('#inline-edit'), bulkRow = $('#bulk-edit'); |
… |
… |
inlineEditPost = { |
46 | 47 | inlineEditPost.edit(this); |
47 | 48 | return false; |
48 | 49 | }); |
| 50 | |
| 51 | $('.check-column input').live('click', function(){ |
| 52 | var id; |
| 53 | if (inlineEditPost.bulkEditing) { |
| 54 | id = $(this).val(); |
| 55 | if ($(this).attr('checked')) { |
| 56 | inlineEditPost.addToBulk(id); |
| 57 | } else { |
| 58 | inlineEditPost.removeFromBulk(id); |
| 59 | } |
| 60 | } |
| 61 | }); |
| 62 | |
| 63 | $('#bulk-titles a').live('click', function(){ |
| 64 | var id = $(this).attr('id').substr(1); |
| 65 | inlineEditPost.removeFromBulk(id); |
| 66 | }); |
49 | 67 | |
50 | 68 | $('#bulk-title-div').parents('fieldset').after( |
51 | 69 | $('#inline-edit fieldset.inline-edit-categories').clone() |
… |
… |
inlineEditPost = { |
84 | 102 | var t = this; |
85 | 103 | $(t.what+t.getId(el)).css('display') == 'none' ? t.revert() : t.edit(el); |
86 | 104 | }, |
| 105 | |
| 106 | addToBulk : function(id) { |
| 107 | var theTitle, item; |
| 108 | theTitle = $('#inline_'+id+' .post_title').text() || inlineEditL10n.notitle; |
| 109 | item = '<div id="ttle'+id+'"><a id="_'+id+'" class="ntdelbutton" title="'+inlineEditL10n.ntdeltitle+'">X</a>'+theTitle+'</div>'; |
| 110 | $('#bulk-titles').append(item); |
| 111 | }, |
| 112 | |
| 113 | removeFromBulk : function(id) { |
| 114 | $('table.widefat input[value="'+id+'"]').attr('checked', ''); |
| 115 | $('#ttle'+id).remove(); |
| 116 | }, |
87 | 117 | |
88 | 118 | setBulk : function(){ |
89 | | var te = '', type = this.type, tax, c = true; |
| 119 | var type = this.type, tax, c = true; |
90 | 120 | this.revert(); |
| 121 | this.bulkEditing = true; |
91 | 122 | |
92 | 123 | $('#bulk-edit td').attr('colspan', $('.widefat:first thead th:visible').length); |
93 | 124 | $('table.widefat tbody').prepend( $('#bulk-edit') ); |
… |
… |
inlineEditPost = { |
96 | 127 | $('tbody th.check-column input[type="checkbox"]').each(function(i){ |
97 | 128 | if ( $(this).attr('checked') ) { |
98 | 129 | c = false; |
99 | | var id = $(this).val(), theTitle; |
100 | | theTitle = $('#inline_'+id+' .post_title').text() || inlineEditL10n.notitle; |
101 | | te += '<div id="ttle'+id+'"><a id="_'+id+'" class="ntdelbutton" title="'+inlineEditL10n.ntdeltitle+'">X</a>'+theTitle+'</div>'; |
| 130 | var id = $(this).val(); |
| 131 | inlineEditPost.addToBulk(id); |
102 | 132 | } |
103 | 133 | }); |
104 | 134 | |
105 | 135 | if ( c ) |
106 | 136 | return this.revert(); |
107 | 137 | |
108 | | $('#bulk-titles').html(te); |
109 | | $('#bulk-titles a').click(function(){ |
110 | | var id = $(this).attr('id').substr(1); |
111 | | |
112 | | $('table.widefat input[value="'+id+'"]').attr('checked', ''); |
113 | | $('#ttle'+id).remove(); |
114 | | }); |
| 138 | // $('#bulk-titles').html(te); |
115 | 139 | |
116 | 140 | // enable autocomplete for tags |
117 | 141 | if ( 'post' == type ) { |
… |
… |
inlineEditPost = { |
268 | 292 | $('table.widefat #bulk-edit').removeClass('inline-editor').hide(); |
269 | 293 | $('#bulk-titles').html(''); |
270 | 294 | $('#inlineedit').append( $('#bulk-edit') ); |
| 295 | this.bulkEditing = false; |
271 | 296 | } else { |
272 | 297 | $('#'+id).remove(); |
273 | 298 | id = id.substr( id.lastIndexOf('-') + 1 ); |
diff --git wp-admin/post.php wp-admin/post.php
index 0dae46d..3bfcb1a 100644
|
|
case 'trash': |
221 | 221 | |
222 | 222 | if ( ! wp_trash_post($post_id) ) |
223 | 223 | wp_die( __('Error in moving to Trash.') ); |
| 224 | $sendback = remove_query_arg( 'updated', $sendback ); |
224 | 225 | |
225 | 226 | wp_redirect( add_query_arg( array('trashed' => 1, 'ids' => $post_id), $sendback ) ); |
226 | 227 | exit(); |