Make WordPress Core


Ignore:
Timestamp:
08/20/2008 04:06:36 AM (16 years ago)
Author:
ryan
Message:

Merge crazyhorse management pages. see #7552

File:
1 edited

Legend:

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

    r8656 r8682  
    1010require_once('admin.php');
    1111
    12 // Handle bulk deletes
    13 if ( isset($_GET['deleteit']) && isset($_GET['delete']) ) {
    14     check_admin_referer('bulk-posts');
    15     foreach( (array) $_GET['delete'] as $post_id_del ) {
    16         $post_del = & get_post($post_id_del);
    17 
    18         if ( !current_user_can('delete_post', $post_id_del) )
    19             wp_die( __('You are not allowed to delete this post.') );
    20 
    21         if ( $post_del->post_type == 'attachment' ) {
    22             if ( ! wp_delete_attachment($post_id_del) )
    23                 wp_die( __('Error in deleting...') );
    24         } else {
    25             if ( !wp_delete_post($post_id_del) )
    26                 wp_die( __('Error in deleting...') );
    27         }
     12// Handle bulk actions
     13if ( isset($_GET['action']) && $_GET['action'] != 'Actions' ) {
     14    switch ( $_GET['action'] ) {
     15        case 'delete':
     16            if ( isset($_GET['post']) ) {
     17                check_admin_referer('bulk-posts');
     18                foreach( (array) $_GET['post'] as $post_id_del ) {
     19                    $post_del = & get_post($post_id_del);
     20
     21                    if ( !current_user_can('delete_post', $post_id_del) )
     22                        wp_die( __('You are not allowed to delete this post.') );
     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                }
     32            }
     33            break;
     34        case 'edit':
     35            // TODO: Decide what to do here - add bulk edit feature, or just disallow if >1 post selected
     36            break;
    2837    }
    29 
    3038    $sendback = wp_get_referer();
    3139    if (strpos($sendback, 'post.php') !== false) $sendback = admin_url('post-new.php');
     
    5361    $_GET['paged'] = 1;
    5462
     63if ( empty($_GET['mode']) )
     64    $mode = 'list';
     65else
     66    $mode = attribute_escape($_GET['mode']);
    5567?>
    5668
     
    6274    printf(__('Comments on %s'), apply_filters( "the_title", $post->post_title));
    6375} else {
    64     $post_status_label = _c('Manage Posts|manage posts header');
     76    $post_status_label = _c('Posts|manage posts header');
    6577    if ( isset($_GET['post_status']) && in_array( $_GET['post_status'], array_keys($post_stati) ) )
    6678        $post_status_label = $post_stati[$_GET['post_status']][1];
     
    8496    $h2_tag    = isset($_GET['tag']) && $_GET['tag'] ? ' ' . sprintf( __('tagged with “%s”'), single_tag_title('', false) ) : '';
    8597    $h2_month  = isset($_GET['m'])   && $_GET['m']   ? ' ' . sprintf( __('during %s'), single_month_title(' ', false) ) : '';
    86     printf( _c( '%1$s%2$s%3$s%4$s%5$s%6$s|You can reorder these: 1: Posts, 2: by {s}, 3: matching {s}, 4: in {s}, 5: tagged with {s}, 6: during {s}' ), $h2_noun, $h2_author, $h2_search, $h2_cat, $h2_tag, $h2_month );
     98    printf( _c( '%1$s%2$s%3$s%4$s%5$s%6$s (<a href="%7$s">Add New</a>)|You can reorder these: 1: Posts, 2: by {s}, 3: matching {s}, 4: in {s}, 5: tagged with {s}, 6: during {s}' ), $h2_noun, $h2_author, $h2_search, $h2_cat, $h2_tag, $h2_month, 'post-new.php' );
    8799}
    88100?></h2>
     
    130142</p>
    131143
     144<input type="hidden" name="mode" value="<?php echo $mode; ?>" />
     145
     146<ul class="view-switch">
     147    <li <?php if ( 'list' == $mode ) echo "class='current'" ?>><a href="<?php echo clean_url(add_query_arg('mode', 'list', $_SERVER['REQUEST_URI'])) ?>"><?php _e('List View') ?></a></li>
     148    <li <?php if ( 'excerpt' == $mode ) echo "class='current'" ?>><a href="<?php echo clean_url(add_query_arg('mode', 'excerpt', $_SERVER['REQUEST_URI'])) ?>"><?php _e('Excerpt View') ?></a></li>
     149</ul>
     150
    132151<div class="tablenav">
    133152
     
    145164
    146165<div class="alignleft">
    147 <input type="submit" value="<?php _e('Delete'); ?>" name="deleteit" class="button-secondary delete" />
     166<select name="action">
     167<option value="" selected><?php _e('Actions'); ?></option>
     168<option value="delete"><?php _e('Delete'); ?></option>
     169<option value="edit"><?php _e('Edit'); ?></option>
     170</select>
     171<input type="submit" value="<?php _e('Apply'); ?>" name="doaction" class="button-secondary action" />
    148172<?php wp_nonce_field('bulk-posts'); ?>
    149173<?php
     
    231255  <tr>
    232256    <th scope="col"><?php _e('Comment') ?></th>
    233     <th scope="col"><?php _e('Date') ?></th>
    234     <th scope="col"><?php _e('Actions') ?></th>
     257    <th scope="col"><?php _e('Submitted') ?></th>
    235258  </tr>
    236259</thead>
     
    238261<?php
    239262    foreach ($comments as $comment)
    240         _wp_comment_row( $comment->comment_ID, 'detail', false, false );
     263        _wp_comment_row( $comment->comment_ID, 'single', false, false );
    241264?>
    242265</tbody>
Note: See TracChangeset for help on using the changeset viewer.