Changeset 8857

Show
Ignore:
Timestamp:
09/10/08 22:47:03 (3 months ago)
Author:
ryan
Message:

Inline editing. First cut. Props Aaron Harp. see #6815

Files:

Legend:

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

    r8754 r8857  
    1313 */ 
    1414define('DOING_AJAX', true); 
     15define('WP_ADMIN', true); 
    1516 
    1617require_once('../wp-load.php'); 
     
    716717    die(get_sample_permalink_html($post_id, $title, $slug)); 
    717718break; 
     719case 'inline-data': 
     720    get_inline_data( explode(',', $_POST['posts']) ); 
     721    die(); 
     722break; 
     723case 'inline-save': 
     724    inline_save_row( $_POST ); 
     725    if ( 'page' == $_POST['post_type'] ) { 
     726        $post = array(); 
     727        $post[] = get_post($_POST['post_ID']); 
     728        page_rows( $post ); 
     729    } elseif ( 'post' == $_POST['post_type'] ) { 
     730        $mode = $_POST['post_view']; 
     731        $post = array(); 
     732        $post[] = get_post($_POST['post_ID']); 
     733        post_rows($post); 
     734    } 
     735    die(); 
     736break; 
    718737case 'meta-box-order': 
    719738    check_ajax_referer( 'meta-box-order' ); 
  • trunk/wp-admin/edit-pages.php

    r8839 r8857  
    4545$parent_file = 'edit.php'; 
    4646wp_enqueue_script('admin-forms'); 
     47wp_enqueue_script('inline-edit'); 
    4748 
    4849$post_stati  = array(   //  array( adj, noun ) 
     
    154155<select name="action"> 
    155156<option value="" selected><?php _e('Actions'); ?></option> 
     157<option value="edit"><?php _e('Edit'); ?></option> 
    156158<option value="delete"><?php _e('Delete'); ?></option> 
    157159</select> 
     
    188190  </thead> 
    189191  <tbody> 
     192  <?php inline_edit_row( 'page' ) ?> 
    190193  <?php page_rows($posts, $pagenum, $per_page); ?> 
    191194  </tbody> 
  • trunk/wp-admin/edit-post-rows.php

    r8729 r8857  
    2828    </thead> 
    2929    <tbody> 
     30       
     31<?php inline_edit_row( 'post' ) ?>     
     32 
    3033<?php 
    3134if ( have_posts() ) { 
  • trunk/wp-admin/edit.php

    r8839 r8857  
    5151$parent_file = 'edit.php'; 
    5252wp_enqueue_script('admin-forms'); 
     53wp_enqueue_script('inline-edit'); 
     54 
    5355 
    5456list($post_stati, $avail_post_stati) = wp_edit_posts_query(); 
     
    170172<select name="action"> 
    171173<option value="" selected><?php _e('Actions'); ?></option> 
     174<option value="edit"><?php _e('Edit'); ?></option> 
    172175<option value="delete"><?php _e('Delete'); ?></option> 
    173 <option value="edit"><?php _e('Edit'); ?></option> 
    174176</select> 
    175177<input type="submit" value="<?php _e('Apply'); ?>" name="doaction" class="button-secondary action" /> 
  • trunk/wp-admin/includes/post.php

    r8732 r8857  
    1010 * 
    1111 * @param bool $update Are we updating a pre-existing post? 
     12 * @param post_data array Array of post data. Defaults to the contents of $_POST 
    1213 * @return object|bool WP_Error on failure, true on success. 
    1314 */ 
    14 function _wp_translate_postdata( $update = false ) { 
     15function _wp_translate_postdata( $update = false, &$post_data = null ) { 
     16 
     17    if ( empty($post_data) ) 
     18        $post_data = &$_POST; 
     19 
    1520    if ( $update ) 
    16         $_POST['ID'] = (int) $_POST['post_ID']; 
    17     $_POST['post_content'] = $_POST['content']; 
    18     $_POST['post_excerpt'] = $_POST['excerpt']; 
    19     $_POST['post_parent'] = isset($_POST['parent_id'])? $_POST['parent_id'] : ''; 
    20     if ( isset($_POST['trackback_url']) ) 
    21         $_POST['to_ping'] = $_POST['trackback_url']; 
    22  
    23     if (!empty ( $_POST['post_author_override'] ) ) { 
    24         $_POST['post_author'] = (int) $_POST['post_author_override']; 
     21        $post_data['ID'] = (int) $post_data['post_ID']; 
     22    $post_data['post_content'] = $post_data['content']; 
     23    $post_data['post_excerpt'] = $post_data['excerpt']; 
     24    $post_data['post_parent'] = isset($post_data['parent_id'])? $post_data['parent_id'] : ''; 
     25    if ( isset($post_data['trackback_url']) ) 
     26        $post_data['to_ping'] = $post_data['trackback_url']; 
     27 
     28    if (!empty ( $post_data['post_author_override'] ) ) { 
     29        $post_data['post_author'] = (int) $post_data['post_author_override']; 
    2530    } else { 
    26         if (!empty ( $_POST['post_author'] ) ) { 
    27             $_POST['post_author'] = (int) $_POST['post_author']; 
     31        if (!empty ( $post_data['post_author'] ) ) { 
     32            $post_data['post_author'] = (int) $post_data['post_author']; 
    2833        } else { 
    29             $_POST['post_author'] = (int) $_POST['user_ID']; 
     34            $post_data['post_author'] = (int) $post_data['user_ID']; 
    3035        } 
    3136    } 
    3237 
    33     if ( isset($_POST['user_ID']) && ($_POST['post_author'] != $_POST['user_ID']) ) { 
    34         if ( 'page' == $_POST['post_type'] ) { 
     38    if ( isset($post_data['user_ID']) && ($post_data['post_author'] != $post_data['user_ID']) ) { 
     39        if ( 'page' == $post_data['post_type'] ) { 
    3540            if ( !current_user_can( 'edit_others_pages' ) ) { 
    3641                return new WP_Error( 'edit_others_pages', $update ? 
     
    5055 
    5156    // What to do based on which button they pressed 
    52     if ( isset($_POST['saveasdraft']) && '' != $_POST['saveasdraft'] ) 
    53         $_POST['post_status'] = 'draft'; 
    54     if ( isset($_POST['saveasprivate']) && '' != $_POST['saveasprivate'] ) 
    55         $_POST['post_status'] = 'private'; 
    56     if ( isset($_POST['publish']) && ( '' != $_POST['publish'] ) && ( $_POST['post_status'] != 'private' ) ) 
    57         $_POST['post_status'] = 'publish'; 
    58     if ( isset($_POST['advanced']) && '' != $_POST['advanced'] ) 
    59         $_POST['post_status'] = 'draft'; 
    60  
    61     $previous_status = get_post_field('post_status',  $_POST['ID']); 
     57    if ( isset($post_data['saveasdraft']) && '' != $post_data['saveasdraft'] ) 
     58        $post_data['post_status'] = 'draft'; 
     59    if ( isset($post_data['saveasprivate']) && '' != $post_data['saveasprivate'] ) 
     60        $post_data['post_status'] = 'private'; 
     61    if ( isset($post_data['publish']) && ( '' != $post_data['publish'] ) && ( $post_data['post_status'] != 'private' ) ) 
     62        $post_data['post_status'] = 'publish'; 
     63    if ( isset($post_data['advanced']) && '' != $post_data['advanced'] ) 
     64        $post_data['post_status'] = 'draft'; 
     65 
     66    $previous_status = get_post_field('post_status',  $post_data['ID']); 
    6267 
    6368    // Posts 'submitted for approval' present are submitted to $_POST the same as if they were being published. 
    6469    // Change status from 'publish' to 'pending' if user lacks permissions to publish or to resave published posts. 
    65     if ( 'page' == $_POST['post_type'] ) { 
    66         if ( 'publish' == $_POST['post_status'] && !current_user_can( 'publish_pages' ) ) 
     70    if ( 'page' == $post_data['post_type'] ) { 
     71        if ( 'publish' == $post_data['post_status'] && !current_user_can( 'publish_pages' ) ) 
    6772            if ( $previous_status != 'publish' OR !current_user_can( 'edit_published_pages') ) 
    68                 $_POST['post_status'] = 'pending'; 
     73                $post_data['post_status'] = 'pending'; 
    6974    } else { 
    70         if ( isset($_POST['post_status']) && ('publish' == $_POST['post_status'] && !current_user_can( 'publish_posts' )) ) : 
     75        if ( isset($post_data['post_status']) && ('publish' == $post_data['post_status'] && !current_user_can( 'publish_posts' )) ) : 
    7176            // Stop attempts to publish new posts, but allow already published posts to be saved if appropriate. 
    7277            if ( $previous_status != 'publish' OR !current_user_can( 'edit_published_posts') ) 
    73                 $_POST['post_status'] = 'pending'; 
     78                $post_data['post_status'] = 'pending'; 
    7479        endif; 
    7580    } 
    7681 
    77     if (!isset( $_POST['comment_status'] )) 
    78         $_POST['comment_status'] = 'closed'; 
    79  
    80     if (!isset( $_POST['ping_status'] )) 
    81         $_POST['ping_status'] = 'closed'; 
     82    if (!isset( $post_data['comment_status'] )) 
     83        $post_data['comment_status'] = 'closed'; 
     84 
     85    if (!isset( $post_data['ping_status'] )) 
     86        $post_data['ping_status'] = 'closed'; 
    8287 
    8388    foreach ( array('aa', 'mm', 'jj', 'hh', 'mn') as $timeunit ) { 
    84         if ( !empty( $_POST['hidden_' . $timeunit] ) && $_POST['hidden_' . $timeunit] != $_POST[$timeunit] ) { 
    85             $_POST['edit_date'] = '1'; 
     89        if ( !empty( $post_data['hidden_' . $timeunit] ) && $post_data['hidden_' . $timeunit] != $post_data[$timeunit] ) { 
     90            $post_data['edit_date'] = '1'; 
    8691            break; 
    8792        } 
    8893    } 
    8994 
    90     if ( !empty( $_POST['edit_date'] ) ) { 
    91         $aa = $_POST['aa']; 
    92         $mm = $_POST['mm']; 
    93         $jj = $_POST['jj']; 
    94         $hh = $_POST['hh']; 
    95         $mn = $_POST['mn']; 
    96         $ss = $_POST['ss']; 
     95    if ( !empty( $post_data['edit_date'] ) ) { 
     96        $aa = $post_data['aa']; 
     97        $mm = $post_data['mm']; 
     98        $jj = $post_data['jj']; 
     99        $hh = $post_data['hh']; 
     100        $mn = $post_data['mn']; 
     101        $ss = $post_data['ss']; 
    97102        $aa = ($aa <= 0 ) ? date('Y') : $aa; 
    98103        $mm = ($mm <= 0 ) ? date('n') : $mm; 
     
    102107        $mn = ($mn > 59 ) ? $mn -60 : $mn; 
    103108        $ss = ($ss > 59 ) ? $ss -60 : $ss; 
    104         $_POST['post_date'] = sprintf( "%04d-%02d-%02d %02d:%02d:%02d", $aa, $mm, $jj, $hh, $mn, $ss ); 
    105         $_POST['post_date_gmt'] = get_gmt_from_date( $_POST['post_date'] ); 
     109        $post_data['post_date'] = sprintf( "%04d-%02d-%02d %02d:%02d:%02d", $aa, $mm, $jj, $hh, $mn, $ss ); 
     110        $post_data['post_date_gmt'] = get_gmt_from_date( $post_data['post_date'] ); 
    106111    } 
    107112 
     
    111116 
    112117// Update an existing post with values provided in $_POST. 
    113 function edit_post() { 
    114  
    115     $post_ID = (int) $_POST['post_ID']; 
    116  
    117     if ( 'page' == $_POST['post_type'] ) { 
     118function edit_post( $post_data = null ) { 
     119 
     120    if ( empty($post_data) ) 
     121        $post_data = &$_POST; 
     122 
     123    $post_ID = (int) $post_data['post_ID']; 
     124 
     125    if ( 'page' == $post_data['post_type'] ) { 
    118126        if ( !current_user_can( 'edit_page', $post_ID ) ) 
    119127            wp_die( __('You are not allowed to edit this page.' )); 
     
    124132 
    125133    // Autosave shouldn't save too soon after a real save 
    126     if ( 'autosave' == $_POST['action'] ) { 
     134    if ( 'autosave' == $post_data['action'] ) { 
    127135        $post =& get_post( $post_ID ); 
    128136        $now = time(); 
     
    133141    } 
    134142 
    135     $translated = _wp_translate_postdata( true ); 
     143    $translated = _wp_translate_postdata( true, $post_data ); 
    136144    if ( is_wp_error($translated) ) 
    137145        wp_die( $translated->get_error_message() ); 
    138146 
    139147    // Meta Stuff 
    140     if ( isset($_POST['meta']) && $_POST['meta'] ) { 
    141         foreach ( $_POST['meta'] as $key => $value ) 
     148    if ( isset($post_data['meta']) && $post_data['meta'] ) { 
     149        foreach ( $post_data['meta'] as $key => $value ) 
    142150            update_meta( $key, $value['key'], $value['value'] ); 
    143151    } 
    144152 
    145     if ( isset($_POST['deletemeta']) && $_POST['deletemeta'] ) { 
    146         foreach ( $_POST['deletemeta'] as $key => $value ) 
     153    if ( isset($post_data['deletemeta']) && $post_data['deletemeta'] ) { 
     154        foreach ( $post_data['deletemeta'] as $key => $value ) 
    147155            delete_meta( $key ); 
    148156    } 
     
    150158    add_meta( $post_ID ); 
    151159 
    152     wp_update_post( $_POST ); 
     160    wp_update_post( $post_data ); 
    153161 
    154162    // Reunite any orphaned attachments with their parent 
     
    164172 
    165173    if ( current_user_can( 'edit_others_posts' ) ) { 
    166         if ( !empty($_POST['sticky']) ) 
     174        if ( !empty($post_data['sticky']) ) 
    167175            stick_post($post_ID); 
    168176        else 
  • trunk/wp-admin/includes/template.php

    r8855 r8857  
    351351    else 
    352352        $posts_columns['date'] = __('Date'); 
    353     //$posts_columns['author'] = __('Author'); 
     353    $posts_columns['author'] = __('Author'); 
    354354    $posts_columns['categories'] = __('Categories'); 
    355355    $posts_columns['tags'] = __('Tags'); 
     
    407407} 
    408408 
    409 function post_rows() { 
     409function inline_edit_row( $type ) { 
     410    global $current_user; 
     411 
     412    if ( 'post' == $type )  
     413        $post = get_default_post_to_edit();  
     414    else  
     415        $post = get_default_page_to_edit();   
     416 
     417    echo '<tr id="inline-edit" style="display: none">'; 
     418    $columns = $type == 'post' ? wp_manage_posts_columns() : wp_manage_pages_columns(); 
     419    foreach($columns as $column_name=>$column_display_name) { 
     420 
     421        switch($column_name) { 
     422 
     423            case 'cb': ?> 
     424              <th class="check-column"></th> 
     425              <?php 
     426              break; 
     427 
     428            case 'modified': 
     429            case 'date': ?> 
     430                <td class="date"> 
     431                    <?php touch_time(1, 1, 4, 1); ?> 
     432                </td> 
     433                <?php 
     434                break; 
     435 
     436            case 'title': ?> 
     437                <td class="<?php echo $type ?>-title"> 
     438                    <div class="title"> 
     439                        <input type="text" name="post_title" class="title" value="" /><br /> 
     440                        <label><?php _e('Slug'); ?></label><input type="text" name="post_name" value="" class="slug" /> 
     441                    </div> 
     442                    <?php if($type == 'page'): ?> 
     443                    <div class="other"> 
     444                        <label><?php _e('Parent'); ?></label> 
     445                        <select name="post_parent"> 
     446                            <option value="0"><?php _e('Main Page (no parent)'); ?></option> 
     447                            <?php parent_dropdown(); ?> 
     448                        </select><br /> 
     449                        <label><?php _e('Template'); ?></label> 
     450                        <select name="page_template"> 
     451                            <option value='default'><?php _e('Default Template'); ?></option> 
     452                            <?php page_template_dropdown() ?> 
     453                        </select> 
     454                    </div> 
     455                    <div class="more"> 
     456                        <label><?php _e('Order'); ?></label><input type="text" name="menu_order" value="<?php echo $post->menu_order ?>" /> 
     457                        <label><?php _e('Password'); ?></label><input type="text" name="post_password" value="<?php echo $post->post_password ?>" />       
     458                    </div> 
     459                    <?php endif; ?> 
     460                    <div class="clear"></div> 
     461                    <?php 
     462                    $actions = array(); 
     463                    $actions['save'] = '<a href="#">' . __('Save') . '</a>'; 
     464                    $actions['cancel'] = '<a href="#">' . __('Cancel') . '</a>'; 
     465                    $action_count = count($actions); 
     466                    $i = 0; 
     467                    foreach ( $actions as $action => $link ) { 
     468                        ++$i; 
     469                        ( $i == $action_count ) ? $sep = '' : $sep = ' | '; 
     470                        echo "<span class='$action'>$link$sep</span>"; 
     471                    } 
     472                    ?> 
     473                </td> 
     474                <?php 
     475                break; 
     476 
     477            case 'categories': ?> 
     478                <td class="categories"> 
     479                    <ul class="categories"> 
     480                        <?php wp_category_checklist() ?> 
     481                    </ul> 
     482                </td> 
     483                <?php 
     484                break; 
     485 
     486            case 'tags': ?> 
     487                <td class="tags"> 
     488                    <textarea name="tags_input"></textarea> 
     489                </td> 
     490                <?php 
     491                break; 
     492 
     493            case 'comments': ?> 
     494                <td class="comments num"> 
     495                    <input title="Allow Comments" type="checkbox" name="comment_status" value="open" /><br /> 
     496                    <input title="Allow Pings" type="checkbox" name="ping_status" value="open" /> 
     497                </td> 
     498                <?php 
     499                break; 
     500 
     501            case 'author': ?> 
     502                <td class="author"> 
     503                    <?php 
     504                    $authors = get_editable_user_ids( $current_user->id ); // TODO: ROLE SYSTEM 
     505                    if ( $authors && count( $authors ) > 1 ) { 
     506                        wp_dropdown_users( array('include' => $authors, 'name' => 'post_author', 'class'=> 'author', 'selected' => $post->post_author) );  
     507                    } else { 
     508                        echo $current_user->user_nicename.'<input type="hidden" value="'.$post->post_author.'" class="author" />'; 
     509                    } 
     510                    ?> 
     511                </td> 
     512                <?php 
     513                break; 
     514 
     515            case 'status': ?> 
     516                <td class="status"> 
     517                    <select name="post_status"> 
     518                        <?php if ( current_user_can('publish_posts') ) : // Contributors only get "Unpublished" and "Pending Review" ?> 
     519                        <option value='publish'><?php _e('Published') ?></option> 
     520                        <option value='future'><?php _e('Scheduled') ?></option> 
     521                        <?php endif; ?> 
     522                        <option value='pending'><?php _e('Pending Review') ?></option> 
     523                        <option value='draft'><?php _e('Unpublished') ?></option> 
     524                    </select> 
     525                    <?php if($type == 'page'): ?> 
     526                    <br /><label><input type="checkbox" name="page_private" value="private" <?php checked($post->post_status, 'private'); ?> /> <?php _e('Private') ?></label></p> 
     527                    <?php else: ?> 
     528                    <?php if ( current_user_can( 'edit_others_posts' ) ) : ?> 
     529                    <br /><label><input type="checkbox" name="sticky" value="sticky" /> <?php _e('Sticky') ?></label></p> 
     530                    <?php endif; ?> 
     531                    <?php endif; ?> 
     532                </td> 
     533                <?php 
     534                break; 
     535 
     536            case 'control_view': ?> 
     537                <td><a href="<?php the_permalink(); ?>" rel="permalink" class="view"><?php _e('View'); ?></a></td> 
     538                <?php 
     539                break; 
     540 
     541            case 'control_edit': ?> 
     542                <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> 
     543                <?php 
     544                break; 
     545 
     546            case 'control_delete': ?> 
     547                <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> 
     548                <?php 
     549                break; 
     550 
     551            default: ?> 
     552                <td><?php do_action('manage_posts_custom_column', $column_name, $post->ID); ?></td> 
     553                <?php 
     554                break; 
     555        } 
     556    } 
     557 
     558    echo '</tr>'; 
     559
     560 
     561function inline_save_row( $data ) {   
     562    // get the original post content 
     563    $post = get_post( $data['post_ID'], ARRAY_A ); 
     564    $data['content'] = $post['post_content']; 
     565 
     566    // statuses 
     567    if ( 'page' == $data['post_type'] && 'private' == $data['page_private'] ) 
     568        $data['post_status'] = 'private'; 
     569    if ( empty($data['comment_status']) )  
     570        $data['comment_status'] = 'closed'; 
     571    if ( empty($data['ping_status']) ) 
     572        $data['ping_status'] = 'closed'; 
     573 
     574    // rename 
     575    $data['user_ID'] = $GLOBALS['user_ID']; 
     576    $data['excerpt'] = $data['post_excerpt']; 
     577    $data['trackback_url'] = $data['to_ping']; 
     578    $data['parent_id'] = $data['post_parent']; 
     579 
     580    // update the post 
     581    $_POST = $data; 
     582    edit_post(); 
     583
     584 
     585// outputs XML of the post/page data ready for use in the inline editor 
     586// accepts array of post IDs 
     587function get_inline_data($posts) { 
     588    global $post; 
     589 
     590    header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true); 
     591    echo "<?xml version='1.0' ?>\n"; 
     592    echo "<posts>\n"; 
     593 
     594    foreach ($posts as $ID) { 
     595        $GLOBALS['post'] = get_post($ID); 
     596        $GLOBALS['post_ID'] = $ID; 
     597 
     598        if ( ($post->post_type == 'post' && !current_user_can('edit_post', $ID)) ||  
     599                ($post->post_type == 'page' && !current_user_can('edit_page', $ID)) ||  
     600                ($post->post_type != 'post' && $post->post_type != 'page')) 
     601            continue; 
     602 
     603        echo "  <post id='$ID'>\n"; 
     604        echo "    <post_title>" . wp_specialchars($post->post_title, 1) . "</post_title>\n"; 
     605        echo "    <post_name>$post->post_name</post_name>\n"; 
     606        echo "    <post_author>$post->post_author</post_author>\n"; 
     607        echo "    <comment_status>$post->comment_status</comment_status>\n"; 
     608        echo "    <ping_status>$post->ping_status</ping_status>\n"; 
     609        echo "    <post_status>$post->post_status</post_status>\n"; 
     610        echo "    <jj>" . mysql2date( 'd', $post->post_date ) . "</jj>\n"; 
     611        echo "    <mm>" . mysql2date( 'm', $post->post_date ) . "</mm>\n"; 
     612        echo "    <aa>" . mysql2date( 'Y', $post->post_date ) . "</aa>\n"; 
     613        echo "    <hh>" . mysql2date( 'H', $post->post_date ) . "</hh>\n"; 
     614        echo "    <mn>" . mysql2date( 'i', $post->post_date ) . "</mn>\n"; 
     615        if( $post->post_type == 'post' ) { 
     616            echo '    <tags_input>' . wp_specialchars(get_tags_to_edit( $post->ID ), 1) . "</tags_input>\n"; 
     617            echo '    <post_category>' . implode( ',', wp_get_post_categories( $post->ID ) ) . "</post_category>\n"; 
     618            echo '    <sticky>' . (is_sticky($post->ID) ? 'sticky' : '') . "</sticky>\n"; 
     619        } 
     620        if( $post->post_type == 'page' ) { 
     621            echo "    <post_parent>$post->post_parent</post_parent>\n"; 
     622            echo '    <page_template>' . wp_specialchars(get_post_meta( $post->ID, '_wp_page_template', true ), 1) . "</page_template>\n"; 
     623            echo "    <post_password>" . wp_specialchars($post->post_password, 1) . "</post_password>\n"; 
     624            echo "    <menu_order>$post->menu_order</menu_order>\n"; 
     625        } 
     626        echo "  </post>\n"; 
     627    } 
     628 
     629    echo '</posts>'; 
     630
     631 
     632function post_rows( $posts = array() ) { 
    410633    global $wp_query, $post, $mode; 
    411634 
     
    414637    // Create array of post IDs. 
    415638    $post_ids = array(); 
    416     foreach ( $wp_query->posts as $a_post ) 
     639 
     640    if ( empty($posts) ) 
     641        $posts = &$wp_query->posts; 
     642 
     643    foreach ( $posts as $a_post ) 
    417644        $post_ids[] = $a_post->ID; 
    418645 
    419646    $comment_pending_count = get_pending_comments_num($post_ids); 
    420     if ( empty($comment_pending_count[$post->ID]) ) 
     647    if ( empty($comment_pending_count) ) 
    421648        $comment_pending_count = array(); 
    422649 
    423     while ( have_posts() ) { 
    424         the_post(); 
    425  
     650    foreach ( $posts as $post ) { 
    426651        if ( empty($comment_pending_count[$post->ID]) ) 
    427652            $comment_pending_count[$post->ID] = 0; 
     
    437662    $global_post = $post; 
    438663    $post = $a_post; 
     664    setup_postdata($post); 
    439665 
    440666    $class = 'alternate' == $class ? '' : 'alternate'; 
     
    484710 
    485711            if ( 'excerpt' == $mode ) { ?> 
    486         <td><?php echo apply_filters('post_date_column_time', $t_time, $post, $column_name, $mode) ?></td> 
     712        <td class="date"><?php echo apply_filters('post_date_column_time', $t_time, $post, $column_name, $mode) ?></td> 
    487713        <?php } else { ?> 
    488         <td><abbr title="<?php echo $t_time ?>"><?php echo apply_filters('post_date_column_time', $h_time, $post, $column_name, $mode) ?></abbr></td> 
     714        <td class="date"><abbr title="<?php echo $t_time ?>"><?php echo apply_filters('post_date_column_time', $h_time, $post, $column_name, $mode) ?></abbr></td> 
    489715        <?php } 
    490716        break; 
     
    501727            $actions = array(); 
    502728            $actions['edit'] = '<a href="post.php?action=edit&amp;post=' . $post->ID . '">' . __('Edit') . '</a>'; 
     729            $actions['inline'] = '<a href="#" class="editinline">' . __('Quick Edit') . '</a>'; 
    503730            $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>"; 
    504731            $action_count = count($actions); 
     
    516743        case 'categories': 
    517744        ?> 
    518         <td><?php 
     745        <td class="categories"><?php 
    519746            $categories = get_the_category(); 
    520747            if ( !empty( $categories ) ) { 
     
    532759        case 'tags': 
    533760        ?> 
    534         <td><?php 
     761        <td class="tags"><?php 
    535762            $tags = get_the_tags(); 
    536763            if ( !empty( $tags ) ) { 
     
    548775        case 'comments': 
    549776        ?> 
    550         <td class="num"><div class="post-com-count-wrapper"> 
     777        <td class="comments num"><div class="post-com-count-wrapper"> 
    551778        <?php 
    552779            $pending_phrase = sprintf( __('%s pending'), number_format( $pending_comments ) ); 
     
    563790        case 'author': 
    564791        ?> 
    565         <td><a href="edit.php?author=<?php the_author_ID(); ?>"><?php the_author() ?></a></td> 
     792        <td class="author"><a href="edit.php?author=<?php the_author_ID(); ?>"><?php the_author() ?></a></td> 
    566793        <?php 
    567794        break; 
     
    569796        case 'status': 
    570797        ?> 
    571         <td
     798        <td class="status"
    572799        <a href="<?php the_permalink(); ?>" title="<?php echo attribute_escape(sprintf(__('View "%s"'), $title)); ?>" rel="permalink"> 
    573800        <?php 
     
    655882    case 'cb': 
    656883        ?> 
    657         <th scope="row" class="check-column"><input type="checkbox" name="delete[]" value="<?php the_ID(); ?>" /></th> 
     884        <th scope="row" class="check-column"><input type="checkbox" name="post[]" value="<?php the_ID(); ?>" /></th> 
    658885        <?php 
    659886        break; 
     
    682909        } 
    683910        ?> 
    684         <td><abbr title="<?php echo $t_time ?>"><?php echo $h_time ?></abbr></td> 
     911        <td class="date"><abbr title="<?php echo $t_time ?>"><?php echo $h_time ?></abbr></td> 
    685912        <?php 
    686913        break; 
     
    697924        $actions = array(); 
    698925        $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>'; 
     926        $actions['inline'] = '<a href="#" class="editinline">' . __('Quick Edit') . '</a>'; 
    699927        $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>"; 
    700928        $action_count = count($actions); 
     
    712940    case 'comments': 
    713941        ?> 
    714         <td class="num"><div class="post-com-count-wrapper"> 
     942        <td class="comments num"><div class="post-com-count-wrapper"> 
    715943        <?php 
    716944        $left = get_pending_comments_num( $page->ID ); 
     
    728956    case 'author': 
    729957        ?> 
    730         <td><a href="edit-pages.php?author=<?php the_author_ID(); ?>"><?php the_author() ?></a></td> 
     958        <td class="author"><a href="edit-pages.php?author=<?php the_author_ID(); ?>"><?php the_author() ?></a></td> 
    731959        <?php 
    732960        break; 
     
    734962    case 'status': 
    735963        ?> 
    736         <td
     964        <td class="status"
    737965        <a href="<?php the_permalink(); ?>" title="<?php echo attribute_escape(sprintf(__('View "%s"'), $title)); ?>" rel="permalink"> 
    738966        <?php 
     
    12411469} 
    12421470 
    1243 function touch_time( $edit = 1, $for_post = 1, $tab_index = 0 ) { 
     1471function touch_time( $edit = 1, $for_post = 1, $tab_index = 0, $multi = 0 ) { 
    12441472    global $wp_locale, $post, $comment; 
    12451473 
     
    12621490    $ss = ($edit) ? mysql2date( 's', $post_date ) : gmdate( 's', $time_adj ); 
    12631491 
    1264     $month = "<select id=\"mm\" name=\"mm\"$tab_index_attribute>\n"; 
     1492    $month = "<select " . ( $multi ? '' : 'id="mm" ' ) . "name=\"mm\"$tab_index_attribute>\n"; 
    12651493    for ( $i = 1; $i < 13; $i = $i +1 ) { 
    12661494        $month .= "\t\t\t" . '<option value="' . zeroise($i, 2) . '"'; 
     
    12711499    $month .= '</select>'; 
    12721500 
    1273     $day = '<input type="text" id="jj" name="jj" value="' . $jj . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off"  />'; 
    1274     $year = '<input type="text" id="aa" name="aa" value="' . $aa . '" size="4" maxlength="5"' . $tab_index_attribute . ' autocomplete="off"  />'; 
    1275     $hour = '<input type="text" id="hh" name="hh" value="' . $hh . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off"  />'; 
    1276     $minute = '<input type="text" id="mn" name="mn" value="' . $mn . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off"  />'; 
     1501    $day = '<input type="text" ' . ( $multi ? '' : 'id="jj" ' ) . 'name="jj" value="' . $jj . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off"  />'; 
     1502    $year = '<input type="text" ' . ( $multi ? '' : 'id="aa" ' ) . 'name="aa" value="' . $aa . '" size="4" maxlength="5"' . $tab_index_attribute . ' autocomplete="off"  />'; 
     1503    $hour = '<input type="text" ' . ( $multi ? '' : 'id="hh" ' ) . 'name="hh" value="' . $hh . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off"  />'; 
     1504    $minute = '<input type="text" ' . ( $multi ? '' : 'id="mn" ' ) . 'name="mn" value="' . $mn . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off"  />'; 
    12771505    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); 
     1506 
     1507    if ( $multi ) return; 
     1508     
    12781509    echo "\n\n"; 
    12791510    foreach ( array('mm', 'jj', 'aa', 'hh', 'mn') as $timeunit ) 
     
    13181549                $current = ''; 
    13191550 
    1320             echo "\n\t<option value='$item->ID'$current>$pad " . wp_specialchars($item->post_title) . "</option>"; 
     1551            echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad " . wp_specialchars($item->post_title) . "</option>"; 
    13211552            parent_dropdown( $default, $item->ID, $level +1 ); 
    13221553        } 
  • trunk/wp-admin/js/forms.js

    r8804 r8857  
    11function checkAll(jQ) { // use attr( checked, fn ) 
    2     jQuery(jQ).find( 'tbody:visible :checkbox' ).attr( 'checked', function() { 
     2    jQuery(jQ).find( 'tbody:visible .check-column :checkbox' ).attr( 'checked', function() { 
    33        return jQuery(this).attr( 'checked' ) ? '' : 'checked'; 
    44    } ); 
     
    77jQuery( function($) { 
    88    var lastClicked = false; 
    9     $( 'tbody :checkbox' ).click( function(e) { 
     9    $( 'tbody .check-column :checkbox' ).click( function(e) { 
    1010        if ( 'undefined' == e.shiftKey ) { return true; } 
    1111        if ( e.shiftKey ) { 
  • trunk/wp-admin/wp-admin.css

    r8845 r8857  
    21402140    margin: 0 5px 0 2px; 
    21412141} 
     2142 
     2143 
     2144/* Inline Editor */ 
     2145 
     2146.inline { 
     2147    font-size: 10px; 
     2148} 
     2149 
     2150.inline td { 
     2151    padding-right: 4px; 
     2152    padding-left: 7px; 
     2153} 
     2154 
     2155.inline input, .inline select, .inline textarea { 
     2156    font-size: 10px !important; 
     2157    padding: 2px; 
     2158    border: 1px solid #ddd; 
     2159} 
     2160 
     2161.inline td.date { 
     2162    width: 87px; 
     2163} 
     2164 
     2165.inline td.page-title { 
     2166    width: 495px; 
     2167} 
     2168 
     2169.inline td.post-title input.title { 
     2170    width: 250px; 
     2171} 
     2172 
     2173.inline td.post-title input.slug { 
     2174    width: 222px; 
     2175    float: right; 
     2176} 
     2177 
     2178.inline div.title { 
     2179    float: left; 
     2180} 
     2181 
     2182.inline div.title input.title { 
     2183    font-size: 12px !important; 
     2184} 
     2185 
     2186.inline div.title label { 
     2187    float: left; 
     2188    margin-top: 4px; 
     2189} 
     2190 
     2191.inline td.page-title input.slug { 
     2192    width: 123px; 
     2193    float: right; 
     2194} 
     2195 
     2196.inline div.other, .inline div.more { 
     2197    width: 190px; 
     2198    float: left; 
     2199    padding-left: 5px; 
     2200} 
     2201 
     2202.inline div.other label, .inline div.more label { 
     2203    display: block; float: left; 
     2204    width: 54px; 
     2205    margin-top: 4px; 
     2206} 
     2207 
     2208.inline div.other select { 
     2209    width: 133px; 
     2210} 
     2211 
     2212.inline div.more { 
     2213    width: 125px; 
     2214} 
     2215 
     2216.inline div.more input { 
     2217    width: 60px; 
     2218} 
     2219 
     2220.inline td.author select { 
     2221    width: 110px; 
     2222} 
     2223 
     2224.inline ul.categories { 
     2225    list-style: none; 
     2226    padding: 0; margin: 0;  
     2227    height: 65px; 
     2228    overflow: auto; 
     2229    font-size: 10px; 
     2230} 
     2231 
     2232.inline ul.categories ul.children { 
     2233    list-style: none; 
     2234    padding-left: 15px; 
     2235} 
     2236 
     2237.inline ul.categories li { 
     2238    margin-bottom: 2px; 
     2239} 
     2240 
     2241.inline ul.categories input { 
     2242    vertical-align: middle; 
     2243    padding: 0; border: 0; 
     2244} 
     2245 
     2246.inline td.tags textarea { 
     2247    height: 58px; width: 100%; 
     2248} 
     2249 
     2250.inline td.comments { 
     2251    padding-left: 0; 
     2252} 
     2253 
     2254.inline td.status select { 
     2255    width: 98px; 
     2256} 
     2257 
     2258.inline td.status input { 
     2259    vertical-align: middle; 
     2260} 
  • trunk/wp-includes/script-loader.php

    r8838 r8857  
    242242 
    243243        $scripts->add( 'theme-preview', '/wp-admin/js/theme-preview.js', array( 'thickbox', 'jquery' ), '20080625' ); 
     244         
     245        $scripts->add( 'inline-edit', '/wp-admin/js/inline-edit.js', array( 'jquery', 'jquery-form', 'suggest' ), '20080812' ); 
    244246 
    245247        $scripts->add( 'plugin-install', '/wp-admin/js/plugin-install.js', array( 'thickbox', 'jquery' ), '20080803' );