Welcome panel contents and functionality. see #11651.

git-svn-id: http://svn.automattic.com/wordpress/trunk@19007 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
koopersmith 2011-10-19 16:41:26 +00:00
parent ca0acb7a05
commit 1391717cfa
10 changed files with 135 additions and 28 deletions

View File

@ -612,7 +612,7 @@ case 'get-comments' :
$x = new WP_Ajax_Response();
ob_start();
foreach ( $wp_list_table->items as $comment ) {
if ( ! current_user_can( 'edit_comment', $comment->comment_ID ) )
if ( ! current_user_can( 'edit_comment', $comment->comment_ID ) )
continue;
get_comment( $comment );
$wp_list_table->single_row( $comment );
@ -1059,6 +1059,19 @@ case 'hidden-columns' :
if ( is_array($hidden) )
update_user_option($user->ID, "manage{$page}columnshidden", $hidden, true);
die('1');
break;
case 'update-welcome-panel' :
check_ajax_referer( 'welcome-panel-nonce', 'welcomepanelnonce' );
if ( ! current_user_can( 'edit_theme_options' ) )
die('-1');
if ( empty( $_POST['visible'] ) )
delete_user_option( get_current_user_id(), 'show_welcome_panel' );
else
update_user_option( get_current_user_id(), 'show_welcome_panel', 1 );
die('1');
break;
case 'menu-get-metabox' :

File diff suppressed because one or more lines are too long

View File

@ -703,6 +703,9 @@ table.widefat span.spam a,
.welcome-panel {
border-color: #ccc;
}
.welcome-panel p {
color: #777;
}
.widget,
#widget-list .widget-top,

File diff suppressed because one or more lines are too long

View File

@ -2147,12 +2147,15 @@ body.admin-bar #adminmenu {
border-width: 3px;
border-style: double;
position: relative;
display: none;
font-size: 14px;
line-height: 1.6em;
overflow: auto;
}
.welcome-panel h3 {
font-size: 24px;
font-weight: normal;
margin-bottom: 0.8em;
}
.welcome-panel .welcome-panel-close {
@ -2162,6 +2165,11 @@ body.admin-bar #adminmenu {
text-decoration: none;
}
.welcome-panel .welcome-panel-column {
width: 33.33333%;
float: left;
}
/*------------------------------------------------------------------------------
10.0 - List Posts (/Pages/etc)

View File

@ -1265,27 +1265,85 @@ function wp_dashboard_empty() {}
* @since 3.3
*/
function wp_welcome_panel() {
if ( ! current_user_can( 'edit_theme_options' ) )
return;
$classes = 'welcome-panel';
if ( ! get_user_option( 'show_welcome_panel' ) )
$classes .= ' hidden';
?>
<div class="welcome-panel">
<h3><?php _e( 'Welcome to WordPress!' ); ?></h3>
<div id="welcome-panel" class="<?php echo esc_attr( $classes ); ?>">
<?php wp_nonce_field( 'welcome-panel-nonce', 'welcomepanelnonce', false ); ?>
<a class="welcome-panel-close" href="#"><?php _e('Close'); ?></a>
<?php
// For now, we'll just approximate capabilities for each role.
?>
<?php if ( current_user_can('switch_themes') ): ?>
<p>[admin placeholder]</p>
<?php elseif ( current_user_can('edit_others_posts') ): ?>
<p>[editor placeholder]</p>
<?php elseif ( current_user_can('publish_posts') ): ?>
<p>[author placeholder]</p>
<?php elseif ( current_user_can('edit_posts') ): ?>
<p>[contributor placeholder]</p>
<?php else: ?>
<p>[subscriber placeholder]</p>
<?php endif; ?>
<h3><?php _e( 'Welcome to WordPress!' ); ?></h3>
<p><?php _e( 'Welcome to your new WordPress site! Here are some things most people do when they set up a new WordPress site. To get started, use the links below and we&#8217;ll give you some extra help with these tasks.' ); ?></p>
<div class="welcome-panel-column">
<ul>
<li>
<a href="<?php echo esc_url( admin_url('profile.php') ); ?>">
<?php _e('Fill in your profile.'); ?>
</a>
</li>
<li>
<a href="<?php echo esc_url( admin_url('options-discussion.php') ); ?>">
<?php _e('Choose comment settings.'); ?>
</a>
</li>
<li>
<a href="<?php echo esc_url( admin_url('options-general.php') ); ?>">
<?php _e('Set your time zone.'); ?>
</a>
</li>
</ul>
</div>
<div class="welcome-panel-column">
<ul>
<li>
<a href="<?php echo esc_url( admin_url('options-general.php') ); ?>">
<?php _e('Edit your site tagline.'); ?>
</a>
</li>
<li>
<a href="<?php echo esc_url( admin_url('themes.php') ); ?>">
<?php _e('Choose a theme.'); ?>
</a>
</li>
<li>
<a href="<?php echo esc_url( admin_url('widgets.php') ); ?>">
<?php _e('Add some widgets.'); ?>
</a>
</li>
</ul>
</div>
<div class="welcome-panel-column">
<ul>
<li>
<?php echo sprintf(
__( 'Delete the default <a href="%1$s">post</a> and <a href="%2$s">comment</a>.' ),
esc_url( admin_url('edit.php') ),
esc_url( admin_url('edit-comments.php') )
); ?>
</li>
<li>
<a href="<?php echo esc_url( admin_url('post-new.php') ); ?>">
<?php _e('Create your first post.'); ?>
</a>
</li>
<li>
<?php echo sprintf(
__( '<a href="%s">Edit the sample page</a> to be about you.' ),
esc_url( admin_url('edit.php?post_type=page') )
); ?>
</li>
</ul>
</div>
</div>
<?php
}

