Dashboard updates from mdawaffe. see #7552

git-svn-id: http://svn.automattic.com/wordpress/trunk@9219 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-10-16 22:35:53 +00:00
parent 7d7305c4c9
commit f46fb544e7
7 changed files with 85 additions and 26 deletions

View File

@ -108,6 +108,20 @@ div.postbox div.inside {
padding: 0;
}
/* QuickPress */
#quick-press #add-media-button {
margin: .5em 0;
}
#quick-press #content-label {
margin-top: 1em;
}
#quick-press .textarea-wrap {
clear: both;
}
/* Recent Drafts */
#dashboard_recent_drafts ul {
margin: 0;
@ -115,19 +129,37 @@ div.postbox div.inside {
list-style: none;
}
/* Primary Feed */
/* Feeds */
#dashboard_primary a.rsswidget, #dashboard_plugins h5 {
.rss-widget ul {
margin: 0;
padding: 0;
list-style: none;
}
.rss-widget a.rsswidget {
font-size: 14px;
}
#dashboard_primary span.rss-date {
.rss-widget span.rss-date {
font-size: 14px;
}
.rss-widget cite {
display: block;
text-align: right;
margin: 0 0 1em;
padding: 0;
}
.rss-widget cite:before {
content: '\2014';
}
/* Plugins */
#dashboard_plugins h5 {
font-size: 14px;
margin: 0;
display: inline;
line-height: 1.4em;

View File

