screen_meta() fixes. Show Help on more pages.

git-svn-id: http://svn.automattic.com/wordpress/trunk@9557 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-11-06 22:21:27 +00:00
parent 4a5e7ba2e4
commit 88d2ecbb4e
14 changed files with 41 additions and 38 deletions

View File

@ -131,7 +131,7 @@ $messages[4] = __('Category not added.');
$messages[5] = __('Category not updated.');
?>
<?php screen_meta('category') ?>
<?php screen_meta('edit-categories') ?>
<div class="wrap nosubsub">
<h2><?php echo wp_specialchars( $title ); ?></h2>

View File

@ -81,7 +81,7 @@ $post_id = isset($_GET['p']) ? (int) $_GET['p'] : 0;
$search_dirty = ( isset($_GET['s']) ) ? $_GET['s'] : '';
$search = attribute_escape( $search_dirty ); ?>
<?php screen_meta('comment') ?>
<?php screen_meta('edit-comments') ?>
<div class="wrap">
<h2><?php echo wp_specialchars( $title ); ?></h2>

View File

@ -471,7 +471,7 @@ add_meta_box('revisionsdiv', __('Post Revisions'), 'post_revisions_meta_box', 'p
endif;
?>
<?php screen_meta('post', 1, 'edit-post'); ?>
<?php screen_meta('post'); ?>
<?php if ( (isset($mode) && 'bookmarklet' == $mode) || isset($_GET['popupurl']) ): ?>
<input type="hidden" name="mode" value="bookmarklet" />

View File

@ -60,7 +60,7 @@ $messages[4] = __('Category not added.');
$messages[5] = __('Category not updated.');
$messages[6] = __('Categories deleted.'); ?>
<?php screen_meta('link-category') ?>
<?php screen_meta('edit-link-categories') ?>
<div class="wrap nosubsub">
<h2><?php echo wp_specialchars( $title ); ?></h2>

View File

@ -309,7 +309,7 @@ function link_advanced_meta_box($link) {
}
add_meta_box('linkadvanceddiv', __('Advanced'), 'link_advanced_meta_box', 'link', 'normal', 'core'); ?>
<?php screen_meta('link', 1) ?>
<?php screen_meta('link') ?>
<div class="wrap">
<h2><?php echo wp_specialchars( $title ); ?></h2>

View File

@ -376,7 +376,7 @@ add_meta_box('revisionsdiv', __('Page Revisions'), 'page_revisions_meta_box', 'p
endif;
?>
<?php screen_meta('page', 1); ?>
<?php screen_meta('page'); ?>
<div class="wrap">
<h2><?php echo wp_specialchars( $title ); ?></h2>

View File

@ -100,7 +100,7 @@ if ( is_singular() ) {
require_once('admin-header.php'); ?>
<?php screen_meta('page') ?>
<?php screen_meta('edit-pages') ?>
<div class="wrap">
<h2><?php echo wp_specialchars( $title ); ?></h2>

View File

@ -129,7 +129,7 @@ $messages[4] = __('Tag not added.');
$messages[5] = __('Tag not updated.');
$messages[6] = __('Tags deleted.'); ?>
<?php screen_meta('tag') ?>
<?php screen_meta('edit-tags') ?>
<div class="wrap nosubsub">
<h2><?php echo wp_specialchars( $title ); ?></h2>

View File

@ -90,7 +90,7 @@ if ( empty($_GET['mode']) )
else
$mode = attribute_escape($_GET['mode']); ?>
<?php screen_meta('post') ?>
<?php screen_meta('edit-posts') ?>
<div class="wrap">
<h2><?php echo wp_specialchars( $title ); ?></h2>

View File

@ -822,10 +822,8 @@ function get_column_headers($page) {
);
return apply_filters('manage_users_columns', $columns);
default :
return apply_filters('manage_' . $page . '_columns', $columns);
return apply_filters('manage_' . $page . '_columns', array());
}
return $columns;
}
/**
@ -3122,18 +3120,28 @@ function _post_states($post) {
}
}
function screen_meta($screen, $metabox = false, $page = '') {
function screen_meta($screen) {
global $wp_meta_boxes;
$column_screens = array('edit-posts' => 'post', 'edit-pages' => 'page', 'edit-tags' => 'tag', 'edit-categories' => 'category',
'edit-link-categories' => 'link-category', 'edit-links' => 'link', 'edit-users' => 'user', 'edit-media' => 'media',
'edit-comments' => 'comment');
$show_screen = false;
if ( !empty($wp_meta_boxes[$screen]) || !empty($column_screens[$screen]) )
$show_screen = true;
?>
<div id="screen-meta">
<?php
if ( $show_screen ) :
?>
<div id="screen-options-wrap" class="hidden">
<h5><?php _e('Show on screen') ?></h5>
<form id="adv-settings" action="" method="get">
<div class="metabox-prefs">
<?php
if ( $metabox ) {
meta_box_prefs($screen);
} else {
manage_columns_prefs($screen);
if ( !meta_box_prefs($screen) ) {
manage_columns_prefs($column_screens[$screen]);
wp_nonce_field( 'hiddencolumns', 'hiddencolumnsnonce', false );
}
?>
@ -3142,25 +3150,22 @@ function screen_meta($screen, $metabox = false, $page = '') {
</div>
<?php
if ( '' != $page ) {
// Allow a plugin to short-circuit
$help = apply_filters('contextual_help', '', $page);
if ( !empty($help) )
return;
global $title;
endif;
$help['edit-post'] = __('<a href="http://codex.wordpress.org/Writing_Posts" target="_blank">Writing Posts</a>');
$help['general-settings'] = __('<a href="http://codex.wordpress.org/Settings_General_SubPanel" target="_blank">General Settings</a>');
global $title;
$help['post'] = __('<a href="http://codex.wordpress.org/Writing_Posts" target="_blank">Writing Posts</a>');
$help['general-settings'] = __('<a href="http://codex.wordpress.org/Settings_General_SubPanel" target="_blank">General Settings</a>');
?>
<div id="contextual-help-wrap" class="hidden">
<?php
if ( isset($help[$page]) ) {
if ( isset($title) && 'edit-post' != $page )
if ( !apply_filters('contextual_help', '', $screen) ) {
if ( isset($help[$screen]) ) {
if ( isset($title) )
echo '<h5>' . sprintf(__('Get help with "%s"'), $title) . '</h5>';
else
echo '<h5>' . __('Get help with this page') . '</h5>';
echo '<div class="metabox-prefs">' . $help[$page] . "</div>\n";
echo '<div class="metabox-prefs">' . $help[$screen] . "</div>\n";
echo '<h5>' . __('Other Help') . '</h5>';
} else {
@ -3172,21 +3177,19 @@ function screen_meta($screen, $metabox = false, $page = '') {
echo '<br />';
_e('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>');
echo "</div>\n";
}
?>
</div>
<?php
}
?>
<div id="screen-meta-links">
<?php if ( '' != $page ) { ?>
<div id="contextual-help-link-wrap" class="hide-if-no-js screen-meta-toggle">
<a href="#contextual-help" id="contextual-help-link" class="show-settings"><?php _e('Help') ?></a>
</div>
<?php } ?>
<?php if ( $show_screen ) { ?>
<div id="screen-options-link-wrap" class="hide-if-no-js screen-meta-toggle">
<a href="#screen-options" id="show-settings-link" class="show-settings"><?php _e('Screen Options') ?></a>
</div>
<?php } ?>
</div>
</div>
<?php

View File

@ -28,7 +28,7 @@ require_once('admin-header.php');
$today = current_time('mysql', 1);
?>
<?php screen_meta('dashboard', 1); ?>
<?php screen_meta('dashboard'); ?>
<div class="wrap">
<h2><?php echo wp_specialchars( $title ); ?></h2>

View File

@ -74,7 +74,7 @@ switch ($order_by) {
break;
} ?>
<?php screen_meta('link') ?>
<?php screen_meta('edit-links') ?>
<div class="wrap nosubsub">
<h2><?php echo wp_specialchars( $title ); ?></h2>

View File

@ -145,7 +145,7 @@ if ( is_singular() ) {
require_once('admin-header.php'); ?>
<?php screen_meta('media') ?>
<?php screen_meta('edit-media') ?>
<?php
if ( isset($_GET['posted']) && (int) $_GET['posted'] ) {

View File

@ -237,7 +237,7 @@ default:
}
endif; ?>
<?php screen_meta('user') ?>
<?php screen_meta('edit-users') ?>
<?php if ( isset($errors) && is_wp_error( $errors ) ) : ?>
<div class="error">