Make WordPress Core

Changeset 6796


Ignore:
Timestamp:
02/12/2008 05:51:53 AM (16 years ago)
Author:
ryan
Message:

Manage->Pages design update

Location:
trunk/wp-admin
Files:
5 edited

Legend:

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

    r6726 r6796  
    77
    88$post_stati  = array(   //  array( adj, noun )
    9             'publish' => array(__('Published'), __('Published pages')),
    10             'draft'   => array(__('Draft'), __('Draft pages')),
    11             'private' => array(__('Private'), __('Private pages'))
    12         );
    13 
     9        'publish' => array(__('Published'), __('Published pages'), __('Published (%s)')),
     10        'future' => array(__('Scheduled'), __('Scheduled pages'), __('Scheduled (%s)')),
     11        'pending' => array(__('Pending Review'), __('Pending pages'), __('Pending Review (%s)')),
     12        'draft' => array(__('Draft'), _c('Drafts|manage posts header'), _c('Draft (%s)|manage posts header')),
     13        'private' => array(__('Private'), __('Private pages'), __('Private (%s)'))
     14    );
    1415
    1516$post_status_label = __('Pages');
     
    2728</script>
    2829<div class="wrap">
     30<form id="posts-filter" action="" method="get">
    2931<h2><?php
    3032// Use $_GET instead of is_ since they can override each other
     
    3840?></h2>
    3941
    40 <p><?php _e('Pages are like posts except they live outside of the normal blog chronology and can be hierarchical. You can use pages to organize and manage any amount of content.'); ?> <a href="page-new.php"><?php _e('Create a new page &raquo;'); ?></a></p>
     42<ul class="subsubsub">
     43<?php
    4144
    42 <form name="searchform" id="searchform" action="" method="get">
    43     <fieldset><legend><?php _e('Search Terms&hellip;') ?></legend>
    44         <input type="text" name="s" id="s" value="<?php echo attribute_escape( stripslashes( $_GET['s'] ) ); ?>" size="17" />
    45     </fieldset>
     45$avail_post_stati = get_available_post_statuses('page');
     46   
     47$status_links = array();
     48foreach ( $post_stati as $status => $label ) {
     49    $class = '';
    4650
     51    if ( !in_array($status, $avail_post_stati) )
     52        continue;
    4753
    48     <fieldset><legend><?php _e('Page Type&hellip;'); ?></legend>
    49         <select name='post_status'>
    50             <option<?php selected( @$_GET['post_status'], 0 ); ?> value='0'><?php _e('Any'); ?></option>
    51 <?php   foreach ( $post_stati as $status => $label ) : ?>
    52             <option<?php selected( @$_GET['post_status'], $status ); ?> value='<?php echo $status; ?>'><?php echo $label[0]; ?></option>
    53 <?php   endforeach; ?>
    54         </select>
    55     </fieldset>
     54    $num_posts = wp_count_posts('page', $status);
     55    if ( $status == $_GET['post_status'] )
     56        $class = ' class="current"';
    5657
    57 <?php $editable_ids = get_editable_user_ids( $user_ID ); if ( $editable_ids && count( $editable_ids ) > 1 ) : ?>
     58    $status_links[] = "<li><a href=\"edit-pages.php?post_status=$status\"$class>" .
     59    sprintf($label[2], $num_posts) . '</a>';
     60}
     61$class = empty($_GET['post_status']) ? ' class="current"' : '';
     62$status_links[] = "<li><a href=\"edit-pages.php\"$class>All Pages</a>";
     63echo implode(' |</li>', $status_links) . '</li>';
     64unset($status_links);
     65?>
     66</ul>
    5867
    59     <fieldset><legend><?php _e('Author&hellip;'); ?></legend>
    60         <?php wp_dropdown_users( array('include' => $editable_ids, 'show_option_all' => __('Any'), 'name' => 'author', 'selected' => isset($_GET['author']) ? $_GET['author'] : 0) ); ?>
    61     </fieldset>
     68<p id="post-search">
     69    <input type="text" id="post-search-input" name="s" value="<?php the_search_query(); ?>" />
     70    <input type="submit" value="<?php _e( 'Search Posts' ); ?>" />
     71</p>
    6272
    63 <?php endif; ?>
     73<br style="clear:both;" />
    6474
    65     <input type="submit" id="post-query-submit" value="<?php _e('Filter &#187;'); ?>" class="button" />
     75<div class="tablenav">
     76
     77<div style="float: left">
     78<input type="button" value="<?php _e('Delete'); ?>" name="deleteit" />
     79</div>
     80
     81<br style="clear:both;" />
     82</div>
    6683</form>
    6784
     
    8097  <thead>
    8198  <tr>
    82     <th scope="col" style="text-align: center"><?php _e('ID') ?></th>
    83     <th scope="col"><?php _e('Title') ?></th>
    84     <th scope="col"><?php _e('Owner') ?></th>
    85     <th scope="col"><?php _e('Updated') ?></th>
    86     <th scope="col" colspan="3" style="text-align: center"><?php _e('Action'); ?></th>
     99<?php $posts_columns = wp_manage_pages_columns(); ?>
     100<?php foreach($posts_columns as $column_display_name) { ?>
     101    <th scope="col"><?php echo $column_display_name; ?></th>
     102<?php } ?>
    87103  </tr>
    88104  </thead>
     
    102118?>
    103119
    104 <h3><a href="page-new.php"><?php _e('Create New Page &raquo;'); ?></a></h3>
    105 
    106120</div>
    107121
  • trunk/wp-admin/edit-post-rows.php

    r6793 r6796  
    44    <tr>
    55
     6<?php $posts_columns = wp_manage_posts_columns(); ?>
    67<?php foreach($posts_columns as $column_display_name) { ?>
    78    <th scope="col"><?php echo $column_display_name; ?></th>
  • trunk/wp-admin/edit.php

    r6778 r6796  
    2525
    2626<div class="wrap">
    27 
    28 <?php
    29 $posts_columns = wp_manage_posts_columns();
    30 
    31 ?>
    3227
    3328<form id="posts-filter" action="" method="get">
  • trunk/wp-admin/includes/post.php

    r6794 r6796  
    482482}
    483483
     484function get_available_post_statuses($type = 'post') {
     485    global $wpdb;
     486
     487    $stati = $wpdb->get_col($wpdb->prepare("SELECT DISTINCT post_status FROM $wpdb->posts WHERE post_type = %s", $type));
     488    return $stati;
     489}
     490
    484491function wp_edit_posts_query( $q = false ) {
    485492    global $wpdb;
     
    496503            );
    497504
    498     $avail_post_stati = $wpdb->get_col("SELECT DISTINCT post_status FROM $wpdb->posts WHERE post_type = 'post'");
     505    $avail_post_stati = get_available_post_statuses('post');
    499506
    500507    $post_status_q = '';
  • trunk/wp-admin/includes/template.php

    r6792 r6796  
    319319    $posts_columns = apply_filters('manage_posts_columns', $posts_columns);
    320320
     321    return $posts_columns;
     322}
     323
     324function wp_manage_pages_columns() {
     325    $posts_columns = array();
     326    $posts_columns['cb'] = '<div style="text-align: center"><input type="checkbox" name="TODO" /></div>';
     327    if ( 'draft' === $_GET['post_status'] )
     328        $posts_columns['modified'] = __('Modified');
     329    elseif ( 'pending' === $_GET['post_status'] )
     330        $posts_columns['modified'] = __('Submitted');
     331    else
     332        $posts_columns['date'] = __('Date');
     333    $posts_columns['title'] = __('Title');
     334    $posts_columns['author'] = __('Author');
     335    if ( !in_array($_GET['post_status'], array('pending', 'draft', 'future')) )
     336        $posts_columns['comments'] = '<div style="text-align: center"><img alt="" src="images/comment-grey-bubble.png" /></div>';
     337    $posts_columns['status'] = __('Status');
     338    $posts_columns = apply_filters('manage_pages_columns', $posts_columns);
    321339
    322340    return $posts_columns;
     
    338356    $id = (int) $page->ID;
    339357    $class = ('alternate' == $class ) ? '' : 'alternate';
    340 
     358    $posts_columns = wp_manage_pages_columns();
    341359?>
    342360  <tr id='page-<?php echo $id; ?>' class='<?php echo $class; ?>'>
    343     <th scope="row" style="text-align: center"><?php echo $page->ID; ?></th>
    344     <td>
    345       <?php echo $pad; ?><?php the_title(); ?>
    346     </td>
    347     <td><?php the_author() ?></td>
    348     <td><?php if ( '0000-00-00 00:00:00' ==$page->post_modified ) _e('Unpublished'); else echo mysql2date( __('Y-m-d g:i a'), $page->post_modified ); ?></td>
    349     <td><a href="<?php the_permalink(); ?>" rel="permalink" class="view"><?php _e( 'View' ); ?></a></td>
    350     <td><?php if ( current_user_can( 'edit_page', $id ) ) { echo "<a href='page.php?action=edit&amp;post=$id' class='edit'>" . __( 'Edit' ) . "</a>"; } ?></td>
    351     <td><?php if ( current_user_can( 'delete_page', $id ) ) { echo "<a href='" . wp_nonce_url( "page.php?action=delete&amp;post=$id", 'delete-page_' . $id ) .  "' class='delete:the-list:page-$id delete'>" . __( 'Delete' ) . "</a>"; } ?></td>
    352   </tr>
     361 
     362 
     363 <?php
     364
     365foreach ($posts_columns as $column_name=>$column_display_name) {
     366
     367    switch ($column_name) {
     368
     369    case 'cb':
     370        ?>
     371        <th scope="row" style="text-align: center"><input type="checkbox" name="delete[]" value="<?php the_ID(); ?>" /></th>
     372        <?php
     373        break;
     374    case 'modified':
     375        ?>
     376        <td><?php if ( '0000-00-00 00:00:00' ==$page->post_modified ) _e('Never'); else the_modified_time(__('Y/m/d \<\b\r \/\> g:i:s a')); ?></td>
     377        <?php
     378        break;
     379    case 'date':
     380        ?>
     381        <td><a href="<?php the_permalink(); ?>" rel="permalink">
     382        <?php
     383        if ( '0000-00-00 00:00:00' ==$page->post_date ) {
     384            _e('Unpublished');
     385        } else {
     386            if ( ( abs(time() - get_post_time()) ) < 86400 ) {
     387                if ( ( 'future' == $page->post_status) )
     388                    echo sprintf( __('%s from now'), human_time_diff( get_post_time() ) );
     389                else
     390                    echo sprintf( __('%s ago'), human_time_diff( get_post_time() ) );
     391            } else {
     392                the_time(__('Y/m/d'));
     393            }
     394        }
     395        ?></a></td>
     396        <?php
     397        break;
     398    case 'title':
     399        ?>
     400        <td><strong><a href="page.php?action=edit&post=<?php the_ID(); ?>"><?php echo $pad; the_title() ?></a></strong>
     401        <?php if ('private' == $page->post_status) _e(' &#8212; <strong>Private</strong>'); ?></td>
     402        <?php
     403        break;
     404
     405    case 'comments':
     406        ?>
     407        <td style="text-align: center">
     408        <?php
     409        $left = get_pending_comments_num( $page->ID );
     410        $pending_phrase = sprintf( __('%s pending'), number_format( $left ) );
     411        if ( $left )
     412            echo '<strong>';
     413        comments_number("<a href='edit.php?p=$id&amp;c=1' title='$pending_phrase' class='post-com-count comment-count'><span>" . __('0') . '</span></a>', "<a href='edit.php?p=$id&amp;c=1' title='$pending_phrase' class='post-com-count comment-count'><span>" . __('1') . '</span></a>', "<a href='edit.php?p=$id&amp;c=1' title='$pending_phrase' class='post-com-count comment-count'><span>" . __('%') . '</span></a>');
     414        if ( $left )
     415            echo '</strong>';
     416        ?>
     417        </td>
     418        <?php
     419        break;
     420
     421    case 'author':
     422        ?>
     423        <td><a href="edit-pages.php?author=<?php the_author_ID(); ?>"><?php the_author() ?></a></td>
     424        <?php
     425        break;
     426
     427    case 'status':
     428        ?>
     429        <td>
     430        <?php
     431        switch ( $page->post_status ) {
     432            case 'publish' :
     433            case 'private' :
     434                _e('Published');
     435                break;
     436            case 'future' :
     437                _e('Scheduled');
     438                break;
     439            case 'pending' :
     440                _e('Pending Review');
     441                break;
     442            case 'draft' :
     443                _e('Unpublished');
     444                break;
     445        }
     446        ?>
     447        </td>
     448        <?php
     449        break;
     450
     451    default:
     452        ?>
     453        <td><?php do_action('manage_pages_custom_column', $column_name, $id); ?></td>
     454        <?php
     455        break;
     456    }
     457}
     458 ?>
     459 
     460   </tr>
    353461
    354462<?php
Note: See TracChangeset for help on using the changeset viewer.