Make WordPress Core


Ignore:
Timestamp:
09/29/2008 09:26:21 AM (16 years ago)
Author:
azaozz
Message:

Add table footers and action selects at the bottom

File:
1 edited

Legend:

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

    r9018 r9028  
    1111
    1212// Handle bulk actions
    13 if ( isset($_GET['action']) && $_GET['action'] != -1 ) {
    14     switch ( $_GET['action'] ) {
     13if ( isset($_GET['action']) && ( -1 != $_GET['action'] || -1 != $_GET['action2'] ) ) {
     14    $doaction = ( -1 != $_GET['action'] ) ? $_GET['action'] : $_GET['action2'];
     15
     16    switch ( $doaction ) {
    1517        case 'delete':
    1618            if ( isset($_GET['post']) && isset($_GET['doaction']) ) {
     
    1820                foreach( (array) $_GET['post'] as $post_id_del ) {
    1921                    $post_del = & get_post($post_id_del);
    20        
     22
    2123                    if ( !current_user_can('delete_page', $post_id_del) )
    2224                        wp_die( __('You are not allowed to delete this page.') );
    23        
     25
    2426                    if ( $post_del->post_type == 'attachment' ) {
    2527                        if ( ! wp_delete_attachment($post_id_del) )
     
    3638                check_admin_referer('bulk-pages');
    3739                $_GET['post_status'] = $_GET['_status'];
    38    
     40
    3941                if ( -1 == $_GET['post_author'] )
    4042                    unset($_GET['post_author']);
    41    
     43
    4244                $done = bulk_edit_posts($_GET);
    4345            }
     
    5658    wp_redirect($sendback);
    5759    exit();
    58 } elseif ( !empty($_GET['_wp_http_referer']) ) {
    59      wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI'])));
     60} elseif ( isset($_GET['_wp_http_referer']) && ! empty($_GET['_wp_http_referer']) ) {
     61     wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) );
    6062     exit;
    6163}
     
    108110</div></div>
    109111
    110 <?php if ( isset($_GET['upd']) && (int) $_GET['upd'] ) { ?>
     112<div class="wrap">
     113
     114<?php if ( isset($_GET['upd']) || isset($_GET['skip']) ) { ?>
    111115<div id="message" class="updated fade"><p>
    112 <?php printf( __ngettext( '%d page updated.', '%d pages updated.', $_GET['upd'] ), number_format_i18n( $_GET['upd'] ) );
    113 unset($_GET['upd']);
    114    
    115     if ( isset($_GET['skip']) && (int) $_GET['skip'] ) {
    116         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'] ) );
    117         unset($_GET['skip']);
    118     } ?>
     116<?php if ( (int) $_GET['upd'] ) {
     117    printf( __ngettext( '%d page updated.', '%d pages updated.', $_GET['upd'] ), number_format_i18n( $_GET['upd'] ) );
     118    unset($_GET['upd']);
     119}
     120
     121if ( (int) $_GET['skip'] ) {
     122    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'] ) );
     123    unset($_GET['skip']);
     124} ?>
    119125</p></div>
    120126<?php } ?>
    121127
    122 <div class="wrap">
     128<?php if ( isset($_GET['posted']) && $_GET['posted'] ) : $_GET['posted'] = (int) $_GET['posted']; ?>
     129<div id="message" class="updated fade"><p><strong><?php _e('Your page has been saved.'); ?></strong> <a href="<?php echo get_permalink( $_GET['posted'] ); ?>"><?php _e('View page'); ?></a> | <a href="<?php echo get_edit_post_link( $_GET['posted'] ); ?>"><?php _e('Edit page'); ?></a></p></div>
     130<?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('posted'), $_SERVER['REQUEST_URI']);
     131endif; ?>
    123132
    124133<h2><?php
     
    159168</ul>
    160169
     170<form id="posts-filter" action="" method="get">
     171
    161172<?php if ( isset($_GET['post_status'] ) ) : ?>
    162173<input type="hidden" name="post_status" value="<?php echo attribute_escape($_GET['post_status']) ?>" />
    163 <?php endif;
    164 
    165 if ( isset($_GET['posted']) && $_GET['posted'] ) : $_GET['posted'] = (int) $_GET['posted']; ?>
    166 <div id="message" class="updated fade"><p><strong><?php _e('Your page has been saved.'); ?></strong> <a href="<?php echo get_permalink( $_GET['posted'] ); ?>"><?php _e('View page'); ?></a> | <a href="<?php echo get_edit_post_link( $_GET['posted'] ); ?>"><?php _e('Edit page'); ?></a></p></div>
    167 <?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('posted'), $_SERVER['REQUEST_URI']);
    168 endif;
    169 ?>
     174<?php endif; ?>
    170175
    171176<div class="tablenav">
     
    190195?>
    191196
    192 <form id="posts-filter" action="" method="get">
    193 
    194197<div class="alignleft">
    195198<select name="action">
    196 <option value="-1" selected><?php _e('Actions'); ?></option>
     199<option value="-1" selected="selected"><?php _e('Actions'); ?></option>
    197200<option value="edit"><?php _e('Edit'); ?></option>
    198201<option value="delete"><?php _e('Delete'); ?></option>
     
    219222  </tr>
    220223  </thead>
     224
     225  <tfoot>
     226  <tr>
     227<?php print_column_headers('page', false); ?>
     228  </tr>
     229  </tfoot>
     230
    221231  <tbody>
    222232  <?php page_rows($posts, $pagenum, $per_page); ?>
    223233  </tbody>
    224234</table>
     235
     236<div class="tablenav">
     237<?php
     238if ( $page_links )
     239    echo "<div class='tablenav-pages'>$page_links</div>";
     240?>
     241
     242<div class="alignleft">
     243<select name="action2">
     244<option value="-1" selected="selected"><?php _e('Actions'); ?></option>
     245<option value="edit"><?php _e('Edit'); ?></option>
     246<option value="delete"><?php _e('Delete'); ?></option>
     247</select>
     248<input type="submit" value="<?php _e('Apply'); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
     249</div>
     250
     251<br class="clear" />
     252</div>
     253
    225254</form>
    226255
     
    238267?>
    239268
    240 <div class="tablenav">
    241 <?php
    242 if ( $page_links )
    243     echo "<div class='tablenav-pages'>$page_links</div>";
    244 ?>
    245 <br class="clear" />
    246 </div>
    247269
    248270<?php
Note: See TracChangeset for help on using the changeset viewer.