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

git-svn-id: http://svn.automattic.com/wordpress/trunk@9083 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz 2008-10-05 04:43:52 +00:00
parent 90792c9a3d
commit dc564f4792
13 changed files with 417 additions and 100 deletions

View File

@ -731,17 +731,47 @@ break;
case 'inline-save':
check_ajax_referer( 'inlineeditnonce', '_inline_edit' );
if ( ! isset($_POST['post_ID']) || ! ( $id = (int) $_POST['post_ID'] ) )
if ( ! isset($_POST['post_ID']) || ! ( $post_ID = (int) $_POST['post_ID'] ) )
exit;
if ( $last = wp_check_post_lock( $id ) ) {
if ( 'page' == $_POST['post_type'] ) {
if ( ! current_user_can( 'edit_page', $post_ID ) )
die( __('You are not allowed to edit this page.') );
} else {
if ( ! current_user_can( 'edit_post', $post_ID ) )
die( __('You are not allowed to edit this post.') );
}
if ( $last = wp_check_post_lock( $post_ID ) ) {
$last_user = get_userdata( $last );
$last_user_name = $last_user ? $last_user->display_name : __( 'Someone' );
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>';
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 ) );
exit;
}
inline_save_row( $_POST );
$data = &$_POST;
$post = get_post( $post_ID, ARRAY_A );
$data['content'] = $post['post_content'];
$data['excerpt'] = $post['post_excerpt'];
// rename
$data['user_ID'] = $GLOBALS['user_ID'];
$data['parent_id'] = $data['post_parent'];
// status
if ( 'private' == $data['keep_private'] )
$data['post_status'] = 'private';
else
$data['post_status'] = $data['_status'];
if ( empty($data['comment_status']) )
$data['comment_status'] = 'closed';
if ( empty($data['ping_status']) )
$data['ping_status'] = 'closed';
// update the post
$_POST = $data;
edit_post();
$post = array();
if ( 'page' == $_POST['post_type'] ) {
@ -752,7 +782,61 @@ case 'inline-save':
$post[] = get_post($_POST['post_ID']);
post_rows($post);
}
die();
exit;
break;
case 'inline-save-tax':
check_ajax_referer( 'taxinlineeditnonce', '_inline_edit' );
if ( ! current_user_can('manage_categories') )
die( '<tr colspan="6"><td>' . __('Cheatin&#8217; uh?') . '</td></tr>' );
if ( ! isset($_POST['tax_ID']) || ! ( $id = (int) $_POST['tax_ID'] ) )
exit;
switch ($_POST['tax_type']) {
case 'cat' :
$data = array();
$data['cat_ID'] = $id;
$data['cat_name'] = $_POST['name'];
$data['category_nicename'] = $_POST['slug'];
if ( isset($_POST['parent']) && (int) $_POST['parent'] > 0 )
$data['category_parent'] = $_POST['parent'];
$updated = wp_update_category($data);
if ( $updated && !is_wp_error($updated) )
echo _cat_row( $id, 0 );
else
die( __('Category not updated.') );
break;
case 'link-cat' :
$updated = wp_update_term($id, 'link_category', $_POST);
if ( $updated && !is_wp_error($updated) )
echo link_cat_row($id);
else
die( __('Category not updated.') );
break;
case 'tag' :
$updated = wp_update_term($id, 'post_tag', $_POST);
if ( $updated && !is_wp_error($updated) ) {
$tag = get_term( $id, 'post_tag' );
if ( !$tag || is_wp_error( $tag ) )
die( __('Tag not updated.') );
echo _tag_row($tag);
} else {
die( __('Tag not updated.') );
}
break;
}
exit;
break;
case 'meta-box-order':
check_ajax_referer( 'meta-box-order' );

View File

