WordPress.org

Make WordPress Core

Changeset 8860


Ignore:
Timestamp:
09/11/08 05:36:34 (7 years ago)
Author:
ryan
Message:

Column hiding for pages. see #7725

Location:
trunk
Files:
1 added
3 edited

Legend:

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

    r8857 r8860  
    4646wp_enqueue_script('admin-forms'); 
    4747wp_enqueue_script('inline-edit'); 
     48wp_enqueue_script('pages'); 
    4849 
    4950$post_stati  = array(   //  array( adj, noun ) 
     
    7879<div class="wrap"> 
    7980<form id="posts-filter" action="" method="get"> 
     81 
     82<div id="show-settings"><a href="#edit_settings" id="show-settings-link" class="hide-if-no-js"><?php _e('Show Settings') ?></a> 
     83<a href="#edit_settings" id="hide-settings-link" class="hide-if-js hide-if-no-js"><?php _e('Hide Settings') ?></a></div> 
     84 
     85<div id="edit-settings" class="hide-if-js hide-if-no-js"> 
     86<div id="edit-settings-wrap"> 
     87<h5><?php _e('Show on screen') ?></h5> 
     88<div class="metabox-prefs"> 
     89<?php manage_columns_prefs('page') ?> 
     90<br class="clear" /> 
     91</div></div> 
     92</div> 
     93 
    8094<h2><?php 
    8195// Use $_GET instead of is_ since they can override each other 
     
    176190  <thead> 
    177191  <tr> 
    178 <?php $posts_columns = wp_manage_pages_columns(); ?> 
    179 <?php foreach($posts_columns as $post_column_key => $column_display_name) { 
     192<?php 
     193$posts_columns = wp_manage_pages_columns(); 
     194$hidden = (array) get_user_option( 'manage-page-columns-hidden' ); 
     195foreach($posts_columns as $post_column_key => $column_display_name) { 
    180196    if ( 'cb' === $post_column_key ) 
    181197        $class = ' class="check-column"'; 
    182198    elseif ( 'comments' === $post_column_key ) 
    183         $class = ' class="num"'; 
     199        $class = ' class="manage-column column-comments num"'; 
     200    elseif ( 'modified' === $post_column_key ) 
     201        $class = ' class="manage-column column-date"'; 
    184202    else 
    185         $class = ''; 
    186 ?> 
    187     <th scope="col"<?php echo $class; ?>><?php echo $column_display_name; ?></th> 
     203        $class = " class=\"manage-column column-$post_column_key\""; 
     204 
     205    $style = ''; 
     206    if ( in_array($post_column_key, $hidden) ) 
     207        $style = ' style="display:none;"'; 
     208?> 
     209    <th scope="col"<?php echo "id=\"$post_column_key\""; echo $class; echo $style?>><?php echo $column_display_name; ?></th> 
    188210<?php } ?> 
    189211  </tr> 
     
    194216  </tbody> 
    195217</table> 
     218 
     219<?php wp_nonce_field( 'hiddencolumns', 'hiddencolumnsnonce', false ); ?> 
    196220 
    197221</form> 
  • trunk/wp-admin/includes/template.php

    r8858 r8860  
    892892    $class = ('alternate' == $class ) ? '' : 'alternate'; 
    893893    $posts_columns = wp_manage_pages_columns(); 
     894    $hidden = (array) get_user_option( 'manage-page-columns-hidden' ); 
    894895    $title = get_the_title(); 
    895896    if ( empty($title) ) 
     
    902903 
    903904foreach ($posts_columns as $column_name=>$column_display_name) { 
     905    $class = "class=\"$column_name column-$column_name\""; 
     906 
     907    $style = ''; 
     908    if ( in_array($column_name, $hidden) ) 
     909        $style = ' style="display:none;"'; 
     910 
     911    $attributes = "$class$style"; 
    904912 
    905913    switch ($column_name) { 
     
    912920    case 'modified': 
    913921    case 'date': 
     922        $attributes = 'class="date column-date"' . $style; 
    914923        if ( '0000-00-00 00:00:00' == $page->post_date && 'date' == $column_name ) { 
    915924            $t_time = $h_time = __('Unpublished'); 
     
    934943        } 
    935944        ?> 
    936         <td class="date"><abbr title="<?php echo $t_time ?>"><?php echo $h_time ?></abbr></td> 
     945        <td <?php echo $attributes ?>><abbr title="<?php echo $t_time ?>"><?php echo $h_time ?></abbr></td> 
    937946        <?php 
    938947        break; 
    939948    case 'title': 
     949        $attributes = 'class="post-title page-title column-title"' . $style; 
    940950        $edit_link = get_edit_post_link( $page->ID ); 
    941951        ?> 
    942         <td class="post-title"><strong><?php if ( current_user_can( 'edit_post', $page->ID ) ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo attribute_escape(sprintf(__('Edit "%s"'), $title)); ?>"><?php echo $pad; echo $title ?></a><?php } else { echo $pad; echo $title; } ?></strong> 
     952        <td <?php echo $attributes ?>><strong><?php if ( current_user_can( 'edit_post', $page->ID ) ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo attribute_escape(sprintf(__('Edit "%s"'), $title)); ?>"><?php echo $pad; echo $title ?></a><?php } else { echo $pad; echo $title; } ?></strong> 
    943953        <?php 
    944954        if ( !empty($post->post_password) ) { _e(' &#8212; <strong>Protected</strong>'); } elseif ('private' == $post->post_status) { _e(' &#8212; <strong>Private</strong>'); } 
    945  
    946         if ( 'excerpt' == $mode ) 
    947             the_excerpt(); 
    948955 
    949956        $actions = array(); 
     
    964971 
    965972    case 'comments': 
    966         ?> 
    967         <td class="comments num"><div class="post-com-count-wrapper"> 
     973        $attributes = 'class="comments column-comments num"' . $style; 
     974        ?> 
     975        <td <?php echo $attributes ?>><div class="post-com-count-wrapper"> 
    968976        <?php 
    969977        $left = get_pending_comments_num( $page->ID ); 
     
    981989    case 'author': 
    982990        ?> 
    983         <td class="author"><a href="edit-pages.php?author=<?php the_author_ID(); ?>"><?php the_author() ?></a></td> 
     991        <td <?php echo $attributes ?>><a href="edit-pages.php?author=<?php the_author_ID(); ?>"><?php the_author() ?></a></td> 
    984992        <?php 
    985993        break; 
     
    987995    case 'status': 
    988996        ?> 
    989         <td class="status"> 
     997        <td <?php echo $attributes ?>> 
    990998        <a href="<?php the_permalink(); ?>" title="<?php echo attribute_escape(sprintf(__('View "%s"'), $title)); ?>" rel="permalink"> 
    991999        <?php 
  • trunk/wp-includes/script-loader.php

    r8858 r8860  
    260260 
    261261        $scripts->add( 'posts', '/wp-admin/js/posts.js', array('columns'), '20080910' ); 
     262        $scripts->add( 'pages', '/wp-admin/js/pages.js', array('columns'), '20080910' ); 
    262263 
    263264        $scripts->add( 'columns', '/wp-admin/js/columns.js', false, '20080910' ); 
Note: See TracChangeset for help on using the changeset viewer.