Make WordPress Core

Changeset 8973


Ignore:
Timestamp:
09/25/2008 01:42:34 PM (18 years ago)
Author:
azaozz
Message:

Batch editing, first cut, see #6815

Location:
trunk/wp-admin
Files:
18 edited

Legend:

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

    r8943 r8973  
    732732        check_ajax_referer( 'inlineeditnonce', '_inline_edit' );
    733733       
    734         if ( ! isset($_POST['post_ID']) )
     734        if ( ! isset($_POST['post_ID']) || ! ( $id = (int) $_POST['post_ID'] ) )
    735735                exit;
     736
     737        if ( $last = wp_check_post_lock( $id ) ) {
     738                $last_user = get_userdata( $last );
     739                $last_user_name = $last_user ? $last_user->display_name : __( 'Someone' );
     740                echo '<tr><td colspan="8"><div class="error"><p>' . sprintf( $_POST['post_type'] == 'page' ? __( 'Saving is disabled: %s is currently editing this page.' ) : __( 'Saving is disabled: %s is currently editing this post.' ),   wp_specialchars( $last_user_name ) ) . '</p></div></td></tr>';
     741                exit;
     742        }
    736743       
    737744        inline_save_row( $_POST );
  • trunk/wp-admin/categories.php

    r8948 r8973  
    179179<option value="delete"><?php _e('Delete'); ?></option>
    180180</select>
    181 <input type="submit" value="<?php _e('Apply'); ?>" name="doaction" class="button-secondary action" />
     181<input type="submit" value="<?php _e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
    182182<?php wp_nonce_field('bulk-categories'); ?>
    183183</div>
  • trunk/wp-admin/css/global.css

    r8787 r8973  
    205205}
    206206*/
    207 .widefat .num {
     207.widefat .num,
     208.widefat .column-comments {
    208209        text-align: center;
    209210}
  • trunk/wp-admin/edit-comments.php

    r8867 r8973  
    196196<option value="delete"><?php _e('Delete'); ?></option>
    197197</select>
    198 <input type="submit" name="doaction" value="<?php _e('Apply'); ?>" class="button-secondary apply" />
     198<input type="submit" name="doaction" id="doaction" value="<?php _e('Apply'); ?>" class="button-secondary apply" />
    199199<?php wp_nonce_field('bulk-comments'); ?>
    200200<?php if ( isset($_GET['apage']) ) { ?>
  • trunk/wp-admin/edit-link-categories.php

    r8948 r8973  
    119119<option value="delete"><?php _e('Delete'); ?></option>
    120120</select>
    121 <input type="submit" value="<?php _e('Apply'); ?>" name="doaction" class="button-secondary action" />
     121<input type="submit" value="<?php _e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
    122122<?php wp_nonce_field('bulk-link-categories'); ?>
    123123</div>
  • trunk/wp-admin/edit-pages.php

    r8948 r8973  
    1010require_once('admin.php');
    1111
    12 // Handle bulk deletes
    13 if ( isset($_GET['action']) && isset($_GET['post']) && isset($_GET['doaction']) ) {
    14         check_admin_referer('bulk-pages');
    15         if ( $_GET['action'] == 'delete' ) {
    16                 foreach( (array) $_GET['post'] as $post_id_del ) {
    17                         $post_del = & get_post($post_id_del);
    18 
    19                         if ( !current_user_can('delete_page', $post_id_del) )
    20                                 wp_die( __('You are not allowed to delete this page.') );
    21 
    22                         if ( $post_del->post_type == 'attachment' ) {
    23                                 if ( ! wp_delete_attachment($post_id_del) )
    24                                         wp_die( __('Error in deleting...') );
    25                         } else {
    26                                 if ( !wp_delete_post($post_id_del) )
    27                                         wp_die( __('Error in deleting...') );
     12// Handle bulk actions
     13if ( isset($_GET['action']) && $_GET['action'] != -1 ) {
     14        switch ( $_GET['action'] ) {
     15                case 'delete':
     16                        if ( isset($_GET['post']) && isset($_GET['doaction']) ) {
     17                                check_admin_referer('bulk-pages');
     18                                foreach( (array) $_GET['post'] as $post_id_del ) {
     19                                        $post_del = & get_post($post_id_del);
     20               
     21                                        if ( !current_user_can('delete_page', $post_id_del) )
     22                                                wp_die( __('You are not allowed to delete this page.') );
     23               
     24                                        if ( $post_del->post_type == 'attachment' ) {
     25                                                if ( ! wp_delete_attachment($post_id_del) )
     26                                                        wp_die( __('Error in deleting...') );
     27                                        } else {
     28                                                if ( !wp_delete_post($post_id_del) )
     29                                                        wp_die( __('Error in deleting...') );
     30                                        }
     31                                }
    2832                        }
    29                 }
    30 
    31                 $sendback = wp_get_referer();
    32                 if (strpos($sendback, 'page.php') !== false) $sendback = admin_url('page-new.php');
    33                 elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php');
    34                 $sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback);
    35 
    36                 wp_redirect($sendback);
    37                 exit();
     33                        break;
     34                case 'edit':
     35                        if ( isset($_GET['post']) ) {
     36                                check_admin_referer('bulk-pages');
     37                                $_GET['post_status'] = $_GET['_status'];
     38       
     39                                if ( -1 == $_GET['post_author'] )
     40                                        unset($_GET['post_author']);
     41       
     42                                $done = bulk_edit_posts($_GET);
     43                        }
     44                        break;
    3845        }
     46        $sendback = wp_get_referer();
     47        if (strpos($sendback, 'page.php') !== false) $sendback = admin_url('page-new.php');
     48        elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php');
     49        $sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback);
     50        if ( isset($done) ) {
     51                $done['upd'] = count( $done['upd'] );
     52                $done['skip'] = count( $done['skip'] );
     53                $sendback = add_query_arg( $done, $sendback );
     54                unset($done);
     55        }
     56        wp_redirect($sendback);
     57        exit();
    3958} elseif ( !empty($_GET['_wp_http_referer']) ) {
    4059         wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI'])));
    … …  
    86105</form>
    87106
     107<?php if ( isset($_GET['upd']) && (int) $_GET['upd'] ) { ?>
     108<div id="message" class="updated fade"><p>
     109<?php printf( __ngettext( '%d page updated.', '%d pages updated.', $_GET['upd'] ), number_format_i18n( $_GET['upd'] ) );
     110unset($_GET['upd']);
     111       
     112        if ( isset($_GET['skip']) && (int) $_GET['skip'] ) {
     113                printf( __ngettext( ' %d page not updated. Somebody is editing it.', ' %d pages not updated. Somebody is editing them.', $_GET['skip'] ), number_format_i18n( $_GET['skip'] ) );
     114                unset($_GET['skip']);
     115        } ?>
     116</p></div>
     117<?php } ?>
     118
    88119<div class="wrap">
    89120<form id="adv-settings" action="" method="get">
    … …  
    176207<option value="delete"><?php _e('Delete'); ?></option>
    177208</select>
    178 <input type="submit" value="<?php _e('Apply'); ?>" name="doaction" class="button-secondary action" />
     209<input type="submit" value="<?php _e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
    179210<?php wp_nonce_field('bulk-pages'); ?>
    180211</div>
    … …  
    198229  </thead>
    199230  <tbody>
    200   <?php inline_edit_row( 'page' ) ?>
    201231  <?php page_rows($posts, $pagenum, $per_page); ?>
    202232  </tbody>
    203233</table>
    204234</form>
     235
     236<?php inline_edit_row( 'page' ) ?>
    205237
    206238<div id="ajax-response"></div>
  • trunk/wp-admin/edit-post-rows.php

    r8943 r8973  
    1616        </thead>
    1717        <tbody>
    18          
    19 <?php inline_edit_row( 'post' ) ?>       
    2018
    2119<?php
  • trunk/wp-admin/edit-tags.php

    r8948 r8973  
    185185<option value="delete"><?php _e('Delete'); ?></option>
    186186</select>
    187 <input type="submit" value="<?php _e('Apply'); ?>" name="doaction" class="button-secondary action" />
     187<input type="submit" value="<?php _e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
    188188<?php wp_nonce_field('bulk-tags'); ?>
    189189</div>
  • trunk/wp-admin/edit.php

    r8948 r8973  
    1111
    1212// Handle bulk actions
    13 if ( isset($_GET['action']) && $_GET['action'] != -1 && isset($_GET['doaction']) ) {
     13if ( isset($_GET['action']) && $_GET['action'] != -1 ) {
    1414        switch ( $_GET['action'] ) {
    1515                case 'delete':
    16                         if ( isset($_GET['post']) ) {
     16                        if ( isset($_GET['post']) && isset($_GET['doaction']) ) {
    1717                                check_admin_referer('bulk-posts');
    1818                                foreach( (array) $_GET['post'] as $post_id_del ) {
    … …  
    3333                        break;
    3434                case 'edit':
    35                         // TODO: Decide what to do here - add bulk edit feature, or just disallow if >1 post selected
     35                        if ( isset($_GET['post']) ) {
     36                                check_admin_referer('bulk-posts');
     37                                $_GET['post_status'] = $_GET['_status'];
     38       
     39                                if ( -1 == $_GET['post_author'] )
     40                                        unset($_GET['post_author']);
     41       
     42                                $done = bulk_edit_posts($_GET);
     43                        }
    3644                        break;
    3745        }
     46
    3847        $sendback = wp_get_referer();
    3948        if (strpos($sendback, 'post.php') !== false) $sendback = admin_url('post-new.php');
    4049        elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php');
    4150        $sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback);
    42 
     51        if ( isset($done) ) {
     52                $done['upd'] = count( $done['upd'] );
     53                $done['skip'] = count( $done['skip'] );
     54                $sendback = add_query_arg( $done, $sendback );
     55                unset($done);
     56        }
    4357        wp_redirect($sendback);
    4458        exit();
    … …  
    7993        </p>
    8094</form>
     95
     96<?php if ( isset($_GET['posted']) && $_GET['posted'] ) : $_GET['posted'] = (int) $_GET['posted']; ?>
     97<div id="message" class="updated fade"><p><strong><?php _e('Your post has been saved.'); ?></strong> <a href="<?php echo get_permalink( $_GET['posted'] ); ?>"><?php _e('View post'); ?></a> | <a href="<?php echo get_edit_post_link( $_GET['posted'] ); ?>"><?php _e('Edit post'); ?></a></p></div>
     98<?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('posted'), $_SERVER['REQUEST_URI']);
     99endif; ?>
     100
     101<?php if ( isset($_GET['upd']) && (int) $_GET['upd'] ) { ?>
     102<div id="message" class="updated fade"><p>
     103<?php printf( __ngettext( '%d post updated.', '%d posts updated.', $_GET['upd'] ), number_format_i18n( $_GET['upd'] ) );
     104unset($_GET['upd']);
     105       
     106        if ( isset($_GET['skip']) && (int) $_GET['skip'] ) {
     107                printf( __ngettext( ' %d post not updated. Somebody is editing it.', ' %d posts not updated. Somebody is editing them.', $_GET['skip'] ), number_format_i18n( $_GET['skip'] ) );
     108                unset($_GET['skip']);
     109        } ?>
     110</p></div>
     111<?php } ?>
    81112
    82113<div class="wrap">
    … …  
    155186<?php if ( isset($_GET['post_status'] ) ) : ?>
    156187<input type="hidden" name="post_status" value="<?php echo attribute_escape($_GET['post_status']) ?>" />
    157 <?php endif;
    158 
    159 if ( isset($_GET['posted']) && $_GET['posted'] ) : $_GET['posted'] = (int) $_GET['posted']; ?>
    160 <div id="message" class="updated fade"><p><strong><?php _e('Your post has been saved.'); ?></strong> <a href="<?php echo get_permalink( $_GET['posted'] ); ?>"><?php _e('View post'); ?></a> | <a href="<?php echo get_edit_post_link( $_GET['posted'] ); ?>"><?php _e('Edit post'); ?></a></p></div>
    161 <?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('posted'), $_SERVER['REQUEST_URI']);
    162 endif;
    163 ?>
    164 
     188<?php endif; ?>
    165189<input type="hidden" name="mode" value="<?php echo $mode; ?>" />
    166190
    … …  
    190214<option value="delete"><?php _e('Delete'); ?></option>
    191215</select>
    192 <input type="submit" value="<?php _e('Apply'); ?>" name="doaction" class="button-secondary action" />
     216<input type="submit" value="<?php _e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
    193217<?php wp_nonce_field('bulk-posts'); ?>
    194218<?php
    … …  
    243267
    244268</form>
     269
     270<?php inline_edit_row( 'post' ); ?>
    245271
    246272<div id="ajax-response"></div>
  • trunk/wp-admin/inbox.php

    r8845 r8973  
    3232<option value="archive"><?php _e('Archive'); ?></option>
    3333</select>
    34 <input type="submit" value="<?php _e('Apply'); ?>" name="doaction" class="button-secondary action" />
     34<input type="submit" value="<?php _e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
    3535</div>
    3636<br class="clear" />
  • trunk/wp-admin/includes/post.php

    r8912 r8973  
    176176
    177177        return $post_ID;
     178}
     179
     180function bulk_edit_posts( $post_data = null ) {
     181
     182        if ( empty($post_data) )
     183                $post_data = &$_POST;
     184
     185        if ( 'page' == $post_data['post_type'] ) {
     186                if ( ! current_user_can( 'edit_pages' ) )
     187                        wp_die( __('You are not allowed to edit pages.') );
     188        } else {
     189                if ( ! current_user_can( 'edit_posts' ) )
     190                        wp_die( __('You are not allowed to edit posts.') );
     191        }
     192
     193        $post_IDs = array_map( intval, (array) $post_data['post'] );
     194
     195        if ( isset($post_data['post_category']) ) {
     196                if ( is_array($post_data['post_category']) && ! empty($post_data['post_category']) )
     197                        $new_cats = array_map( absint, $post_data['post_category'] );
     198                else
     199                        unset($post_data['post_category']);
     200        }
     201
     202        if ( isset($post_data['tags_input']) ) {
     203                if ( ! empty($post_data['tags_input']) ) {
     204                        $new_tags = preg_replace( '/\s*,\s*/', ',', rtrim($post_data['tags_input'], ' ,') );
     205                        $new_tags = explode(',', $new_tags);
     206                } else {
     207                        unset($post_data['tags_input']);
     208                }
     209        }
     210
     211        $reset = array( 'post_author', 'post_status', 'post_password', 'post_parent', 'page_template', 'comment_status', 'ping_status', 'keep_private' );
     212        foreach ( $reset as $field ) {
     213                if ( isset($post_data[$field]) && '' == $post_data[$field] )
     214                        unset($post_data[$field]);
     215        }
     216
     217        $updated = $skipped = array();
     218        foreach ( $post_IDs as $post_ID ) {
     219
     220                if ( wp_check_post_lock( $post_ID ) ) {
     221                        $skipped[] = $post_ID;
     222                        continue;
     223                }
     224
     225                if ( isset($new_cats) ) {
     226                        $cats = (array) wp_get_post_categories($post_ID);
     227                        $post_data['post_category'] = array_unique( array_merge($cats, $new_cats) );
     228                }
     229
     230                if ( isset($new_tags) ) {
     231                        $tags = wp_get_post_tags($post_ID, array('fields' => 'names'));
     232                        $post_data['tags_input'] = array_unique( array_merge($tags, $new_tags) );
     233                }
     234
     235                $post_data['ID'] = $post_ID;
     236                $updated[] = wp_update_post( $post_data );
     237        }
     238
     239        return array( 'upd' => $updated, 'skip' => $skipped );
    178240}
    179241
  • trunk/wp-admin/includes/template.php

    r8967 r8973  
    623623        $col_count = count($columns) - $hidden_count;
    624624        $m = ( isset($mode) && 'excerpt' == $mode ) ? 'excerpt' : 'list';
    625         ?>
    626         <tr title="<?php _e('Double-click to cancel'); ?>" id="inline-edit" style="display: none"><td colspan="<?php echo $col_count; ?>">
     625        $can_publish = current_user_can('publish_posts'); ?>
     626
     627<form method="get" action=""><table style="display: none"><tbody id="inlineedit">
     628        <?php
     629        $bulk = 0;
     630        while ( $bulk < 2 ) { ?>
     631       
     632        <tr title="<?php _e('Double-click to cancel'); ?>" id="<?php echo $bulk ? 'bulk-edit' : 'inline-edit'; ?>" style="display: none"><td colspan="<?php echo $col_count; ?>">
    627633        <?php
    628634        foreach($columns as $column_name=>$column_display_name) {
    … …  
    641647                        case 'modified':
    642648                        case 'date':
    643                         ?>
     649                                if ( ! $bulk ) { ?>
    644650                                <div <?php echo $attributes; ?> title="<?php _e('Timestamp'); ?>">
    645651                                        <div class="title"><?php _e('Timestamp'); ?></div>
    … …  
    649655                                </div>
    650656                                <?php
     657                                }
    651658                                break;
    652659
    653660                        case 'title':
    654661                                $attributes = "class=\"$type-title column-title quick-edit-div\"" . $style; ?>
     662                                <?php if ( $bulk ) { ?>
     663                                <div <?php echo $attributes; ?> id="bulk-title-div" title="<?php $is_page ? _e('Selected pages') : _e('Selected posts'); ?>">
     664                                        <div class="title"><?php $is_page ? _e('Selected pages') : _e('Selected posts'); ?></div>
     665                                        <div class="in">
     666                                        <div id="bulk-titles"></div>
     667                                        </div>
     668                                </div>
     669                                <?php } else { ?>
    655670                                <div <?php echo $attributes ?>>
    656671                                        <div class="title"><?php _e('Title'); ?></div>
    … …  
    661676                                        </div>
    662677                                </div>
     678                                <?php } ?>
     679
    663680                                <?php if ( $is_page ) { ?>
    664681                                <div class="parent quick-edit-div" title="<?php _e('Page Parent'); ?>">
    … …  
    666683                                        <div class="in">
    667684                                        <select name="post_parent">
     685                                                <?php if ( $bulk ) { ?>
     686                                                <option value=""><?php _e('- No Change -'); ?></option>
     687                                                <?php } ?>
    668688                                                <option value="0"><?php _e('Main Page (no parent)'); ?></option>
    669689                                                <?php parent_dropdown(); ?>
    … …  
    671691                                        </div>
    672692                                </div>
     693
    673694                                <div class="template quick-edit-div" title="<?php _e('Page Template'); ?>">
    674695                                        <div class="title"><?php _e('Page Template'); ?></div>
    675696                                        <div class="in">
    676697                                        <select name="page_template">
    677                                                 <option value='default'><?php _e('Default Template'); ?></option>
     698                                                <?php if ( $bulk ) { ?>
     699                                                <option value=""><?php _e('- No Change -'); ?></option>
     700                                                <?php } ?>
     701                                                <option value="default"><?php _e('Default Template'); ?></option>
    678702                                                <?php page_template_dropdown() ?>
    679703                                        </select>
    680704                                        </div>
    681705                                </div>
     706
     707                                <?php if ( ! $bulk ) { ?>
    682708                                <div class="order quick-edit-div" title="<?php _e('Page Order'); ?>">
    683709                                        <div class="title"><?php _e('Page Order'); ?></div>
    … …  
    687713                                </div>
    688714                                <?php }
     715                                }
    689716
    690717                                break;
    691718
    692719                        case 'categories': ?>
     720                                <?php if ( ! $bulk ) { ?>
    693721                                <div <?php echo $attributes ?> title="<?php _e('Categories'); ?>">
    694722                                        <div class="title"><?php _e('Categories'); ?>
    … …  
    699727                                        </ul>
    700728                                </div>
    701                                 <?php
     729                                <?php }
    702730                                break;
    703731
    704732                        case 'tags': ?>
     733                                <?php if ( ! $bulk ) { ?>
    705734                                <div <?php echo $attributes ?> title="<?php _e('Tags'); ?>">
    706735                                        <div class="title"><?php _e('Tags'); ?></div>
    … …  
    709738                                        </div>
    710739                                </div>
    711                                 <?php
     740                                <?php }
    712741                                break;
    713742
    714743                        case 'comments':
    715                                 $attributes = 'class="comments column-comments num quick-edit-div"' . $style; ?>
     744                                ?>
    716745                                <div <?php echo $attributes ?> title="<?php _e('Comments and Pings'); ?>">
    717746                                        <div class="title"><?php _e('Comments and Pings'); ?></div>
    718747                                        <div class="in">
     748                                        <?php if ( $bulk ) { ?>
     749                                        <select name="comment_status">
     750                                                <option value=""><?php _e('- No Change -'); ?></option>
     751                                                <option value="open"><?php _e('Allow Comments'); ?></option>
     752                                                <option value="closed"><?php _e('Disallow Comments'); ?></option>
     753                                        </select>
     754                                        <select name="ping_status">
     755                                                <option value=""><?php _e('- No Change -'); ?></option>
     756                                                <option value="open"><?php _e('Allow Pings'); ?></option>
     757                                                <option value="closed"><?php _e('Disallow Pings'); ?></option>
     758                                        </select>
     759                                        <?php } else { ?>
    719760                                        <label><input type="checkbox" name="comment_status" value="open" />
    720761                                        <?php _e('Allow Comments'); ?></label><br />
    721762                                        <label><input type="checkbox" name="ping_status" value="open" />
    722763                                        <?php _e('Allow Pings'); ?></label>
     764                                        <?php } ?>
    723765                                        </div>
    724766                                </div>
    … …  
    732774                                        <div class="title"><?php _e('Author'); ?></div>
    733775                                        <div class="in">
    734                                         <?php wp_dropdown_users( array('include' => $authors, 'name' => 'post_author', 'class'=> 'authors', 'selected' => $post->post_author) ); ?>
     776                                        <?php
     777                                        $users_opt = array('include' => $authors, 'name' => 'post_author', 'class'=> 'authors');
     778                                        if ( $bulk ) $users_opt['show_option_none'] = __('- No Change -');
     779                                        wp_dropdown_users( $users_opt ); ?>
    735780                                        </div>
    736781                                </div>
    737782                                <?php } ?>
    738783
     784                                <?php if ( ! $bulk ) { ?>
    739785                                <div class="password quick-edit-div" title="<?php _e('Password'); ?>">
    740786                                        <div class="title"><?php _e('Password'); ?></div>
    741787                                        <div class="in">
    742                                         <input type="text" name="post_password" value="<?php the_post_password(); ?>" />
     788                                        <input type="text" name="post_password" value="" />
    743789                                        <label title="<?php _e('Privacy'); ?>">
    744790                                        <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>
    745791                                        </div>
    746792                                </div>
    747                                 <?php
     793                                <?php }
    748794                                break;
    749795
    … …  
    753799                                        <div class="in">
    754800                                        <select name="_status">
    755                                                 <?php if ( current_user_can('publish_posts') ) { // Contributors only get "Unpublished" and "Pending Review" ?>
    756                                                 <option value='publish'><?php _e('Published') ?></option>
    757                                                 <option value='future'><?php _e('Scheduled') ?></option>
     801                                                <?php if ( $bulk ) { ?>
     802                                                <option value=""><?php _e('- No Change -'); ?></option>
     803                                                        <?php if ( $can_publish ) { ?>
     804                                                        <option value="private"><?php _e('Private') ?></option>
     805                                                        <?php } ?>
    758806                                                <?php } ?>
    759                                                 <option value='pending'><?php _e('Pending Review') ?></option>
    760                                                 <option value='draft'><?php _e('Unpublished') ?></option>
     807                                                <?php if ( $can_publish ) { // Contributors only get "Unpublished" and "Pending Review" ?>
     808                                                <option value="publish"><?php _e('Published') ?></option>
     809                                                <option value="future"><?php _e('Scheduled') ?></option>
     810                                                <?php } ?>
     811                                                <option value="pending"><?php _e('Pending Review') ?></option>
     812                                                <option value="draft"><?php _e('Unpublished') ?></option>
    761813                                        </select>
    762814                                        </div>
    763815                                </div>
    764816
    765                                 <?php if ( current_user_can( 'edit_others_posts' ) && ! $is_page ) { ?>
     817                                <?php if ( ! $is_page && ! $bulk && current_user_can( 'edit_others_posts' ) ) { ?>
    766818                                <div class="sticky quick-edit-div" <?php echo $style; ?> title="<?php _e('Sticky') ?>">
    767819                                        <div class="title"><?php _e('Sticky'); ?></div>
    … …  
    774826                                break;
    775827
    776                         case 'control_view': ?>
    777                                 <div><a href="<?php the_permalink(); ?>" rel="permalink" class="view"><?php _e('View'); ?></a></div>
    778                                 <?php
    779                                 break;
    780 
    781                         case 'control_edit': ?>
    782                                 <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>
    783                                 <?php
    784                                 break;
    785 
    786                         case 'control_delete': ?>
    787                                 <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>
    788                                 <?php
    789                                 break;
    790 
    791                         default: ?>
    792                                 <div><?php do_action('manage_posts_custom_column', $column_name, $post->ID); ?></div>
    793                                 <?php
     828                        default:
     829                                if ( $bulk )
     830                                        do_action('bulk_edit_custom_box', $column_name, $type);
     831                                else
     832                                        do_action('quick_edit_custom_box', $column_name, $type);
     833
    794834                                break;
    795835                }
    … …  
    800840                <a accesskey="c" href="#inline-edit" title="<?php _e('Cancel'); ?>" class="button-secondary cancel"><?php _e('Cancel'); ?></a>
    801841                <a accesskey="s" href="#inline-edit" title="<?php _e('Save'); ?>" class="button-secondary save"><?php _e('Save'); ?></a>
    802                 <?php wp_nonce_field( 'inlineeditnonce', '_inline_edit', false ) ?>
     842                <?php if ( ! $bulk ) wp_nonce_field( 'inlineeditnonce', '_inline_edit', false ); ?>
    803843                <input type="hidden" name="post_view" value="<?php echo $m; ?>" />
    804844        </div>
    805845        </td></tr>
     846<?php
     847        $bulk++;
     848        } ?>
     849        </tbody></table></form>
    806850<?php
    807851}
    … …  
    845889
    846890        echo '
    847 <div id="inline_' . $post->ID . '">
    848         <input type="hidden" name="" class="post_title" value="' . $title . '" />
    849         <input type="hidden" name="" class="post_name" value="' . $post->post_name . '" />
    850         <input type="hidden" name="" class="post_author" value="' . $post->post_author . '" />
    851         <input type="hidden" name="" class="comment_status" value="' . $post->comment_status . '" />
    852         <input type="hidden" name="" class="ping_status" value="' . $post->ping_status . '" />
    853         <input type="hidden" name="" class="_status" value="' . $post->post_status . '" />
    854         <input type="hidden" name="" class="jj" value="' . mysql2date( 'd', $post->post_date ) . '" />
    855         <input type="hidden" name="" class="mm" value="' . mysql2date( 'm', $post->post_date ) . '" />
    856         <input type="hidden" name="" class="aa" value="' . mysql2date( 'Y', $post->post_date ) . '" />
    857         <input type="hidden" name="" class="hh" value="' . mysql2date( 'H', $post->post_date ) . '" />
    858         <input type="hidden" name="" class="mn" value="' . mysql2date( 'i', $post->post_date ) . '" />
    859         <input type="hidden" name="" class="post_password" value="' . wp_specialchars($post->post_password, 1) . '" />';
     891<div class="hidden" id="inline_' . $post->ID . '">
     892        <div class="post_title">' . $title . '</div>
     893        <div class="post_name">' . $post->post_name . '</div>
     894        <div class="post_author">' . $post->post_author . '</div>
     895        <div class="comment_status">' . $post->comment_status . '</div>
     896        <div class="ping_status">' . $post->ping_status . '</div>
     897        <div class="_status">' . $post->post_status . '</div>
     898        <div class="jj">' . mysql2date( 'd', $post->post_date ) . '</div>
     899        <div class="mm">' . mysql2date( 'm', $post->post_date ) . '</div>
     900        <div class="aa">' . mysql2date( 'Y', $post->post_date ) . '</div>
     901        <div class="hh">' . mysql2date( 'H', $post->post_date ) . '</div>
     902        <div class="mn">' . mysql2date( 'i', $post->post_date ) . '</div>
     903        <div class="post_password">' . wp_specialchars($post->post_password, 1) . '</div>';
    860904
    861905        if( $post->post_type == 'page' )
    862906                echo '
    863         <input type="hidden" name="" class="post_parent" value="' . $post->post_parent . '" />
    864         <input type="hidden" name="" class="page_template" value="' . wp_specialchars(get_post_meta( $post->ID, '_wp_page_template', true ), 1) . '" />
    865         <input type="hidden" name="" class="menu_order" value="' . $post->menu_order . '" />';
     907        <div class="post_parent">' . $post->post_parent . '</div>
     908        <div class="page_template">' . wp_specialchars(get_post_meta( $post->ID, '_wp_page_template', true ), 1) . '</div>
     909        <div class="menu_order">' . $post->menu_order . '</div>';
    866910       
    867911        if( $post->post_type == 'post' )
    868912                echo '
    869         <input type="hidden" name="" class="tags_input" value="' . wp_specialchars( str_replace( ',', ', ', get_tags_to_edit($post->ID) ), 1) . '" />
    870         <input type="hidden" name="" class="post_category" value="' . implode( ',', wp_get_post_categories( $post->ID ) ) . '" />
    871         <input type="hidden" name="" class="sticky" value="' . (is_sticky($post->ID) ? 'sticky' : '') . '" />';
     913        <div class="tags_input">' . wp_specialchars( str_replace( ',', ', ', get_tags_to_edit($post->ID) ), 1) . '</div>
     914        <div class="post_category">' . implode( ',', wp_get_post_categories( $post->ID ) ) . '</div>
     915        <div class="sticky">' . (is_sticky($post->ID) ? 'sticky' : '') . '</div>';
    872916               
    873917        echo '</div>';
    … …  
    10361080
    10371081                case 'comments':
    1038                         $attributes = 'class="comments column-comments num"' . $style;
    10391082                ?>
    10401083                <td <?php echo $attributes ?>><div class="post-com-count-wrapper">
    … …  
    12111254
    12121255        case 'comments':
    1213                 $attributes = 'class="comments column-comments num"' . $style;
    12141256                ?>
    12151257                <td <?php echo $attributes ?>><div class="post-com-count-wrapper">
  • trunk/wp-admin/js/inline-edit.js

    r8951 r8973  
    22(function($) {
    33inlineEdit = {
    4         type : '',
    5         rows : '',
    64
    75        init : function() {
    8                 var t = this, blankRow = $('#inline-edit');
     6                var t = this, qeRow = $('#inline-edit'), bulkRow = $('#bulk-edit');
    97
    108                t.type = $('table.widefat').hasClass('page') ? 'page' : 'post';
     9                t.what = '#'+t.type+'-';
    1110
    1211                // get all editable rows
    … …  
    1413
    1514                // prepare the edit row
    16                 blankRow.dblclick(function() { inlineEdit.toggle(this); })
    17                         .keyup(function(e) { if(e.which == 27) return inlineEdit.revert(this); });
    18 
    19                 $('a.cancel', blankRow).click(function() { return inlineEdit.revert(this); });
    20                 $('a.save', blankRow).click(function() { return inlineEdit.save(this); });
     15                qeRow.dblclick(function() { inlineEdit.toggle(this); })
     16                        .keyup(function(e) { if(e.which == 27) return inlineEdit.revert(); });
     17
     18                bulkRow.dblclick(function() { inlineEdit.revert(); })
     19                        .keyup(function(e) { if (e.which == 27) return inlineEdit.revert(); });
     20
     21                $('a.cancel', qeRow).click(function() { return inlineEdit.revert(); });
     22                $('a.save', qeRow).click(function() { return inlineEdit.save(this); });
     23
     24                $('a.cancel', bulkRow).click(function() { return inlineEdit.revert(); });
     25                $('a.save', bulkRow).click(function() { return inlineEdit.saveBulk(); });
    2126
    2227                // add events
    2328                t.rows.dblclick(function() { inlineEdit.toggle(this); });
    2429                t.addEvents(t.rows);
     30
     31                $('#bulk-title-div').after(
     32                        $('#inline-edit div.categories').clone(),
     33                        $('#inline-edit div.tags').clone()
     34                );
     35
     36                // categories expandable?
     37                $('span.catshow').click(function() {
     38                        $('.inline-editor ul.cat-checklist').addClass("cat-hover");
     39                        $('.inline-editor span.cathide').show();
     40                        $(this).hide();
     41                });
     42
     43                $('span.cathide').click(function() {
     44                        $('.inline-editor ul.cat-checklist').removeClass("cat-hover");
     45                        $('.inline-editor span.catshow').show();
     46                        $(this).hide();
     47                });
     48
     49                $('select[name="_status"] option[value="future"]', bulkRow).remove();
     50
     51                $('#doaction').click(function(e){
     52                        if ( $('select[name="action"]').val() == 'edit' ) {
     53                                e.preventDefault();
     54                                t.setBulk();
     55                        } else if ( $('form#posts-filter tr.inline-editor').length > 0 ) {
     56                                t.revert();
     57                        }
     58                });
     59               
     60                $('#post-query-submit').click(function(e){
     61                        if ( $('form#posts-filter tr.inline-editor').length > 0 )
     62                                t.revert();
     63                });
     64               
    2565        },
    2666
    … …  
    2868                var t = this;
    2969
    30                 $('#'+t.type+'-'+t.getId(el)).css('display') == 'none' ? t.revert(el) : t.edit(el);
     70                $(t.what+t.getId(el)).css('display') == 'none' ? t.revert() : t.edit(el);
    3171        },
    3272
    … …  
    3979        },
    4080
     81        setBulk : function() {
     82                var te = '', c = '';
     83                this.revert();
     84
     85                $('table.widefat tbody').prepend( $('#bulk-edit') );
     86                $('#bulk-edit').addClass('inline-editor').show();
     87
     88                $('tbody th.check-column input[type="checkbox"]').each(function(i){
     89                        if ( $(this).attr('checked') ) {
     90                                var id = $(this).val();
     91                                c = c == '' ? ' class="alternate"' : '';
     92                                te += '<div'+c+'>'+$('#inline_'+id+' .post_title').text()+'</div>';
     93                        }
     94                });
     95
     96                $('#bulk-titles').html(te);
     97
     98                // enable autocomplete for tags
     99                if ( this.type == 'post' )
     100                        $('tr.inline-editor textarea[name="tags_input"]').suggest( 'admin-ajax.php?action=ajax-tag-search', { delay: 500, minchars: 2, multiple: true, multipleSep: ", " } );
     101        },
     102
    41103        edit : function(id) {
    42                 var t = this, type = t.type, old = $('tr.inline-editor').attr('id');
    43 
    44                 if( typeof(id) == 'object' )
     104                var t = this;
     105                t.revert();
     106
     107                if ( typeof(id) == 'object' )
    45108                        id = t.getId(id);
    46109
    47                 if ( old ) {
    48                         old = old.split('-')[1];
    49                         t.revert(old);
    50                 }
    51 
    52110                var fields = ['post_title', 'post_name', 'post_author', '_status', 'jj', 'mm', 'aa', 'hh', 'mn', 'post_password'];
    53                 if ( type == 'page' ) fields.push('post_parent', 'menu_order', 'page_template');
    54                 if ( type == 'post' ) fields.push('tags_input');
     111                if ( t.type == 'page' ) fields.push('post_parent', 'menu_order', 'page_template');
     112                if ( t.type == 'post' ) fields.push('tags_input');
    55113
    56114                // add the new blank row
    57115                var editRow = $('#inline-edit').clone(true);
    58116
    59                 if ( $('#'+type+'-'+id).hasClass('alternate') )
     117                if ( $(t.what+id).hasClass('alternate') )
    60118                        $(editRow).addClass('alternate');
    61                 $('#'+type+'-'+id).hide().after(editRow);
     119                $(t.what+id).hide().after(editRow);
    62120
    63121                // populate the data
    64122                var rowData = $('#inline_'+id);
    65123                for ( var f = 0; f < fields.length; f++ ) {
    66                         $(':input[name="'+fields[f]+'"]', editRow).val( $('.'+fields[f], rowData).val() );
     124                        $(':input[name="'+fields[f]+'"]', editRow).val( $('.'+fields[f], rowData).text() );
    67125                }
    68126
    69                 if ( $('.comment_status', rowData).val() == 'open' )
     127                if ( $('.comment_status', rowData).text() == 'open' )
    70128                        $('input[name="comment_status"]', editRow).attr("checked", "checked");
    71                 if ( $('.ping_status', rowData).val() == 'open' )
     129                if ( $('.ping_status', rowData).text() == 'open' )
    72130                        $('input[name="ping_status"]', editRow).attr("checked", "checked");
    73                 if ( $('.sticky', rowData).val() == 'sticky' )
     131                if ( $('.sticky', rowData).text() == 'sticky' )
    74132                        $('input[name="sticky"]', editRow).attr("checked", "checked");
    75133
    76134                // categories
    77135                var cats;
    78                 if ( cats = $('.post_category', rowData).val() )
    79                         $('ul.cat-checklist :checkbox').val(cats.split(','));
     136                if ( cats = $('.post_category', rowData).text() )
     137                        $('ul.cat-checklist :checkbox', editRow).val(cats.split(','));
    80138
    81139                // handle the post status
    82                 var status = $('._status', rowData).val();
     140                var status = $('._status', rowData).text();
    83141                if ( status != 'future' ) $('select[name="_status"] option[value="future"]', editRow).remove();
    84142                if ( status == 'private' ) $('input[name="keep_private"]', editRow).attr("checked", "checked");
    … …  
    100158                }
    101159
    102                 // categories expandable?
    103                 $('span.catshow', editRow).click(function() {
    104                         $('ul.cat-checklist', editRow).addClass("cat-hover");
    105                         $('span.cathide', editRow).show();
    106                         $(this).hide();
    107                 });
    108 
    109                 $('span.cathide', editRow).click(function() {
    110                         $('ul.cat-checklist', editRow).removeClass("cat-hover");
    111                         $('span.catshow', editRow).show();
    112                         $(this).hide();
    113                 });
    114 
    115160                $(editRow).attr('id', 'edit-'+id).addClass('inline-editor').show();
    116161                $('.ptitle', editRow).focus();
    117162
    118163                // enable autocomplete for tags
    119                 if ( type == 'post' )
     164                if ( t.type == 'post' )
    120165                        $('tr.inline-editor textarea[name="tags_input"]').suggest( 'admin-ajax.php?action=ajax-tag-search', { delay: 500, minchars: 2, multiple: true, multipleSep: ", " } );
    121166
    … …  
    141186                // make ajax request
    142187                $.post('admin-ajax.php', params,
    143                         function(html) {
    144                                 var row = $('#'+inlineEdit.type+'-'+id);
    145                                 $('#edit-'+id).hide();
    146                                 html = $(html).html();
    147                                 row.html(html).show();
    148                                 row.animate( { backgroundColor: '#FFFBCC' }, 200)
    149                                          .animate( { backgroundColor: row.css('background-color') }, 500);
     188                        function(r) {
     189                                var row = $(inlineEdit.what+id);
     190                                $('#edit-'+id).remove();
     191                                row.html($(r).html()).show()
     192                                        .animate( { backgroundColor: '#CCEEBB' }, 500)
     193                                        .animate( { backgroundColor: '#eefee7' }, 500);
    150194                                inlineEdit.addEvents(row);
    151195                        }
    … …  
    154198        },
    155199
    156         revert : function(id) {
    157                 if ( typeof(id) == 'object' )
    158                         id = this.getId(id);
    159 
    160                 $('#edit-'+id).remove();
    161                 $('#'+this.type+'-'+id).show();
     200        saveBulk : function() {
     201                $('form#posts-filter').submit();
     202        },
     203
     204        revert : function() {
     205                var id;
     206
     207                if ( id = $('table.widefat tr.inline-editor').attr('id') ) {
     208                        if ( 'bulk-edit' == id ) {
     209                                $('table.widefat #bulk-edit').removeClass('inline-editor').hide();
     210                                $('#bulk-titles').html('');
     211                                $('#inlineedit').append( $('#bulk-edit') );
     212                        } else  {
     213                                $('#'+id).remove();
     214                                id = id.substr( id.lastIndexOf('-') + 1 );
     215                                $(this.what+id).show();
     216                        }
     217                }
    162218
    163219                return false;
  • trunk/wp-admin/link-manager.php

    r8948 r8973  
    121121<option value="delete"><?php _e('Delete'); ?></option>
    122122</select>
    123 <input type="submit" value="<?php _e('Apply'); ?>" name="doaction" class="button-secondary action" />
     123<input type="submit" value="<?php _e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
    124124<?php
    125125$categories = get_terms('link_category', "hide_empty=1");
  • trunk/wp-admin/plugins.php

    r8755 r8973  
    332332                        <option value="deactivate-selected"><?php _e('Deactivate'); ?></option>
    333333                </select>
    334                 <input type="submit" name="doaction" value="<?php _e('Apply'); ?>" class="button-secondary action" />
     334                <input type="submit" name="doaction_active" value="<?php _e('Apply'); ?>" class="button-secondary action" />
    335335        </div>
    336336</div>
    … …  
    357357<?php endif; ?>
    358358                </select>
    359                 <input type="submit" value="<?php _e('Apply'); ?>" name="doaction" class="button-secondary action" />
     359                <input type="submit" value="<?php _e('Apply'); ?>" name="doaction_recent" class="button-secondary action" />
    360360                <input type="submit" name="clear-recent-list" value="<?php _e('Clear List') ?>" class="button-secondary" />
    361361        </div>
  • trunk/wp-admin/upload.php

    r8948 r8973  
    272272<?php } ?>
    273273</select>
    274 <input type="submit" id="submit" value="<?php _e('Apply'); ?>" name="doaction" class="button-secondary action" />
     274<input type="submit" id="submit" value="<?php _e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
    275275<?php wp_nonce_field('bulk-media'); ?>
    276276<?php
  • trunk/wp-admin/users.php

    r8948 r8973  
    333333<option value="delete"><?php _e('Delete'); ?></option>
    334334</select>
    335 <input type="submit" value="<?php _e('Apply'); ?>" name="doaction" class="button-secondary action" />
     335<input type="submit" value="<?php _e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
    336336<label class="hidden" for="new_role"><?php _e('Change role to&hellip;') ?></label><select name="new_role" id="new_role"><option value=''><?php _e('Change role to&hellip;') ?></option><?php wp_dropdown_roles(); ?></select>
    337337<input type="submit" value="<?php _e('Change'); ?>" name="changeit" class="button-secondary" />
  • trunk/wp-admin/wp-admin.css

    r8955 r8973  
    22042204
    22052205.inline-editor div.title {
    2206         padding: 2px 5px;
     2206        height: 18px;
     2207        line-height: 16px;
     2208        padding: 1px 5px;
    22072209        cursor: default;
    22082210}
    … …  
    22112213.inline-editor .page-title {
    22122214        width: 260px;
     2215}
     2216
     2217#bulk-edit .post-title,
     2218#bulk-edit .page-title {
     2219        width: 200px;
     2220        height: 179px;
    22132221}
    22142222
    … …  
    22592267
    22602268.inline-editor .categories {
    2261         width: 180px;
     2269        width: 200px;
    22622270}
    22632271
    … …  
    22762284.inline-editor .categories ul.cat-hover {
    22772285        height: 200px;
    2278         overflow: auto;
     2286        overflow-x: auto;
    22792287}
    22802288
    … …  
    23022310
    23032311.inline-editor .tags {
    2304         width: 220px;
     2312        width: 200px;
    23052313}
    23062314
    … …  
    23092317        border-style: solid;
    23102318        height: 45px;
    2311         width: 200px;
     2319        width: 180px;
    23122320        font-size: 11px;
    23132321}
    … …  
    23182326}
    23192327
     2328#wpbody-content .inline-editor .comments select {
     2329        margin-bottom: 3px;
     2330        width: 150px;
     2331}
     2332
     2333.inline-editor .parent {
     2334        width: 180px;
     2335}
     2336
     2337#wpbody-content .inline-editor .parent select {
     2338        width: 170px;
     2339}
     2340
    23202341.inline-editor .quick-edit-save {
    23212342        padding: 8px 10px;
     2343}
     2344
     2345#bulk-titles {
     2346        height: 150px;
     2347        overflow: auto;
     2348        cursor: default;
     2349}
     2350
     2351#bulk-titles div {
     2352        padding: 1px 2px;
    23222353}
    23232354
Note: See TracChangeset for help on using the changeset viewer.