Make WordPress Core

Changeset 8894


Ignore:
Timestamp:
09/15/2008 05:53:30 PM (18 years ago)
Author:
ryan
Message:

Column hiding for media library. see #7725

Location:
trunk
Files:
1 added
4 edited

Legend:

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

    r8682 r8894  
    1313        <tr>
    1414
    15 <?php $posts_columns = wp_manage_media_columns(); ?>
    16 <?php foreach($posts_columns as $post_column_key => $column_display_name) {
     15<?php
     16$posts_columns = wp_manage_media_columns();
     17$hidden = (array) get_user_option( 'manage-media-columns-hidden' );
     18?>
     19<?php foreach ($posts_columns as $post_column_key => $column_display_name ) {
    1720        if ( 'cb' === $post_column_key )
    1821                $class = ' class="check-column"';
    1922        elseif ( 'comments' === $post_column_key )
    20                 $class = ' class="num"';
     23                $class = ' class="manage-column column-comments num"';
     24        elseif ( 'modified' === $post_column_key )
     25                $class = ' class="manage-column column-date"';
    2126        else
    22                 $class = '';
    23 ?>
    24         <th scope="col"<?php echo $class; ?>><?php echo $column_display_name; ?></th>
     27                $class = " class=\"manage-column column-$post_column_key\"";
     28
     29        $style = '';
     30        if ( in_array($post_column_key, $hidden) )
     31                $style = ' style="display:none;"';
     32?>
     33        <th scope="col"<?php echo "id=\"$post_column_key\""; echo $class; echo $style?>><?php echo $column_display_name; ?></th>
    2534<?php } ?>
    2635
    … …  
    4554<?php
    4655
    47 foreach($posts_columns as $column_name=>$column_display_name) {
     56foreach ($posts_columns as $column_name => $column_display_name ) {
     57        $class = "class=\"$column_name column-$column_name\"";
     58
     59        $style = '';
     60        if ( in_array($column_name, $hidden) )
     61                $style = ' style="display:none;"';
     62
     63        $attributes = "$class$style";
    4864
    4965        switch($column_name) {
    … …  
    5167        case 'cb':
    5268                ?>
    53                 <th scope="row" class="check-column"><input type="checkbox" name="media[]" value="<?php the_ID(); ?>" /></th>
     69                <th scope="row" <?php echo $attributes ?>><input type="checkbox" name="media[]" value="<?php the_ID(); ?>" /></th>
    5470                <?php
    5571                break;
    5672
    5773        case 'icon':
     74                $attributes = 'class="post-title column-title"' . $style;
    5875                ?>
    5976                <td class="media-icon"><?php
    … …  
    7390        case 'media':
    7491                ?>
    75                 <td><strong><a href="<?php echo get_edit_post_link( $post->ID ); ?>" title="<?php echo attribute_escape(sprintf(__('Edit "%s"'), $att_title)); ?>"><?php echo $att_title; ?></a></strong><br />
     92                <td <?php echo $attributes ?>><strong><a href="<?php echo get_edit_post_link( $post->ID ); ?>" title="<?php echo attribute_escape(sprintf(__('Edit "%s"'), $att_title)); ?>"><?php echo $att_title; ?></a></strong><br />
    7693                <?php echo strtoupper(preg_replace('/^.*?\.(\w+)$/', '$1', get_attached_file($post->ID))); ?>
    7794                <p>
    … …  
    87104        case 'tags':
    88105                ?>
    89                 <td><?php
     106                <td <?php echo $attributes ?>><?php
    90107                $tags = get_the_tags();
    91108                if ( !empty( $tags ) ) {
    … …  
    103120        case 'desc':
    104121                ?>
    105                 <td><?php echo has_excerpt() ? $post->post_excerpt : ''; ?></td>
     122                <td <?php echo $attributes ?>><?php echo has_excerpt() ? $post->post_excerpt : ''; ?></td>
    106123                <?php
    107124                break;
    … …  
    124141                }
    125142                ?>
    126                 <td><?php echo $h_time ?></td>
     143                <td <?php echo $attributes ?>><?php echo $h_time ?></td>
    127144                <?php
    128145                break;
    … …  
    137154                        }
    138155                        ?>
    139                         <td><strong><a href="<?php echo get_edit_post_link( $post->post_parent ); ?>"><?php echo $title ?></a></strong>, <?php echo get_the_time(__('Y/m/d')); ?></td>
     156                        <td <?php echo $attributes ?>><strong><a href="<?php echo get_edit_post_link( $post->post_parent ); ?>"><?php echo $title ?></a></strong>, <?php echo get_the_time(__('Y/m/d')); ?></td>
    140157                        <?php
    141158                } else {
    142159                        ?>
    143                         <td>&nbsp;</td>
     160                        <td <?php echo $attributes ?>>&nbsp;</td>
    144161                        <?php
    145162                }
    … …  
    148165
    149166        case 'comments':
    150                 ?>
    151                 <td class="num"><div class="post-com-count-wrapper">
     167                $attributes = 'class="comments column-comments num"' . $style;
     168                ?>
     169                <td <?php echo $attributes ?>><div class="post-com-count-wrapper">
    152170                <?php
    153171                $left = get_pending_comments_num( $post->ID );
    … …  
    165183        case 'actions':
    166184                ?>
    167                 <td>
     185                <td <?php echo $attributes ?>>
    168186                <a href="media.php?action=edit&amp;attachment_id=<?php the_ID(); ?>" title="<?php echo attribute_escape(sprintf(__('Edit "%s"'), $att_title)); ?>"><?php _e('Edit'); ?></a> |
    169187                <a href="<?php the_permalink(); ?>"><?php _e('Get permalink'); ?></a>
    … …  
    174192        default:
    175193                ?>
    176                 <td><?php do_action('manage_media_custom_column', $column_name, $id); ?></td>
     194                <td <?php echo $attributes ?>><?php do_action('manage_media_custom_column', $column_name, $id); ?></td>
    177195                <?php
    178196                break;
  • trunk/wp-admin/includes/template.php

    r8889 r8894  
    372372        $posts_columns['date'] = _c('Date Added|media column header');
    373373        $posts_columns['parent'] = _c('Appears with|media column header');
    374         $posts_columns['comments'] = '<div class="vers"><img alt="Comments" src="images/comment-grey-bubble.png" /></div>';
     374        //$posts_columns['comments'] = '<div class="vers"><img alt="Comments" src="images/comment-grey-bubble.png" /></div>';
     375        $posts_columns['comments'] = __('Comments');
    375376//      $posts_columns['actions'] = _c('Actions|media column header');
    376377        $posts_columns = apply_filters('manage_media_columns', $posts_columns);
    … …  
    19931994        foreach ( $columns as $column => $title ) {
    19941995                // Can't hide these
    1995                 if ( 'cb' == $column || 'title' == $column || 'name' == $column )
     1996                if ( 'cb' == $column || 'title' == $column || 'name' == $column || 'media' == $column )
    19961997                        continue;
     1998                if ( empty($title) )
     1999                        continue;
     2000
    19972001                if ( 'comments' == $column )
    19982002                        $title = __('Comments');
  • trunk/wp-admin/upload.php

    r8867 r8894  
    4949$parent_file = 'edit.php';
    5050wp_enqueue_script( 'admin-forms' );
     51wp_enqueue_script('media');
    5152
    5253list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query();
    … …  
    7576
    7677<form id="posts-filter" action="" method="get">
     78
     79<div id="show-settings"><a href="#edit_settings" id="show-settings-link" class="hide-if-no-js"><?php _e('Advanced Options') ?></a>
     80<a href="#edit_settings" id="hide-settings-link" class="hide-if-js hide-if-no-js"><?php _e('Hide Options') ?></a></div>
     81
     82<div id="edit-settings" class="hide-if-js hide-if-no-js">
     83<div id="edit-settings-wrap">
     84<h5><?php _e('Show on screen') ?></h5>
     85<div class="metabox-prefs">
     86<?php manage_columns_prefs('media') ?>
     87<br class="clear" />
     88</div></div>
     89</div>
     90
    7791<h2><?php
    7892if ( is_singular() ) {
    … …  
    215229<?php include( 'edit-attachment-rows.php' ); ?>
    216230
     231<?php wp_nonce_field( 'hiddencolumns', 'hiddencolumnsnonce', false ); ?>
     232
    217233</form>
    218234
  • trunk/wp-includes/script-loader.php

    r8888 r8894  
    264264                $scripts->add( 'pages', '/wp-admin/js/pages.js', array('columns'), '20080910' );
    265265                $scripts->add( 'links', '/wp-admin/js/links.js', array('columns'), '20080913' );
     266                $scripts->add( 'media', '/wp-admin/js/media.js', array('columns'), '20080915' );
    266267
    267268                $scripts->add( 'columns', '/wp-admin/js/columns.js', false, '20080910' );
Note: See TracChangeset for help on using the changeset viewer.