@ -111,6 +111,8 @@ if ( isset($_GET['_wp_http_referer']) && ! empty($_GET['_wp_http_referer']) ) {
wp_enqueue_script( 'admin-categories' );
wp_enqueue_script('admin-forms');
if ( current_user_can('manage_categories') )
wp_enqueue_script('inline-edit-tax');
require_once ('admin-header.php');
@ -235,6 +237,7 @@ if ( $page_links )
<?php include('edit-category-form.php'); ?>
<?php inline_edit_term_row('category'); ?>
<?php endif; ?>
<?php

View File

@ -48,6 +48,8 @@ $title = __('Link Categories');
wp_enqueue_script( 'admin-categories' );
wp_enqueue_script('admin-forms');
if ( current_user_can('manage_categories') )
wp_enqueue_script('inline-edit-tax');
require_once ('admin-header.php');
@ -183,6 +185,7 @@ if ( $page_links )
</div>
<?php include('edit-link-category-form.php'); ?>
<?php inline_edit_term_row('link-category'); ?>
<?php endif; ?>

View File

@ -69,7 +69,7 @@ if ( empty($title) )
$title = __('View All Pages');
$parent_file = 'edit.php';
wp_enqueue_script('admin-forms');
wp_enqueue_script('inline-edit');
wp_enqueue_script('inline-edit-post');
wp_enqueue_script('pages');
$post_stati = array( // array( adj, noun )

View File

@ -115,6 +115,8 @@ if ( isset($_GET['_wp_http_referer']) && ! empty($_GET['_wp_http_referer']) ) {
wp_enqueue_script( 'admin-tags' );
wp_enqueue_script('admin-forms');
if ( current_user_can('manage_categories') )
wp_enqueue_script('inline-edit-tax');
require_once ('admin-header.php');
@ -187,7 +189,7 @@ if ( $page_links )
<div class="clear"></div>
<table class="widefat">
<table class="widefat tag">
<thead>
<tr>
<?php print_column_headers('tag'); ?>
@ -236,6 +238,7 @@ if ( $page_links )
<br />
<?php include('edit-tag-form.php'); ?>
<?php inline_edit_term_row('tag'); ?>
<?php endif; ?>

View File

@ -70,7 +70,7 @@ if ( empty($title) )
$title = __('View All Posts');
$parent_file = 'edit.php';
wp_enqueue_script('admin-forms');
wp_enqueue_script('inline-edit');
wp_enqueue_script('inline-edit-post');
wp_enqueue_script('posts');
list($post_stati, $avail_post_stati) = wp_edit_posts_query();

View File

@ -123,6 +123,7 @@ function _cat_row( $category, $level, $name_override = false ) {
$edit = "<a class='row-title' href='$edit_link' title='" . attribute_escape(sprintf(__('Edit "%s"'), $category->name)) . "'>" . attribute_escape( $name ) . '</a><br />';
$actions = array();
$actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
$actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __('Quick Edit') . '</a>';
if ( $default_cat_id != $category->term_id )
$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>";
$action_count = count($actions);
@ -136,11 +137,11 @@ function _cat_row( $category, $level, $name_override = false ) {
$edit = $name;
}
$class = " class='alternate'" == $class ? '' : " class='alternate'";
$class = 'alternate' == $class ? '' : 'alternate';
$category->count = number_format_i18n( $category->count );
$posts_count = ( $category->count > 0 ) ? "<a href='edit.php?cat=$category->term_id'>$category->count</a>" : $category->count;
$output = "<tr id='cat-$category->term_id'$class>";
$output = "<tr id='cat-$category->term_id' class='iedit $class'>";
$columns = get_column_headers('category');
$hidden = (array) get_user_option( 'manage-category-columns-hidden' );
@ -164,7 +165,11 @@ function _cat_row( $category, $level, $name_override = false ) {
$output .= '</th>';
break;
case 'name':
$output .= "<td $attributes>$edit</td>";
$output .= "<td $attributes>$edit";
$output .= '<div class="hidden" id="inline_' . $category->term_id . '">';
$output .= '<div class="name">' . attribute_escape( $category->name ) . '</div>';
$output .= '<div class="slug">' . $category->slug . '</div>';
$output .= '<div class="cat_parent">' . $category->parent . '</div></div></td>';
break;
case 'description':
$output .= "<td $attributes>$category->description</td>";
@ -182,6 +187,86 @@ function _cat_row( $category, $level, $name_override = false ) {
return apply_filters('cat_row', $output);
}
/**
* {@internal Missing Short Description}}
*
* @since 2.7
*
* Outputs the HTML for the hidden table rows used in Categories, Link Caregories and Tags quick edit.
*
* @param string $type "tag", "category" or "link-category"
* @return
*/
function inline_edit_term_row($type) {
if ( ! current_user_can( 'manage_categories' ) )
return;
$is_tag = $type == 'tag';
$columns = $is_tag ? get_column_headers('tag') : get_column_headers('category');
$hidden = (array) get_user_option( "manage-$type-columns-hidden" ); ?>
<form method="get" action=""><table style="display: none"><tbody id="inlineedit">
<tr title="<?php _e('Double-click to cancel'); ?>" id="inline-edit" style="display: none"><td colspan="8">
<?php
foreach ( $columns as $column_name => $column_display_name ) {
$class = "class=\"$column_name column-$column_name quick-edit-div\"";
$style = in_array($column_name, $hidden) ? ' style="display:none;"' : '';
$attributes = "$class$style";
switch ($column_name) {
case 'cb':
break;
case 'description':
break;
case 'name': ?>
<div class="tax-name quick-edit-div"<?php echo $style ?> title="<?php _e('Name'); ?>">
<div class="title"><?php _e('Name'); ?></div>
<div class="in">
<input type="text" name="name" class="ptitle" value="" />
</div>
</div>
<?php
$output .= "<td $attributes>$edit</td>";
break;
case 'slug': ?>
<div class="tax-slug quick-edit-div"<?php echo $style ?> title="<?php _e('Slug'); ?>">
<div class="title"><?php _e('Slug'); ?></div>
<div class="in">
<input type="text" name="slug" class="ptitle" value="" />
</div>
</div>
<?php
$output .= "<td $attributes>$category->slug</td>";
break;
case 'posts':
if ( 'category' == $type ) { ?>
<div class="tax-parent quick-edit-div"<?php echo $style ?> title="<?php _e('Parent Category'); ?>">
<div class="title"><?php _e('Parent Category'); ?></div>
<div class="in">
<?php wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('None'))); ?>
</div>
</div>
<?php }
break;
}
}
?>
<div class="clear"></div>
<div class="quick-edit-save">
<a accesskey="c" href="#inline-edit" title="<?php _e('Cancel'); ?>" class="button-secondary cancel"><?php _e('Cancel'); ?></a>
<a accesskey="s" href="#inline-edit" title="<?php _e('Save'); ?>" class="button-secondary save"><?php _e('Save'); ?></a>
<span class="hidden error"></span>
<?php wp_nonce_field( 'taxinlineeditnonce', '_inline_edit', false ); ?>
</div>
</td></tr>
</tbody></table></form>
<?php
}
/**
* {@internal Missing Short Description}}
*
@ -206,6 +291,7 @@ function link_cat_row( $category, $name_override = false ) {
$edit = "<a class='row-title' href='$edit_link' title='" . attribute_escape(sprintf(__('Edit "%s"'), $category->name)) . "'>$name</a><br />";
$actions = array();
$actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
$actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __('Quick Edit') . '</a>';
if ( $default_cat_id != $category->term_id )
$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>";
$action_count = count($actions);
@ -219,11 +305,11 @@ function link_cat_row( $category, $name_override = false ) {
$edit = $name;
}
$class = " class='alternate'" == $class ? '' : " class='alternate'";
$class = 'alternate' == $class ? '' : 'alternate';
$category->count = number_format_i18n( $category->count );
$count = ( $category->count > 0 ) ? "<a href='link-manager.php?cat_id=$category->term_id'>$category->count</a>" : $category->count;
$output = "<tr id='link-cat-$category->term_id'$class>";
$output = "<tr id='link-cat-$category->term_id' class='iedit $class'>";
$columns = get_column_headers('link-category');
$hidden = (array) get_user_option( 'manage-link-category-columns-hidden' );
foreach ( $columns as $column_name => $column_display_name ) {
@ -246,7 +332,11 @@ function link_cat_row( $category, $name_override = false ) {
$output .= "</th>";
break;
case 'name':
$output .= "<td $attributes>$edit</td>";
$output .= "<td $attributes>$edit";
$output .= '<div class="hidden" id="inline_' . $category->term_id . '">';
$output .= '<div class="name">' . attribute_escape( $category->name ) . '</div>';
$output .= '<div class="slug">' . $category->slug . '</div>';
$output .= '<div class="cat_parent">' . $category->parent . '</div></div></td>';
break;
case 'description':
$output .= "<td $attributes>$category->description</td>";
@ -517,6 +607,7 @@ function _tag_row( $tag, $class = '' ) {
$out .= '<td ' . $attributes . '><strong><a class="row-title" href="' . $edit_link . '" title="' . attribute_escape(sprintf(__('Edit "%s"'), $name)) . '">' . $name . '</a></strong><br />';
$actions = array();
$actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
$actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __('Quick Edit') . '</a>';
$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>";
$action_count = count($actions);
$i = 0;
@ -525,7 +616,9 @@ function _tag_row( $tag, $class = '' ) {
( $i == $action_count ) ? $sep = '' : $sep = ' | ';
$out .= "<span class='$action'>$link$sep</span>";
}
$out .= '</td>';
$out .= '<div class="hidden" id="inline_' . $tag->term_id . '">';
$out .= '<div class="name">' . $name . '</div>';
$out .= '<div class="slug">' . $tag->slug . '</div></div></td>';
break;
case 'slug':
$out .= "<td $attributes>$tag->slug</td>";
@ -573,7 +666,7 @@ function tag_rows( $page = 1, $pagesize = 20, $searchterms = '' ) {
$class = '';
$count = 0;
foreach( $tags as $tag )
$out .= _tag_row( $tag, ++$count % 2 ? ' class="alternate"' : '' );
$out .= _tag_row( $tag, ++$count % 2 ? ' class="iedit alternate"' : ' class="iedit"' );
// filter and send to screen
$out = apply_filters('tag_rows', $out);
@ -799,9 +892,11 @@ function print_column_headers( $type, $id = true ) {
/**
* {@internal Missing Short Description}}
*
* @since unknown
* Outputs the quick edit and bulk edit table rows
*
* @param unknown_type $type
* @since 2.7
*
* @param string $type 'post' or 'page'
*/
function inline_edit_row( $type ) {
global $current_user, $mode;
@ -1045,40 +1140,6 @@ function inline_edit_row( $type ) {
<?php
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $data
*/
function inline_save_row( $data ) {
// get the original post content
$post = get_post( $data['post_ID'], ARRAY_A );
$data['content'] = $post['post_content'];
// statuses
if ( 'private' == $data['keep_private'] )
$data['post_status'] = 'private';
else
$data['post_status'] = $data['_status'];
if ( empty($data['comment_status']) )
$data['comment_status'] = 'closed';
if ( empty($data['ping_status']) )
$data['ping_status'] = 'closed';
// rename
$data['user_ID'] = $GLOBALS['user_ID'];
$data['excerpt'] = $data['post_excerpt'];
$data['trackback_url'] = $data['to_ping'];
$data['parent_id'] = $data['post_parent'];
// update the post
$_POST = $data;
edit_post();
}
// adds hidden fields with the data for use in the inline editor
/**
* {@internal Missing Short Description}}

View File

@ -1,6 +1,6 @@
(function($) {
inlineEdit = {
inlineEditPost = {
init : function() {
var t = this, qeRow = $('#inline-edit'), bulkRow = $('#bulk-edit');
@ -12,20 +12,20 @@ inlineEdit = {
t.rows = $('tr.iedit');
// prepare the edit row
qeRow.dblclick(function() { inlineEdit.toggle(this); })
.keyup(function(e) { if(e.which == 27) return inlineEdit.revert(); });
qeRow.dblclick(function() { inlineEditPost.toggle(this); })
.keyup(function(e) { if(e.which == 27) return inlineEditPost.revert(); });
bulkRow.dblclick(function() { inlineEdit.revert(); })
.keyup(function(e) { if (e.which == 27) return inlineEdit.revert(); });
bulkRow.dblclick(function() { inlineEditPost.revert(); })
.keyup(function(e) { if (e.which == 27) return inlineEditPost.revert(); });
$('a.cancel', qeRow).click(function() { return inlineEdit.revert(); });
$('a.save', qeRow).click(function() { return inlineEdit.save(this); });
$('a.cancel', qeRow).click(function() { return inlineEditPost.revert(); });
$('a.save', qeRow).click(function() { return inlineEditPost.save(this); });
$('a.cancel', bulkRow).click(function() { return inlineEdit.revert(); });
$('a.save', bulkRow).click(function() { return inlineEdit.saveBulk(); });
$('a.cancel', bulkRow).click(function() { return inlineEditPost.revert(); });
$('a.save', bulkRow).click(function() { return inlineEditPost.saveBulk(); });
// add events
t.rows.dblclick(function() { inlineEdit.toggle(this); });
t.rows.dblclick(function() { inlineEditPost.toggle(this); });
t.addEvents(t.rows);
$('#bulk-title-div').after(
@ -82,7 +82,7 @@ inlineEdit = {
addEvents : function(r) {
r.each(function() {
var row = $(this);
$('a.editinline', row).click(function() { inlineEdit.edit(this); return false; });
$('a.editinline', row).click(function() { inlineEditPost.edit(this); return false; });
row.attr('title', inlineEditL10n.edit);
});
},
@ -104,7 +104,7 @@ inlineEdit = {
$('#bulk-titles').html(te);
$('#bulk-titles a').click(function() {
var id = $(this).attr('id').substr(1), r = inlineEdit.type+'-'+id;
var id = $(this).attr('id').substr(1), r = inlineEditPost.type+'-'+id;
$('table.widefat input[value="'+id+'"]').attr('checked', '');
$('#ttle'+id).remove();
@ -186,7 +186,7 @@ inlineEdit = {
if( typeof(id) == 'object' )
id = this.getId(id);
$('#edit-'+id+' .check-column').html('<img src="images/loading.gif" alt="" />');
$('#edit-'+id+'.quick-edit-save').append('<img style="padding:0 15px;" src="images/loading.gif" alt="" />');
var params = {
action: 'inline-save',
@ -201,12 +201,17 @@ inlineEdit = {
// make ajax request
$.post('admin-ajax.php', params,
function(r) {
var row = $(inlineEdit.what+id);
$('#edit-'+id).remove();
row.html($(r).html()).show()
.animate( { backgroundColor: '#CCEEBB' }, 500)
.animate( { backgroundColor: '#eefee7' }, 500);
inlineEdit.addEvents(row);
var row = $(inlineEditPost.what+id);
if (r) {
$('#edit-'+id).remove();
row.html($(r).html()).show()
.animate( { backgroundColor: '#CCEEBB' }, 500)
.animate( { backgroundColor: '#eefee7' }, 500);
inlineEditPost.addEvents(row);
} else {
$('#edit-'+id+' .quick-edit-save').append('<span class="error">'+inlineEditL10n.error+'</span>');
}
}
);
return false;
@ -241,5 +246,5 @@ inlineEdit = {
}
};
$(document).ready(function(){inlineEdit.init();});
$(document).ready(function(){inlineEditPost.init();});
})(jQuery);

View File

@ -0,0 +1,145 @@
(function($) {
inlineEditTax = {
init : function() {
var t = this, row = $('#inline-edit');
t.type = $('#the-list').attr('className').substr(5);
t.what = '#'+t.type+'-';
// get all editable rows
t.rows = $('tr.iedit');
// prepare the edit row
row.dblclick(function() { inlineEditTax.toggle(this); })
.keyup(function(e) { if(e.which == 27) return inlineEditTax.revert(); });
$('a.cancel', row).click(function() { return inlineEditTax.revert(); });
$('a.save', row).click(function() { return inlineEditTax.save(this); });
// add events
t.rows.dblclick(function() { inlineEditTax.toggle(this); });
t.addEvents(t.rows);
$('#doaction, #doaction2, #post-query-submit').click(function(e){
if ( $('form#posts-filter tr.inline-editor').length > 0 )
t.revert();
});
},
toggle : function(el) {
var t = this;
$(t.what+t.getId(el)).css('display') == 'none' ? t.revert() : t.edit(el);
},
addEvents : function(r) {
r.each(function() {
var row = $(this);
$('a.editinline', row).click(function() { inlineEditTax.edit(this); return false; });
row.attr('title', inlineEditL10n.edit);
});
},
edit : function(id) {
var t = this;
t.revert();
if ( typeof(id) == 'object' )
id = t.getId(id);
var editRow = $('#inline-edit').clone(true), rowData = $('#inline_'+id);
if ( $(t.what+id).hasClass('alternate') )
$(editRow).addClass('alternate');
$(t.what+id).hide().after(editRow);
$(':input[name="name"]', editRow).val( $('.name', rowData).text() );
$(':input[name="slug"]', editRow).val( $('.slug', rowData).text() );
// cat parents
var cat_parent = $('.cat_parent', rowData).text();
if ( cat_parent != '0' )
$('select[name="parent"]', editRow).val(cat_parent);
// remove the current parent and children from the parent dropdown
var pageOpt = $('select[name="parent"] option[value="'+id+'"]', editRow);
if ( pageOpt.length > 0 ) {
var pageLevel = pageOpt[0].className.split('-')[1], nextPage = pageOpt, pageLoop = true;
while ( pageLoop ) {
var nextPage = nextPage.next('option'), nextLevel = nextPage[0].className.split('-')[1];
if ( nextLevel <= pageLevel ) {
pageLoop = false;
} else {
nextPage.remove();
nextPage = pageOpt;
}
}
pageOpt.remove();
}
$(editRow).attr('id', 'edit-'+id).addClass('inline-editor').show();
$('.ptitle', editRow).eq(0).focus();
return false;
},
save : function(id) {
if( typeof(id) == 'object' )
id = this.getId(id);
$('#edit-'+id+'.quick-edit-save').append('<img style="padding:0 15px;" src="images/loading.gif" alt="" />');
var params = {
action: 'inline-save-tax',
tax_type: this.type,
tax_ID: id
};
var fields = $('#edit-'+id+' :input').fieldSerialize();
params = fields + '&' + $.param(params);
// make ajax request
$.post('admin-ajax.php', params,
function(r) {
var row = $(inlineEditTax.what+id);
if (r) {
if ( -1 != r.indexOf('<tr') ) {
$('#edit-'+id).remove();
row.html($(r).html()).show()
.animate( { backgroundColor: '#CCEEBB' }, 500)
.animate( { backgroundColor: '#eefee7' }, 500);
inlineEditTax.addEvents(row);
} else
$('#edit-'+id+' .quick-edit-save .error').html(r).show();
} else
$('#edit-'+id+' .quick-edit-save .error').html(inlineEditL10n.error).show();
}
);
return false;
},
revert : function() {
var id = $('table.widefat tr.inline-editor').attr('id');
if ( id ) {
$('#'+id).remove();
id = id.substr( id.lastIndexOf('-') + 1 );
$(this.what+id).show();
}
return false;
},
getId : function(o) {
var id = o.tagName == 'TR' ? o.id : $(o).parents('tr').attr('id');
var parts = id.split('-');
return parts[parts.length - 1];
}
};
$(document).ready(function(){inlineEditTax.init();});
})(jQuery);

View File

@ -2151,7 +2151,9 @@ a.togbox {
}
.inline-editor .post-title,
.inline-editor .page-title {
.inline-editor .page-title,
.inline-editor .tax-name,
.inline-editor .tax-slug {
width: 260px;
}
@ -2162,7 +2164,9 @@ a.togbox {
}
.inline-editor .post-title .ptitle,
.inline-editor .page-title .ptitle {
.inline-editor .page-title .ptitle,
.inline-editor .tax-name .ptitle,
.inline-editor .tax-slug .ptitle {
width: 245px;
margin-bottom: 5px;
font-size: 12px !important;
@ -2206,7 +2210,8 @@ a.togbox {
width: 80px;
}
.inline-editor .categories {
.inline-editor .categories,
.inline-editor .column-posts {
width: 200px;
}
@ -2271,11 +2276,13 @@ a.togbox {
width: 150px;
}
.inline-editor .parent {
.inline-editor .parent,
.inline-editor .tax-parent {
width: 180px;
}
#wpbody-content .inline-editor .parent select {
#wpbody-content .inline-editor .parent select,
#wpbody-content .inline-editor .tax-parent select {
width: 170px;
}

View File

@ -1402,7 +1402,7 @@ class Walker_CategoryDropdown extends Walker {
$pad = str_repeat('&nbsp;', $depth * 3);
$cat_name = apply_filters('list_cats', $category->name, $category);
$output .= "\t<option value=\"".$category->term_id."\"";
$output .= "\t<option class=\"level-$depth\" value=\"".$category->term_id."\"";
if ( $category->term_id == $args['selected'] )
$output .= ' selected="selected"';
$output .= '>';

View File

@ -1544,7 +1544,7 @@ function wp_update_post($postarr = array()) {
$postarr = array_merge($post, $postarr);
$postarr['post_category'] = $post_cats;
if ( $clear_date ) {
$postarr['post_date'] = current_time('mysql');;
$postarr['post_date'] = current_time('mysql');
$postarr['post_date_gmt'] = '';
}

View File

@ -242,11 +242,17 @@ function wp_default_scripts( &$scripts ) {
$scripts->add( 'theme-preview', '/wp-admin/js/theme-preview.js', array( 'thickbox', 'jquery' ), '20080625' );
$scripts->add( 'inline-edit', '/wp-admin/js/inline-edit.js', array( 'jquery', 'jquery-form', 'suggest' ), '20080930' );
$scripts->localize( 'inline-edit', 'inlineEditL10n', array(
$scripts->add( 'inline-edit-post', '/wp-admin/js/inline-edit-post.js', array( 'jquery', 'jquery-form', 'suggest' ), '20080930' );
$scripts->localize( 'inline-edit-post', 'inlineEditL10n', array(
'edit' => __('Double-click to edit')
) );
$scripts->add( 'inline-edit-tax', '/wp-admin/js/inline-edit-tax.js', array( 'jquery', 'jquery-form' ), '20081003' );
$scripts->localize( 'inline-edit-tax', 'inlineEditL10n', array(
'edit' => __('Double-click to edit'),
'error' => __('Error while saving the changes.')
) );
$scripts->add( 'plugin-install', '/wp-admin/js/plugin-install.js', array( 'thickbox', 'jquery' ), '20080803' );
$scripts->localize( 'plugin-install', 'plugininstallL10n', array(
'plugin_information' => __('Plugin Information:')