From 48df0bbc2cecb765a791131f09b122d1571af82a Mon Sep 17 00:00:00 2001 From: ryan Date: Tue, 12 Feb 2008 05:51:53 +0000 Subject: [PATCH] Manage->Pages design update git-svn-id: http://svn.automattic.com/wordpress/trunk@6796 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/edit-pages.php | 76 +++++++++++-------- wp-admin/edit-post-rows.php | 1 + wp-admin/edit.php | 5 -- wp-admin/includes/post.php | 9 ++- wp-admin/includes/template.php | 130 ++++++++++++++++++++++++++++++--- 5 files changed, 173 insertions(+), 48 deletions(-) diff --git a/wp-admin/edit-pages.php b/wp-admin/edit-pages.php index 6aeed9355d..7a5a9b3b08 100644 --- a/wp-admin/edit-pages.php +++ b/wp-admin/edit-pages.php @@ -6,11 +6,12 @@ wp_enqueue_script( 'wp-lists' ); require_once('admin-header.php'); $post_stati = array( // array( adj, noun ) - 'publish' => array(__('Published'), __('Published pages')), - 'draft' => array(__('Draft'), __('Draft pages')), - 'private' => array(__('Private'), __('Private pages')) - ); - + 'publish' => array(__('Published'), __('Published pages'), __('Published (%s)')), + 'future' => array(__('Scheduled'), __('Scheduled pages'), __('Scheduled (%s)')), + 'pending' => array(__('Pending Review'), __('Pending pages'), __('Pending Review (%s)')), + 'draft' => array(__('Draft'), _c('Drafts|manage posts header'), _c('Draft (%s)|manage posts header')), + 'private' => array(__('Private'), __('Private pages'), __('Private (%s)')) + ); $post_status_label = __('Pages'); $post_status_q = ''; @@ -26,6 +27,7 @@ jQuery(function($){$('#the-list').wpList();}); /* ]]> */
+

-

+
    + -
    - -
    +$avail_post_stati = get_available_post_statuses('page'); + +$status_links = array(); +foreach ( $post_stati as $status => $label ) { + $class = ''; + if ( !in_array($status, $avail_post_stati) ) + continue; -
    - -
    + $num_posts = wp_count_posts('page', $status); + if ( $status == $_GET['post_status'] ) + $class = ' class="current"'; - 1 ) : ?> + $status_links[] = "
  • " . + sprintf($label[2], $num_posts) . ''; +} +$class = empty($_GET['post_status']) ? ' class="current"' : ''; +$status_links[] = "
  • All Pages"; +echo implode(' |
  • ', $status_links) . ''; +unset($status_links); +?> +
-
- $editable_ids, 'show_option_all' => __('Any'), 'name' => 'author', 'selected' => isset($_GET['author']) ? $_GET['author'] : 0) ); ?> -
+

+ + +

- +
- +
+ +
+ +
+ +
+

@@ -79,11 +96,10 @@ if ($posts) { - - - - - + + + + @@ -101,8 +117,6 @@ if ($posts) { } // end if ($posts) ?> -

- diff --git a/wp-admin/edit-post-rows.php b/wp-admin/edit-post-rows.php index 807335f68a..17ca71ea47 100644 --- a/wp-admin/edit-post-rows.php +++ b/wp-admin/edit-post-rows.php @@ -3,6 +3,7 @@ + diff --git a/wp-admin/edit.php b/wp-admin/edit.php index c29c310827..49000a90c2 100644 --- a/wp-admin/edit.php +++ b/wp-admin/edit.php @@ -25,11 +25,6 @@ endif;
- -

query( "UPDATE $wpdb->posts SET post_parent = $new_ID WHERE post_parent = $old_ID" ); } +function get_available_post_statuses($type = 'post') { + global $wpdb; + + $stati = $wpdb->get_col($wpdb->prepare("SELECT DISTINCT post_status FROM $wpdb->posts WHERE post_type = %s", $type)); + return $stati; +} + function wp_edit_posts_query( $q = false ) { global $wpdb; if ( false === $q ) @@ -495,7 +502,7 @@ function wp_edit_posts_query( $q = false ) { 'private' => array(__('Private'), __('Private posts'), __('Private (%s)')) ); - $avail_post_stati = $wpdb->get_col("SELECT DISTINCT post_status FROM $wpdb->posts WHERE post_type = 'post'"); + $avail_post_stati = get_available_post_statuses('post'); $post_status_q = ''; if ( isset($q['post_status']) && in_array( $q['post_status'], array_keys($post_stati) ) ) diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index 91bfdd56be..bfbbb3feaa 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -318,6 +318,24 @@ function wp_manage_posts_columns() { $posts_columns['status'] = __('Status'); $posts_columns = apply_filters('manage_posts_columns', $posts_columns); + return $posts_columns; +} + +function wp_manage_pages_columns() { + $posts_columns = array(); + $posts_columns['cb'] = '
'; + if ( 'draft' === $_GET['post_status'] ) + $posts_columns['modified'] = __('Modified'); + elseif ( 'pending' === $_GET['post_status'] ) + $posts_columns['modified'] = __('Submitted'); + else + $posts_columns['date'] = __('Date'); + $posts_columns['title'] = __('Title'); + $posts_columns['author'] = __('Author'); + if ( !in_array($_GET['post_status'], array('pending', 'draft', 'future')) ) + $posts_columns['comments'] = '
'; + $posts_columns['status'] = __('Status'); + $posts_columns = apply_filters('manage_pages_columns', $posts_columns); return $posts_columns; } @@ -337,19 +355,109 @@ function display_page_row( $page, &$children_pages, $level = 0 ) { $pad = str_repeat( '— ', $level ); $id = (int) $page->ID; $class = ('alternate' == $class ) ? '' : 'alternate'; - + $posts_columns = wp_manage_pages_columns(); ?>

- - - - - - - - + + + $column_display_name) { + + switch ($column_name) { + + case 'cb': + ?> + + + + + + + + + + + + + + + + + +
ID; ?> - - post_modified ) _e('Unpublished'); else echo mysql2date( __('Y-m-d g:i a'), $page->post_modified ); ?>" . __( 'Edit' ) . ""; } ?>" . __( 'Delete' ) . ""; } ?>
post_modified ) _e('Never'); else the_modified_time(__('Y/m/d \<\b\r \/\> g:i:s a')); ?> + post_date ) { + _e('Unpublished'); + } else { + if ( ( abs(time() - get_post_time()) ) < 86400 ) { + if ( ( 'future' == $page->post_status) ) + echo sprintf( __('%s from now'), human_time_diff( get_post_time() ) ); + else + echo sprintf( __('%s ago'), human_time_diff( get_post_time() ) ); + } else { + the_time(__('Y/m/d')); + } + } + ?> + post_status) _e(' — Private'); ?> + ID ); + $pending_phrase = sprintf( __('%s pending'), number_format( $left ) ); + if ( $left ) + echo ''; + comments_number("" . __('0') . '', "" . __('1') . '', "" . __('%') . ''); + if ( $left ) + echo ''; + ?> + + post_status ) { + case 'publish' : + case 'private' : + _e('Published'); + break; + case 'future' : + _e('Scheduled'); + break; + case 'pending' : + _e('Pending Review'); + break; + case 'draft' : + _e('Unpublished'); + break; + } + ?> +