Changeset 9083

Show
Ignore:
Timestamp:
10/05/08 04:43:52 (2 months ago)
Author:
azaozz
Message:

Quick Edit for Tags, Categories and Link Categories, improvements to handling errors in quick and bulk edit.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-admin/admin-ajax.php

    r8973 r9083  
    731731case 'inline-save': 
    732732    check_ajax_referer( 'inlineeditnonce', '_inline_edit' ); 
    733      
    734     if ( ! isset($_POST['post_ID']) || ! ( $id = (int) $_POST['post_ID'] ) ) 
     733 
     734    if ( ! isset($_POST['post_ID']) || ! ( $post_ID = (int) $_POST['post_ID'] ) ) 
    735735        exit; 
    736736 
    737     if ( $last = wp_check_post_lock( $id ) ) { 
     737    if ( 'page' == $_POST['post_type'] ) { 
     738        if ( ! current_user_can( 'edit_page', $post_ID ) ) 
     739            die( __('You are not allowed to edit this page.') ); 
     740    } else { 
     741        if ( ! current_user_can( 'edit_post', $post_ID ) ) 
     742            die( __('You are not allowed to edit this post.') ); 
     743    } 
     744 
     745    if ( $last = wp_check_post_lock( $post_ID ) ) { 
    738746        $last_user = get_userdata( $last ); 
    739747        $last_user_name = $last_user ? $last_user->display_name : __( 'Someone' ); 
    740         echo '<tr><td colspan="8"><div class="error"><p>' . sprintf( $_POST['post_type'] == 'page' ? __( 'Saving is disabled: %s is currently editing this page.' ) : __( 'Saving is disabled: %s is currently editing this post.' ),  wp_specialchars( $last_user_name ) ) . '</p></div></td></tr>'
     748        printf( $_POST['post_type'] == 'page' ? __( 'Saving is disabled: %s is currently editing this page.' ) : __( 'Saving is disabled: %s is currently editing this post.' ),   wp_specialchars( $last_user_name ) )
    741749        exit; 
    742750    } 
    743      
    744     inline_save_row( $_POST ); 
    745      
     751 
     752    $data = &$_POST; 
     753    $post = get_post( $post_ID, ARRAY_A ); 
     754    $data['content'] = $post['post_content']; 
     755    $data['excerpt'] = $post['post_excerpt']; 
     756 
     757    // rename 
     758    $data['user_ID'] = $GLOBALS['user_ID']; 
     759    $data['parent_id'] = $data['post_parent']; 
     760 
     761    // status 
     762    if ( 'private' == $data['keep_private'] ) 
     763        $data['post_status'] = 'private'; 
     764    else 
     765        $data['post_status'] = $data['_status']; 
     766 
     767    if ( empty($data['comment_status']) ) 
     768        $data['comment_status'] = 'closed'; 
     769    if ( empty($data['ping_status']) ) 
     770        $data['ping_status'] = 'closed'; 
     771 
     772    // update the post 
     773    $_POST = $data; 
     774    edit_post(); 
     775 
    746776    $post = array(); 
    747777    if ( 'page' == $_POST['post_type'] ) { 
     
    753783        post_rows($post); 
    754784    } 
    755     die(); 
     785 
     786    exit; 
     787    break; 
     788case 'inline-save-tax': 
     789    check_ajax_referer( 'taxinlineeditnonce', '_inline_edit' ); 
     790 
     791    if ( ! current_user_can('manage_categories') ) 
     792        die( '<tr colspan="6"><td>' . __('Cheatin&#8217; uh?') . '</td></tr>' ); 
     793 
     794    if ( ! isset($_POST['tax_ID']) || ! ( $id = (int) $_POST['tax_ID'] ) ) 
     795        exit; 
     796 
     797    switch ($_POST['tax_type']) { 
     798        case 'cat' : 
     799            $data = array(); 
     800            $data['cat_ID'] = $id; 
     801            $data['cat_name'] = $_POST['name']; 
     802            $data['category_nicename'] = $_POST['slug']; 
     803            if ( isset($_POST['parent']) && (int) $_POST['parent'] > 0 ) 
     804                $data['category_parent'] = $_POST['parent']; 
     805 
     806            $updated = wp_update_category($data); 
     807 
     808            if ( $updated && !is_wp_error($updated) ) 
     809                echo _cat_row( $id, 0 ); 
     810            else 
     811                die( __('Category not updated.') ); 
     812 
     813            break; 
     814        case 'link-cat' : 
     815            $updated = wp_update_term($id, 'link_category', $_POST); 
     816 
     817            if ( $updated && !is_wp_error($updated) ) 
     818                echo link_cat_row($id); 
     819            else 
     820                die( __('Category not updated.') ); 
     821 
     822            break; 
     823        case 'tag' : 
     824            $updated = wp_update_term($id, 'post_tag', $_POST); 
     825 
     826            if ( $updated && !is_wp_error($updated) ) { 
     827                $tag = get_term( $id, 'post_tag' ); 
     828                if ( !$tag || is_wp_error( $tag ) ) 
     829                    die( __('Tag not updated.') ); 
     830 
     831                echo _tag_row($tag); 
     832            } else { 
     833                die( __('Tag not updated.') ); 
     834            } 
     835 
     836            break; 
     837    } 
     838 
     839    exit; 
    756840    break; 
    757841case 'meta-box-order': 
     
    804888                break; 
    805889        } 
    806          
     890 
    807891        if ( '0000-00-00 00:00:00' == $post->post_date ) { 
    808892            $time = ''; 
  • trunk/wp-admin/categories.php

    r9074 r9083  
    112112wp_enqueue_script( 'admin-categories' ); 
    113113wp_enqueue_script('admin-forms'); 
     114if ( current_user_can('manage_categories') ) 
     115    wp_enqueue_script('inline-edit-tax'); 
    114116 
    115117require_once ('admin-header.php'); 
     
    236238<?php include('edit-category-form.php'); ?> 
    237239 
     240<?php inline_edit_term_row('category'); ?> 
    238241<?php endif; ?> 
    239242 
  • trunk/wp-admin/edit-link-categories.php

    r9074 r9083  
    4949wp_enqueue_script( 'admin-categories' ); 
    5050wp_enqueue_script('admin-forms'); 
     51if ( current_user_can('manage_categories') ) 
     52    wp_enqueue_script('inline-edit-tax'); 
    5153 
    5254require_once ('admin-header.php'); 
     
    184186 
    185187<?php include('edit-link-category-form.php'); ?> 
     188<?php inline_edit_term_row('link-category'); ?> 
    186189 
    187190<?php endif; ?> 
  • trunk/wp-admin/edit-pages.php

    r9074 r9083  
    7070$parent_file = 'edit.php'; 
    7171wp_enqueue_script('admin-forms'); 
    72 wp_enqueue_script('inline-edit'); 
     72wp_enqueue_script('inline-edit-post'); 
    7373wp_enqueue_script('pages'); 
    7474 
  • trunk/wp-admin/edit-tags.php

    r9074 r9083  
    116116wp_enqueue_script( 'admin-tags' ); 
    117117wp_enqueue_script('admin-forms'); 
     118if ( current_user_can('manage_categories') ) 
     119    wp_enqueue_script('inline-edit-tax'); 
    118120 
    119121require_once ('admin-header.php'); 
     
    188190<div class="clear"></div> 
    189191 
    190 <table class="widefat"> 
     192<table class="widefat tag"> 
    191193    <thead> 
    192194    <tr> 
     
    237239<br /> 
    238240<?php include('edit-tag-form.php'); ?> 
     241<?php inline_edit_term_row('tag'); ?> 
    239242 
    240243<?php endif; ?> 
  • trunk/wp-admin/edit.php

    r9073 r9083  
    7171$parent_file = 'edit.php'; 
    7272wp_enqueue_script('admin-forms'); 
    73 wp_enqueue_script('inline-edit'); 
     73wp_enqueue_script('inline-edit-post'); 
    7474wp_enqueue_script('posts'); 
    7575 
  • trunk/wp-admin/includes/template.php

    r9074 r9083  
    124124        $actions = array(); 
    125125        $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>'; 
     126        $actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __('Quick Edit') . '</a>'; 
    126127        if ( $default_cat_id != $category->term_id ) 
    127128            $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("categories.php?action=delete&amp;cat_ID=$category->term_id", 'delete-category_' . $category->term_id) . "' onclick=\"if ( confirm('" . js_escape(sprintf(__("You are about to delete this category '%s'\n 'Cancel' to stop, 'OK' to delete."), $name )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>"; 
     
    137138    } 
    138139 
    139     $class = " class='alternate'" == $class ? '' : " class='alternate'"
     140    $class = 'alternate' == $class ? '' : 'alternate'
    140141 
    141142    $category->count = number_format_i18n( $category->count ); 
    142143    $posts_count = ( $category->count > 0 ) ? "<a href='edit.php?cat=$category->term_id'>$category->count</a>" : $category->count; 
    143     $output = "<tr id='cat-$category->term_id'$class>"; 
     144    $output = "<tr id='cat-$category->term_id' class='iedit $class'>"; 
    144145 
    145146    $columns = get_column_headers('category'); 
     
    165166                break; 
    166167            case 'name': 
    167                 $output .= "<td $attributes>$edit</td>"; 
     168                $output .= "<td $attributes>$edit"; 
     169                $output .= '<div class="hidden" id="inline_' . $category->term_id . '">'; 
     170                $output .= '<div class="name">' . attribute_escape( $category->name ) . '</div>'; 
     171                $output .= '<div class="slug">' . $category->slug . '</div>'; 
     172                $output .= '<div class="cat_parent">' . $category->parent . '</div></div></td>'; 
    168173                break; 
    169174            case 'description': 
     
    181186 
    182187    return apply_filters('cat_row', $output); 
     188} 
     189 
     190/** 
     191 * {@internal Missing Short Description}} 
     192 * 
     193 * @since 2.7 
     194 *  
     195 * Outputs the HTML for the hidden table rows used in Categories, Link Caregories and Tags quick edit. 
     196 * 
     197 * @param string $type "tag", "category" or "link-category" 
     198 * @return  
     199 */ 
     200function inline_edit_term_row($type) { 
     201 
     202    if ( ! current_user_can( 'manage_categories' ) ) 
     203        return; 
     204 
     205    $is_tag = $type == 'tag'; 
     206    $columns = $is_tag ? get_column_headers('tag') : get_column_headers('category'); 
     207    $hidden = (array) get_user_option( "manage-$type-columns-hidden" ); ?> 
     208 
     209<form method="get" action=""><table style="display: none"><tbody id="inlineedit"> 
     210    <tr title="<?php _e('Double-click to cancel'); ?>" id="inline-edit" style="display: none"><td colspan="8"> 
     211    <?php 
     212 
     213    foreach ( $columns as $column_name => $column_display_name ) { 
     214        $class = "class=\"$column_name column-$column_name quick-edit-div\""; 
     215        $style = in_array($column_name, $hidden) ? ' style="display:none;"' : ''; 
     216        $attributes = "$class$style"; 
     217 
     218        switch ($column_name) { 
     219            case 'cb': 
     220                break; 
     221            case 'description': 
     222                break; 
     223            case 'name': ?> 
     224                <div class="tax-name quick-edit-div"<?php echo $style ?> title="<?php _e('Name'); ?>"> 
     225                    <div class="title"><?php _e('Name'); ?></div> 
     226                    <div class="in"> 
     227                    <input type="text" name="name" class="ptitle" value="" /> 
     228                    </div> 
     229                </div> 
     230                <?php 
     231 
     232                $output .= "<td $attributes>$edit</td>"; 
     233                break; 
     234            case 'slug': ?> 
     235                <div class="tax-slug quick-edit-div"<?php echo $style ?> title="<?php _e('Slug'); ?>"> 
     236                    <div class="title"><?php _e('Slug'); ?></div> 
     237                    <div class="in"> 
     238                    <input type="text" name="slug" class="ptitle" value="" /> 
     239                    </div> 
     240                </div> 
     241                <?php 
     242 
     243                $output .= "<td $attributes>$category->slug</td>"; 
     244                break; 
     245            case 'posts': 
     246                if ( 'category' == $type ) { ?> 
     247                <div class="tax-parent quick-edit-div"<?php echo $style ?> title="<?php _e('Parent Category'); ?>"> 
     248                    <div class="title"><?php _e('Parent Category'); ?></div> 
     249                        <div class="in"> 
     250                        <?php wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('None'))); ?> 
     251                        </div> 
     252                </div> 
     253                <?php } 
     254                break; 
     255        } 
     256    } 
     257    ?> 
     258    <div class="clear"></div> 
     259    <div class="quick-edit-save"> 
     260        <a accesskey="c" href="#inline-edit" title="<?php _e('Cancel'); ?>" class="button-secondary cancel"><?php _e('Cancel'); ?></a> 
     261        <a accesskey="s" href="#inline-edit" title="<?php _e('Save'); ?>" class="button-secondary save"><?php _e('Save'); ?></a> 
     262        <span class="hidden error"></span> 
     263        <?php wp_nonce_field( 'taxinlineeditnonce', '_inline_edit', false ); ?> 
     264    </div> 
     265    </td></tr> 
     266    </tbody></table></form> 
     267<?php 
    183268} 
    184269 
     
    207292        $actions = array(); 
    208293        $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>'; 
     294        $actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __('Quick Edit') . '</a>'; 
    209295        if ( $default_cat_id != $category->term_id ) 
    210296            $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("link-category.php?action=delete&amp;cat_ID=$category->term_id", 'delete-link-category_' . $category->term_id) . "' onclick=\"if ( confirm('" . js_escape(sprintf(__("You are about to delete this category '%s'\n 'Cancel' to stop, 'OK' to delete."), $name )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>"; 
     
    220306    } 
    221307 
    222     $class = " class='alternate'" == $class ? '' : " class='alternate'"
     308    $class = 'alternate' == $class ? '' : 'alternate'
    223309 
    224310    $category->count = number_format_i18n( $category->count ); 
    225311    $count = ( $category->count > 0 ) ? "<a href='link-manager.php?cat_id=$category->term_id'>$category->count</a>" : $category->count; 
    226     $output = "<tr id='link-cat-$category->term_id'$class>"; 
     312    $output = "<tr id='link-cat-$category->term_id' class='iedit $class'>"; 
    227313    $columns = get_column_headers('link-category'); 
    228314    $hidden = (array) get_user_option( 'manage-link-category-columns-hidden' ); 
     
    247333                break; 
    248334            case 'name': 
    249                 $output .= "<td $attributes>$edit</td>"; 
     335                $output .= "<td $attributes>$edit"; 
     336                $output .= '<div class="hidden" id="inline_' . $category->term_id . '">'; 
     337                $output .= '<div class="name">' . attribute_escape( $category->name ) . '</div>'; 
     338                $output .= '<div class="slug">' . $category->slug . '</div>'; 
     339                $output .= '<div class="cat_parent">' . $category->parent . '</div></div></td>'; 
    250340                break; 
    251341            case 'description': 
     
    518608                    $actions = array(); 
    519609                    $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>'; 
     610                    $actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __('Quick Edit') . '</a>'; 
    520611                    $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("edit-tags.php?action=delete&amp;tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id) . "' onclick=\"if ( confirm('" . js_escape(sprintf(__("You are about to delete this tag '%s'\n 'Cancel' to stop, 'OK' to delete."), $name )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>"; 
    521612                    $action_count = count($actions); 
     
    526617                        $out .= "<span class='$action'>$link$sep</span>"; 
    527618                    } 
    528                     $out .= '</td>'; 
     619                    $out .= '<div class="hidden" id="inline_' . $tag->term_id . '">'; 
     620                    $out .= '<div class="name">' . $name . '</div>'; 
     621                    $out .= '<div class="slug">' . $tag->slug . '</div></div></td>'; 
    529622                    break; 
    530623                case 'slug': 
     
    574667    $count = 0; 
    575668    foreach( $tags as $tag ) 
    576         $out .= _tag_row( $tag, ++$count % 2 ? ' class="alternate"' : '' ); 
     669        $out .= _tag_row( $tag, ++$count % 2 ? ' class="iedit alternate"' : ' class="iedit"' ); 
    577670 
    578671    // filter and send to screen 
     
    746839            ); 
    747840            return apply_filters('manage_users_columns', $columns); 
    748         default :  
     841        default : 
    749842            return apply_filters('manage_' . $page . '_columns', $columns); 
    750843    } 
     
    800893 * {@internal Missing Short Description}} 
    801894 * 
    802  * @since unknown 
    803  * 
    804  * @param unknown_type $type 
     895 * Outputs the quick edit and bulk edit table rows 
     896 *   
     897 * @since 2.7 
     898 * 
     899 * @param string $type 'post' or 'page' 
    805900 */ 
    806901function inline_edit_row( $type ) { 
     
    824919    $bulk = 0; 
    825920    while ( $bulk < 2 ) { ?> 
    826      
     921 
    827922    <tr title="<?php _e('Double-click to cancel'); ?>" id="<?php echo $bulk ? 'bulk-edit' : 'inline-edit'; ?>" style="display: none"><td colspan="<?php echo $col_count; ?>"> 
    828923    <?php 
     
    9691064                    <div class="title"><?php _e('Author'); ?></div> 
    9701065                    <div class="in"> 
    971                     <?php  
     1066                    <?php 
    9721067                    $users_opt = array('include' => $authors, 'name' => 'post_author', 'class'=> 'authors', 'multi' => 1); 
    9731068                    if ( $bulk ) $users_opt['show_option_none'] = __('- No Change -'); 
     
    10461141} 
    10471142 
    1048 /** 
    1049  * {@internal Missing Short Description}} 
    1050  * 
    1051  * @since unknown 
    1052  * 
    1053  * @param unknown_type $data 
    1054  */ 
    1055 function inline_save_row( $data ) { 
    1056     // get the original post content 
    1057     $post = get_post( $data['post_ID'], ARRAY_A ); 
    1058     $data['content'] = $post['post_content']; 
    1059  
    1060     // statuses 
    1061     if ( 'private' == $data['keep_private'] ) 
    1062         $data['post_status'] = 'private'; 
    1063     else 
    1064         $data['post_status'] = $data['_status']; 
    1065  
    1066     if ( empty($data['comment_status']) ) 
    1067         $data['comment_status'] = 'closed'; 
    1068     if ( empty($data['ping_status']) ) 
    1069         $data['ping_status'] = 'closed'; 
    1070  
    1071     // rename 
    1072     $data['user_ID'] = $GLOBALS['user_ID']; 
    1073     $data['excerpt'] = $data['post_excerpt']; 
    1074     $data['trackback_url'] = $data['to_ping']; 
    1075     $data['parent_id'] = $data['post_parent']; 
    1076  
    1077     // update the post 
    1078     $_POST = $data; 
    1079     edit_post(); 
    1080 } 
    1081  
    10821143// adds hidden fields with the data for use in the inline editor 
    10831144/** 
     
    10921153    if ( ! current_user_can('edit_' . $post->post_type, $post->ID) ) 
    10931154        return; 
    1094      
     1155 
    10951156    $title = _draft_or_post_title($post->ID); 
    10961157 
     
    11151176    <div class="page_template">' . wp_specialchars(get_post_meta( $post->ID, '_wp_page_template', true ), 1) . '</div> 
    11161177    <div class="menu_order">' . $post->menu_order . '</div>'; 
    1117      
     1178 
    11181179    if( $post->post_type == 'post' ) 
    11191180        echo ' 
     
    11211182    <div class="post_category">' . implode( ',', wp_get_post_categories( $post->ID ) ) . '</div> 
    11221183    <div class="sticky">' . (is_sticky($post->ID) ? 'sticky' : '') . '</div>'; 
    1123          
     1184 
    11241185    echo '</div>'; 
    11251186} 
     
    12321293            else 
    12331294                echo '<abbr title="' . $t_time . '">' . apply_filters('post_date_column_time', $h_time, $post, $column_name, $mode) . '</abbr>'; 
    1234              
     1295 
    12351296            echo '</td>'; 
    12361297        break; 
     
    14771538            echo "<span class='$action'>$link$sep</span>"; 
    14781539        } 
    1479          
     1540 
    14801541        get_inline_data($post); 
    14811542        echo '</td>'; 
     
    29753036    $title = get_the_title($post_id); 
    29763037    if ( empty($title) ) 
    2977         $title = __('(no title)');  
     3038        $title = __('(no title)'); 
    29783039    return $title; 
    29793040} 
  • trunk/wp-admin/js/inline-edit-post.js

    r9036 r9083  
    11 
    22(function($) { 
    3 inlineEdit = { 
     3inlineEditPost = { 
    44 
    55    init : function() { 
     
    1313 
    1414        // prepare the edit row 
    15         qeRow.dblclick(function() { inlineEdit.toggle(this); }) 
    16             .keyup(function(e) { if(e.which == 27) return inlineEdit.revert(); }); 
    17  
    18         bulkRow.dblclick(function() { inlineEdit.revert(); }) 
    19             .keyup(function(e) { if (e.which == 27) return inlineEdit.revert(); }); 
    20  
    21         $('a.cancel', qeRow).click(function() { return inlineEdit.revert(); }); 
    22         $('a.save', qeRow).click(function() { return inlineEdit.save(this); }); 
    23  
    24         $('a.cancel', bulkRow).click(function() { return inlineEdit.revert(); }); 
    25         $('a.save', bulkRow).click(function() { return inlineEdit.saveBulk(); }); 
     15        qeRow.dblclick(function() { inlineEditPost.toggle(this); }) 
     16            .keyup(function(e) { if(e.which == 27) return inlineEditPost.revert(); }); 
     17 
     18        bulkRow.dblclick(function() { inlineEditPost.revert(); }) 
     19            .keyup(function(e) { if (e.which == 27) return inlineEditPost.revert(); }); 
     20 
     21        $('a.cancel', qeRow).click(function() { return inlineEditPost.revert(); }); 
     22        $('a.save', qeRow).click(function() { return inlineEditPost.save(this); }); 
     23 
     24        $('a.cancel', bulkRow).click(function() { return inlineEditPost.revert(); }); 
     25        $('a.save', bulkRow).click(function() { return inlineEditPost.saveBulk(); }); 
    2626 
    2727        // add events 
    28         t.rows.dblclick(function() { inlineEdit.toggle(this); }); 
     28        t.rows.dblclick(function() { inlineEditPost.toggle(this); }); 
    2929        t.addEvents(t.rows); 
    3030 
     
    6666            } 
    6767        }); 
    68          
     68 
    6969        $('#post-query-submit').click(function(e){ 
    7070            if ( $('form#posts-filter tr.inline-editor').length > 0 ) 
    7171                t.revert(); 
    7272        }); 
    73          
     73 
    7474    }, 
    7575 
     
    8383        r.each(function() { 
    8484            var row = $(this); 
    85             $('a.editinline', row).click(function() { inlineEdit.edit(this); return false; }); 
     85            $('a.editinline', row).click(function() { inlineEditPost.edit(this); return false; }); 
    8686            row.attr('title', inlineEditL10n.edit); 
    8787        }); 
     
    105105        $('#bulk-titles').html(te); 
    106106        $('#bulk-titles a').click(function() { 
    107             var id = $(this).attr('id').substr(1), r = inlineEdit.type+'-'+id; 
     107            var id = $(this).attr('id').substr(1), r = inlineEditPost.type+'-'+id; 
    108108 
    109109            $('table.widefat input[value="'+id+'"]').attr('checked', ''); 
     
    187187            id = this.getId(id); 
    188188 
    189         $('#edit-'+id+' .check-column').html('<img src="images/loading.gif" alt="" />'); 
     189        $('#edit-'+id+'.quick-edit-save').append('<img style="padding:0 15px;" src="images/loading.gif" alt="" />'); 
    190190 
    191191        var params = { 
     
    202202        $.post('admin-ajax.php', params, 
    203203            function(r) { 
    204                 var row = $(inlineEdit.what+id); 
    205                 $('#edit-'+id).remove(); 
    206                 row.html($(r).html()).show() 
    207                     .animate( { backgroundColor: '#CCEEBB' }, 500) 
    208                     .animate( { backgroundColor: '#eefee7' }, 500); 
    209                 inlineEdit.addEvents(row); 
     204                var row = $(inlineEditPost.what+id); 
     205 
     206                if (r) { 
     207                    $('#edit-'+id).remove(); 
     208                    row.html($(r).html()).show() 
     209                        .animate( { backgroundColor: '#CCEEBB' }, 500) 
     210                        .animate( { backgroundColor: '#eefee7' }, 500); 
     211                    inlineEditPost.addEvents(row); 
     212                } else { 
     213                    $('#edit-'+id+' .quick-edit-save').append('<span class="error">'+inlineEditL10n.error+'</span>'); 
     214                } 
    210215            } 
    211216        ); 
     
    242247}; 
    243248 
    244 $(document).ready(function(){inlineEdit.init();}); 
     249$(document).ready(function(){inlineEditPost.init();}); 
    245250})(jQuery); 
  • trunk/wp-admin/wp-admin.css

    r9073 r9083  
    21522152 
    21532153.inline-editor .post-title, 
    2154 .inline-editor .page-title { 
     2154.inline-editor .page-title, 
     2155.inline-editor .tax-name, 
     2156.inline-editor .tax-slug { 
    21552157    width: 260px; 
    21562158} 
     
    21632165 
    21642166.inline-editor .post-title .ptitle, 
    2165 .inline-editor .page-title .ptitle { 
     2167.inline-editor .page-title .ptitle, 
     2168.inline-editor .tax-name .ptitle, 
     2169.inline-editor .tax-slug .ptitle { 
    21662170    width: 245px; 
    21672171    margin-bottom: 5px; 
     
    22072211} 
    22082212 
    2209 .inline-editor .categories { 
     2213.inline-editor .categories, 
     2214.inline-editor .column-posts { 
    22102215    width: 200px; 
    22112216} 
     
    22722277} 
    22732278 
    2274 .inline-editor .parent { 
     2279.inline-editor .parent, 
     2280.inline-editor .tax-parent { 
    22752281    width: 180px; 
    22762282} 
    22772283 
    2278 #wpbody-content .inline-editor .parent select { 
     2284#wpbody-content .inline-editor .parent select, 
     2285#wpbody-content .inline-editor .tax-parent select { 
    22792286    width: 170px; 
    22802287} 
  • trunk/wp-includes/classes.php

    r8964 r9083  
    14031403 
    14041404        $cat_name = apply_filters('list_cats', $category->name, $category); 
    1405         $output .= "\t<option value=\"".$category->term_id."\""; 
     1405        $output .= "\t<option class=\"level-$depth\" value=\"".$category->term_id."\""; 
    14061406        if ( $category->term_id == $args['selected'] ) 
    14071407            $output .= ' selected="selected"'; 
  • trunk/wp-includes/post.php

    r9055 r9083  
    15451545    $postarr['post_category'] = $post_cats; 
    15461546    if ( $clear_date ) { 
    1547         $postarr['post_date'] = current_time('mysql');; 
     1547        $postarr['post_date'] = current_time('mysql'); 
    15481548        $postarr['post_date_gmt'] = ''; 
    15491549    } 
  • trunk/wp-includes/script-loader.php

    r9064 r9083  
    3737function wp_default_scripts( &$scripts ) { 
    3838    global $current_user; 
    39      
     39 
    4040    if (!$guessurl = site_url()) 
    4141        $guessurl = wp_guess_url(); 
    42      
     42 
    4343    $userid = isset($current_user) ? $current_user->ID : 0; 
    4444    $scripts->base_url = $guessurl; 
     
    242242 
    243243        $scripts->add( 'theme-preview', '/wp-admin/js/theme-preview.js', array( 'thickbox', 'jquery' ), '20080625' ); 
    244          
    245         $scripts->add( 'inline-edit', '/wp-admin/js/inline-edit.js', array( 'jquery', 'jquery-form', 'suggest' ), '20080930' ); 
    246         $scripts->localize( 'inline-edit', 'inlineEditL10n', array( 
     244 
     245        $scripts->add( 'inline-edit-post', '/wp-admin/js/inline-edit-post.js', array( 'jquery', 'jquery-form', 'suggest' ), '20080930' ); 
     246        $scripts->localize( 'inline-edit-post', 'inlineEditL10n', array( 
    247247            'edit' => __('Double-click to edit') 
     248        ) ); 
     249 
     250        $scripts->add( 'inline-edit-tax', '/wp-admin/js/inline-edit-tax.js', array( 'jquery', 'jquery-form' ), '20081003' ); 
     251        $scripts->localize( 'inline-edit-tax', 'inlineEditL10n', array( 
     252            'edit' => __('Double-click to edit'), 
     253            'error' => __('Error while saving the changes.') 
    248254        ) ); 
    249255 
     
    254260 
    255261        $scripts->add( 'farbtastic', '/wp-admin/js/farbtastic.js', array('jquery'), '1.2' ); 
    256          
     262 
    257263        $scripts->add( 'user-settings', '/wp-admin/js/user-settings.js', array(), '20080829' ); 
    258264        $scripts->localize( 'user-settings', 'userSettings', array(