Ticket #12684: 12684_2.patch
File 12684_2.patch, 14.0 KB (added by , 8 years ago) |
---|
-
.gitignore
diff --git a/.gitignore b/.gitignore index dd18e54..3c54a44 100644
a b wp-tests-config.php 42 42 43 43 # Ignore other .gitignore files to allow for personal customizations 44 44 .gitignore 45 /nbproject/private/ 46 No newline at end of file -
src/wp-admin/edit-tags.php
diff --git a/src/wp-admin/edit-tags.php b/src/wp-admin/edit-tags.php index 748ae17..bb22f91 100644
a b case 'edit': 163 163 164 164 exit; 165 165 166 case 'edit-parent': 167 168 $parent_id = (int) $_REQUEST['parent']; 169 170 if ($parent_id != -1) { 171 172 $terms = (array) $_REQUEST['delete_tags']; 173 174 foreach ($terms as $term_id) { 175 if ($term_id == $parent_id) 176 continue; 177 178 $update_parent = wp_update_term($term_id, $_REQUEST['taxonomy'], array('parent' => $parent_id)); 179 180 if ($update_parent && !is_wp_error($update_parent)) 181 $location = add_query_arg('message', 3, $location); 182 } 183 } 184 185 break; 186 166 187 case 'editedtag': 167 188 $tag_ID = (int) $_POST['tag_ID']; 168 189 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 8cfeedf..affc83b 100644
a b 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 { 160 164 * 161 165 * @return string 162 166 */ 163 public function current_action() { 164 if ( isset( $_REQUEST['action'] ) && isset( $_REQUEST['delete_tags'] ) && ( 'delete' === $_REQUEST['action'] || 'delete' === $_REQUEST['action2'] ) ) 167 public function current_action() { 168 169 170 if ( isset( $_REQUEST['action'] ) && isset( $_REQUEST['delete_tags'] ) && ( 'delete' === $_REQUEST['action'] || 'delete' === $_REQUEST['action2'] ) ) { 165 171 return 'bulk-delete'; 172 } else if ( isset( $_REQUEST['action'] ) && isset( $_REQUEST['delete_tags'] ) && ( 'edit' == $_REQUEST['action'] || 'edit-category' == $_REQUEST['screen'] ) ) { 173 return 'edit-parent'; 174 } 166 175 167 176 return parent::current_action(); 168 177 } … … class WP_Terms_List_Table extends WP_List_Table { 555 564 ?> 556 565 557 566 <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> 567 574 568 <?php 575 569 576 570 $core_columns = array( 'cb' => true, 'description' => true, 'name' => true, 'slug' => true, 'posts' => true ); … … class WP_Terms_List_Table extends WP_List_Table { 580 574 foreach ( $columns as $column_name => $column_display_name ) { 581 575 if ( isset( $core_columns[$column_name] ) ) 582 576 continue; 583 584 /** This action is documented in wp-admin/includes/class-wp-posts-list-table.php */ 577 578 if ( $bulk ) { 579 580 do_action( 'bulk_edit_custom_box', $column_name, $this->screen->taxonomy ); 581 582 } else { 583 585 584 do_action( 'quick_edit_custom_box', $column_name, 'edit-tags', $this->screen->taxonomy ); 585 586 } 586 587 } 587 588 588 589 ?> 589 590 <p class="inline-edit-save submit"> 591 <a href="#inline-edit" class="cancel button-secondary alignleft"><?php _e( 'Cancel' ); ?></a> 592 <a href="#inline-edit" class="save button-primary alignright"><?php echo $tax->labels->update_item; ?></a> 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> 590 <?php 591 $bulk = 0; 592 while ( $bulk < 2 ) { ?> 593 <tr id="<?php echo $bulk ? 'bulk-edit' : 'inline-edit'; ?>" class="inline-edit-row inline-edit-row-<?php 594 echo "inline-edit-" . $this->screen->taxonomy; 595 echo $bulk ? " bulk-edit-row bulk-edit-row bulk-edit-{$this->screen->taxonomy}" : " quick-edit-row quick-edit-row inline-edit-{$this->screen->taxonomy}"; 596 ?>" style="display: none"><td colspan="<?php echo $this->get_column_count(); ?>" class="colspanchange"> 597 598 <?php if ($bulk) : ?> 599 <fieldset class="inline-edit-col-left"> 600 <legend class="inline-edit-legend"><?php echo __('Bulk Edit'); ?></legend> 601 <div class="inline-edit-col"> 602 <div id="bulk-title-div"> 603 <div id="bulk-titles"></div> 604 </div> 605 </div> 606 </fieldset> 607 <fieldset class="inline-edit-col-left"> 608 <span class="title inline-edit-categories-label"><?php _e('Parent Category') ?></span> 609 <div class="inline-edit-col"> 610 <div class="bulk-edit-col"> 611 <?php 612 wp_dropdown_categories(array( 613 'hide_empty' => 0, 614 'hide_if_empty' => false, 615 'name' => 'parent', 616 'orderby' => 'name', 617 'taxonomy' => $this->screen->taxonomy, 618 'hierarchical' => true, 619 'show_option_none' => __('None') 620 )); 621 ?> 622 </div> 623 </div> 624 </div> 625 </fieldset> 626 <?php else : // $bulk ?> 627 <fieldset> 628 <legend class="inline-edit-legend"><?php echo $bulk ? __('Bulk Edit') : __('Quick Edit'); ?></legend> 629 <div class="inline-edit-col"> 630 <label> 631 <span class="title"><?php _ex('Name', 'term name'); ?></span> 632 <span class="input-text-wrap"><input type="text" name="name" class="ptitle" value="" /></span> 633 </label> 634 <?php if (!global_terms_enabled()) { ?> 635 <label> 636 <span class="title"><?php _e('Slug'); ?></span> 637 <span class="input-text-wrap"><input type="text" name="slug" class="ptitle" value="" /></span> 638 </label> 639 <?php } ?> 640 </div> 641 </fieldset> 642 <?php endif; // $bulk ?> 643 644 645 646 <p class="inline-edit-save submit"> 647 <a href="#inline-edit" class="cancel button-secondary alignleft"><?php _e('Cancel'); ?></a> 648 <?php 649 if ($bulk) : 650 submit_button(__('Update'), 'button-primary alignright', 'edit-parent', false); 651 else : // $bulk 652 ?> 653 <a href="#inline-edit" class="save button-primary alignright"><?php echo $tax->labels->update_item; ?></a> 654 <?php endif; // $bulk ?> 655 <span class="spinner"></span> 656 <span class="error" style="display:none;"></span> 657 <?php wp_nonce_field('taxinlineeditnonce', '_inline_edit', false); ?> 658 <input type="hidden" name="taxonomy" value="<?php echo esc_attr($this->screen->taxonomy); ?>" /> 659 <input type="hidden" name="post_type" value="<?php echo esc_attr($this->screen->post_type); ?>" /> 660 <?php if ($bulk) { ?> 661 <input type="hidden" name="screen" value="<?php echo esc_attr($this->screen->id); ?>" /> 662 <?php } ?> 663 <br class="clear" /> 664 </p> 665 </td> 666 </tr> 667 668 <?php 669 $bulk++; 670 } 671 ?> 601 672 </tbody></table></form> 602 673 <?php 603 674 } -
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;