Changeset 8858
- Timestamp:
- 09/11/2008 01:46:30 AM (16 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-ajax.php
r8857 r8858 705 705 update_usermeta($current_user->ID, 'meta-box-hidden_'.$page, $hidden); 706 706 break; 707 case 'hidden-columns' : 708 check_ajax_referer( 'hiddencolumns', 'hiddencolumnsnonce' ); 709 $hidden = isset( $_POST['hidden'] )? $_POST['hidden'] : ''; 710 $hidden = explode( ',', $_POST['hidden'] ); 711 $page = isset( $_POST['page'] )? $_POST['page'] : ''; 712 if ( !preg_match( '/^[a-z-]+$/', $page ) ) { 713 die(-1); 714 } 715 $current_user = wp_get_current_user(); 716 if ( is_array($hidden) ) 717 update_usermeta($current_user->ID, "manage-$page-columns-hidden", $hidden); 707 718 case 'get-permalink': 708 719 check_ajax_referer( 'getpermalink', 'getpermalinknonce' ); -
trunk/wp-admin/edit-post-rows.php
r8857 r8858 13 13 <tr> 14 14 15 <?php $posts_columns = wp_manage_posts_columns(); ?> 16 <?php foreach($posts_columns as $post_column_key => $column_display_name) { 15 <?php 16 $posts_columns = wp_manage_posts_columns(); 17 $hidden = (array) get_user_option( 'manage-post-columns-hidden' ); 18 foreach ( $posts_columns as $post_column_key => $column_display_name ) { 17 19 if ( 'cb' === $post_column_key ) 18 20 $class = ' class="check-column"'; 19 21 elseif ( 'comments' === $post_column_key ) 20 $class = ' class="num"'; 22 $class = ' class="manage-column column-comments num"'; 23 elseif ( 'modified' === $post_column_key ) 24 $class = ' class="manage-column column-date"'; 21 25 else 22 $class = ''; 26 $class = " class=\"manage-column column-$post_column_key\""; 27 28 $style = ''; 29 if ( in_array($post_column_key, $hidden) ) 30 $style = ' style="display:none;"'; 23 31 ?> 24 <th scope="col"<?php echo $class;?>><?php echo $column_display_name; ?></th>32 <th scope="col"<?php echo "id=\"$post_column_key\""; echo $class; echo $style?>><?php echo $column_display_name; ?></th> 25 33 <?php } ?> 26 34 -
trunk/wp-admin/edit.php
r8857 r8858 52 52 wp_enqueue_script('admin-forms'); 53 53 wp_enqueue_script('inline-edit'); 54 54 wp_enqueue_script('posts'); 55 55 56 56 list($post_stati, $avail_post_stati) = wp_edit_posts_query(); … … 75 75 76 76 <form id="posts-filter" action="" method="get"> 77 78 <div id="show-settings"><a href="#edit_settings" id="show-settings-link" class="hide-if-no-js"><?php _e('Show Settings') ?></a> 79 <a href="#edit_settings" id="hide-settings-link" class="hide-if-js hide-if-no-js"><?php _e('Hide Settings') ?></a></div> 80 81 <div id="edit-settings" class="hide-if-js hide-if-no-js"> 82 <div id="edit-settings-wrap"> 83 <h5><?php _e('Show on screen') ?></h5> 84 <div class="metabox-prefs"> 85 <?php manage_columns_prefs('post') ?> 86 <br class="clear" /> 87 </div></div> 88 </div> 89 77 90 <h2><?php 78 91 if ( is_single() ) { … … 227 240 <?php include( 'edit-post-rows.php' ); ?> 228 241 242 <?php wp_nonce_field( 'hiddencolumns', 'hiddencolumnsnonce', false ); ?> 243 229 244 </form> 230 245 -
trunk/wp-admin/includes/template.php
r8857 r8858 417 417 echo '<tr id="inline-edit" style="display: none">'; 418 418 $columns = $type == 'post' ? wp_manage_posts_columns() : wp_manage_pages_columns(); 419 $hidden = (array) get_user_option( "manage-$type-columns-hidden" ); 419 420 foreach($columns as $column_name=>$column_display_name) { 421 $class = "class=\"$column_name column-$column_name\""; 422 423 $style = ''; 424 if ( in_array($column_name, $hidden) ) 425 $style = ' style="display:none;"'; 426 427 $attributes = "$class$style"; 420 428 421 429 switch($column_name) { … … 427 435 428 436 case 'modified': 429 case 'date': ?> 430 <td class="date"> 437 case 'date': 438 $attributes = 'class="date column-date"' . $style; 439 ?> 440 <td class="date"<?php echo $style ?>> 431 441 <?php touch_time(1, 1, 4, 1); ?> 432 442 </td> … … 434 444 break; 435 445 436 case 'title': ?> 437 <td class="<?php echo $type ?>-title"> 446 case 'title': 447 $attributes = "class=\"$type-title column-title\"" . $style; 448 ?> 449 <td <?php echo $attributes ?>> 438 450 <div class="title"> 439 451 <input type="text" name="post_title" class="title" value="" /><br /> 440 452 <label><?php _e('Slug'); ?></label><input type="text" name="post_name" value="" class="slug" /> 441 453 </div> 442 <?php if ($type == 'page'): ?>454 <?php if ($type == 'page'): ?> 443 455 <div class="other"> 444 456 <label><?php _e('Parent'); ?></label> … … 476 488 477 489 case 'categories': ?> 478 <td class="categories">490 <td <?php echo $attributes ?>> 479 491 <ul class="categories"> 480 492 <?php wp_category_checklist() ?> … … 485 497 486 498 case 'tags': ?> 487 <td class="tags">499 <td <?php echo $attributes ?>> 488 500 <textarea name="tags_input"></textarea> 489 501 </td> … … 491 503 break; 492 504 493 case 'comments': ?> 494 <td class="comments num"> 505 case 'comments': 506 $attributes = 'class="comments column-comments num"' . $style; 507 ?> 508 <td <?php echo $attributes ?>> 495 509 <input title="Allow Comments" type="checkbox" name="comment_status" value="open" /><br /> 496 510 <input title="Allow Pings" type="checkbox" name="ping_status" value="open" /> … … 500 514 501 515 case 'author': ?> 502 <td class="author">516 <td <?php echo $attributes ?>> 503 517 <?php 504 518 $authors = get_editable_user_ids( $current_user->id ); // TODO: ROLE SYSTEM … … 514 528 515 529 case 'status': ?> 516 <td class="status">530 <td <?php echo $attributes ?>> 517 531 <select name="post_status"> 518 532 <?php if ( current_user_can('publish_posts') ) : // Contributors only get "Unpublished" and "Pending Review" ?> … … 675 689 <?php 676 690 $posts_columns = wp_manage_posts_columns(); 677 foreach($posts_columns as $column_name=>$column_display_name) { 678 679 switch($column_name) { 691 $hidden = (array) get_user_option( 'manage-post-columns-hidden' ); 692 foreach ( $posts_columns as $column_name=>$column_display_name ) { 693 $class = "class=\"$column_name column-$column_name\""; 694 695 $style = ''; 696 if ( in_array($column_name, $hidden) ) 697 $style = ' style="display:none;"'; 698 699 $attributes = "$class$style"; 700 701 switch ($column_name) { 680 702 681 703 case 'cb': … … 687 709 case 'modified': 688 710 case 'date': 711 $attributes = 'class="date column-date"' . $style; 689 712 if ( '0000-00-00 00:00:00' == $post->post_date && 'date' == $column_name ) { 690 713 $t_time = $h_time = __('Unpublished'); … … 710 733 711 734 if ( 'excerpt' == $mode ) { ?> 712 <td class="date"><?php echo apply_filters('post_date_column_time', $t_time, $post, $column_name, $mode) ?></td>735 <td <?php echo $attributes ?>><?php echo apply_filters('post_date_column_time', $t_time, $post, $column_name, $mode) ?></td> 713 736 <?php } else { ?> 714 <td class="date"><abbr title="<?php echo $t_time ?>"><?php echo apply_filters('post_date_column_time', $h_time, $post, $column_name, $mode) ?></abbr></td>737 <td <?php echo $attributes ?>><abbr title="<?php echo $t_time ?>"><?php echo apply_filters('post_date_column_time', $h_time, $post, $column_name, $mode) ?></abbr></td> 715 738 <?php } 716 739 break; 717 740 718 741 case 'title': 719 ?> 720 <td class="post-title"><strong><?php if ( current_user_can( 'edit_post', $post->ID ) ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo attribute_escape(sprintf(__('Edit "%s"'), $title)); ?>"><?php echo $title ?></a><?php } else { echo $title; } ?></strong> 742 $attributes = 'class="post-title column-title"' . $style; 743 ?> 744 <td <?php echo $attributes ?>><strong><?php if ( current_user_can( 'edit_post', $post->ID ) ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo attribute_escape(sprintf(__('Edit "%s"'), $title)); ?>"><?php echo $title ?></a><?php } else { echo $title; } ?></strong> 721 745 <?php 722 746 if ( !empty($post->post_password) ) { _e(' — <strong>Protected</strong>'); } elseif ('private' == $post->post_status) { _e(' — <strong>Private</strong>'); } … … 743 767 case 'categories': 744 768 ?> 745 <td class="categories"><?php769 <td <?php echo $attributes ?>><?php 746 770 $categories = get_the_category(); 747 771 if ( !empty( $categories ) ) { … … 759 783 case 'tags': 760 784 ?> 761 <td class="tags"><?php785 <td <?php echo $attributes ?>><?php 762 786 $tags = get_the_tags(); 763 787 if ( !empty( $tags ) ) { … … 774 798 775 799 case 'comments': 776 ?> 777 <td class="comments num"><div class="post-com-count-wrapper"> 800 $attributes = 'class="comments column-comments num"' . $style; 801 ?> 802 <td <?php echo $attributes ?>><div class="post-com-count-wrapper"> 778 803 <?php 779 804 $pending_phrase = sprintf( __('%s pending'), number_format( $pending_comments ) ); … … 790 815 case 'author': 791 816 ?> 792 <td class="author"><a href="edit.php?author=<?php the_author_ID(); ?>"><?php the_author() ?></a></td>817 <td <?php echo $attributes ?>><a href="edit.php?author=<?php the_author_ID(); ?>"><?php the_author() ?></a></td> 793 818 <?php 794 819 break; … … 796 821 case 'status': 797 822 ?> 798 <td class="status">823 <td <?php echo $attributes ?>> 799 824 <a href="<?php the_permalink(); ?>" title="<?php echo attribute_escape(sprintf(__('View "%s"'), $title)); ?>" rel="permalink"> 800 825 <?php … … 1918 1943 } 1919 1944 1945 function manage_columns_prefs($page) { 1946 if ( 'post' == $page ) 1947 $columns = wp_manage_posts_columns(); 1948 elseif ( 'page' == $page ) 1949 $columns = wp_manage_pages_columns(); 1950 elseif ( 'media' == $page ) 1951 $columns = wp_manage_media_columns(); 1952 else return; 1953 1954 $hidden = (array) get_user_option( "manage-$page-columns-hidden" ); 1955 1956 foreach ( $columns as $column => $title ) { 1957 // Can't hide these 1958 if ( 'cb' == $column || 'title' == $column ) 1959 continue; 1960 if ( 'comments' == $column ) 1961 $title = __('Comments'); 1962 $id = "$column-hide"; 1963 echo '<label for="' . $id . '">'; 1964 echo '<input class="hide-column-tog" name="' . $id . '" type="checkbox" id="' . $id . '" value="' . $column . '"' . (! in_array($column, $hidden) ? ' checked="checked"' : '') . ' />'; 1965 echo "$title</label>\n"; 1966 } 1967 } 1968 1920 1969 ?> -
trunk/wp-includes/script-loader.php
r8857 r8858 258 258 'time' => time() 259 259 ) ); 260 261 $scripts->add( 'posts', '/wp-admin/js/posts.js', array('columns'), '20080910' ); 262 263 $scripts->add( 'columns', '/wp-admin/js/columns.js', false, '20080910' ); 264 $scripts->localize( 'columns', 'columnsL10n', array( 265 'requestFile' => admin_url('admin-ajax.php'), 266 ) ); 260 267 } 261 268 }
Note: See TracChangeset
for help on using the changeset viewer.