Make WordPress Core


Ignore:
Timestamp:
09/28/2008 03:00:20 PM (17 years ago)
Author:
azaozz
Message:

Media library: move filter above tablenav

File:
1 edited

Legend:

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

    r9016 r9020  
    150150</div></form>
    151151</div></div>
     152
     153<?php
     154if ( isset($_GET['posted']) && (int) $_GET['posted'] ) {
     155    $_GET['message'] = '1';
     156    $_SERVER['REQUEST_URI'] = remove_query_arg(array('posted'), $_SERVER['REQUEST_URI']);
     157}
     158
     159$messages[1] = __('Media attachment updated.');
     160$messages[2] = __('Media deleted.');
     161$messages[3] = __('Error saving media attachment.');
     162
     163if ( isset($_GET['message']) && (int) $_GET['message'] )
     164    $message = $messages[$_GET['message']];
     165
     166if ( isset($message) ) { ?>
     167<div id="message" class="updated fade"><p><?php echo $message; ?></p></div>
     168<?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']);
     169}
     170?>
     171
     172<?php do_action('restrict_manage_posts'); ?>
    152173
    153174<div class="wrap">
     
    186207?></h2>
    187208
    188 <form id="posts-filter" action="" method="get">
    189209<ul class="subsubsub">
    190210<?php
     
    218238</ul>
    219239
    220 <?php
    221 if ( isset($_GET['posted']) && $_GET['posted'] ) : $_GET['posted'] = (int) $_GET['posted']; ?>
    222 <div id="message" class="updated fade"><p><strong><?php _e('Your media has been saved.'); ?></strong> <a href="<?php echo get_permalink( $_GET['posted'] ); ?>"><?php _e('View media'); ?></a> | <a href="<?php echo get_edit_post_link( $_GET['posted'] ); ?>"><?php _e('Edit media'); ?></a></p></div>
    223 <?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('posted'), $_SERVER['REQUEST_URI']);
    224 endif;
    225 
    226 $messages[1] = __('Media attachment updated.');
    227 $messages[2] = __('Media deleted.');
    228 $messages[3] = __('Error saving media attachment.');
    229 
    230 if ( isset($_GET['message']) && (int) $_GET['message'] )
    231     $message = $messages[$_GET['message']];
    232 
    233 if ( isset($message) ) { ?>
    234 <div id="message" class="updated fade"><p><?php echo $message; ?></p></div>
    235 <?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']);
    236 }
    237 ?>
    238 
    239 <?php do_action('restrict_manage_posts'); ?>
     240<div class="filter">
     241<form id="list-filter" action="" method="get">
     242<?php
     243if ( ! is_singular() && ! isset($_GET['detached']) ) {
     244    $arc_query = "SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts WHERE post_type = 'attachment' ORDER BY post_date DESC";
     245
     246    $arc_result = $wpdb->get_results( $arc_query );
     247
     248    $month_count = count($arc_result);
     249
     250    if ( $month_count && !( 1 == $month_count && 0 == $arc_result[0]->mmonth ) ) : ?>
     251<select name='m'>
     252<option<?php selected( @$_GET['m'], 0 ); ?> value='0'><?php _e('Show all dates'); ?></option>
     253<?php
     254foreach ($arc_result as $arc_row) {
     255    if ( $arc_row->yyear == 0 )
     256        continue;
     257    $arc_row->mmonth = zeroise( $arc_row->mmonth, 2 );
     258
     259    if ( $arc_row->yyear . $arc_row->mmonth == $_GET['m'] )
     260        $default = ' selected="selected"';
     261    else
     262        $default = '';
     263
     264    echo "<option$default value='$arc_row->yyear$arc_row->mmonth'>";
     265    echo $wp_locale->get_month($arc_row->mmonth) . " $arc_row->yyear";
     266    echo "</option>\n";
     267}
     268?>
     269</select>
     270<?php endif; // month_count ?>
     271
     272<input type="submit" id="post-query-submit" value="<?php _e('Filter'); ?>" class="button-secondary" />
     273
     274<?php } // ! is_singular ?>
     275</form></div>
     276
     277<form id="posts-filter" action="" method="get">
    240278
    241279<div class="tablenav">
    242 
    243280<?php
    244281if ( ! isset($page_links_total) )
     
    266303<input type="submit" id="submit" value="<?php _e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
    267304<?php wp_nonce_field('bulk-media'); ?>
    268 <?php
    269 
    270 if ( ! is_singular() && ! isset($_GET['detached']) ) {
    271     $arc_query = "SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts WHERE post_type = 'attachment' ORDER BY post_date DESC";
    272 
    273     $arc_result = $wpdb->get_results( $arc_query );
    274 
    275     $month_count = count($arc_result);
    276 
    277     if ( $month_count && !( 1 == $month_count && 0 == $arc_result[0]->mmonth ) ) : ?>
    278 <select name='m'>
    279 <option<?php selected( @$_GET['m'], 0 ); ?> value='0'><?php _e('Show all dates'); ?></option>
    280 <?php
    281 foreach ($arc_result as $arc_row) {
    282     if ( $arc_row->yyear == 0 )
    283         continue;
    284     $arc_row->mmonth = zeroise( $arc_row->mmonth, 2 );
    285 
    286     if ( $arc_row->yyear . $arc_row->mmonth == $_GET['m'] )
    287         $default = ' selected="selected"';
    288     else
    289         $default = '';
    290 
    291     echo "<option$default value='$arc_row->yyear$arc_row->mmonth'>";
    292     echo $wp_locale->get_month($arc_row->mmonth) . " $arc_row->yyear";
    293     echo "</option>\n";
    294 }
    295 ?>
    296 </select>
    297 <?php endif; // month_count ?>
    298 
    299 <input type="submit" id="post-query-submit" value="<?php _e('Filter'); ?>" class="button-secondary" />
    300 
    301 <?php } // ! is_singular ?>
    302305
    303306<?php if ( isset($_GET['detached']) ) { ?>
     
    428431<table class="widefat" style="margin-top: .5em">
    429432<thead>
    430   <tr>
    431     <th scope="col"><?php _e('Comment') ?></th>
    432     <th scope="col"><?php _e('Date') ?></th>
    433     <th scope="col"><?php _e('Actions') ?></th>
    434   </tr>
     433    <tr>
     434        <th scope="col"><?php _e('Comment') ?></th>
     435        <th scope="col"><?php _e('Date') ?></th>
     436        <th scope="col"><?php _e('Actions') ?></th>
     437    </tr>
    435438</thead>
    436439<tbody id="the-comment-list" class="list:comment">
    437440<?php
    438         foreach ($comments as $comment)
    439                 _wp_comment_row( $comment->comment_ID, 'detail', false, false );
     441        foreach ($comments as $comment)
     442            _wp_comment_row( $comment->comment_ID, 'detail', false, false );
    440443?>
    441444</tbody>
Note: See TracChangeset for help on using the changeset viewer.