Sytling and improvements to inline editing, see #6815

git-svn-id: http://svn.automattic.com/wordpress/trunk@8943 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz 2008-09-21 19:45:45 +00:00
parent c57cfbaefc
commit 2e11a3bf66
10 changed files with 590 additions and 493 deletions

View File

@ -715,6 +715,7 @@ case 'hidden-columns' :
$current_user = wp_get_current_user();
if ( is_array($hidden) )
update_usermeta($current_user->ID, "manage-$page-columns-hidden", $hidden);
break;
case 'get-permalink':
check_ajax_referer( 'getpermalink', 'getpermalinknonce' );
$post_id = isset($_POST['post_id'])? intval($_POST['post_id']) : 0;
@ -727,16 +728,8 @@ case 'sample-permalink':
$slug = isset($_POST['new_slug'])? $_POST['new_slug'] : '';
die(get_sample_permalink_html($post_id, $title, $slug));
break;
case 'inline-data':
check_ajax_referer( 'inlineeditnonce', 'inline_edit_nonce' );
if ( isset($_POST['posts']) )
get_inline_data( explode(',', $_POST['posts']) );
die();
break;
case 'inline-save':
check_ajax_referer( 'inlineeditnonce', 'inline_edit_nonce' );
check_ajax_referer( 'inlineeditnonce', '_inline_edit' );
if ( ! isset($_POST['post_ID']) )
exit;
@ -753,7 +746,7 @@ case 'inline-save':
post_rows($post);
}
die();
break;
break;
case 'meta-box-order':
check_ajax_referer( 'meta-box-order' );
update_user_option( $GLOBALS['current_user']->ID, "meta-box-order_$_POST[page]", $_POST['order'] );

View File

@ -806,7 +806,8 @@ table.diff .diff-addedline ins {
border-bottom-color: #14568A;
}
#replydiv {
#replydiv,
.inline-editor .quick-edit-div {
border-color: #EBEBEB #CCC #CCC #EBEBEB;
background-color: #fff;
}
@ -821,7 +822,7 @@ table.diff .diff-addedline ins {
background-color: #f8f8f8;
}
/* table vim shorcuts */
/* table vim shortcuts */
.vim-current {
background-color: #CFEBF7 !important;
}
@ -842,4 +843,27 @@ div.star.select:hover {
#plugin-information .fyi h2.mainheader {
background-color: #cee1ef;
}
}
/* inline editor */
.inline-editor input,
.inline-editor textarea {
border-color: #ddd;
}
.inline-editor div.title {
background-color: #CFEBF7;
}
.inline-editor ul.cat-checklist {
background-color: #FFFFFF;
}
.inline-editor .categories .catshow,
.inline-editor .categories .cathide {
color: #2583AD;
}
.inline-editor .quick-edit-save {
background-color: #CFEBF7;
}

View File

@ -789,7 +789,8 @@ table.diff .diff-addedline ins {
border-bottom-color: #E4F2FD;
}
#replydiv {
#replydiv,
.inline-editor .quick-edit-div {
border-color: #EBEBEB #CCC #CCC #EBEBEB;
background-color: #fff;
}
@ -804,7 +805,7 @@ table.diff .diff-addedline ins {
background-color: #f8f8f8;
}
/* table vim shorcuts */
/* table vim shortcuts */
.vim-current {
background-color: #E4F2FD !important;
}
@ -826,3 +827,26 @@ div.star.select:hover {
#plugin-information .fyi h2.mainheader {
background-color: #cee1ef;
}
/* inline editor */
.inline-editor input,
.inline-editor textarea {
border-color: #ddd;
}
.inline-editor div.title {
background-color: #EAF3FA;
}
.inline-editor ul.cat-checklist {
background-color: #FFFFFF;
}
.inline-editor .categories .catshow,
.inline-editor .categories .cathide {
color: #2583AD;
}
.inline-editor .quick-edit-save {
background-color: #EAF3FA;
}

View File