View File

@ -28,7 +28,12 @@ else
add_screen_option('layout_columns', array('max' => 4, 'default' => 2) );
add_screen_option( 'overview', '<p>' . __( 'Welcome to your WordPress Dashboard! This is the screen you will see when you log in to your site, and gives you access to all the site management features of WordPress. You can get help for any screen by clicking the Help tab in the top bar.' ) . '</p>' );
$overview = '<p>' . __( 'Welcome to your WordPress Dashboard! This is the screen you will see when you log in to your site, and gives you access to all the site management features of WordPress. You can get help for any screen by clicking the Help tab in the top bar.' ) . '</p>';
if ( current_user_can( 'edit_theme_options' ) )
$overview .= '<a href="#" class="welcome-panel-open">' . __('Show the welcome panel.') . '</a>';
add_screen_option( 'overview', $overview );
// Help tabs

View File

@ -1,6 +1,26 @@
var ajaxWidgets, ajaxPopulateWidgets, quickPressLoad;
jQuery(document).ready( function($) {
/* Dashboard Welcome Panel */
var welcomePanel = $('#welcome-panel'),
updateWelcomePanel = function( visible ) {
$.post( ajaxurl, {
action: 'update-welcome-panel',
visible: visible,
welcomepanelnonce: $('#welcomepanelnonce').val()
});
};
$('.welcome-panel-close', welcomePanel).click( function() {
welcomePanel.addClass('hidden');
updateWelcomePanel( 0 );
});
$('.welcome-panel-open', '#adv-settings').click( function() {
welcomePanel.removeClass('hidden');
updateWelcomePanel( 1 );
});
// These widgets are sometimes populated via ajax
ajaxWidgets = [
'dashboard_incoming_links',

View File

@ -1 +1 @@
var ajaxWidgets,ajaxPopulateWidgets,quickPressLoad;jQuery(document).ready(function(a){ajaxWidgets=["dashboard_incoming_links","dashboard_primary","dashboard_secondary","dashboard_plugins"];ajaxPopulateWidgets=function(c){function b(d,h){var g,f=a("#"+h+" div.inside:visible").find(".widget-loading");if(f.length){g=f.parent();setTimeout(function(){g.load(ajaxurl.replace("/admin-ajax.php","")+"/index-extra.php?jax="+h,"",function(){g.hide().slideDown("normal",function(){a(this).css("display","")})})},d*500)}}if(c){c=c.toString();if(a.inArray(c,ajaxWidgets)!=-1){b(0,c)}}else{a.each(ajaxWidgets,b)}};ajaxPopulateWidgets();postboxes.add_postbox_toggles(pagenow,{pbshow:ajaxPopulateWidgets});quickPressLoad=function(){var b=a("#quickpost-action"),c;c=a("#quick-press").submit(function(){a("#dashboard_quick_press #publishing-action img.waiting").css("visibility","visible");a('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').prop("disabled",true);if("post"==b.val()){b.val("post-quickpress-publish")}a("#dashboard_quick_press div.inside").load(c.attr("action"),c.serializeArray(),function(){a("#dashboard_quick_press #publishing-action img.waiting").css("visibility","hidden");a('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').prop("disabled",false);a("#dashboard_quick_press ul").next("p").remove();a("#dashboard_quick_press ul").find("li").each(function(){a("#dashboard_recent_drafts ul").prepend(this)}).end().remove();quickPressLoad()});return false});a("#publish").click(function(){b.val("post-quickpress-publish")})};quickPressLoad()});
var ajaxWidgets,ajaxPopulateWidgets,quickPressLoad;jQuery(document).ready(function(b){var c=b("#welcome-panel"),a=function(d){b.post(ajaxurl,{action:"update-welcome-panel",visible:d,welcomepanelnonce:b("#welcomepanelnonce").val()})};b(".welcome-panel-close",c).click(function(){c.addClass("hidden");a(0)});b(".welcome-panel-open","#adv-settings").click(function(){c.removeClass("hidden");a(1)});ajaxWidgets=["dashboard_incoming_links","dashboard_primary","dashboard_secondary","dashboard_plugins"];ajaxPopulateWidgets=function(e){function d(f,j){var h,g=b("#"+j+" div.inside:visible").find(".widget-loading");if(g.length){h=g.parent();setTimeout(function(){h.load(ajaxurl.replace("/admin-ajax.php","")+"/index-extra.php?jax="+j,"",function(){h.hide().slideDown("normal",function(){b(this).css("display","")})})},f*500)}}if(e){e=e.toString();if(b.inArray(e,ajaxWidgets)!=-1){d(0,e)}}else{b.each(ajaxWidgets,d)}};ajaxPopulateWidgets();postboxes.add_postbox_toggles(pagenow,{pbshow:ajaxPopulateWidgets});quickPressLoad=function(){var d=b("#quickpost-action"),e;e=b("#quick-press").submit(function(){b("#dashboard_quick_press #publishing-action img.waiting").css("visibility","visible");b('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').prop("disabled",true);if("post"==d.val()){d.val("post-quickpress-publish")}b("#dashboard_quick_press div.inside").load(e.attr("action"),e.serializeArray(),function(){b("#dashboard_quick_press #publishing-action img.waiting").css("visibility","hidden");b('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').prop("disabled",false);b("#dashboard_quick_press ul").next("p").remove();b("#dashboard_quick_press ul").find("li").each(function(){b("#dashboard_recent_drafts ul").prepend(this)}).end().remove();quickPressLoad()});return false});b("#publish").click(function(){d.val("post-quickpress-publish")})};quickPressLoad()});

View File

@ -365,7 +365,7 @@ function wp_default_scripts( &$scripts ) {
$scripts->add( 'farbtastic', '/wp-admin/js/farbtastic.js', array('jquery'), '1.2' );
$scripts->add( 'dashboard', "/wp-admin/js/dashboard$suffix.js", array( 'jquery', 'admin-comments', 'postbox' ), '20110524', 1 );
$scripts->add( 'dashboard', "/wp-admin/js/dashboard$suffix.js", array( 'jquery', 'admin-comments', 'postbox' ), '20111019', 1 );
$scripts->add( 'hoverIntent', "/wp-includes/js/hoverIntent$suffix.js", array('jquery'), '20090102', 1 );
@ -431,13 +431,13 @@ function wp_default_styles( &$styles ) {
// Any rtl stylesheets that don't have a .dev version for ltr
$no_suffix = array( 'farbtastic' );
$styles->add( 'wp-admin', "/wp-admin/css/wp-admin$suffix.css", array(), '20111018' );
$styles->add( 'wp-admin', "/wp-admin/css/wp-admin$suffix.css", array(), '20111019' );
$styles->add( 'ie', "/wp-admin/css/ie$suffix.css", array(), '20111015' );
$styles->add_data( 'ie', 'conditional', 'lte IE 7' );
// all colors stylesheets need to have the same query strings (cache manifest compat)
$colors_version = '20111017a';
$colors_version = '20111019';
// Register "meta" stylesheet for admin colors. All colors-* style sheets should have the same version string.
$styles->add( 'colors', true, array('wp-admin'), $colors_version );