QE: fix notices and check if the returned string contains the row HTML, props DD32, fixes #8115

git-svn-id: http://svn.automattic.com/wordpress/trunk@9712 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz 2008-11-15 12:04:38 +00:00
parent 818ef0d5f4
commit f0804b3c26
5 changed files with 23 additions and 18 deletions

View File

@ -880,10 +880,12 @@ case 'inline-save':
// rename
$data['user_ID'] = $GLOBALS['user_ID'];
$data['parent_id'] = $data['post_parent'];
if ( isset($data['post_parent']) )
$data['parent_id'] = $data['post_parent'];
// status
if ( 'private' == $data['keep_private'] )
if ( isset($data['keep_private']) && 'private' == $data['keep_private'] )
$data['post_status'] = 'private';
else
$data['post_status'] = $data['_status'];

View File

@ -1170,6 +1170,7 @@ function get_inline_data($post) {
<div class="aa">' . mysql2date( 'Y', $post->post_date ) . '</div>
<div class="hh">' . mysql2date( 'H', $post->post_date ) . '</div>
<div class="mn">' . mysql2date( 'i', $post->post_date ) . '</div>
<div class="ss">' . mysql2date( 's', $post->post_date ) . '</div>
<div class="post_password">' . wp_specialchars($post->post_password, 1) . '</div>';
if( $post->post_type == 'page' )
@ -2331,6 +2332,8 @@ function touch_time( $edit = 1, $for_post = 1, $tab_index = 0, $multi = 0 ) {
$minute = '<input type="text" ' . ( $multi ? '' : 'id="mn" ' ) . 'name="mn" value="' . $mn . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" />';
printf(_c('%1$s%2$s, %3$s @ %4$s : %5$s|1: month input, 2: day input, 3: year input, 4: hour input, 5: minute input'), $month, $day, $year, $hour, $minute);
echo '<input type="hidden" id="ss" name="ss" value="' . $ss . '" />';
if ( $multi ) return;
echo "\n\n";

View File

@ -123,7 +123,7 @@ inlineEditPost = {
if ( typeof(id) == 'object' )
id = t.getId(id);
var fields = ['post_title', 'post_name', 'post_author', '_status', 'jj', 'mm', 'aa', 'hh', 'mn', 'post_password'];
var fields = ['post_title', 'post_name', 'post_author', '_status', 'jj', 'mm', 'aa', 'hh', 'mn', 'ss', 'post_password'];
if ( t.type == 'page' ) fields.push('post_parent', 'menu_order', 'page_template');
if ( t.type == 'post' ) fields.push('tags_input');
@ -207,15 +207,19 @@ inlineEditPost = {
var row = $(inlineEditPost.what+id);
if (r) {
r = r.replace(/hide-if-no-js/, '');
$('#edit-'+id).remove();
row.html($(r).html());
if ( 'draft' == $('input[name="post_status"]').val() )
row.find('td.column-comments').hide();
inlineEditPost.addEvents(row);
row.fadeIn();
if ( -1 != r.indexOf('<tr') ) {
r = r.replace(/hide-if-no-js/, '');
$('#edit-'+id).remove();
row.html($(r).html());
if ( 'draft' == $('input[name="post_status"]').val() )
row.find('td.column-comments').hide();
inlineEditPost.addEvents(row);
row.fadeIn();
} else {
r = r.replace( /<.[^<>]*?>/g, '' );
$('#edit-'+id+' .inline-edit-save').append('<span class="error">'+r+'</span>');
}
} else {
$('#edit-'+id+' .inline-edit-save').append('<span class="error">'+inlineEditL10n.error+'</span>');
}

View File

@ -12,7 +12,6 @@ inlineEditTax = {
t.rows = $('tr.iedit');
// prepare the edit row
// .dblclick(function() { inlineEditTax.toggle(this); })
row.keyup(function(e) { if(e.which == 27) return inlineEditTax.revert(); });
$('a.cancel', row).click(function() { return inlineEditTax.revert(); });
@ -20,7 +19,6 @@ inlineEditTax = {
$('input, select', row).keydown(function(e) { if(e.which == 13) return inlineEditTax.save(this); });
// add events
// t.rows.dblclick(function() { inlineEditTax.toggle(this); });
t.addEvents(t.rows);
$('#posts-filter input[type="submit"]').click(function(e){
@ -112,9 +110,7 @@ inlineEditTax = {
if ( -1 != r.indexOf('<tr') ) {
$('#edit-'+id).remove();
r = r.replace(/hide-if-no-js/, '');
row.html($(r).html()).show()
.animate( { backgroundColor: '#CCEEBB' }, 500)
.animate( { backgroundColor: '#eefee7' }, 500);
row.html($(r).html()).fadeIn();
inlineEditTax.addEvents(row);
} else
$('#edit-'+id+' .inline-edit-save .error').html(r).show();

View File

@ -251,7 +251,7 @@ function wp_default_scripts( &$scripts ) {
$scripts->add( 'theme-preview', '/wp-admin/js/theme-preview.js', array( 'thickbox', 'jquery' ), '20080625' );
$scripts->add( 'inline-edit-post', '/wp-admin/js/inline-edit-post.js', array( 'jquery', 'jquery-form', 'suggest' ), '20081110' );
$scripts->add( 'inline-edit-post', '/wp-admin/js/inline-edit-post.js', array( 'jquery', 'jquery-form', 'suggest' ), '20081115' );
$scripts->localize( 'inline-edit-post', 'inlineEditL10n', array(
'error' => __('Error while saving the changes.')
) );