Ticket #12684: 12684_3.patch
| File 12684_3.patch, 15.5 KB (added by , 10 years ago) |
|---|
-
src/wp-admin/edit-tags.php
\ No newline at end of file diff --git src/wp-admin/edit-tags.php src/wp-admin/edit-tags.php index 846928c..a374981 100644
case 'edit': 167 167 168 168 exit; 169 169 170 case 'edit-parent': 171 $parent_id = (int) $_REQUEST['parent']; 172 173 if ($parent_id != -1) { 174 $terms = (array) $_REQUEST['delete_tags']; 175 176 foreach ($terms as $term_id) { 177 if ($term_id == $parent_id) 178 continue; 179 $update_parent = wp_update_term($term_id, $_REQUEST['taxonomy'], array('parent' => $parent_id)); 180 181 if ($update_parent && !is_wp_error($update_parent)) 182 $location = add_query_arg('message', 3, $location); 183 } 184 } 185 186 break; 187 170 188 case 'editedtag': 171 189 $tag_ID = (int) $_POST['tag_ID']; 172 190 check_admin_referer( 'update-tag_' . $tag_ID ); -
src/wp-admin/includes/class-wp-terms-list-table.php
diff --git src/wp-admin/includes/class-wp-terms-list-table.php src/wp-admin/includes/class-wp-terms-list-table.php index 765b1a3..6c47fd8 100644
class WP_Terms_List_Table extends WP_List_Table { 152 152 protected function get_bulk_actions() { 153 153 $actions = array(); 154 154 $actions['delete'] = __( 'Delete' ); 155 156 if ( is_taxonomy_hierarchical( $this->screen->taxonomy ) ) { 157 $actions['edit'] = __( 'Edit' ); 158 } 155 159 156 160 return $actions; 157 161 } … … class WP_Terms_List_Table extends WP_List_Table { 161 165 * @return string 162 166 */ 163 167 public function current_action() { 164 if ( isset( $_REQUEST['action'] ) && isset( $_REQUEST['delete_tags'] ) && ( 'delete' === $_REQUEST['action'] || 'delete' === $_REQUEST['action2'] ) ) 168 if ( isset( $_REQUEST['action'] ) && isset( $_REQUEST['delete_tags'] ) && ( 'delete' === $_REQUEST['action'] || 'delete' === $_REQUEST['action2'] ) ) { 165 169 return 'bulk-delete'; 170 } else if ( isset( $_REQUEST['action'] ) && isset( $_REQUEST['delete_tags'] ) && ( 'edit' == $_REQUEST['action'] || 'edit-category' == $_REQUEST['screen'] ) ) { 171 return 'edit-parent'; 172 } 166 173 167 174 return parent::current_action(); 168 175 } … … class WP_Terms_List_Table extends WP_List_Table { 555 562 ?> 556 563 557 564 <form method="get"><table style="display: none"><tbody id="inlineedit"> 558 <tr id="inline-edit" class="inline-edit-row" style="display: none"><td colspan="<?php echo $this->get_column_count(); ?>" class="colspanchange"> 559 560 <fieldset> 561 <legend class="inline-edit-legend"><?php _e( 'Quick Edit' ); ?></legend> 562 <div class="inline-edit-col"> 563 <label> 564 <span class="title"><?php _ex( 'Name', 'term name' ); ?></span> 565 <span class="input-text-wrap"><input type="text" name="name" class="ptitle" value="" /></span> 566 </label> 567 <?php if ( !global_terms_enabled() ) { ?> 568 <label> 569 <span class="title"><?php _e( 'Slug' ); ?></span> 570 <span class="input-text-wrap"><input type="text" name="slug" class="ptitle" value="" /></span> 571 </label> 572 <?php } ?> 573 </div></fieldset> 574 <?php 575 576 $core_columns = array( 'cb' => true, 'description' => true, 'name' => true, 'slug' => true, 'posts' => true ); 577 578 list( $columns ) = $this->get_column_info(); 579 580 foreach ( $columns as $column_name => $column_display_name ) { 581 if ( isset( $core_columns[$column_name] ) ) 582 continue; 583 584 /** This action is documented in wp-admin/includes/class-wp-posts-list-table.php */ 585 do_action( 'quick_edit_custom_box', $column_name, 'edit-tags', $this->screen->taxonomy ); 586 } 587 588 ?> 589 590 <p class="inline-edit-save submit"> 591 <button type="button" class="cancel button-secondary alignleft"><?php _e( 'Cancel' ); ?></button> 592 <button type="button" class="save button-primary alignright"><?php echo $tax->labels->update_item; ?></button> 593 <span class="spinner"></span> 594 <span class="error" style="display:none;"></span> 595 <?php wp_nonce_field( 'taxinlineeditnonce', '_inline_edit', false ); ?> 596 <input type="hidden" name="taxonomy" value="<?php echo esc_attr( $this->screen->taxonomy ); ?>" /> 597 <input type="hidden" name="post_type" value="<?php echo esc_attr( $this->screen->post_type ); ?>" /> 598 <br class="clear" /> 599 </p> 600 </td></tr> 565 566 <?php 567 568 $core_columns = array( 'cb' => true, 'description' => true, 'name' => true, 'slug' => true, 'posts' => true ); 569 570 list( $columns ) = $this->get_column_info(); 571 572 foreach ( $columns as $column_name => $column_display_name ) { 573 if ( isset( $core_columns[$column_name] ) ) 574 continue; 575 576 if ( $bulk ) { 577 do_action( 'bulk_edit_custom_box', $column_name, $this->screen->taxonomy ); 578 } else { 579 /** This action is documented in wp-admin/includes/class-wp-posts-list-table.php */ 580 do_action( 'quick_edit_custom_box', $column_name, 'edit-tags', $this->screen->taxonomy ); 581 } 582 } 583 584 ?> 585 <?php 586 587 $bulk = 0; 588 while ( $bulk < 2 ) { 589 ?> 590 <tr id="<?php echo $bulk ? 'bulk-edit' : 'inline-edit'; ?>" class="inline-edit-row inline-edit-row-<?php echo "inline-edit-" . $this->screen->taxonomy; echo $bulk ? " bulk-edit-row bulk-edit-row bulk-edit-{$this->screen->taxonomy}" : " quick-edit-row quick-edit-row inline-edit-{$this->screen->taxonomy}"; ?>" style="display: none"> 591 <td colspan="<?php echo $this->get_column_count(); ?>" class="colspanchange"> 592 <?php if ($bulk) : ?> 593 594 <fieldset class="inline-edit-col-left"> 595 <legend class="inline-edit-legend"><?php echo __('Bulk Edit'); ?></legend> 596 <div class="inline-edit-col"> 597 <div id="bulk-title-div"> 598 <div id="bulk-titles"></div> 599 </div> 600 </div> 601 </fieldset> 602 <fieldset class="inline-edit-col-left"> 603 <span class="title inline-edit-categories-label"><?php _e('Parent Category') ?></span> 604 <div class="inline-edit-col"> 605 <div class="bulk-edit-col"> 606 <?php 607 608 wp_dropdown_categories(array( 609 'hide_empty' => 0, 610 'hide_if_empty' => false, 611 'name' => 'parent', 612 'orderby' => 'name', 613 'taxonomy' => $this->screen->taxonomy, 614 'hierarchical' => true, 615 'show_option_none' => __('None') 616 )); 617 618 ?> 619 </div> 620 </div> 621 </div> 622 </fieldset> 623 <?php else : ?> 624 <fieldset> 625 <legend class="inline-edit-legend"><?php echo $bulk ? __('Bulk Edit') : __('Quick Edit'); ?></legend> 626 <div class="inline-edit-col"> 627 <label> 628 <span class="title"><?php _ex('Name', 'term name'); ?></span> 629 <span class="input-text-wrap"><input type="text" name="name" class="ptitle" value="" /></span> 630 </label> 631 <?php if (!global_terms_enabled()) { ?> 632 <label> 633 <span class="title"><?php _e('Slug'); ?></span> 634 <span class="input-text-wrap"><input type="text" name="slug" class="ptitle" value="" /></span> 635 </label> 636 <?php } ?> 637 </div> 638 </fieldset> 639 <?php endif; ?> 640 641 <p class="inline-edit-save submit"> 642 <a href="#inline-edit" class="cancel button-secondary alignleft"><?php _e('Cancel'); ?></a> 643 644 <?php 645 if ($bulk) : 646 submit_button(__('Update'), 'button-primary alignright', 'edit-parent', false); 647 else : 648 ?> 649 <a href="#inline-edit" class="save button-primary alignright"><?php echo $tax->labels->update_item; ?></a> 650 <?php endif;?> 651 652 <span class="spinner"></span> 653 <span class="error" style="display:none;"></span> 654 <?php wp_nonce_field('taxinlineeditnonce', '_inline_edit', false); ?> 655 656 <input type="hidden" name="taxonomy" value="<?php echo esc_attr($this->screen->taxonomy); ?>" /> 657 <input type="hidden" name="post_type" value="<?php echo esc_attr($this->screen->post_type); ?>" /> 658 <?php if ($bulk) { ?> 659 <input type="hidden" name="screen" value="<?php echo esc_attr($this->screen->id); ?>" /> 660 <?php } ?> 661 <br class="clear" /> 662 </p> 663 </td> 664 </tr> 665 666 <?php 667 $bulk++; 668 } 669 ?> 601 670 </tbody></table></form> 602 671 <?php 603 672 } -
src/wp-admin/js/inline-edit-tax.js
diff --git src/wp-admin/js/inline-edit-tax.js src/wp-admin/js/inline-edit-tax.js index a05dc09..6cdc1e4 100644
inlineEditTax = { 26 26 $( '.cancel', row ).click( function() { 27 27 return inlineEditTax.revert(); 28 28 }); 29 $( '.cancel' ).click( function() { 30 return inlineEditTax.revert(); 31 }); 29 32 $( '.save', row ).click( function() { 30 33 return inlineEditTax.save(this); 31 34 }); … … inlineEditTax = { 38 41 $( '#posts-filter input[type="submit"]' ).mousedown( function() { 39 42 t.revert(); 40 43 }); 44 45 $('#doaction, #doaction2').click(function(e) { 46 var n = $(this).attr('id').substr(2); 47 if ( 'edit' === $( 'select[name="' + n + '"]' ).val() ) { 48 e.preventDefault(); 49 t.setBulk(); 50 } else if ( $('form#posts-filter tr.inline-editor').length > 0 ) { 51 t.revert(); 52 } 53 }); 41 54 }, 42 55 43 56 toggle : function(el) { 44 57 var t = this; 45 $(t.what+t.getId(el)).css('display') === 'none' ? t.revert() : t.edit(el); 58 $(t.what+t.getId(el)).css('display') === 'none' ? t.revert() : t.edit(el); 59 46 60 }, 47 61 setBulk : function() { 62 var te = '', type = this.type, tax, c = true; 63 this.revert(); 64 $( '#bulk-edit td' ).attr( 'colspan', $( 'th:visible, td:visible', '.widefat:first thead' ).length ); 65 $('table.widefat tbody').prepend( $('#bulk-edit') ).prepend('<tr class="hidden"></tr>'); 66 $('#bulk-edit').addClass('inline-editor').show(); 67 68 $( 'tbody th.check-column input[type="checkbox"]' ).each( function() { 69 if ( $(this).prop('checked') ) { 70 c = false; 71 var id = $(this).val(), theTitle; 72 theTitle = $('#tag-'+id+' .row-title').html() || inlineEditL10n.notitle; 73 te += '<div id="ttle'+id+'"><a id="_'+id+'" class="ntdelbutton" title="'+inlineEditL10n.ntdeltitle+'">X</a>'+theTitle+'</div>'; 74 } 75 }); 76 77 if ( c ) { 78 return this.revert(); 79 } 80 81 $('#bulk-titles').html(te); 82 83 $('#bulk-titles a').click(function(){ 84 var id = $(this).attr('id').substr(1); 85 $('table.widefat input[value="' + id + '"]').prop('checked', false); 86 $('#ttle'+id).remove(); 87 }); 88 89 $('html, body').animate( { scrollTop: 0 }, 'fast' ); 90 }, 48 91 edit : function(id) { 49 92 var editRow, rowData, val, 50 93 t = this; … … inlineEditTax = { 143 186 var id = $('table.widefat tr.inline-editor').attr('id'); 144 187 145 188 if ( id ) { 146 $( 'table.widefat .spinner' ).removeClass( 'is-active' ); 147 $('#'+id).siblings('tr.hidden').addBack().remove(); 148 id = id.substr( id.lastIndexOf('-') + 1 ); 149 // Show the taxonomy listing and move focus back to the taxonomy title. 150 $( this.what + id ).show().find( '.row-title' ).focus(); 189 $( 'table.widefat .spinner' ).removeClass( 'is-active' ); 190 if ( 'bulk-edit' === id ) { 191 $('table.widefat #bulk-edit').removeClass('inline-editor').hide().siblings('tr.hidden').remove(); 192 $('#bulk-titles').empty(); 193 $('#inlineedit').append( $('#bulk-edit') ); 194 } else { 195 $('#'+id).siblings('tr.hidden').addBack().remove(); 196 id = id.substr( id.lastIndexOf('-') + 1 ); 197 // Show the taxonomy listing and move focus back to the taxonomy title. 198 $( this.what + id ).show().find( '.row-title' ).focus(); 199 } 151 200 } 152 201 }, 153 202