Changeset 6796
- Timestamp:
- 02/12/2008 05:51:53 AM (17 years ago)
- Location:
- trunk/wp-admin
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/edit-pages.php
r6726 r6796 7 7 8 8 $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 ); 14 15 15 16 $post_status_label = __('Pages'); … … 27 28 </script> 28 29 <div class="wrap"> 30 <form id="posts-filter" action="" method="get"> 29 31 <h2><?php 30 32 // Use $_GET instead of is_ since they can override each other … … 38 40 ?></h2> 39 41 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 »'); ?></a></p> 42 <ul class="subsubsub"> 43 <?php 41 44 42 <form name="searchform" id="searchform" action="" method="get"> 43 <fieldset><legend><?php _e('Search Terms…') ?></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(); 48 foreach ( $post_stati as $status => $label ) { 49 $class = ''; 46 50 51 if ( !in_array($status, $avail_post_stati) ) 52 continue; 47 53 48 <fieldset><legend><?php _e('Page Type…'); ?></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"'; 56 57 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>"; 63 echo implode(' |</li>', $status_links) . '</li>'; 64 unset($status_links); 65 ?> 66 </ul> 58 67 59 <fieldset><legend><?php _e('Author…'); ?></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> 62 72 63 < ?php endif; ?>73 <br style="clear:both;" /> 64 74 65 <input type="submit" id="post-query-submit" value="<?php _e('Filter »'); ?>" 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> 66 83 </form> 67 84 … … 80 97 <thead> 81 98 <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 } ?> 87 103 </tr> 88 104 </thead> … … 102 118 ?> 103 119 104 <h3><a href="page-new.php"><?php _e('Create New Page »'); ?></a></h3>105 106 120 </div> 107 121 -
trunk/wp-admin/edit-post-rows.php
r6793 r6796 4 4 <tr> 5 5 6 <?php $posts_columns = wp_manage_posts_columns(); ?> 6 7 <?php foreach($posts_columns as $column_display_name) { ?> 7 8 <th scope="col"><?php echo $column_display_name; ?></th> -
trunk/wp-admin/edit.php
r6778 r6796 25 25 26 26 <div class="wrap"> 27 28 <?php29 $posts_columns = wp_manage_posts_columns();30 31 ?>32 27 33 28 <form id="posts-filter" action="" method="get"> -
trunk/wp-admin/includes/post.php
r6794 r6796 482 482 } 483 483 484 function 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 484 491 function wp_edit_posts_query( $q = false ) { 485 492 global $wpdb; … … 496 503 ); 497 504 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'); 499 506 500 507 $post_status_q = ''; -
trunk/wp-admin/includes/template.php
r6792 r6796 319 319 $posts_columns = apply_filters('manage_posts_columns', $posts_columns); 320 320 321 return $posts_columns; 322 } 323 324 function 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); 321 339 322 340 return $posts_columns; … … 338 356 $id = (int) $page->ID; 339 357 $class = ('alternate' == $class ) ? '' : 'alternate'; 340 358 $posts_columns = wp_manage_pages_columns(); 341 359 ?> 342 360 <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&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&post=$id", 'delete-page_' . $id ) . "' class='delete:the-list:page-$id delete'>" . __( 'Delete' ) . "</a>"; } ?></td> 352 </tr> 361 362 363 <?php 364 365 foreach ($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(' — <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&c=1' title='$pending_phrase' class='post-com-count comment-count'><span>" . __('0') . '</span></a>', "<a href='edit.php?p=$id&c=1' title='$pending_phrase' class='post-com-count comment-count'><span>" . __('1') . '</span></a>', "<a href='edit.php?p=$id&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> 353 461 354 462 <?php
Note: See TracChangeset
for help on using the changeset viewer.