diff --git a/wp-admin/admin-ajax.php b/wp-admin/admin-ajax.php index 9b36c10d5..62346c649 100644 --- a/wp-admin/admin-ajax.php +++ b/wp-admin/admin-ajax.php @@ -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'] ); diff --git a/wp-admin/css/colors-classic.css b/wp-admin/css/colors-classic.css index c2d34c06c..6a286b6db 100644 --- a/wp-admin/css/colors-classic.css +++ b/wp-admin/css/colors-classic.css @@ -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; -} \ No newline at end of file +} + +/* 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; +} diff --git a/wp-admin/css/colors-fresh.css b/wp-admin/css/colors-fresh.css index 23dea9ddf..03ddf4352 100644 --- a/wp-admin/css/colors-fresh.css +++ b/wp-admin/css/colors-fresh.css @@ -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; +} diff --git a/wp-admin/edit-pages.php b/wp-admin/edit-pages.php index 244b8d9a7..890bdcabb 100644 --- a/wp-admin/edit-pages.php +++ b/wp-admin/edit-pages.php @@ -189,7 +189,7 @@ $all = !( $h2_search || $post_status_q ); if ($posts) { ?> - +
diff --git a/wp-admin/edit-post-rows.php b/wp-admin/edit-post-rows.php index 031b7c634..206704628 100644 --- a/wp-admin/edit-post-rows.php +++ b/wp-admin/edit-post-rows.php @@ -8,7 +8,7 @@ if ( ! defined('ABSPATH') ) die(); ?> -
+
diff --git a/wp-admin/edit.php b/wp-admin/edit.php index 184cd1b4c..c23f5d870 100644 --- a/wp-admin/edit.php +++ b/wp-admin/edit.php @@ -185,7 +185,7 @@ if ( $page_links )
diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index 193d1c742..f8161d609 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -86,7 +86,7 @@ function _cat_row( $category, $level, $name_override = false ) { $actions = array(); $actions['edit'] = '' . __('Edit') . ''; if ( $default_cat_id != $category->term_id ) - $actions['delete'] = "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') . ""; + $actions['delete'] = "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') . ""; $action_count = count($actions); $i = 0; foreach ( $actions as $action => $link ) { @@ -157,7 +157,7 @@ function link_cat_row( $category ) { $actions = array(); $actions['edit'] = '' . __('Edit') . ''; if ( $default_cat_id != $category->term_id ) - $actions['delete'] = "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') . ""; + $actions['delete'] = "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') . ""; $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 .= "
"; - break; + $output .= ""; + break; case 'name': $output .= ""; 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
  • " . ''; + $output .= "\n
  • " . ''; } function end_el(&$output, $category, $depth, $args) { @@ -315,7 +315,7 @@ function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10, $ech ?>
  • '; $columns = get_column_headers('tag'); @@ -388,10 +388,10 @@ function _tag_row( $tag, $class = '' ) { $out .= ''; break; case 'name': - $out .= ' + '; - $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'; + ?> + - - + + - - + - + - +
    title=""> +
    +
    + +
    +
    - + $attributes = 'class="comments column-comments num quick-edit-div"' . $style; ?> +
    title=""> +
    +
    +
    + +
    +
    - + case 'author': + $authors = get_editable_user_ids( $current_user->id ); // TODO: ROLE SYSTEM + if ( $authors && count( $authors ) > 1 ) { ?> +
    title=""> +
    +
    + $authors, 'name' => 'post_author', 'class'=> 'authors', 'selected' => $post->post_author) ); ?> +
    +
    + + +
    +
    +
    + + +
    +
    - - + + + +
    title=""> +
    +
    + +
    +
    + - +
    - +
    ID) ) { echo "" . __('Edit') . ""; } ?>
    - +
    ID) ) { echo "ID) . "' class='delete'>" . __('Delete') . ""; } ?>
    - +
    ID); ?>
    - echo ''; +
    +
    + + + + +
    + +\n"; - echo "\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 ' +
    + + + + + + + + + + + + '; - 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 " \n"; - echo " " . wp_specialchars($post->post_title, 1) . "\n"; - echo " $post->post_name\n"; - echo " $post->post_author\n"; - echo " $post->comment_status\n"; - echo " $post->ping_status\n"; - echo " $post->post_status\n"; - echo " " . mysql2date( 'd', $post->post_date ) . "\n"; - echo " " . mysql2date( 'm', $post->post_date ) . "\n"; - echo " " . mysql2date( 'Y', $post->post_date ) . "\n"; - echo " " . mysql2date( 'H', $post->post_date ) . "\n"; - echo " " . mysql2date( 'i', $post->post_date ) . "\n"; - if( $post->post_type == 'post' ) { - echo ' ' . wp_specialchars(get_tags_to_edit( $post->ID ), 1) . "\n"; - echo ' ' . implode( ',', wp_get_post_categories( $post->ID ) ) . "\n"; - echo ' ' . (is_sticky($post->ID) ? 'sticky' : '') . "\n"; - } - if( $post->post_type == 'page' ) { - echo " $post->post_parent\n"; - echo ' ' . wp_specialchars(get_post_meta( $post->ID, '_wp_page_template', true ), 1) . "\n"; - echo " " . wp_specialchars($post->post_password, 1) . "\n"; - echo " $post->menu_order\n"; - } - echo " \n"; - } - - echo ''; + if( $post->post_type == 'page' ) + echo ' + + + '; + + if( $post->post_type == 'post' ) + echo ' + + + '; + + echo '
    '; } 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)'); ?> -
    post_status ); ?>' valign="top"> + post_status ); ?> iedit' valign="top"> - - - - '; + if ( 'excerpt' == $mode ) + echo apply_filters('post_date_column_time', $t_time, $post, $column_name, $mode); + else + echo '' . apply_filters('post_date_column_time', $h_time, $post, $column_name, $mode) . ''; + + echo ''; break; case 'title': @@ -954,7 +978,7 @@ function _post_row($a_post, $pending_comments, $mode) { $actions = array(); $actions['edit'] = '' . __('Edit') . ''; $actions['inline'] = '' . __('Quick Edit') . ''; - $actions['delete'] = "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') . ""; + $actions['delete'] = "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') . ""; if ( in_array($post->post_status, array('pending', 'draft')) ) $actions['view'] = '' . __('Preview') . ''; else @@ -966,6 +990,8 @@ function _post_row($a_post, $pending_comments, $mode) { ( $i == $action_count ) ? $sep = '' : $sep = ' | '; echo "$link$sep"; } + + get_inline_data($post); ?> post_title = wp_specialchars( $page->post_title ); $pad = str_repeat( '— ', $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)'); ?> - - - - " class=" iedit"> +$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'] = '' . __('Edit') . ''; $actions['inline'] = '' . __('Quick Edit') . ''; - $actions['delete'] = "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') . ""; + $actions['delete'] = "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') . ""; if ( in_array($post->post_status, array('pending', 'draft')) ) $actions['view'] = '' . __('Preview') . ''; else @@ -1175,9 +1199,9 @@ foreach ($posts_columns as $column_name=>$column_display_name) { ( $i == $action_count ) ? $sep = '' : $sep = ' | '; echo "$link$sep"; } - ?> - - '; break; case 'comments': @@ -1236,9 +1260,9 @@ foreach ($posts_columns as $column_name=>$column_display_name) { break; } } - ?> +?> - + 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 = "$user_object->user_login
    "; $actions = array(); $actions['edit'] = '' . __('Edit') . ''; - $actions['delete'] = "user_login )) . "') ) { return true;}return false;\">" . __('Delete') . ""; + $actions['delete'] = "user_login )) . "') ) { return true;}return false;\">" . __('Delete') . ""; $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" ) ); ?> - + - + - + - + - + - +$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')

    - + @@ -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 "
    \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 ''; echo '
    '; - } + } } function manage_columns_prefs($page) { @@ -2244,7 +2268,7 @@ function find_posts_div($found_action = '') { - + @@ -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 : '', @@ -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() ) diff --git a/wp-admin/js/inline-edit.js b/wp-admin/js/inline-edit.js index 0e79720fb..389f504b8 100644 --- a/wp-admin/js/inline-edit.js +++ b/wp-admin/js/inline-edit.js @@ -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(''); + + 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(''); - - 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]; -} \ No newline at end of file +$(document).ready(function(){inlineEdit.init();}); +})(jQuery); diff --git a/wp-admin/wp-admin.css b/wp-admin/wp-admin.css index 6c3970ae4..c0cc05e48 100644 --- a/wp-admin/wp-admin.css +++ b/wp-admin/wp-admin.css @@ -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 */ diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index 9d625a745..c0ed23f0b 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -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(
    "; - if ( absint( get_option( 'default_link_category' ) ) != $category->term_id ) { - $output .= ""; - } else { - $output .= " "; - } - $output .= ""; + if ( absint( get_option( 'default_link_category' ) ) != $category->term_id ) { + $output .= ""; + } else { + $output .= " "; + } + $output .= "$edit
    ' . $name . '
    '; + $out .= '
    ' . $name . '
    '; $actions = array(); $actions['edit'] = '' . __('Edit') . ''; - $actions['delete'] = "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') . ""; + $actions['delete'] = "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') . ""; $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 . '"'; ?> -
    >>
    >>
    comment_post_ID) ) { ?>comment_post_ID) ) { ?> - - + + + comment_post_ID) ) { - $actions['approve'] = "" . __( 'Approve' ) . ''; + $actions['approve'] = "" . __( 'Approve' ) . ''; $actions['unapprove'] = "" . __( 'Unapprove' ) . ''; 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'] = "" . __( 'Spam' ) . ''; + $actions['spam'] = "" . __( 'Spam' ) . ''; $actions['delete'] = "" . __('Delete') . ''; $actions['edit'] = "". __('Edit') . ''; if ( 'spam' != $the_comment_status ) @@ -1564,27 +1588,27 @@ function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true } } ?> -
    - -
    - - ID ) ) : ?> - comment_author_email) ): ?> -
    - - - + +
    + + ID ) ) : ?> + comment_author_email) ): ?> +
    + + +
    - "" comment_count); ?>
    - -
    + "" comment_count); ?>
    + +