Dashboard Styling, props mdawaffe, fixes #8070

git-svn-id: https://develop.svn.wordpress.org/trunk@9536 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz
2008-11-05 21:56:57 +00:00
parent 52c196a781
commit 8fe1e3f997
6 changed files with 148 additions and 75 deletions
+19 -36
View File
@@ -28,7 +28,7 @@ function wp_dashboard_setup() {
wp_add_dashboard_widget( 'dashboard_right_now', __( 'Right Now' ), 'wp_dashboard_right_now' );
// Recent Comments Widget
wp_add_dashboard_widget( 'dashboard_recent_comments', __( 'Recent Comments' ), 'wp_dashboard_recent_comments' );
wp_add_dashboard_widget( 'dashboard_recent_comments', sprintf( __( 'Recent Comments <a href="%s">View all</a>' ), 'edit-comments.php' ), 'wp_dashboard_recent_comments' );
// Incoming Links Widget
if ( !isset( $widget_options['dashboard_incoming_links'] ) || !isset( $widget_options['dashboard_incoming_links']['home'] ) || $widget_options['dashboard_incoming_links']['home'] != get_option('home') ) {
@@ -51,7 +51,7 @@ function wp_dashboard_setup() {
wp_add_dashboard_widget( 'dashboard_quick_press', __( 'QuickPress' ), 'wp_dashboard_quick_press' );
// Recent Drafts
wp_add_dashboard_widget( 'dashboard_recent_drafts', __( 'Recent Drafts' ), 'wp_dashboard_recent_drafts' );
wp_add_dashboard_widget( 'dashboard_recent_drafts', sprintf( __( 'Recent Drafts <a href="%s">View all</a>' ), 'edit.php?post_status=draft' ), 'wp_dashboard_recent_drafts' );
// Primary feed (Dev Blog) Widget
@@ -311,11 +311,11 @@ function wp_dashboard_quick_press() {
<input type="text" name="post_title" id="title" autocomplete="off" value="<?php echo attribute_escape( $post->post_title ); ?>" />
</div>
<div id="add-media-button" class="alignright">
<a class="thickbox button" href="<?php echo clean_url( admin_url('media-upload.php?TB_iframe=true') ) ?>" id="add-media-link"><?php _e( 'Insert Media' ); ?></a>
<div id="media-buttons" class="hide-if-no-js">
<?php do_action( 'media_buttons' ); ?>
</div>
<h4 id="content-label"><label for="content"><?php _e('Post') ?></label></h4>
<h4 id="content-label"><label for="content"><?php _e('Content') ?></label></h4>
<div class="textarea-wrap">
<textarea name="content" id="content" class="mceEditor" rows="3" cols="15"><?php echo $post->post_content; ?></textarea>
</div>
@@ -324,14 +324,14 @@ function wp_dashboard_quick_press() {
<div class="input-text-wrap">
<input type="text" name="tags_input" id="tags-input" value="<?php echo get_tags_to_edit( $post->ID ); ?>" />
</div>
<p class='field-tip'><?php _e('Separate tags with commas'); ?></p>
<p class="submit">
<input type="hidden" name="action" id="quickpost-action" value="post-quickpress-save" />
<input type="hidden" name="quickpress_post_ID" value="<?php echo (int) $post->ID; ?>" />
<?php wp_nonce_field('add-post'); ?>
<input type="submit" name="save" id="save-post" class="button alignleft" value="<?php _e('Save Draft'); ?>" />
<input type="submit" name="publish" id="publish" accesskey="p" class="button button-highlighted alignright" value="<?php _e('Publish'); ?>" />
<input type="submit" name="save" id="save-post" class="button" value="<?php _e('Save Draft'); ?>" />
<input type="reset" value="<?php _e( 'Cancel' ); ?>" class="cancel" />
<input type="submit" name="publish" id="publish" accesskey="p" class="button button-highlighted" value="<?php _e('Publish'); ?>" />
<br class="clear" />
</p>
@@ -362,7 +362,10 @@ function wp_dashboard_recent_drafts( $drafts = false ) {
foreach ( $drafts as $draft ) {
$url = get_edit_post_link( $draft->ID );
$title = _draft_or_post_title( $draft->ID );
$list[] = '<abbr title="' . get_the_time(__('Y/m/d g:i:s A'), $draft) . '">' . get_the_time( get_option( 'date_format' ), $draft ) . "</abbr> <a href='$url' title='" . sprintf( __( 'Edit "%s"' ), attribute_escape( $title ) ) . "'>$title</a>";
$item = "<h4><a href='$url' title='" . sprintf( __( 'Edit "%s"' ), attribute_escape( $title ) ) . "'>$title</a> <abbr title='" . get_the_time(__('Y/m/d g:i:s A'), $draft) . "'>" . get_the_time( get_option( 'date_format' ), $draft ) . '</abbr></h4>';
if ( $the_content = preg_split( '#\s#', strip_tags( $draft->post_content ), 11, PREG_SPLIT_NO_EMPTY ) )
$item .= '<p>' . join( ' ', array_slice( $the_content, 0, 10 ) ) . ( 10 < count( $the_content ) ? '&hellip;' : '' ) . '</p>';
$list[] = $item;
}
?>
<ul>
@@ -387,7 +390,6 @@ function wp_dashboard_recent_comments() {
?>
<div id="the-comment-list" class="list:comment">
<p class="view-all"><a href="edit-comments.php"><?php _e( 'View All Comments' ); ?></a></p>
<?php
foreach ( $comments as $comment )
_wp_dashboard_recent_comments_row( $comment );
@@ -408,26 +410,8 @@ function wp_dashboard_recent_comments() {
}
function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) {
static $date = false;
static $today = false;
static $yesterday = false;
$GLOBALS['comment'] =& $comment;
if ( $show_date ) {
if ( !$today )
$today = gmdate( get_option( 'date_format' ), time() + get_option( 'gmt_offset' ) );
if ( !$yesterday )
$yesterday = gmdate( get_option( 'date_format' ), strtotime( 'yesterday' ) + get_option( 'gmt_offset' ) );
$wordy_dates = array( $today => __( 'Today' ), $yesterday => __( 'Yesterday' ) );
$comment_date = gmdate( get_option( 'date_format' ), strtotime( $comment->comment_date ) + get_option( 'gmt_offset' ) );
if ( $comment_date != $date ) {
$date = $comment_date;
echo '<h4>' . ( isset( $wordy_dates[$date] ) ? $wordy_dates[$date] : $date ) . ":</h4>\n";
}
}
$comment_post_url = get_edit_post_link( $comment->comment_post_ID );
$comment_post_title = get_the_title( $comment->comment_post_ID );
$comment_post_link = "<a href='$comment_post_url'>$comment_post_title</a>";
@@ -444,10 +428,10 @@ function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) {
$actions['approve'] = "<a href='$approve_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=approved vim-a' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>';
$actions['unapprove'] = "<a href='$unapprove_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved vim-u' title='" . __( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>';
$actions['edit'] = "<a href='comment.php?action=editcomment&amp;c={$comment->comment_ID}' title='" . __('Edit comment') . "'>". __('Edit') . '</a>';
$actions['spam'] = "<a href='$spam_url' class='delete:the-comment-list:comment-$comment->comment_ID::spam=1 vim-s vim-destructive' title='" . __( 'Mark this comment as spam' ) . "'>" . __( 'Spam' ) . '</a>';
$actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID delete vim-d vim-destructive'>" . __('Delete') . '</a>';
$actions['quickedit'] = '<a onclick="commentReply.open(\''.$comment->comment_ID.'\',\''.$comment->comment_post_ID.'\',\'edit\');return false;" class="vim-q" title="'.__('Quick Edit').'" href="#">' . __('Quick&nbsp;Edit') . '</a>';
$actions['reply'] = '<a onclick="commentReply.open(\''.$comment->comment_ID.'\',\''.$comment->comment_post_ID.'\');return false;" class="vim-r hide-if-no-js" title="'.__('Reply to this comment').'" href="#">' . __('Reply') . '</a>';
$actions['spam'] = "<a href='$spam_url' class='delete:the-comment-list:comment-$comment->comment_ID::spam=1 vim-s vim-destructive' title='" . __( 'Mark this comment as spam' ) . "'>" . __( 'Spam' ) . '</a>';
$actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID delete vim-d vim-destructive'>" . __('Delete') . '</a>';
$actions = apply_filters( 'comment_row_actions', $actions, $comment );
@@ -458,10 +442,8 @@ function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) {
( ( ('approve' == $action || 'unapprove' == $action) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | ';
// Reply and quickedit need a hide-if-no-js span
if ( 'reply' == $action )
if ( 'reply' == $action || 'quickedit' == $action )
$action .= ' hide-if-no-js';
elseif ( 'quickedit' == $action )
$action .= ' hide-if-no-js hide-if-js'; // hah
$actions_string .= "<span class='$action'>$sep$link</span>";
}
@@ -472,8 +454,8 @@ function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) {
<div id="comment-<?php echo $comment->comment_ID; ?>" <?php comment_class( array( 'comment-item', wp_get_comment_status($comment->comment_ID) ) ); ?>>
<?php if ( !$comment->comment_type || 'comment' == $comment->comment_type ) : ?>
<?php echo get_avatar( $comment, 32 ); ?>
<span class="comment-meta"><?php printf( __( '%1$s in response to %2$s:' ), '<cite>' . get_comment_author() . '</cite>', $comment_post_link ); ?></span>
<?php echo get_avatar( $comment, 50 ); ?>
<h4 class="comment-meta"><?php printf( __( 'From %1$s on %2$s%3$s' ), '<cite class="comment-author">' . get_comment_author_link() . '</cite>', $comment_post_link, ' <span class="approve">' . __( '[Awaiting Moderation]' ) . '</span>' ); ?></h4>
<?php
else :
@@ -490,7 +472,8 @@ function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) {
$type = wp_specialchars( $type );
?>
<span class="comment-meta"><?php printf( __( '%3$s on %2$s: %1$s' ), '<cite>' . get_comment_author() . '</cite>', $comment_post_link, "<strong>$type</strong>" ); ?></span>
<h4 class="comment-meta"><?php printf( __( '%1$s on %2$s' ), "<strong>$type</strong>", $comment_post_link ); ?></h4>
<p class="comment-author"><?php comment_author_link(); ?></p>
<?php endif; // comment_type ?>
<blockquote><p><?php comment_excerpt(); ?></p></blockquote>