Dashboard pluggability improvements from mdawaffe. see #8265

git-svn-id: http://svn.automattic.com/wordpress/trunk@9748 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-11-18 01:04:41 +00:00
parent cf333304bb
commit 3b4f3fdcfd
3 changed files with 19 additions and 5 deletions

View File

@ -85,6 +85,13 @@ div.postbox div.inside {
padding: 0;
}
#dashboard-widgets .heading {
font-size: 1em;
font-weight: normal;
font-style: italic;
font-family: Georgia, serif;
}
/* Right Now */
#dashboard_right_now p.sub,

View File

@ -91,6 +91,11 @@ function wp_dashboard_setup() {
// Filter widget order
$dashboard_widgets = apply_filters( 'wp_dashboard_widgets', array() );
foreach ( $dashboard_widgets as $widget_id ) {
$name = empty( $wp_registered_widgets[$widget_id]['all_link'] ) ? $wp_registered_widgets[$widget_id]['name'] : $wp_registered_widgets[$widget_id]['name'] . " <a href='{$wp_registered_widgets[$widget_id]['all_link']}' class='edit-box open-box'>" . __('View all') . '</a>';
wp_add_dashboard_widget( $widget_id, $name, $wp_registered_widgets[$widget_id]['callback'], $wp_registered_widget_controls[$widget_id]['callback'] );
}
if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['widget_id']) ) {
ob_start(); // hack - but the same hack wp-admin/widgets.php uses
wp_dashboard_trigger_widget_control( $_POST['widget_id'] );
@ -102,9 +107,6 @@ function wp_dashboard_setup() {
if ( $update )
update_option( 'dashboard_widget_options', $widget_options );
foreach ( $dashboard_widgets as $widget_id )
wp_add_dashboard_widget( $widget_id, $wp_registered_widgets[$widget_id]['name'], $wp_registered_widgets[$widget_id]['callback'], $wp_registered_widget_controls[$widget_id]['callback'] );
do_action('do_meta_boxes', 'dashboard', 'normal', '');
do_action('do_meta_boxes', 'dashboard', 'side', '');
}
@ -130,7 +132,7 @@ function wp_add_dashboard_widget( $widget_id, $widget_name, $callback, $control_
}
function _wp_dashboard_control_callback( $dashboard, $meta_box ) {
echo '<form action="" method="post">';
echo '<form action="" method="post" class="dashboard-widget-control-form">';
wp_dashboard_trigger_widget_control( $meta_box['id'] );
echo "<p class='submit'><input type='hidden' name='widget_id' value='$meta_box[id]' /><input type='submit' value='" . __( 'Submit' ) . "' /></p>";
@ -801,4 +803,9 @@ function wp_dashboard_rss_control( $widget_id, $form_inputs = array() ) {
wp_widget_rss_form( $widget_options[$widget_id], $form_inputs );
}
/**
* Empty function usable by plugins to output empty dashboard widget (to be populated later by JS).
*/
function wp_dashboard_empty() {}
?>

View File

@ -313,7 +313,7 @@ function wp_default_styles( &$styles ) {
$styles->add( 'global', '/wp-admin/css/global.css', array(), '20081106' );
$styles->add( 'media', '/wp-admin/css/media.css', array(), '20080709' );
$styles->add( 'widgets', '/wp-admin/css/widgets.css' );
$styles->add( 'dashboard', '/wp-admin/css/dashboard.css', array(), '20081115' );
$styles->add( 'dashboard', '/wp-admin/css/dashboard.css', array(), '20081117' );
$styles->add( 'install', '/wp-admin/css/install.css', array(), '20080708' );
$styles->add( 'theme-editor', '/wp-admin/css/theme-editor.css' );
$styles->add( 'press-this', '/wp-admin/css/press-this.css', array(), '20081115' );