@ -189,7 +189,7 @@ $all = !( $h2_search || $post_status_q );
if ($posts) {
?>
<table class="widefat">
<table class="widefat page">
<thead>
<tr>
<?php print_column_headers('page'); ?>

View File

@ -8,7 +8,7 @@
if ( ! defined('ABSPATH') ) die();
?>
<table class="widefat">
<table class="widefat post">
<thead>
<tr>
<?php print_column_headers('post'); ?>

View File

@ -185,7 +185,7 @@ if ( $page_links )
<div class="alignleft">
<select name="action">
<option value="" selected><?php _e('Actions'); ?></option>
<option value="" selected="selected"><?php _e('Actions'); ?></option>
<option value="edit"><?php _e('Edit'); ?></option>
<option value="delete"><?php _e('Delete'); ?></option>
</select>

View File

@ -86,7 +86,7 @@ function _cat_row( $category, $level, $name_override = false ) {
$actions = array();
$actions['edit'] = '<a href="' . $edit_link . '">' . __('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>";
$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);
$i = 0;
foreach ( $actions as $action => $link ) {
@ -157,7 +157,7 @@ function link_cat_row( $category ) {
$actions = array();
$actions['edit'] = '<a href="' . $edit_link . '">' . __('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>";
$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);
$i = 0;
foreach ( $actions as $action => $link ) {
@ -187,14 +187,14 @@ function link_cat_row( $category ) {
switch ($column_name) {
case 'cb':
$output .= "<th scope='row' class='check-column'>";
if ( absint( get_option( 'default_link_category' ) ) != $category->term_id ) {
$output .= "<input type='checkbox' name='delete[]' value='$category->term_id' />";
} else {
$output .= "&nbsp;";
}
$output .= "</th>";
break;
$output .= "<th scope='row' class='check-column'>";
if ( absint( get_option( 'default_link_category' ) ) != $category->term_id ) {
$output .= "<input type='checkbox' name='delete[]' value='$category->term_id' />";
} else {
$output .= "&nbsp;";
}
$output .= "</th>";
break;
case 'name':
$output .= "<td $attributes>$edit</td>";
break;
@ -249,7 +249,7 @@ class Walker_Category_Checklist extends Walker {
extract($args);
$class = in_array( $category->term_id, $popular_cats ) ? ' class="popular-category"' : '';
$output .= "\n<li id='category-$category->term_id'$class>" . '<label for="in-category-' . $category->term_id . '" class="selectit"><input value="' . $category->term_id . '" type="checkbox" name="post_category[]" id="in-category-' . $category->term_id . '"' . (in_array( $category->term_id, $selected_cats ) ? ' checked="checked"' : "" ) . '/> ' . wp_specialchars( apply_filters('the_category', $category->name )) . '</label>';
$output .= "\n<li id='category-$category->term_id'$class>" . '<label class="selectit"><input value="' . $category->term_id . '" type="checkbox" name="post_category[]" id="in-category-' . $category->term_id . '"' . (in_array( $category->term_id, $selected_cats ) ? ' checked="checked"' : "" ) . '/> ' . wp_specialchars( apply_filters('the_category', $category->name )) . '</label>';
}
function end_el(&$output, $category, $depth, $args) {
@ -315,7 +315,7 @@ function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10, $ech
?>
<li id="<?php echo $id; ?>" class="popular-category">
<label class="selectit" for="in-<?php echo $id; ?>">
<label class="selectit">
<input id="in-<?php echo $id; ?>" type="checkbox" value="<?php echo (int) $category->term_id; ?>" />
<?php echo wp_specialchars( apply_filters( 'the_category', $category->name ) ); ?>
</label>
@ -369,7 +369,7 @@ function _tag_row( $tag, $class = '' ) {
$count = ( $count > 0 ) ? "<a href='edit.php?tag=$tag->slug'>$count</a>" : $count;
$name = apply_filters( 'term_name', $tag->name );
$edit_link = "edit-tags.php?action=edit&amp;tag_ID=$tag->term_id";
$edit_link = "edit-tags.php?action=edit&amp;tag_ID=$tag->term_id";
$out = '';
$out .= '<tr id="tag-' . $tag->term_id . '"' . $class . '>';
$columns = get_column_headers('tag');
@ -388,10 +388,10 @@ function _tag_row( $tag, $class = '' ) {
$out .= '<th scope="row" class="check-column"> <input type="checkbox" name="delete_tags[]" value="' . $tag->term_id . '" /></th>';
break;
case 'name':
$out .= '<td ' . $attributes . '><strong><a class="row-title" href="' . $edit_link . '" title="' . attribute_escape(sprintf(__('Edit "%s"'), $name)) . '">' . $name . '</a></strong><br />';
$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['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>";
$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;
foreach ( $actions as $action => $link ) {
@ -571,7 +571,7 @@ function get_column_headers($page) {
}
function print_column_headers( $type ) {
$columns = get_column_headers( $type );
$columns = get_column_headers( $type );
$hidden = (array) get_user_option( "manage-$type-columns-hidden" );
$styles = array();
$styles['tag']['posts'] = 'width: 90px;';
@ -602,23 +602,29 @@ function print_column_headers( $type ) {
$style .= ' ' . $styles[$type][$column_key];
$style = ' style="' . $style . '"';
?>
<th scope="col"<?php echo "id=\"$column_key\""; echo $class; echo $style?>><?php echo $column_display_name; ?></th>
<th scope="col" <?php echo "id=\"$column_key\""; echo $class; echo $style?>><?php echo $column_display_name; ?></th>
<?php }
}
function inline_edit_row( $type ) {
global $current_user;
global $current_user, $mode;
if ( 'post' == $type )
$post = get_default_post_to_edit();
else
$post = get_default_page_to_edit();
$is_page = 'page' == $type;
if ( $is_page )
$post = get_default_page_to_edit();
else
$post = get_default_post_to_edit();
echo '<tr id="inline-edit" style="display: none">';
$columns = $type == 'post' ? wp_manage_posts_columns() : wp_manage_pages_columns();
$columns = $is_page ? wp_manage_pages_columns() : wp_manage_posts_columns();
$hidden = (array) get_user_option( "manage-$type-columns-hidden" );
$hidden_count = empty($hidden[0]) ? 0 : count($hidden);
$col_count = count($columns) - $hidden_count;
$m = ( isset($mode) && 'excerpt' == $mode ) ? 'excerpt' : 'list';
?>
<tr title="<?php _e('Double-click to cancel'); ?>" id="inline-edit" style="display: none"><td colspan="<?php echo $col_count; ?>">
<?php
foreach($columns as $column_name=>$column_display_name) {
$class = "class=\"$column_name column-$column_name\"";
$class = "class=\"$column_name column-$column_name quick-edit-div\"";
$style = '';
if ( in_array($column_name, $hidden) )
@ -627,163 +633,186 @@ function inline_edit_row( $type ) {
$attributes = "$class$style";
switch($column_name) {
case 'cb': ?>
<th class="check-column"></th>
<?php
break;
case 'cb':
break;
case 'modified':
case 'date':
$attributes = 'class="date column-date"' . $style;
?>
<td class="date"<?php echo $style ?>>
<div <?php echo $attributes; ?> title="<?php _e('Timestamp'); ?>">
<div class="title"><?php _e('Timestamp'); ?></div>
<div class="in">
<?php touch_time(1, 1, 4, 1); ?>
</td>
</div>
</div>
<?php
break;
case 'title':
$attributes = "class=\"$type-title column-title\"" . $style;
?>
<td <?php echo $attributes ?>>
<?php wp_nonce_field( 'inlineeditnonce', 'inline_edit_nonce', false ) ?>
<div class="title">
<input type="text" name="post_title" class="title" value="" /><br />
<label><?php _e('Slug'); ?></label><input type="text" name="post_name" value="" class="slug" />
$attributes = "class=\"$type-title column-title quick-edit-div\"" . $style; ?>
<div <?php echo $attributes ?>>
<div class="title"><?php _e('Title'); ?></div>
<div class="in">
<label title="<?php _e('Title'); ?>"><input type="text" name="post_title" class="ptitle" value="" /></label><br />
<div class="slug">
<label title="<?php _e('Slug'); ?>"><?php _e('Slug'); ?><input type="text" name="post_name" value="" /></label></div>
</div>
<?php if ($type == 'page'): ?>
<div class="other">
<label><?php _e('Parent'); ?></label>
<select name="post_parent">
<option value="0"><?php _e('Main Page (no parent)'); ?></option>
<?php parent_dropdown(); ?>
</select><br />
<label><?php _e('Template'); ?></label>
<select name="page_template">
<option value='default'><?php _e('Default Template'); ?></option>
<?php page_template_dropdown() ?>
</select>
</div>
<?php if ( $is_page ) { ?>
<div class="parent quick-edit-div" title="<?php _e('Page Parent'); ?>">
<div class="title"><?php _e('Page Parent'); ?></div>
<div class="in">
<select name="post_parent">
<option value="0"><?php _e('Main Page (no parent)'); ?></option>
<?php parent_dropdown(); ?>
</select>
</div>
<div class="more">
<label><?php _e('Order'); ?></label><input type="text" name="menu_order" value="<?php echo $post->menu_order ?>" />
<label><?php _e('Password'); ?></label><input type="text" name="post_password" value="<?php echo $post->post_password ?>" />
</div>
<div class="template quick-edit-div" title="<?php _e('Page Template'); ?>">
<div class="title"><?php _e('Page Template'); ?></div>
<div class="in">
<select name="page_template">
<option value='default'><?php _e('Default Template'); ?></option>
<?php page_template_dropdown() ?>
</select>
</div>
<?php endif; ?>
<div class="clear"></div>
<div class="save">
<?php
$actions = array();
$actions['save'] = '<a href="#">' . __('Save') . '</a>';
$actions['cancel'] = '<a href="#">' . __('Cancel') . '</a>';
$action_count = count($actions);
$i = 0;
foreach ( $actions as $action => $link ) {
++$i;
( $i == $action_count ) ? $sep = '' : $sep = ' | ';
echo "<span class='$action'>$link$sep</span>";
}
?>
</div>
<div class="order quick-edit-div" title="<?php _e('Page Order'); ?>">
<div class="title"><?php _e('Page Order'); ?></div>
<div class="in">
<input type="text" name="menu_order" value="<?php echo $post->menu_order ?>" />
</div>
</td>
<?php
</div>
<?php }
break;
case 'categories': ?>
<td <?php echo $attributes ?>>
<ul class="categories">
<?php wp_category_checklist() ?>
<div <?php echo $attributes ?> title="<?php _e('Categories'); ?>">
<div class="title"><?php _e('Categories'); ?>
<span class="catshow"><?php _e('(expand)'); ?></span>
<span class="cathide" style="display:none;"><?php _e('(fold)'); ?></span></div>
<ul class="cat-checklist">
<?php wp_category_checklist(); ?>
</ul>
</td>
</div>
<?php
break;
case 'tags': ?>
<td <?php echo $attributes ?>>
<textarea name="tags_input"></textarea>
</td>
<div <?php echo $attributes ?> title="<?php _e('Tags'); ?>">
<div class="title"><?php _e('Tags'); ?></div>
<div class="in">
<textarea cols="22" rows="1" type="text" name="tags_input" class="tags_input"></textarea>
</div>
</div>
<?php
break;
case 'comments':
$attributes = 'class="comments column-comments num"' . $style;
?>
<td <?php echo $attributes ?>>
<input title="Allow Comments" type="checkbox" name="comment_status" value="open" /><br />
<input title="Allow Pings" type="checkbox" name="ping_status" value="open" />
</td>
$attributes = 'class="comments column-comments num quick-edit-div"' . $style; ?>
<div <?php echo $attributes ?> title="<?php _e('Comments and Pings'); ?>">
<div class="title"><?php _e('Comments and Pings'); ?></div>
<div class="in">
<label><input type="checkbox" name="comment_status" value="open" />
<?php _e('Allow Comments'); ?></label><br />
<label><input type="checkbox" name="ping_status" value="open" />
<?php _e('Allow Pings'); ?></label>
</div>
</div>
<?php
break;
case 'author': ?>
<td <?php echo $attributes ?>>
<?php
$authors = get_editable_user_ids( $current_user->id ); // TODO: ROLE SYSTEM
if ( $authors && count( $authors ) > 1 ) {
wp_dropdown_users( array('include' => $authors, 'name' => 'post_author', 'class'=> 'author', 'selected' => $post->post_author) );
} else {
echo $current_user->user_nicename.'<input type="hidden" value="'.$post->post_author.'" class="author" />';
}
?>
</td>
case 'author':
$authors = get_editable_user_ids( $current_user->id ); // TODO: ROLE SYSTEM
if ( $authors && count( $authors ) > 1 ) { ?>
<div <?php echo $attributes ?> title="<?php _e('Author'); ?>">
<div class="title"><?php _e('Author'); ?></div>
<div class="in">
<?php wp_dropdown_users( array('include' => $authors, 'name' => 'post_author', 'class'=> 'authors', 'selected' => $post->post_author) ); ?>
</div>
</div>
<?php } ?>
<div class="password quick-edit-div" title="<?php _e('Password'); ?>">
<div class="title"><?php _e('Password'); ?></div>
<div class="in">
<input type="text" name="post_password" value="<?php echo $post->post_password ?>" />
<label title="<?php _e('Privacy'); ?>">
<input type="checkbox" name="keep_private" value="private" <?php checked($post->post_status, 'private'); ?> /> <?php echo $is_page ? __('Keep this page private') : __('Keep this post private'); ?></label>
</div>
</div>
<?php
break;
case 'status': ?>
<td <?php echo $attributes ?>>
<div <?php echo $attributes ?> title="<?php _e('Status'); ?>">
<div class="title"><?php _e('Status'); ?></div>
<div class="in">
<select name="post_status">
<?php if ( current_user_can('publish_posts') ) : // Contributors only get "Unpublished" and "Pending Review" ?>
<?php if ( current_user_can('publish_posts') ) { // Contributors only get "Unpublished" and "Pending Review" ?>
<option value='publish'><?php _e('Published') ?></option>
<option value='future'><?php _e('Scheduled') ?></option>
<?php endif; ?>
<?php } ?>
<option value='pending'><?php _e('Pending Review') ?></option>
<option value='draft'><?php _e('Unpublished') ?></option>
</select>
<?php if($type == 'page'): ?>
<br /><label><input type="checkbox" name="page_private" value="private" <?php checked($post->post_status, 'private'); ?> /> <?php _e('Private') ?></label></p>
<?php else: ?>
<?php if ( current_user_can( 'edit_others_posts' ) ) : ?>
<br /><label><input type="checkbox" name="sticky" value="sticky" /> <?php _e('Sticky') ?></label></p>
<?php endif; ?>
<?php endif; ?>
</td>
<?php
</div>
</div>
<?php if ( current_user_can( 'edit_others_posts' ) && ! $is_page ) { ?>
<div class="sticky quick-edit-div" <?php echo $style; ?> title="<?php _e('Sticky') ?>">
<div class="title"><?php _e('Sticky'); ?></div>
<div class="in">
<label title="<?php _e('Sticky') ?>">
<input type="checkbox" name="sticky" value="sticky" /> <?php _e('Stick this post to the front page') ?></label>
</div>
</div>
<?php }
break;
case 'control_view': ?>
<td><a href="<?php the_permalink(); ?>" rel="permalink" class="view"><?php _e('View'); ?></a></td>
<div><a href="<?php the_permalink(); ?>" rel="permalink" class="view"><?php _e('View'); ?></a></div>
<?php
break;
case 'control_edit': ?>
<td><?php if ( current_user_can('edit_post',$post->ID) ) { echo "<a href='post.php?action=edit&amp;post=$id' class='edit'>" . __('Edit') . "</a>"; } ?></td>
<div><?php if ( current_user_can('edit_post',$post->ID) ) { echo "<a href='post.php?action=edit&amp;post=$id' class='edit'>" . __('Edit') . "</a>"; } ?></div>
<?php
break;
case 'control_delete': ?>
<td><?php if ( current_user_can('delete_post',$post->ID) ) { echo "<a href='" . wp_nonce_url("post.php?action=delete&amp;post=$id", 'delete-post_' . $post->ID) . "' class='delete'>" . __('Delete') . "</a>"; } ?></td>
<div><?php if ( current_user_can('delete_post',$post->ID) ) { echo "<a href='" . wp_nonce_url("post.php?action=delete&amp;post=$id", 'delete-post_' . $post->ID) . "' class='delete'>" . __('Delete') . "</a>"; } ?></div>
<?php
break;
default: ?>
<td><?php do_action('manage_posts_custom_column', $column_name, $post->ID); ?></td>
<div><?php do_action('manage_posts_custom_column', $column_name, $post->ID); ?></div>
<?php
break;
}
}
} ?>
echo '</tr>';
<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>
<?php wp_nonce_field( 'inlineeditnonce', '_inline_edit', false ) ?>
<input type="hidden" name="post_view" value="<?php echo $m; ?>" />
</div>
</td></tr>
<?php
}
function inline_save_row( $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 ( 'page' == $data['post_type'] && 'private' == $data['page_private'] )
if ( 'private' == $data['keep_private'] )
$data['post_status'] = 'private';
if ( empty($data['comment_status']) )
if ( empty($data['comment_status']) )
$data['comment_status'] = 'closed';
if ( empty($data['ping_status']) )
$data['ping_status'] = 'closed';
@ -799,51 +828,44 @@ function inline_save_row( $data ) {
edit_post();
}
// outputs XML of the post/page data ready for use in the inline editor
// accepts array of post IDs
function get_inline_data($posts) {
global $post;
// adds hidden fields with the data for use in the inline editor
function get_inline_data($post) {
header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
echo "<?xml version='1.0' ?>\n";
echo "<posts>\n";
if ( ! current_user_can('edit_' . $post->post_type, $post->ID) )
return;
$title = apply_filters( 'the_title', $post->post_title );
if ( empty($title) )
$title = __('(no title)');
foreach ($posts as $ID) {
$GLOBALS['post'] = get_post($ID);
$GLOBALS['post_ID'] = $ID;
echo '
<div id="inline_' . $post->ID . '">
<input type="hidden" name="" class="post_title" value="' . $title . '" />
<input type="hidden" name="" class="post_name" value="' . $post->post_name . '" />
<input type="hidden" name="" class="post_author" value="' . $post->post_author . '" />
<input type="hidden" name="" class="comment_status" value="' . $post->comment_status . '" />
<input type="hidden" name="" class="ping_status" value="' . $post->ping_status . '" />
<input type="hidden" name="" class="post_status" value="' . $post->post_status . '" />
<input type="hidden" name="" class="jj" value="' . mysql2date( 'd', $post->post_date ) . '" />
<input type="hidden" name="" class="mm" value="' . mysql2date( 'm', $post->post_date ) . '" />
<input type="hidden" name="" class="aa" value="' . mysql2date( 'Y', $post->post_date ) . '" />
<input type="hidden" name="" class="hh" value="' . mysql2date( 'H', $post->post_date ) . '" />
<input type="hidden" name="" class="mn" value="' . mysql2date( 'i', $post->post_date ) . '" />
<input type="hidden" name="" class="post_password" value="' . wp_specialchars($post->post_password, 1) . '" />';
if ( ($post->post_type == 'post' && !current_user_can('edit_post', $ID)) ||
($post->post_type == 'page' && !current_user_can('edit_page', $ID)) ||
($post->post_type != 'post' && $post->post_type != 'page'))
continue;
echo " <post id='$ID'>\n";
echo " <post_title>" . wp_specialchars($post->post_title, 1) . "</post_title>\n";
echo " <post_name>$post->post_name</post_name>\n";
echo " <post_author>$post->post_author</post_author>\n";
echo " <comment_status>$post->comment_status</comment_status>\n";
echo " <ping_status>$post->ping_status</ping_status>\n";
echo " <post_status>$post->post_status</post_status>\n";
echo " <jj>" . mysql2date( 'd', $post->post_date ) . "</jj>\n";
echo " <mm>" . mysql2date( 'm', $post->post_date ) . "</mm>\n";
echo " <aa>" . mysql2date( 'Y', $post->post_date ) . "</aa>\n";
echo " <hh>" . mysql2date( 'H', $post->post_date ) . "</hh>\n";
echo " <mn>" . mysql2date( 'i', $post->post_date ) . "</mn>\n";
if( $post->post_type == 'post' ) {
echo ' <tags_input>' . wp_specialchars(get_tags_to_edit( $post->ID ), 1) . "</tags_input>\n";
echo ' <post_category>' . implode( ',', wp_get_post_categories( $post->ID ) ) . "</post_category>\n";
echo ' <sticky>' . (is_sticky($post->ID) ? 'sticky' : '') . "</sticky>\n";
}
if( $post->post_type == 'page' ) {
echo " <post_parent>$post->post_parent</post_parent>\n";
echo ' <page_template>' . wp_specialchars(get_post_meta( $post->ID, '_wp_page_template', true ), 1) . "</page_template>\n";
echo " <post_password>" . wp_specialchars($post->post_password, 1) . "</post_password>\n";
echo " <menu_order>$post->menu_order</menu_order>\n";
}
echo " </post>\n";
}
echo '</posts>';
if( $post->post_type == 'page' )
echo '
<input type="hidden" name="" class="post_parent" value="' . $post->post_parent . '" />
<input type="hidden" name="" class="page_template" value="' . wp_specialchars(get_post_meta( $post->ID, '_wp_page_template', true ), 1) . '" />
<input type="hidden" name="" class="menu_order" value="' . $post->menu_order . '" />';
if( $post->post_type == 'post' )
echo '
<input type="hidden" name="" class="tags_input" value="' . wp_specialchars( str_replace( ',', ', ', get_tags_to_edit($post->ID) ), 1) . '" />
<input type="hidden" name="" class="post_category" value="' . implode( ',', wp_get_post_categories( $post->ID ) ) . '" />
<input type="hidden" name="" class="sticky" value="' . (is_sticky($post->ID) ? 'sticky' : '') . '" />';
echo '</div>';
}
function post_rows( $posts = array() ) {
@ -874,13 +896,13 @@ function post_rows( $posts = array() ) {
function _post_row($a_post, $pending_comments, $mode) {
global $post;
static $class;
static $rowclass;
$global_post = $post;
$post = $a_post;
setup_postdata($post);
$class = 'alternate' == $class ? '' : 'alternate';
$rowclass = 'alternate' == $rowclass ? '' : 'alternate';
global $current_user;
$post_owner = ( $current_user->ID == $post->post_author ? 'self' : 'other' );
$edit_link = get_edit_post_link( $post->ID );
@ -888,7 +910,7 @@ function _post_row($a_post, $pending_comments, $mode) {
if ( empty($title) )
$title = __('(no title)');
?>
<tr id='post-<?php echo $post->ID; ?>' class='<?php echo trim( $class . ' author-' . $post_owner . ' status-' . $post->post_status ); ?>' valign="top">
<tr id='post-<?php echo $post->ID; ?>' class='<?php echo trim( $rowclass . ' author-' . $post_owner . ' status-' . $post->post_status ); ?> iedit' valign="top">
<?php
$posts_columns = wp_manage_posts_columns();
$hidden = (array) get_user_option( 'manage-post-columns-hidden' );
@ -934,11 +956,13 @@ function _post_row($a_post, $pending_comments, $mode) {
}
}
if ( 'excerpt' == $mode ) { ?>
<td <?php echo $attributes ?>><?php echo apply_filters('post_date_column_time', $t_time, $post, $column_name, $mode) ?></td>
<?php } else { ?>
<td <?php echo $attributes ?>><abbr title="<?php echo $t_time ?>"><?php echo apply_filters('post_date_column_time', $h_time, $post, $column_name, $mode) ?></abbr></td>
<?php }
echo '<td ' . $attributes . '>';
if ( 'excerpt' == $mode )
echo apply_filters('post_date_column_time', $t_time, $post, $column_name, $mode);
else
echo '<abbr title="' . $t_time . '">' . apply_filters('post_date_column_time', $h_time, $post, $column_name, $mode) . '</abbr>';
echo '</td>';
break;
case 'title':
@ -954,7 +978,7 @@ function _post_row($a_post, $pending_comments, $mode) {
$actions = array();
$actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '">' . __('Edit') . '</a>';
$actions['inline'] = '<a href="#" class="editinline">' . __('Quick Edit') . '</a>';
$actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID) . "' onclick=\"if ( confirm('" . js_escape(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this draft '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this post '%s'\n 'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
$actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID) . "' onclick=\"if ( confirm('" . js_escape(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this draft '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this post '%s'\n 'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
if ( in_array($post->post_status, array('pending', 'draft')) )
$actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . attribute_escape(sprintf(__('Preview "%s"'), $title)) . '" rel="permalink">' . __('Preview') . '</a>';
else
@ -966,6 +990,8 @@ function _post_row($a_post, $pending_comments, $mode) {
( $i == $action_count ) ? $sep = '' : $sep = ' | ';
echo "<span class='$action'>$link$sep</span>";
}
get_inline_data($post);
?>
</td>
<?php
@ -1088,7 +1114,7 @@ function _post_row($a_post, $pending_comments, $mode) {
*/
function display_page_row( $page, $level = 0 ) {
global $post;
static $class;
static $rowclass;
$post = $page;
setup_postdata($page);
@ -1096,17 +1122,15 @@ function display_page_row( $page, $level = 0 ) {
$page->post_title = wp_specialchars( $page->post_title );
$pad = str_repeat( '&#8212; ', $level );
$id = (int) $page->ID;
$class = ('alternate' == $class ) ? '' : 'alternate';
$rowclass = 'alternate' == $rowclass ? '' : 'alternate';
$posts_columns = wp_manage_pages_columns();
$hidden = (array) get_user_option( 'manage-page-columns-hidden' );
$title = get_the_title();
if ( empty($title) )
$title = __('(no title)');
?>
<tr id='page-<?php echo $id; ?>' class='<?php echo $class; ?>'>
<?php
<tr id="page-<?php echo $id; ?>" class="<?php echo $rowclass; ?> iedit">
<?php
foreach ($posts_columns as $column_name=>$column_display_name) {
$class = "class=\"$column_name column-$column_name\"";
@ -1163,7 +1187,7 @@ foreach ($posts_columns as $column_name=>$column_display_name) {
$actions = array();
$actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
$actions['inline'] = '<a href="#" class="editinline">' . __('Quick Edit') . '</a>';
$actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("page.php?action=delete&amp;post=$page->ID", 'delete-page_' . $page->ID) . "' onclick=\"if ( confirm('" . js_escape(sprintf( ('draft' == $page->post_status) ? __("You are about to delete this draft '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this page '%s'\n 'Cancel' to stop, 'OK' to delete."), $page->post_title )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
$actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("page.php?action=delete&amp;post=$page->ID", 'delete-page_' . $page->ID) . "' onclick=\"if ( confirm('" . js_escape(sprintf( ('draft' == $page->post_status) ? __("You are about to delete this draft '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this page '%s'\n 'Cancel' to stop, 'OK' to delete."), $page->post_title )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
if ( in_array($post->post_status, array('pending', 'draft')) )
$actions['view'] = '<a href="' . get_permalink($page->ID) . '" title="' . attribute_escape(sprintf(__('Preview "%s"'), $title)) . '" rel="permalink">' . __('Preview') . '</a>';
else
@ -1175,9 +1199,9 @@ foreach ($posts_columns as $column_name=>$column_display_name) {
( $i == $action_count ) ? $sep = '' : $sep = ' | ';
echo "<span class='$action'>$link$sep</span>";
}
?>
</td>
<?php
get_inline_data($post);
echo '</td>';
break;
case 'comments':
@ -1236,9 +1260,9 @@ foreach ($posts_columns as $column_name=>$column_display_name) {
break;
}
}
?>
?>
</tr>
</tr>
<?php
}
@ -1265,10 +1289,10 @@ function page_rows($pages, $pagenum = 1, $per_page = 20) {
* It only takes O(N) to arrange this and it takes O(1) for subsequent lookup operations
* If searching, ignore hierarchy and treat everything as top level
*/
if ( empty($_GET['s']) ) {
if ( empty($_GET['s']) ) {
$top_level_pages = array();
$children_pages = array();
$children_pages = array();
foreach ( $pages as $page ) {
@ -1379,7 +1403,7 @@ function user_row( $user_object, $style = '', $role = '' ) {
if ('/' == substr( $short_url, -1 ))
$short_url = substr( $short_url, 0, -1 );
if ( strlen( $short_url ) > 35 )
$short_url = substr( $short_url, 0, 32 ).'...';
$short_url = substr( $short_url, 0, 32 ).'...';
$numposts = get_usernumposts( $user_object->ID );
if ( current_user_can( 'edit_user', $user_object->ID ) ) {
if ($current_user->ID == $user_object->ID) {
@ -1390,7 +1414,7 @@ function user_row( $user_object, $style = '', $role = '' ) {
$edit = "<strong><a href=\"$edit_link\">$user_object->user_login</a></strong><br />";
$actions = array();
$actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
$actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("users.php?action=delete&amp;user=$user_object->ID", 'bulk-users') . "' onclick=\"if ( confirm('" . js_escape(sprintf(__("You are about to delete this user '%s'\n 'Cancel' to stop, 'OK' to delete."), $user_object->user_login )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
$actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("users.php?action=delete&amp;user=$user_object->ID", 'bulk-users') . "' onclick=\"if ( confirm('" . js_escape(sprintf(__("You are about to delete this user '%s'\n 'Cancel' to stop, 'OK' to delete."), $user_object->user_login )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
$action_count = count($actions);
$i = 0;
foreach ( $actions as $action => $link ) {
@ -1511,24 +1535,24 @@ function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true
else
$ptime = mysql2date(__('Y/m/d \a\t g:i A'), $comment->comment_date );
$delete_url = clean_url( wp_nonce_url( "comment.php?action=deletecomment&p=$comment->comment_post_ID&c=$comment->comment_ID", "delete-comment_$comment->comment_ID" ) );
$approve_url = clean_url( wp_nonce_url( "comment.php?action=approvecomment&p=$comment->comment_post_ID&c=$comment->comment_ID", "approve-comment_$comment->comment_ID" ) );
$delete_url = clean_url( wp_nonce_url( "comment.php?action=deletecomment&p=$comment->comment_post_ID&c=$comment->comment_ID", "delete-comment_$comment->comment_ID" ) );
$approve_url = clean_url( wp_nonce_url( "comment.php?action=approvecomment&p=$comment->comment_post_ID&c=$comment->comment_ID", "approve-comment_$comment->comment_ID" ) );
$unapprove_url = clean_url( wp_nonce_url( "comment.php?action=unapprovecomment&p=$comment->comment_post_ID&c=$comment->comment_ID", "unapprove-comment_$comment->comment_ID" ) );
$spam_url = clean_url( wp_nonce_url( "comment.php?action=deletecomment&dt=spam&p=$comment->comment_post_ID&c=$comment->comment_ID", "delete-comment_$comment->comment_ID" ) );
$spam_url = clean_url( wp_nonce_url( "comment.php?action=deletecomment&dt=spam&p=$comment->comment_post_ID&c=$comment->comment_ID", "delete-comment_$comment->comment_ID" ) );
?>
<tr id="comment-<?php echo $comment->comment_ID; ?>" class='<?php echo $the_comment_status; ?>'>
<tr id="comment-<?php echo $comment->comment_ID; ?>" class='<?php echo $the_comment_status; ?>'>
<?php if ( $checkbox ) : ?>
<td class="check-column"><?php if ( current_user_can('edit_post', $comment->comment_post_ID) ) { ?><input type="checkbox" name="delete_comments[]" value="<?php echo $comment->comment_ID; ?>" /><?php } ?></td>
<td class="check-column"><?php if ( current_user_can('edit_post', $comment->comment_post_ID) ) { ?><input type="checkbox" name="delete_comments[]" value="<?php echo $comment->comment_ID; ?>" /><?php } ?></td>
<?php endif; ?>
<td class="comment-column">
<?php if ( 'detail' == $mode || 'single' == $mode ) comment_text(); ?>
<td class="comment-column">
<?php if ( 'detail' == $mode || 'single' == $mode ) comment_text(); ?>
<?php
$actions = array();
if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
$actions['approve'] = "<a href='$approve_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=approved vim-a' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>';
$actions['approve'] = "<a href='$approve_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=approved vim-a' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>';
$actions['unapprove'] = "<a href='$unapprove_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved vim-u' title='" . __( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>';
if ( $comment_status ) { // not looking at all comments
if ( 'approved' == $the_comment_status ) {
@ -1540,7 +1564,7 @@ function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true
}
}
if ( 'spam' != $the_comment_status )
$actions['spam'] = "<a href='$spam_url' class='delete:the-comment-list:comment-$comment->comment_ID::spam=1 vim-s vim-destructive' title='" . __( 'Mark this comment as spam' ) . "'>" . __( 'Spam' ) . '</a>';
$actions['spam'] = "<a href='$spam_url' class='delete:the-comment-list:comment-$comment->comment_ID::spam=1 vim-s vim-destructive' title='" . __( 'Mark this comment as spam' ) . "'>" . __( 'Spam' ) . '</a>';
$actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID delete vim-d vim-destructive'>" . __('Delete') . '</a>';
$actions['edit'] = "<a href='comment.php?action=editcomment&amp;c={$comment->comment_ID}' title='" . __('Edit comment') . "'>". __('Edit') . '</a>';
if ( 'spam' != $the_comment_status )
@ -1564,27 +1588,27 @@ function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true
}
}
?>
</td>
</td>
<td class="author-column">
<strong><?php comment_author(); ?></strong><br />
<?php if ( !empty($author_url) ) : ?>
<a href="<?php echo $author_url ?>"><?php echo $author_url_display; ?></a><br />
<?php endif; ?>
<?php if ( current_user_can( 'edit_post', $post->ID ) ) : ?>
<?php if ( !empty($comment->comment_author_email) ): ?>
<?php comment_author_email_link() ?><br />
<?php endif; ?>
<a href="edit-comments.php?s=<?php comment_author_IP() ?>&amp;mode=detail"><?php comment_author_IP() ?></a>
<?php endif; //current_user_can?>
<?php if ( !empty($author_url) ) : ?>
<a href="<?php echo $author_url ?>"><?php echo $author_url_display; ?></a><br />
<?php endif; ?>
<?php if ( current_user_can( 'edit_post', $post->ID ) ) : ?>
<?php if ( !empty($comment->comment_author_email) ): ?>
<?php comment_author_email_link() ?><br />
<?php endif; ?>
<a href="edit-comments.php?s=<?php comment_author_IP() ?>&amp;mode=detail"><?php comment_author_IP() ?></a>
<?php endif; //current_user_can?>
</td>
<td class="date-column"><?php comment_date(__('Y/m/d \a\t g:ia')); ?></td>
<td class="date-column"><?php comment_date(__('Y/m/d \a\t g:ia')); ?></td>
<?php if ( 'single' !== $mode ) : ?>
<td class="response-column">
"<?php echo $post_link ?>" <?php echo sprintf('(%s comments)', $post->comment_count); ?><br />
<?php echo get_the_time(__('Y/m/d \a\t g:ia')); ?>
</td>
<td class="response-column">
"<?php echo $post_link ?>" <?php echo sprintf('(%s comments)', $post->comment_count); ?><br />
<?php echo get_the_time(__('Y/m/d \a\t g:ia')); ?>
</td>
<?php endif; ?>
</tr>
</tr>
<?php
}
@ -1593,7 +1617,7 @@ function wp_comment_reply($position = '1', $checkbox = false, $mode = 'single')
// allow plugin to replace the popup content
$content = apply_filters( 'wp_comment_reply', '', array('position'=>$position, 'checkbox'=>$checkbox, 'mode'=>$mode) );
if ( ! empty($content) ) {
echo $content;
return;
@ -1606,7 +1630,7 @@ function wp_comment_reply($position = '1', $checkbox = false, $mode = 'single')
<p class="submit"><button id="close-button" onclick="commentReply.close();" class="button"><?php _e('Close'); ?></button>
<button id="back-button" onclick="commentReply.back();" class="button"><?php _e('Go back'); ?></button></p>
</div>
<div id="replydiv" style="display:none;">
<p id="replyhandle"><?php _e('Reply'); ?></p>
<form action="" method="post" id="replyform">
@ -1699,7 +1723,7 @@ function _list_meta_row( $entry, &$count ) {
}
}
$entry['meta_key'] = attribute_escape($entry['meta_key']);
$entry['meta_key'] = attribute_escape($entry['meta_key']);
$entry['meta_value'] = htmlspecialchars($entry['meta_value']); // using a <textarea />
$entry['meta_id'] = (int) $entry['meta_id'];
@ -1792,14 +1816,14 @@ function touch_time( $edit = 1, $for_post = 1, $tab_index = 0, $multi = 0 ) {
}
$month .= '</select>';
$day = '<input type="text" ' . ( $multi ? '' : 'id="jj" ' ) . 'name="jj" value="' . $jj . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" />';
$year = '<input type="text" ' . ( $multi ? '' : 'id="aa" ' ) . 'name="aa" value="' . $aa . '" size="4" maxlength="5"' . $tab_index_attribute . ' autocomplete="off" />';
$hour = '<input type="text" ' . ( $multi ? '' : 'id="hh" ' ) . 'name="hh" value="' . $hh . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" />';
$minute = '<input type="text" ' . ( $multi ? '' : 'id="mn" ' ) . 'name="mn" value="' . $mn . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" />';
$day = '<input type="text" ' . ( $multi ? '' : 'id="jj" ' ) . 'name="jj" value="' . $jj . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" />';
$year = '<input type="text" ' . ( $multi ? '' : 'id="aa" ' ) . 'name="aa" value="' . $aa . '" size="4" maxlength="5"' . $tab_index_attribute . ' autocomplete="off" />';
$hour = '<input type="text" ' . ( $multi ? '' : 'id="hh" ' ) . 'name="hh" value="' . $hh . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" />';
$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);
if ( $multi ) return;
echo "\n\n";
foreach ( array('mm', 'jj', 'aa', 'hh', 'mn') as $timeunit )
echo '<input type="hidden" id="hidden_' . $timeunit . '" name="hidden_' . $timeunit . '" value="' . $$timeunit . '" />' . "\n";
@ -1891,7 +1915,7 @@ function the_attachment_links( $id = false ) {
<?php else : ?>
<tr>
<th scope="row"><?php _e( 'Link to file' ) ?></th>
<td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo wp_get_attachment_url(); ?>" class="attachmentlink"><?php echo basename( wp_get_attachment_url() ); ?></a></textarea></td>
<td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo wp_get_attachment_url(); ?>" class="attachmentlink"><?php echo basename( wp_get_attachment_url() ); ?></a></textarea></td>
</tr>
<tr>
<th scope="row"><?php _e( 'Link to page' ) ?></th>
@ -1977,7 +2001,7 @@ function wp_remember_old_slug() {
*
* @param string $id String for use in the 'id' attribute of tags.
* @param string $title Title of the meta box
* @param string $callback Function that fills the box with the desired content. The function should echo its output.
* @param string $callback Function that fills the box with the desired content. The function should echo its output.
* @param string $page The type of edit page on which to show the box (post, page, link)
* @param string $context The context within the page where the boxes should show ('normal', 'advanced')
* @param string $priority The priority within the context where the boxes should show ('high', 'low')
@ -1985,7 +2009,7 @@ function wp_remember_old_slug() {
function add_meta_box($id, $title, $callback, $page, $context = 'advanced', $priority = 'default') {
global $wp_meta_boxes;
if ( !isset($wp_meta_boxes) )
if ( !isset($wp_meta_boxes) )
$wp_meta_boxes = array();
if ( !isset($wp_meta_boxes[$page]) )
$wp_meta_boxes[$page] = array();
@ -2012,7 +2036,7 @@ function add_meta_box($id, $title, $callback, $page, $context = 'advanced', $pri
// If no priority given and id already present, use existing priority
if ( empty($priority) ) {
$priority = $a_priority;
// else if we're adding to the sorted priortiy, we don't know the title or callback. Glab them from the previously added context/priority.
// else if we're adding to the sorted priortiy, we don't know the title or callback. Glab them from the previously added context/priority.
} elseif ( 'sorted' == $priority ) {
$title = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['title'];
$callback = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['callback'];
@ -2043,8 +2067,8 @@ function do_meta_boxes($page, $context, $object) {
echo "<div id='$context-sortables' class='meta-box-sortables'>\n";
$i = 0;
do {
// Grab the ones the user has manually sorted. Pull them out of their previous context/priority and into the one the user chose
do {
// Grab the ones the user has manually sorted. Pull them out of their previous context/priority and into the one the user chose
if ( !$already_sorted && $sorted = get_user_option( "meta-box-order_$page" ) ) {
foreach ( $sorted as $box_context => $ids )
foreach ( explode(',', $ids) as $id )
@ -2094,7 +2118,7 @@ function do_meta_boxes($page, $context, $object) {
function remove_meta_box($id, $page, $context) {
global $wp_meta_boxes;
if ( !isset($wp_meta_boxes) )
if ( !isset($wp_meta_boxes) )
$wp_meta_boxes = array();
if ( !isset($wp_meta_boxes[$page]) )
$wp_meta_boxes[$page] = array();
@ -2137,13 +2161,13 @@ function meta_box_prefs($page) {
*
* @param string $id String for use in the 'id' attribute of tags.
* @param string $title Title of the section
* @param string $callback Function that fills the section with the desired content. The function should echo its output.
* @param string $callback Function that fills the section with the desired content. The function should echo its output.
* @param string $page The type of settings page on which to show the section (general, reading, writing, ...)
*/
function add_settings_section($id, $title, $callback, $page) {
global $wp_settings_sections;
if ( !isset($wp_settings_sections) )
if ( !isset($wp_settings_sections) )
$wp_settings_sections = array();
if ( !isset($wp_settings_sections[$page]) )
$wp_settings_sections[$page] = array();
@ -2160,7 +2184,7 @@ function add_settings_section($id, $title, $callback, $page) {
*
* @param string $id String for use in the 'id' attribute of tags.
* @param string $title Title of the field
* @param string $callback Function that fills the field with the desired content. The function should echo its output.
* @param string $callback Function that fills the field with the desired content. The function should echo its output.
* @param string $page The type of settings page on which to show the field (general, reading, writing, ...)
* @param string $section The section of the settingss page in which to show the box (default, ...)
* @param array $args Additional arguments
@ -2168,7 +2192,7 @@ function add_settings_section($id, $title, $callback, $page) {
function add_settings_field($id, $title, $callback, $page, $section = 'default', $args = array()) {
global $wp_settings_fields;
if ( !isset($wp_settings_fields) )
if ( !isset($wp_settings_fields) )
$wp_settings_fields = array();
if ( !isset($wp_settings_fields[$page]) )
$wp_settings_fields[$page] = array();
@ -2211,7 +2235,7 @@ function do_settings_fields($page, $section) {
call_user_func($field['callback']);
echo '</td>';
echo '</tr>';
}
}
}
function manage_columns_prefs($page) {
@ -2244,7 +2268,7 @@ function find_posts_div($found_action = '') {
<?php if ( $found_action ) { ?>
<input type="hidden" name="found_action" value="<?php echo $found_action; ?>" />
<?php } ?>
<input type="hidden" name="affected" id="affected" value="" />
<?php wp_nonce_field( 'find-posts', '_ajax_nonce', false ); ?>
<label class="hidden" for="find-posts-input"><?php _e( 'Search' ); ?></label>
@ -2279,42 +2303,42 @@ function find_posts_div($found_action = '') {
minHeight: 150,
minWidth: 280
}).css({'top':st+'px','left':'50%','marginLeft':'-200px'});
$('.ui-resizable-handle').css({
'backgroundColor': '#e5e5e5'
});
$('.ui-resizable-se').css({
'border': '0 none',
'width': '15px',
'height': '16px',
'background': 'transparent url(images/se.png) no-repeat scroll 0 0'
});
$('#find-posts-input').focus().keyup(function(e){
if (e.which == 27) findPosts.close(); // close on Escape
});
return false;
},
close : function() {
$('#find-posts-response').html('');
$('#find-posts').draggable('destroy').resizable('destroy').hide();
},
send : function() {
var post = {};
post['ps'] = $('#find-posts-input').val();
post['action'] = 'find_posts';
post['_ajax_nonce'] = $('#_ajax_nonce').val();
if ( $('#find-posts-pages:checked').val() )
post['pages'] = 1;
else
post['posts'] = 1;
$.ajax({
type : 'POST',
url : '<?php echo admin_url('admin-ajax.php'); ?>',
@ -2323,7 +2347,7 @@ function find_posts_div($found_action = '') {
error : function(r) { findPosts.error(r); }
});
},
show : function(x) {
if ( typeof(x) == 'string' ) {
@ -2335,22 +2359,22 @@ function find_posts_div($found_action = '') {
if ( r.errors )
this.error({'responseText': wpAjax.broken});
r = r.responses[0];
$('#find-posts-response').html(r.data);
},
error : function(r) {
var er = r.statusText;
if ( r.responseText )
er = r.responseText.replace( /<.[^<>]*?>/g, '' );
if ( er )
$('#find-posts-response').html(er);
}
};
$(document).ready(function(){
$('#find-posts-submit').click(function(e) {
if ( '' == $('#find-posts-response').html() )

View File

@ -1,187 +1,174 @@
var postType = null;
var postView = null;
var postsXml = null;
var inlineRows = null;
jQuery(document).ready(function() {
postType = window.location.href.indexOf('edit.php') == -1 ? 'page' : 'post';
postView = window.location.href.indexOf('mode=excerpt') == -1 ? 'list' : 'excerpt';
(function($) {
inlineEdit = {
type : '',
rows : '',
// get IDs of all editable rows
inlineRows = jQuery('table.widefat .check-column :checkbox[name="post[]"]').parents('tr');
init : function() {
var t = this, blankRow = $('#inline-edit');
// prepare the edit row
var blankRow = jQuery('#inline-edit');
jQuery('ul.categories *', blankRow).removeAttr('id');
jQuery('ul.categories label', blankRow).removeAttr('for');
blankRow.attr('title', 'Double-click to cancel')
.dblclick(function() { toggleRow(this); })
.keypress(function(event) { if(event.which == 13) return saveRow(this); });
jQuery('span.cancel a', blankRow).click(function() { return revertRow(this); });
jQuery('span.save a', blankRow).click(function() { return saveRow(this); });
t.type = $('table.widefat').hasClass('page') ? 'page' : 'post';
// add events and get data
inlineRows.dblclick(function() { toggleRow(this); });
addEvents(inlineRows);
// get all editable rows
t.rows = $('tr.iedit');
// get data
getInlineData('all');
});
// prepare the edit row
blankRow.dblclick(function() { inlineEdit.toggle(this); })
.keyup(function(e) { if(e.which == 27) return inlineEdit.revert(this); });
function toggleRow(el) {
jQuery('#'+postType+'-'+getRowId(el)).css('display') == 'none' ? revertRow(el) : editRow(el);
}
$('a.cancel', blankRow).click(function() { return inlineEdit.revert(this); });
$('a.save', blankRow).click(function() { return inlineEdit.save(this); });
// add events to links and make rows double-clickable
function addEvents(rows) {
rows.each(function() {
var row = jQuery(this);
jQuery('a.editinline', row).click(function() { editRow(this); return false; });
row.attr('title', 'Double-click to edit');
});
}
// add events
t.rows.dblclick(function() { inlineEdit.toggle(this); });
t.addEvents(t.rows);
},
function getInlineData(id) {
if(id == 'all') {
var editable = [];
inlineRows.each(function(i) { editable[i] = getRowId(this); });
id = editable.join(',');
}
toggle : function(el) {
var t = this;
$('#'+t.type+'-'+t.getId(el)).css('display') == 'none' ? t.revert(el) : t.edit(el);
},
addEvents : function(r) {
r.each(function() {
var row = $(this);
$('a.editinline', row).click(function() { inlineEdit.edit(this); return false; });
row.attr('title', inlineEditL10n.edit);
});
},
edit : function(id) {
var t = this, type = t.type, old = $('tr.inline-editor').attr('id');
if( typeof(id) == 'object' )
id = t.getId(id);
if ( old ) {
old = old.split('-')[1];
t.revert(old);
}
var fields = ['post_title', 'post_name', 'post_author', 'post_status', 'jj', 'mm', 'aa', 'hh', 'mn', 'post_password'];
if ( type == 'page' ) fields.push('post_parent', 'menu_order', 'page_template');
if ( type == 'post' ) fields.push('tags_input');
// add the new blank row
var editRow = $('#inline-edit').clone(true);
if ( $('#'+type+'-'+id).hasClass('alternate') )
$(editRow).addClass('alternate');
$('#'+type+'-'+id).hide().after(editRow);
// populate the data
var rowData = $('#inline_'+id);
for ( var f = 0; f < fields.length; f++ ) {
$(':input[name="'+fields[f]+'"]', editRow).val( $('.'+fields[f], rowData).val() );
}
if ( $('.comment_status', rowData).val() == 'open' )
$('input[name="comment_status"]', editRow).attr("checked", "checked");
if ( $('.ping_status', rowData).val() == 'open' )
$('input[name="ping_status"]', editRow).attr("checked", "checked");
if ( $('.sticky', rowData).val() == 'sticky' )
$('input[name="sticky"]', editRow).attr("checked", "checked");
// categories
var cats;
if ( cats = $('.post_category', rowData).val() )
$('ul.cat-checklist :checkbox').val(cats.split(','));
// handle the post status
var status = $('.post_status', rowData).val();
if ( status != 'future' ) $('select[name="post_status"] option[value="future"]', editRow).remove();
if ( status == 'private' ) $('input[name="keep_private"]', editRow).attr("checked", "checked");
// remove the current page and children from the parent dropdown
var pageOpt = $('select[name="post_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();
}
// categories expandable?
$('span.catshow', editRow).click(function() {
$('ul.cat-checklist', editRow).addClass("cat-hover");
$('span.cathide', editRow).show();
$(this).hide();
});
$('span.cathide', editRow).click(function() {
$('ul.cat-checklist', editRow).removeClass("cat-hover");
$('span.catshow', editRow).show();
$(this).hide();
});
$(editRow).attr('id', 'edit-'+id).addClass('inline-editor').show();
$('.ptitle', editRow).focus();
// enable autocomplete for tags
if ( type == 'post' )
$('tr.inline-editor textarea[name="tags_input"]').suggest( 'admin-ajax.php?action=ajax-tag-search', { delay: 500, minchars: 2, multiple: true, multipleSep: ", " } );
if(id == '')
return false;
jQuery.post('admin-ajax.php', {
'inline_edit_nonce': jQuery('#inline_edit_nonce').val(),
action: 'inline-data',
posts: id
},
function(xml) {
if(id.indexOf(',') == -1) {
var newData = jQuery(xml).find('post[id="'+id+'"]');
jQuery(postsXml).find('post[id="'+id+'"]').replaceWith(newData);
} else {
postsXml = xml;
},
save : function(id) {
if( typeof(id) == 'object' )
id = this.getId(id);
$('#edit-'+id+' .check-column').html('<img src="images/loading.gif" alt="" />');
var params = {
action: 'inline-save',
post_type: this.type,
post_ID: id,
edit_date: 'true'
};
var fields = $('#edit-'+id+' :input').fieldSerialize();
params = fields + '&' + $.param(params);
// make ajax request
$.post('admin-ajax.php', params,
function(html) {
var row = $('#'+inlineEdit.type+'-'+id);
$('#edit-'+id).hide();
html = $(html).html();
row.html(html).show();
row.animate( { backgroundColor: '#FFFBCC' }, 200)
.animate( { backgroundColor: row.css('background-color') }, 500);
inlineEdit.addEvents(row);
}
}, 'xml'
);
}
);
return false;
},
function editRow(id) {
if(typeof(id) == 'object')
id = getRowId(id);
revert : function(id) {
if ( typeof(id) == 'object' )
id = this.getId(id);
var blankRow = jQuery('#inline-edit');
$('#edit-'+id).remove();
$('#'+this.type+'-'+id).show();
var fields = ['post_title', 'post_name', 'post_author', 'post_status', 'jj', 'mm', 'aa', 'hh', 'mn'];
if(postType == 'page') fields.push('post_parent', 'menu_order', 'page_template', 'post_password');
if(postType == 'post') fields.push('tags_input');
return false;
},
// add the new blank row
var editRow = blankRow.clone(true);
jQuery(editRow).attr('id', 'edit-'+id).addClass('inline-editor').show();
if(jQuery('#'+postType+'-'+id).hasClass('alternate'))
jQuery(editRow).addClass('alternate');
jQuery('#'+postType+'-'+id).hide().after(editRow);
// populate the data
var rowData = jQuery(postsXml).find('post[id="'+id+'"]');
for(var f = 0; f < fields.length; f++) {
jQuery(':input[name="'+fields[f]+'"]', editRow).val(jQuery(fields[f], rowData).text());
}
// ping, comments, and privacy
if(jQuery('comment_status', rowData).text() == 'open')
jQuery('input[name="comment_status"]', editRow).select();
if(jQuery('ping_status', rowData).text() == 'open')
jQuery('input[name="ping_status"]', editRow).select();
if(jQuery('sticky', rowData).text() == 'sticky')
jQuery('input[name="sticky"]', editRow).select();
// categories
var categories = jQuery('post_category', rowData).text().split(',');
jQuery(categories).each(function() {
jQuery('ul.categories :checkbox[value="'+this+'"]', editRow).select();
});
// handle the post status
var status = jQuery('post_status', rowData).text();
if(status != 'future') jQuery('select[name="post_status"] option[value="future"]', editRow).remove();
if(status == 'private') jQuery('input[name="page_private"]', editRow).select();
// enable autocomplete for tags
if(postType == 'post') {
jQuery('tr.inline textarea[name="tags_input"]').suggest( 'admin-ajax.php?action=ajax-tag-search', { delay: 500, minchars: 2, multiple: true, multipleSep: ", " } );
}
// remove the current page and children from the parent dropdown
var pageOpt = jQuery('select[name="post_parent"] option[value="'+id+'"]', editRow);
if(pageOpt.length > 0) {
var pageLevel = pageOpt[0].className.split('-')[1];
var nextPage = pageOpt; var pageLoop = true;
while(pageLoop) {
var nextPage = nextPage.next('option');
var nextLevel = nextPage[0].className.split('-')[1];
if(nextLevel <= pageLevel)
pageLoop = false;
else {
nextPage.remove();
nextPage = pageOpt;
}
}
pageOpt.remove();
getId : function(o) {
var id = o.tagName == 'TR' ? o.id : $(o).parents('tr').attr('id');
var parts = id.split('-');
return parts[parts.length - 1];
}
};
return false;
}
function saveRow(id) {
if(typeof(id) == 'object')
id = getRowId(id);
jQuery('#edit-'+id+' .check-column').html('<img src="images/loading.gif" alt="" />');
var params = {
'inline_edit_nonce': jQuery('#inline_edit_nonce').val(),
action: 'inline-save',
post_type: postType,
post_ID: id,
edit_date: 'true',
post_view: postView
};
var fields = jQuery('#edit-'+id+' :input').fieldSerialize();
params = fields + '&' + jQuery.param(params);
// make ajax request
jQuery.post('admin-ajax.php', params,
function(html) {
var row = jQuery('#'+postType+'-'+id);
jQuery('#edit-'+id).hide();
html = jQuery(html).html();
row.html(html).show();
row.animate( { backgroundColor: '#FFFBCC' }, 200)
.animate( { backgroundColor: row.css('background-color') }, 500);
getInlineData(id);
addEvents(row);
}
);
return false;
}
function revertRow(id) {
if(typeof(id) == 'object')
id = getRowId(id);
jQuery('#edit-'+id).remove();
jQuery('#'+postType+'-'+id).show();
return false;
}
function getRowId(obj) {
var id = obj.tagName == 'TR' ? obj.id : jQuery(obj).parents('tr').attr('id');
var parts = id.split('-');
return parts[parts.length - 1];
}
$(document).ready(function(){inlineEdit.init();});
})(jQuery);

View File

@ -2159,120 +2159,162 @@ a.togbox {
font-size: 11px;
}
.inline-editor .save {
padding-top: 5px;
}
.inline-editor td {
padding-right: 4px;
padding-left: 7px;
padding: 3px;
}
.inline-editor input, .inline-editor select, .inline-editor textarea {
font-size: 10px !important;
.inline-editor .save,
.inline-editor .cancel {
margin-right: 5px;
}
.inline-editor .quick-edit-div {
float: left;
height: 85px;
margin: 0 5px 3px 0;
width: 130px;
border-style: solid;
border-width: 1px;
padding: 2px;
border: 1px solid #ddd;
}
.inline-editor td.date {
width: 87px;
.inline-editor .in {
padding: 4px;
margin: 2px 0 0;
line-height: 15px;
}
.inline-editor td.page-title {
width: 495px;
.inline-editor input {
font-size: 11px !important;
padding: 2px;
border-width: 1px;
border-style: solid;
}
.inline-editor td.post-title input.title {
width: 250px;
}
.inline-editor td.post-title input.slug {
width: 222px;
float: right;
#wpbody-content .inline-editor select {
padding: 0;
height: auto;
width: 120px;
font-size: 11px !important;
}
.inline-editor div.title {
float: left;
padding: 2px 5px;
cursor: default;
}
.inline-editor div.title input.title {
.inline-editor .post-title,
.inline-editor .page-title {
width: 260px;
}
.inline-editor .post-title .ptitle,
.inline-editor .page-title .ptitle {
width: 245px;
margin-bottom: 5px;
font-size: 12px !important;
}
.inline-editor div.title label {
float: left;
margin-top: 4px;
.inline-editor .post-title .slug,
.inline-editor .page-title .slug {
text-align: right;
}
.inline-editor td.page-title input.slug {
width: 123px;
float: right;
.inline-editor .slug input {
width: 170px;
margin: 0 2px 0 4px;
}
.inline-editor div.other, .inline-editor div.more {
width: 190px;
float: left;
padding-left: 5px;
.inline-editor .password input,
.inline-editor .order input {
width: 112px;
}
.inline-editor div.other label, .inline-editor div.more label {
display: block; float: left;
width: 54px;
margin-top: 4px;
.inline-editor .password label input {
width: auto;
margin: 3px 0 0;
}
.inline-editor div.other select {
width: 133px;
.inline-editor .date {
width: 160px;
}
.inline-editor div.more {
width: 125px;
.inline-editor .date input {
padding: 2px 1px;
margin: 1px;
width: 18px;
}
.inline-editor div.more input {
width: 60px;
.inline-editor .date input[name="aa"] {
width: 30px;
}
.inline-editor td.author select {
width: 110px;
#wpbody-content .inline-editor .date select {
width: 80px;
}
.inline-editor ul.categories {
.inline-editor .categories {
width: 180px;
}
.inline-editor .categories ul.cat-checklist {
list-style: none;
padding: 0; margin: 0;
padding: 0 0 0 4px;
margin: 0;
height: 65px;
overflow: auto;
font-size: 10px;
font-size: 11px;
z-index: 5;
position: relative;
overflow-x: hidden;
}
.inline-editor ul.categories ul.children {
.inline-editor .categories ul.cat-hover {
height: 200px;
overflow: auto;
}
.inline-editor .categories ul.children {
list-style: none;
padding-left: 15px;
}
.inline-editor ul.categories li {
margin-bottom: 2px;
.inline-editor .categories li {
margin-bottom: 3px;
line-height: auto;
}
.inline-editor ul.categories input {
.inline-editor .categories input {
vertical-align: middle;
padding: 0; border: 0;
padding: 0;
border: 0;
}
.inline-editor td.tags textarea {
height: 58px; width: 100%;
.inline-editor .categories .catshow,
.inline-editor .categories .cathide {
font-size: 9px;
cursor: pointer;
}
.inline-editor td.comments {
padding-left: 0;
.inline-editor .tags {
width: 220px;
}
.inline-editor td.status select {
width: 98px;
.inline-editor textarea {
border-width: 1px;
border-style: solid;
height: 45px;
width: 200px;
font-size: 11px;
}
.inline-editor td.status input {
vertical-align: middle;
.inline-editor .comments {
text-align: left;
width: 160px;
}
.inline-editor .quick-edit-save {
padding: 8px 10px;
}
/* Media library */

View File

@ -244,7 +244,10 @@ 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' ), '20080812' );
$scripts->add( 'inline-edit', '/wp-admin/js/inline-edit.js', array( 'jquery', 'jquery-form', 'suggest' ), '20080920' );
$scripts->localize( 'inline-edit', 'inlineEditL10n', array(
'edit' => __('Double-click to edit')
) );
$scripts->add( 'plugin-install', '/wp-admin/js/plugin-install.js', array( 'thickbox', 'jquery' ), '20080803' );
$scripts->localize( 'plugin-install', 'plugininstallL10n', array(