Key screen meta off of page hook. fixes #8246

git-svn-id: http://svn.automattic.com/wordpress/trunk@9735 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-11-17 19:16:26 +00:00
parent 153d88757c
commit 5c5d1aef4d
16 changed files with 105 additions and 83 deletions

View File

@ -192,13 +192,13 @@ if ( $page_links )
<table class="widefat fixed" cellspacing="0">
<thead>
<tr>
<?php print_column_headers('category'); ?>
<?php print_column_headers('categories'); ?>
</tr>
</thead>
<tfoot>
<tr>
<?php print_column_headers('category', false); ?>
<?php print_column_headers('categories', false); ?>
</tr>
</tfoot>

View File

@ -251,13 +251,13 @@ if ( 'spam' == $comment_status ) {
<table class="widefat comments fixed" cellspacing="0">
<thead>
<tr>
<?php print_column_headers('comment'); ?>
<?php print_column_headers('edit-comments'); ?>
</tr>
</thead>
<tfoot>
<tr>
<?php print_column_headers('comment', false); ?>
<?php print_column_headers('edit-comments', false); ?>
</tr>
</tfoot>

View File

@ -69,8 +69,8 @@ endif; ?>
<form class="search-form" action="" method="get">
<p class="search-box">
<label class="hidden" for="category-search-input"><?php _e( 'Search Categories' ); ?>:</label>
<input type="text" class="search-input" id="category-search-input" name="s" value="<?php _admin_search_query(); ?>" />
<label class="hidden" for="link-category-search-input"><?php _e( 'Search Categories' ); ?>:</label>
<input type="text" class="search-input" id="link-category-search-input" name="s" value="<?php _admin_search_query(); ?>" />
<input type="submit" value="<?php _e( 'Search Categories' ); ?>" class="button" />
</p>
</form>
@ -120,13 +120,13 @@ if ( $page_links )
<table class="widefat fixed" cellspacing="0">
<thead>
<tr>
<?php print_column_headers('link-category'); ?>
<?php print_column_headers('edit-link-categories'); ?>
</tr>
</thead>
<tfoot>
<tr>
<?php print_column_headers('link-category', false); ?>
<?php print_column_headers('edit-link-categories', false); ?>
</tr>
</tfoot>

View File

@ -216,13 +216,13 @@ if ($posts) {
<table class="widefat page fixed" cellspacing="0">
<thead>
<tr>
<?php print_column_headers('page'); ?>
<?php print_column_headers('edit-pages'); ?>
</tr>
</thead>
<tfoot>
<tr>
<?php print_column_headers('page', false); ?>
<?php print_column_headers('edit-pages', false); ?>
</tr>
</tfoot>
@ -316,7 +316,7 @@ endif; // posts;
});
});
})(jQuery);
columns.init('page');
columns.init('edit-pages');
/* ]]> */
</script>

View File

@ -11,13 +11,13 @@ if ( ! defined('ABSPATH') ) die();
<table class="widefat post fixed" cellspacing="0">
<thead>
<tr>
<?php print_column_headers('post'); ?>
<?php print_column_headers('edit'); ?>
</tr>
</thead>
<tfoot>
<tr>
<?php print_column_headers('post', false); ?>
<?php print_column_headers('edit', false); ?>
</tr>
</tfoot>

View File

@ -188,13 +188,13 @@ if ( $page_links )
<table class="widefat tag fixed" cellspacing="0">
<thead>
<tr>
<?php print_column_headers('tag'); ?>
<?php print_column_headers('edit-tags'); ?>
</tr>
</thead>
<tfoot>
<tr>
<?php print_column_headers('tag', false); ?>
<?php print_column_headers('edit-tags', false); ?>
</tr>
</tfoot>

View File

@ -330,7 +330,7 @@ endif; // posts;
});
});
})(jQuery);
columns.init('post');
columns.init('edit');
/* ]]> */
</script>

View File

