Ticket #12684: 12684.patch
File 12684.patch, 6.8 KB (added by , 9 years ago) |
---|
-
src/wp-admin/edit-tags.php
diff --git a/src/wp-admin/edit-tags.php b/src/wp-admin/edit-tags.php index 0bf8d3e..210777a 100644
a b case 'edit': 158 158 159 159 exit; 160 160 161 case 'edit-parent': 162 163 if($_REQUEST['parent']!=-1) { 164 165 $parent_id= $_REQUEST['parent']; 166 167 foreach ( $_REQUEST['delete_tags'] as $term_id ) { 168 169 if ( $term_id == $parent_id ) 170 continue; 171 172 $update_parent = wp_update_term( $term_id, $_REQUEST['taxonomy'], array( 'parent' => $parent_id ) ); 173 174 if ( $update_parent && !is_wp_error( $update_parent ) ) 175 $location = add_query_arg( 'message', 3, $location ); 176 177 } 178 } 179 180 break; 181 161 182 case 'editedtag': 162 183 $tag_ID = (int) $_POST['tag_ID']; 163 184 check_admin_referer( 'update-tag_' . $tag_ID ); -
src/wp-admin/includes/class-wp-terms-list-table.php
diff --git a/src/wp-admin/includes/class-wp-terms-list-table.php b/src/wp-admin/includes/class-wp-terms-list-table.php index 2acbfcf..37ec510 100644
a b class WP_Terms_List_Table extends WP_List_Table { 144 144 protected function get_bulk_actions() { 145 145 $actions = array(); 146 146 $actions['delete'] = __( 'Delete' ); 147 148 if ( is_taxonomy_hierarchical( $this->screen->taxonomy ) ) { 149 $actions['edit'] = __( 'Edit' ); 150 } 147 151 148 152 return $actions; 149 153 } … … class WP_Terms_List_Table extends WP_List_Table { 153 157 * @return string 154 158 */ 155 159 public function current_action() { 156 if ( isset( $_REQUEST['action'] ) && isset( $_REQUEST['delete_tags'] ) && ( 'delete' === $_REQUEST['action'] || 'delete' === $_REQUEST['action2'] ) ) 160 if ( isset( $_REQUEST['action'] ) && isset( $_REQUEST['delete_tags'] ) && ( 'delete' === $_REQUEST['action'] || 'delete' === $_REQUEST['action2'] ) ) { 157 161 return 'bulk-delete'; 162 } else if ( isset( $_REQUEST['action'] ) && isset( $_REQUEST['delete_tags'] ) && ( 'edit' == $_REQUEST['action'] || 'edit-parent' == $_REQUEST['category_screen'] ) ) { 163 return 'edit-parent'; 164 } 158 165 159 166 return parent::current_action(); 160 167 } … … class WP_Terms_List_Table extends WP_List_Table { 590 597 <br class="clear" /> 591 598 </p> 592 599 </td></tr> 600 601 <tr id="bulk-edit" class="bulk-edit-row bulk-edit-row inline-edit-row bulk-edit-row-post "> 602 <td class="colspanchange" colspan="<?php echo $this->get_column_count(); ?>"> 603 604 <fieldset class="inline-edit-col-left"><div class="inline-edit-col"> 605 <h4>Bulk Edit</h4> 606 <div id="bulk-title-div"> 607 <div id="bulk-titles"></div> 608 </div> 609 </div></fieldset> 610 611 <fieldset class="inline-edit-col-left"><div class="inline-edit-col"> 612 <div class="bulk-edit-col"> 613 <span class="title inline-edit-categories-label">Parent Category</span> 614 <?php 615 wp_dropdown_categories(array( 616 'hide_empty' => 0, 617 'hide_if_empty' => false, 618 'name' => 'parent', 619 'orderby' => 'name', 620 'taxonomy' => $this->screen->taxonomy, 621 'hierarchical' => true, 622 'show_option_none' => __('None') 623 )); 624 ?> 625 </div> 626 </fieldset> 627 628 <p class="submit inline-edit-save"> 629 <button type="button" class="button-secondary cancel alignleft"><?php _e('Cancel'); ?></button> 630 <?php 631 submit_button(__('Update'), 'button-primary alignright', 'edit-parent', false); 632 ?> 633 <span class="spinner"></span> 634 <input type="hidden" name="post_view" value="<?php echo esc_attr($this->screen->taxonomy); ?>" /> 635 <input type="hidden" name="screen" value="<?php echo esc_attr($this->screen->id); ?>" /> 636 <input type="hidden" name="category_screen" value="edit-parent" /> 637 <span class="error" style="display:none"></span> 638 <br class="clear" /> 639 </p> 640 641 </td> 642 </tr> 593 643 </tbody></table></form> 594 644 <?php 595 645 } -
src/wp-admin/js/inline-edit-tax.js
diff --git a/src/wp-admin/js/inline-edit-tax.js b/src/wp-admin/js/inline-edit-tax.js index 99bfca4..4c17d6f 100644
a b inlineEditTax = { 25 25 $( 'a.cancel', row ).click( function() { 26 26 return inlineEditTax.revert(); 27 27 }); 28 $( '.cancel' ).click( function() { 29 return inlineEditTax.revert(); 30 }); 28 31 $( 'a.save', row ).click( function() { 29 32 return inlineEditTax.save(this); 30 33 }); … … inlineEditTax = { 37 40 $( '#posts-filter input[type="submit"]' ).mousedown( function() { 38 41 t.revert(); 39 42 }); 43 44 $('#doaction, #doaction2').click(function(e){ 45 var n = $(this).attr('id').substr(2); 46 if ( 'edit' === $( 'select[name="' + n + '"]' ).val() ) { 47 e.preventDefault(); 48 t.setBulk(); 49 } else if ( $('form#posts-filter tr.inline-editor').length > 0 ) { 50 t.revert(); 51 } 52 }); 53 }, 54 55 56 setBulk : function() { 57 var te = '', type = this.type, tax, c = true; 58 this.revert(); 59 60 $( '#bulk-edit td' ).attr( 'colspan', $( 'th:visible, td:visible', '.widefat:first thead' ).length ); 61 $('table.widefat tbody').prepend( $('#bulk-edit') ).prepend('<tr class="hidden"></tr>'); 62 $('#bulk-edit').addClass('inline-editor').show(); 63 64 $( 'tbody th.check-column input[type="checkbox"]' ).each( function() { 65 if ( $(this).prop('checked') ) { 66 c = false; 67 var id = $(this).val(), theTitle; 68 theTitle = $('#tag-'+id+' .row-title').html() || inlineEditL10n.notitle; 69 te += '<div id="ttle'+id+'"><a id="_'+id+'" class="ntdelbutton" title="'+inlineEditL10n.ntdeltitle+'">X</a>'+theTitle+'</div>'; 70 } 71 }); 72 73 if ( c ) { 74 return this.revert(); 75 } 76 77 $('#bulk-titles').html(te); 78 $('#bulk-titles a').click(function(){ 79 var id = $(this).attr('id').substr(1); 80 81 $('table.widefat input[value="' + id + '"]').prop('checked', false); 82 $('#ttle'+id).remove(); 83 }); 84 85 $('html, body').animate( { scrollTop: 0 }, 'fast' ); 86 40 87 }, 41 88 42 89 toggle : function(el) { … … inlineEditTax = { 134 181 135 182 if ( id ) { 136 183 $( 'table.widefat .spinner' ).removeClass( 'is-active' ); 137 $('#'+id).siblings('tr.hidden').addBack().remove(); 138 id = id.substr( id.lastIndexOf('-') + 1 ); 139 $(this.what+id).show(); 184 if ( 'bulk-edit' === id ) { 185 $('table.widefat #bulk-edit').removeClass('inline-editor').hide().siblings('tr.hidden').remove(); 186 $('#bulk-titles').empty(); 187 $('#inlineedit').append( $('#bulk-edit') ); 188 } else { 189 $('#'+id).siblings('tr.hidden').addBack().remove(); 190 id = id.substr( id.lastIndexOf('-') + 1 ); 191 $(this.what+id).show(); 192 } 140 193 } 141 194 142 195 return false;