Make WordPress Core

Ticket #12684: 12684.patch

File 12684.patch, 6.8 KB (added by dipali.dhole27@…, 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': 
    158158
    159159        exit;
    160160
     161case '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
    161182case 'editedtag':
    162183        $tag_ID = (int) $_POST['tag_ID'];
    163184        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 { 
    144144        protected function get_bulk_actions() {
    145145                $actions = array();
    146146                $actions['delete'] = __( 'Delete' );
     147               
     148                if ( is_taxonomy_hierarchical( $this->screen->taxonomy ) ) {
     149                        $actions['edit'] = __( 'Edit' );
     150                }
    147151
    148152                return $actions;
    149153        }
    class WP_Terms_List_Table extends WP_List_Table { 
    153157         * @return string
    154158         */
    155159        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'] ) ) {
    157161                        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                }
    158165
    159166                return parent::current_action();
    160167        }
    class WP_Terms_List_Table extends WP_List_Table { 
    590597                        <br class="clear" />
    591598                </p>
    592599                </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>
    593643                </tbody></table></form>
    594644        <?php
    595645        }
  • 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 = { 
    2525                $( 'a.cancel', row ).click( function() {
    2626                        return inlineEditTax.revert();
    2727                });
     28                $( '.cancel' ).click( function() {               
     29                        return inlineEditTax.revert();
     30                });
    2831                $( 'a.save', row ).click( function() {
    2932                        return inlineEditTax.save(this);
    3033                });
    inlineEditTax = { 
    3740                $( '#posts-filter input[type="submit"]' ).mousedown( function() {
    3841                        t.revert();
    3942                });
     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       
    4087        },
    4188
    4289        toggle : function(el) {
    inlineEditTax = { 
    134181
    135182                if ( id ) {
    136183                        $( '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                        }
    140193                }
    141194
    142195                return false;