@ -144,8 +144,8 @@ function _cat_row( $category, $level, $name_override = false ) {
$posts_count = ( $category->count > 0 ) ? "<a href='edit.php?cat=$category->term_id'>$category->count</a>" : $category->count;
$output = "<tr id='cat-$category->term_id' class='iedit $row_class'>";
$columns = get_column_headers('category');
$hidden = (array) get_user_option( 'manage-category-columns-hidden' );
$columns = get_column_headers('categories');
$hidden = get_hidden_columns('categories');
foreach ( $columns as $column_name => $column_display_name ) {
$class = "class=\"$column_name column-$column_name\"";
@ -305,8 +305,8 @@ function link_cat_row( $category, $name_override = false ) {
$category->count = number_format_i18n( $category->count );
$count = ( $category->count > 0 ) ? "<a href='link-manager.php?cat_id=$category->term_id'>$category->count</a>" : $category->count;
$output = "<tr id='link-cat-$category->term_id' class='iedit $class'>";
$columns = get_column_headers('link-category');
$hidden = (array) get_user_option( 'manage-link-category-columns-hidden' );
$columns = get_column_headers('edit-link-categories');
$hidden = get_hidden_columns('edit-link-categories');
foreach ( $columns as $column_name => $column_display_name ) {
$class = "class=\"$column_name column-$column_name\"";
@ -584,8 +584,8 @@ function _tag_row( $tag, $class = '' ) {
$edit_link = "edit-tags.php?action=edit&amp;tag_ID=$tag->term_id";
$out = '';
$out .= '<tr id="tag-' . $tag->term_id . '"' . $class . '>';
$columns = get_column_headers('tag');
$hidden = (array) get_user_option( 'manage-tag-columns-hidden' );
$columns = get_column_headers('edit-tags');
$hidden = get_hidden_columns('edit-tags');
foreach ( $columns as $column_name => $column_display_name ) {
$class = "class=\"$column_name column-$column_name\"";
@ -748,13 +748,21 @@ function wp_manage_pages_columns() {
* @return unknown
*/
function get_column_headers($page) {
static $columns = array();
// Store in static to avoid running filters on each call
if ( isset($columns[$page]) )
return $columns[$page];
switch ($page) {
case 'post':
return wp_manage_posts_columns();
case 'page':
return wp_manage_pages_columns();
case 'comment':
$columns = array(
case 'edit':
$columns[$page] = wp_manage_posts_columns();
break;
case 'edit-pages':
$columns[$page] = wp_manage_pages_columns();
break;
case 'edit-comments':
$columns[$page] = array(
'cb' => '<input type="checkbox" />',
'comment' => __('Comment'),
'author' => __('Author'),
@ -762,9 +770,9 @@ function get_column_headers($page) {
'response' => __('In Response To')
);
return apply_filters('manage_comments_columns', $columns);
case 'link':
$columns = array(
break;
case 'link-manager':
$columns[$page] = array(
'cb' => '<input type="checkbox" />',
'name' => __('Name'),
'url' => __('URL'),
@ -773,11 +781,12 @@ function get_column_headers($page) {
'visible' => __('Visible')
);
return apply_filters('manage_link_columns', $columns);
case 'media':
return wp_manage_media_columns();
case 'category':
$columns = array(
break;
case 'upload':
$columns[$page] = wp_manage_media_columns();
break;
case 'categories':
$columns[$page] = array(
'cb' => '<input type="checkbox" />',
'name' => __('Name'),
'description' => __('Description'),
@ -785,27 +794,27 @@ function get_column_headers($page) {
'posts' => __('Posts')
);
return apply_filters('manage_categories_columns', $columns);
case 'link-category':
$columns = array(
break;
case 'edit-link-categories':
$columns[$page] = array(
'cb' => '<input type="checkbox" />',
'name' => __('Name'),
'description' => __('Description'),
'links' => __('Links')
);
return apply_filters('manage_link_categories_columns', $columns);
case 'tag':
$columns = array(
break;
case 'edit-tags':
$columns[$page] = array(
'cb' => '<input type="checkbox" />',
'name' => __('Name'),
'slug' => __('Slug'),
'posts' => __('Posts')
);
return apply_filters('manage_link_categories_columns', $columns);
case 'user':
$columns = array(
break;
case 'users':
$columns[$page] = array(
'cb' => '<input type="checkbox" />',
'username' => __('Username'),
'name' => __('Name'),
@ -813,10 +822,13 @@ function get_column_headers($page) {
'role' => __('Role'),
'posts' => __('Posts')
);
return apply_filters('manage_users_columns', $columns);
break;
default :
return apply_filters('manage_' . $page . '_columns', array());
$columns[$page] = array();
}
$columns[$page] = apply_filters('manage_' . $page . '_columns', $columns[$page]);
return $columns[$page];
}
/**
@ -828,8 +840,9 @@ function get_column_headers($page) {
* @param unknown_type $id
*/
function print_column_headers( $type, $id = true ) {
$type = str_replace('.php', '', $type);
$columns = get_column_headers( $type );
$hidden = (array) get_user_option( "manage-$type-columns-hidden" );
$hidden = get_hidden_columns($type);
$styles = array();
// $styles['tag']['posts'] = 'width: 90px;';
// $styles['link-category']['links'] = 'width: 90px;';
@ -860,6 +873,18 @@ function print_column_headers( $type, $id = true ) {
<?php }
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $page
*/
function get_hidden_columns($page) {
$page = str_replace('.php', '', $page);
return (array) get_user_option( 'manage-' . $page . '-columns-hidden' );
}
/**
* {@internal Missing Short Description}}
*
@ -1245,8 +1270,8 @@ function _post_row($a_post, $pending_comments, $mode) {
?>
<tr id='post-<?php echo $post->ID; ?>' class='<?php echo trim( $rowclass . ' author-' . $post_owner . ' status-' . $post->post_status ); ?> iedit' valign="top">
<?php
$posts_columns = wp_manage_posts_columns();
$hidden = (array) get_user_option( 'manage-post-columns-hidden' );
$posts_columns = get_column_headers('edit');
$hidden = get_hidden_columns('edit');
foreach ( $posts_columns as $column_name=>$column_display_name ) {
$class = "class=\"$column_name column-$column_name\"";
@ -1448,8 +1473,8 @@ function display_page_row( $page, $level = 0 ) {
$pad = str_repeat( '&#8212; ', $level );
$id = (int) $page->ID;
$rowclass = 'alternate' == $rowclass ? '' : 'alternate';
$posts_columns = wp_manage_pages_columns();
$hidden = (array) get_user_option( 'manage-page-columns-hidden' );
$posts_columns = get_column_headers('edit-pages');
$hidden = get_hidden_columns('edit-pages');
$title = _draft_or_post_title();
?>
<tr id="page-<?php echo $id; ?>" class="<?php echo $rowclass; ?> iedit">
@ -1751,8 +1776,8 @@ function user_row( $user_object, $style = '', $role = '' ) {
}
$role_name = isset($wp_roles->role_names[$role]) ? translate_with_context($wp_roles->role_names[$role]) : __('None');
$r = "<tr id='user-$user_object->ID'$style>";
$columns = get_column_headers('user');
$hidden = (array) get_user_option( 'manage-user-columns-hidden' );
$columns = get_column_headers('users');
$hidden = get_hidden_columns('users');
$avatar = get_avatar( $user_object->user_email, 32 );
foreach ( $columns as $column_name => $column_display_name ) {
$class = "class=\"$column_name column-$column_name\"";
@ -1906,8 +1931,8 @@ function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true
$spam_url = clean_url( wp_nonce_url( "comment.php?action=deletecomment&dt=spam&p=$comment->comment_post_ID&c=$comment->comment_ID", "delete-comment_$comment->comment_ID" ) );
echo "<tr id='comment-$comment->comment_ID' class='$the_comment_status'>";
$columns = get_column_headers('comment');
$hidden = (array) get_user_option( 'manage-comment-columns-hidden' );
$columns = get_column_headers('edit-comments');
$hidden = get_hidden_columns('edit-comments');
foreach ( $columns as $column_name => $column_display_name ) {
$class = "class=\"$column_name column-$column_name\"";
@ -2862,7 +2887,7 @@ function do_settings_fields($page, $section) {
function manage_columns_prefs($page) {
$columns = get_column_headers($page);
$hidden = (array) get_user_option( "manage-$page-columns-hidden" );
$hidden = get_hidden_columns($page);
foreach ( $columns as $column => $title ) {
// Can't hide these
@ -3180,19 +3205,16 @@ function screen_meta($screen) {
global $wp_meta_boxes;
$screen = str_replace('.php', '', $screen);
$column_screens = array('edit' => 'post', 'edit-pages' => 'page', 'edit-tags' => 'tag', 'categories' => 'category',
'edit-link-categories' => 'link-category', 'link-manager' => 'link', 'users' => 'user', 'upload' => 'media',
'edit-comments' => 'comment');
$screen = str_replace('-new', '', $screen);
$screen = str_replace('-add', '', $screen);
$column_screens = get_column_headers($screen);
$meta_screens = array('index' => 'dashboard');
if ( isset($meta_screens[$screen]) )
$screen = $meta_screens[$screen];
$show_screen = false;
if ( !empty($wp_meta_boxes[$screen]) || !empty($column_screens[$screen]) )
if ( !empty($wp_meta_boxes[$screen]) || !empty($column_screens) )
$show_screen = true;
?>
<div id="screen-meta">
@ -3204,8 +3226,8 @@ function screen_meta($screen) {
<form id="adv-settings" action="" method="get">
<div class="metabox-prefs">
<?php
if ( !meta_box_prefs($screen) && isset($column_screens[$screen]) ) {
manage_columns_prefs($column_screens[$screen]);
if ( !meta_box_prefs($screen) && isset($column_screens) ) {
manage_columns_prefs($screen);
wp_nonce_field( 'hiddencolumns', 'hiddencolumnsnonce', false );
}
?>

View File

@ -29,9 +29,9 @@ jQuery(function($) {
else
$('#the-list').wpList({ addAfter: addAfter2 });
if ( jQuery('#link-category-search').size() ) {
columns.init('link-category');
if ( jQuery('#link-category-search-input').size() ) {
columns.init('edit-link-categories');
} else {
columns.init('category');
columns.init('categories');
}
});

View File

@ -283,7 +283,7 @@ commentReply = {
};
$(document).ready(function(){
columns.init('comment');
columns.init('edit-comments');
commentReply.init();
if ( typeof QTags != 'undefined' )

View File

@ -26,5 +26,5 @@ jQuery(function($) {
else
$('#the-list').wpList({ addAfter: addAfter2 });
columns.init('tag');
columns.init('edit-tags');
});

View File

@ -1,5 +1,5 @@
jQuery( function($) {
$('#users').wpList();
columns.init('user');
columns.init('users');
});

View File

@ -139,21 +139,21 @@ if ( !empty($_GET['s']) )
$args['search'] = $_GET['s'];
$links = get_bookmarks( $args );
if ( $links ) {
$link_columns = get_column_headers('link');
$hidden = (array) get_user_option( 'manage-link-columns-hidden' );
$link_columns = get_column_headers('link-manager');
$hidden = (array) get_user_option( 'manage-link-manager-columns-hidden' );
?>
<?php wp_nonce_field('bulk-bookmarks') ?>
<table class="widefat fixed" cellspacing="0">
<thead>
<tr>
<?php print_column_headers('link'); ?>
<?php print_column_headers('link-manager'); ?>
</tr>
</thead>
<tfoot>
<tr>
<?php print_column_headers('link', false); ?>
<?php print_column_headers('link-manager', false); ?>
</tr>
</tfoot>
@ -278,7 +278,7 @@ if ( $links ) {
});
});
})(jQuery);
columns.init('link');
columns.init('link-manager');
/* ]]> */
</script>

View File

@ -463,7 +463,7 @@ endif; // posts;
});
});
})(jQuery);
columns.init('media');
columns.init('upload');
/* ]]> */
</script>

View File

@ -331,13 +331,13 @@ unset($role_links);
<table class="widefat fixed" cellspacing="0">
<thead>
<tr class="thead">
<?php print_column_headers('user') ?>
<?php print_column_headers('users') ?>
</tr>
</thead>
<tfoot>
<tr class="thead">
<?php print_column_headers('user', false) ?>
<?php print_column_headers('users', false) ?>
</tr>
</tfoot>

View File

@ -145,8 +145,8 @@ function wp_default_scripts( &$scripts ) {
'add' => attribute_escape(__('Add')),
'how' => __('Separate multiple categories with commas.')
) );
$scripts->add( 'admin-categories', '/wp-admin/js/categories.js', array('wp-lists'), '20080925' );
$scripts->add( 'admin-tags', '/wp-admin/js/tags.js', array('wp-lists'), '20080925' );
$scripts->add( 'admin-categories', '/wp-admin/js/categories.js', array('wp-lists'), '20081117' );
$scripts->add( 'admin-tags', '/wp-admin/js/tags.js', array('wp-lists'), '20081117' );
$scripts->add( 'admin-custom-fields', '/wp-admin/js/custom-fields.js', array('wp-lists'), '20070823' );
$scripts->add( 'password-strength-meter', '/wp-admin/js/password-strength-meter.js', array('jquery'), '20081021' );
$scripts->localize( 'password-strength-meter', 'pwsL10n', array(
@ -156,12 +156,12 @@ function wp_default_scripts( &$scripts ) {
'good' => __('Medium'),
'strong' => __('Strong')
) );
$scripts->add( 'admin-comments', '/wp-admin/js/edit-comments.js', array('wp-lists', 'jquery-ui-resizable', 'quicktags'), '20081115b' );
$scripts->add( 'admin-comments', '/wp-admin/js/edit-comments.js', array('wp-lists', 'jquery-ui-resizable', 'quicktags'), '20081117' );
$scripts->localize( 'admin-comments', 'adminCommentsL10n', array(
'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']),
'hotkeys_highlight_last' => isset($_GET['hotkeys_highlight_last'])
) );
$scripts->add( 'admin-users', '/wp-admin/js/users.js', array('wp-lists'), '20080925' );
$scripts->add( 'admin-users', '/wp-admin/js/users.js', array('wp-lists'), '20081117' );
$scripts->add( 'xfn', '/wp-admin/js/xfn.js', false, '3517' );
$scripts->add( 'postbox', '/wp-admin/js/postbox.js', array('jquery-ui-sortable'), '20081109' );
$scripts->localize( 'postbox', 'postboxL10n', array(