@ -28,7 +28,7 @@ function wp_dashboard_setup() {
wp_add_dashboard_widget( 'dashboard_recent_comments', __( 'Recent Comments' ), 'wp_dashboard_recent_comments' );
// QuickPress Widget
wp_add_dashboard_widget( 'dashboard_quick_press', __( 'QuickPress' ), 'wp_dashboard_quick_press', 'wp_dashboard_empty_control' );
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' );
@ -184,9 +184,13 @@ function wp_dashboard_quick_press( $dashboard, $meta_box ) {
<input type="text" name="post_title" id="title" autocomplete="off" value="<?php echo attribute_escape( $post->post_title ); ?>" />
</div>
<h4><label for="quickpress-content"><?php _e('Post') ?></label></h4>
<div id="add-media-button" class="alignright">
<a class="thickbox button" href="http://hacek.local/wordpress/wp-admin/media-upload.php?TB_iframe=true" id="add-media-link"><?php _e( 'Insert Media' ); ?></a>
</div>
<h4 id="content-label"><label for="content"><?php _e('Post') ?></label></h4>
<div class="textarea-wrap">
<textarea name="content" id="quickpress-content" class="mceEditor" rows="3" cols="15"><?php echo $post->post_content; ?></textarea>
<textarea name="content" id="content" class="mceEditor" rows="3" cols="15"><?php echo $post->post_content; ?></textarea>
</div>
<h4><label for="tags-input"><?php _e('Tags') ?></label></h4>
@ -315,7 +319,8 @@ function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) {
$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['reply'] = '<a onclick="commentReply.open(\''.$comment->comment_ID.'\',\''.$comment->comment_post_ID.'\');return false;" class="vim-r" title="'.__('Reply to this comment').'" href="#">' . __('Reply') . '</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 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 = apply_filters( 'comment_row_actions', $actions, $comment );
@ -326,8 +331,10 @@ 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 || 'quickedit' == $action )
if ( 'reply' == $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>";
}
@ -361,6 +368,15 @@ function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) {
<?php endif; // comment_type ?>
<blockquote><p><?php comment_excerpt(); ?></p></blockquote>
<p class="comment-actions"><?php echo $actions_string; ?></p>
<div id="inline-<?php echo $comment->comment_ID; ?>" class="hidden">
<textarea class="comment"><?php echo $comment->comment_content; ?></textarea>
<div class="author-email"><?php echo attribute_escape( $comment->comment_author_email ); ?></div>
<div class="author"><?php echo attribute_escape( $comment->comment_author ); ?></div>
<div class="author-url"><?php echo attribute_escape( $comment->comment_author_url ); ?></div>
<div class="comment_status"><?php echo $comment->comment_approved; ?></div>
</div>
</div>
<?php
}
@ -454,7 +470,9 @@ function wp_dashboard_primary_control() {
*/
function wp_dashboard_rss_output( $widget_id ) {
$widgets = get_option( 'dashboard_widget_options' );
echo "<div class='rss-widget'>";
wp_widget_rss_output( $widgets[$widget_id] );
echo "</div>";
}
function wp_dashboard_secondary() {
@ -462,7 +480,7 @@ function wp_dashboard_secondary() {
}
function wp_dashboard_secondary_control() {
wp_dashboard_rss_control( 'dashboard_secondary', array( 'show_summary' => false, 'show_author' => false, 'show_date' => false ) );
wp_dashboard_rss_control( 'dashboard_secondary' );
}
/**
@ -476,21 +494,23 @@ function wp_dashboard_secondary_output() {
$widgets = get_option( 'dashboard_widget_options' );
@extract( @$widgets['dashboard_secondary'], EXTR_SKIP );
$rss = @fetch_rss( $url );
if ( !isset($rss->items) || 0 == count($rss->items) )
return false;
echo "<ul id='planetnews'>\n";
$rss->items = array_slice($rss->items, 0, $items);
foreach ($rss->items as $item ) {
$title = wp_specialchars($item['title']);
list($author,$post) = explode( ':', $title, 2 );
$link = clean_url($item['link']);
echo "\t<li><a href='$link'><span class='post'>$post</span><span class='hidden'> - </span><cite>$author</cite></a></li>\n";
if ( 'http://planet.wordpress.org/' == $rss->channel['link'] ) {
foreach ( array_keys($rss->items) as $i ) {
list($site, $description) = explode( ':', wp_specialchars($rss->items[$i]['title']), 2 );
$rss->items[$i]['dc']['creator'] = trim($site);
$rss->items[$i]['title'] = trim($description);
}
}
echo "</ul>\n<br class='clear' />\n";
echo "<div class='rss-widget'>";
wp_widget_rss_output( $rss, $widgets['dashboard_secondary'] );
echo "</div>";
}
function wp_dashboard_plugins() {
@ -605,11 +625,6 @@ function wp_dashboard_cached_rss_widget( $widget_id, $callback, $check_urls = ar
/* Dashboard Widgets Controls */
// Temp
function wp_dashboard_empty_control() {
echo "This feature isn't enabled in this prototype.";
}
// Calls widget_control callback
/**
* Calls widget control callback.

View File

@ -16,6 +16,7 @@ wp_dashboard_setup();
wp_enqueue_script( 'dashboard' );
wp_enqueue_script( 'plugin-install' );
wp_enqueue_script( 'media-upload' );
wp_admin_css( 'dashboard' );
wp_admin_css( 'plugin-install' );
add_thickbox();

View File

@ -1,3 +1,5 @@
var edCanvas;
jQuery( function($) {
// close postboxes that should be closed
@ -42,6 +44,8 @@ var quickPressLoad = function() {
} );
$('#publish').click( function() { act.val( 'post-quickpress-publish' ); } );
edCanvas = jQuery('#content');
};
quickPressLoad();

View File

@ -89,6 +89,8 @@ commentReply = {
init : function() {
this.rows = $('#the-comment-list tr');
if ( !this.rows.size() )
this.rows = $('#the-comment-list > div.comment-item');
var row = $('#replyrow');
$('a.cancel', row).click(function() { return commentReply.revert(); });

View File

@ -9,8 +9,11 @@ function send_to_editor(h) {
h = ed.plugins.wpeditimage._do_shcode(h);
ed.execCommand('mceInsertContent', false, h);
} else
} else if ( jQuery.isFunction( 'edInsertContent' ) ) {
edInsertContent(edCanvas, h);
} else {
jQuery( edCanvas ).val( jQuery( edCanvas ).val() + h );
}
tb_remove();
}

View File

@ -1581,11 +1581,13 @@ function wp_widget_rss_output( $rss, $args = array() ) {
if ( empty($title) )
$title = __('Untitled');
$desc = '';
$summary = '';
if ( isset( $item['description'] ) && is_string( $item['description'] ) )
$desc = $summary = str_replace(array("\n", "\r"), ' ', attribute_escape(strip_tags(html_entity_decode($item['description'], ENT_QUOTES))));
$desc = str_replace(array("\n", "\r"), ' ', attribute_escape(strip_tags(html_entity_decode($item['description'], ENT_QUOTES))));
elseif ( isset( $item['summary'] ) && is_string( $item['summary'] ) )
$desc = $summary = str_replace(array("\n", "\r"), ' ', attribute_escape(strip_tags(html_entity_decode($item['summary'], ENT_QUOTES))));
$desc = str_replace(array("\n", "\r"), ' ', attribute_escape(strip_tags(html_entity_decode($item['summary'], ENT_QUOTES))));
if ( 360 < strlen( $desc ) )
$desc = substr( $desc, 0, 360 ) . ' [&hellip;]';
$summary = $desc;
if ( $show_summary ) {
$desc = '';