Make titles into links in Dashboard Right Now module, props mattwalters, fixes #8438 for trunk

git-svn-id: https://develop.svn.wordpress.org/trunk@10300 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2009-01-05 10:08:31 +00:00
parent 1d0781a8c8
commit b79698dc1e
1 changed files with 49 additions and 27 deletions

View File

@ -181,12 +181,13 @@ function wp_dashboard_right_now() {
// Posts
$num = number_format_i18n( $num_posts->publish );
if ( current_user_can( 'edit_posts' ) )
$text = "<a href='edit.php'>$num</a>";
else
$text = $num;
echo '<td class="first b b-posts">' . $text . '</td>';
echo '<td class="t posts">' . __ngettext( 'Post', 'Posts', intval($num_posts->publish) ) . '</td>';
$text = __ngettext( 'Post', 'Posts', intval($num_posts->publish) );
if ( current_user_can( 'edit_posts' ) ) {
$num = "<a href='edit.php'>$num</a>";
$text = "<a href='edit.php'>$text</a>";
}
echo '<td class="first b b-posts">' . $num . '</td>';
echo '<td class="t posts">' . $text . '</td>';
/* TODO: Show status breakdown on hover
if ( $can_edit_pages && !empty($num_pages->publish) ) { // how many pages is not exposed in feeds. Don't show if !current_user_can
$post_type_texts[] = '<a href="edit-pages.php">'.sprintf( __ngettext( '%s page', '%s pages', $num_pages->publish ), number_format_i18n( $num_pages->publish ) ).'</a>';
@ -206,58 +207,79 @@ function wp_dashboard_right_now() {
// Total Comments
$num = number_format_i18n($num_comm->total_comments);
if ( current_user_can( 'moderate_comments' ) )
$text = __ngettext( 'Comment', 'Comments', $num_comm->total_comments );
if ( current_user_can( 'moderate_comments' ) ) {
$num = "<a href='edit-comments.php'>$num</a>";
echo '<td class="b b-comments">'.$num.'</td>';
echo '<td class="last t comments">' . __ngettext( 'Comment', 'Comments', $num_comm->total_comments ) . '</td>';
$text = "<a href='edit-comments.php'>$text</a>";
}
echo '<td class="b b-comments">' . $num . '</td>';
echo '<td class="last t comments">' . $text . '</td>';
echo '</tr><tr>';
// Pages
$num = number_format_i18n( $num_pages->publish );
if ( current_user_can( 'edit_pages' ) )
$text = __ngettext( 'Page', 'Pages', $num_pages->publish );
if ( current_user_can( 'edit_pages' ) ) {
$num = "<a href='edit-pages.php'>$num</a>";
echo '<td class="first b b_pages">'.$num.'</td>';
echo '<td class="t pages">' . __ngettext( 'Page', 'Pages', $num_pages->publish ) . '</td>';
$text = "<a href='edit-pages.php'>$text</a>";
}
echo '<td class="first b b_pages">' . $num . '</td>';
echo '<td class="t pages">' . $text . '</td>';
// Approved Comments
$num = number_format_i18n($num_comm->approved);
if ( current_user_can( 'moderate_comments' ) )
$text = __ngettext( 'Approved', 'Approved', $num_comm->approved );
if ( current_user_can( 'moderate_comments' ) ) {
$num = "<a href='edit-comments.php?comment_status=approved'>$num</a>";
echo '<td class="b b_approved">'.$num.'</td>';
echo '<td class="last t approved">' . __ngettext( 'Approved', 'Approved', $num_comm->approved ) . '</td>';
$text = "<a class='approved' href='edit-comments.php?comment_status=approved'>$text</a>";
}
echo '<td class="b b_approved">' . $num . '</td>';
echo '<td class="last t">' . $text . '</td>';
echo "</tr>\n\t<tr>";
// Categories
$num = number_format_i18n( $num_cats );
if ( current_user_can( 'manage_categories' ) )
$text = __ngettext( 'Category', 'Categories', $num_cats );
if ( current_user_can( 'manage_categories' ) ) {
$num = "<a href='categories.php'>$num</a>";
echo '<td class="first b b-cats">'.$num.'</td>';
echo '<td class="t cats">' . __ngettext( 'Category', 'Categories', $num_cats ) . '</td>';
$text = "<a href='categories.php'>$text</a>";
}
echo '<td class="first b b-cats">' . $num . '</td>';
echo '<td class="t cats">' . $text . '</td>';
// Pending Comments
$num = number_format_i18n($num_comm->moderated);
if ( current_user_can( 'moderate_comments' ) )
$text = __ngettext( 'Pending', 'Pending', $num_comm->moderated );
if ( current_user_can( 'moderate_comments' ) ) {
$num = "<a href='edit-comments.php?comment_status=moderated'><span class='pending-count'>$num</span></a>";
echo '<td class="b b-waiting">'.$num.'</td>';
echo '<td class="last t waiting">' . __ngettext( 'Pending', 'Pending', $num_comm->moderated ) . '</td>';
$text = "<a class='waiting' href='edit-comments.php?comment_status=moderated'>$text</a>";
}
echo '<td class="b b-waiting">' . $num . '</td>';
echo '<td class="last t">' . $text . '</td>';
echo "</tr>\n\t<tr>";
// Tags
$num = number_format_i18n( $num_tags );
if ( current_user_can( 'manage_categories' ) )
$text = __ngettext( 'Tag', 'Tags', $num_tags );
if ( current_user_can( 'manage_categories' ) ) {
$num = "<a href='edit-tags.php'>$num</a>";
echo '<td class="first b b-tags">'.$num.'</td>';
echo '<td class="t tags">' . __ngettext( 'Tag', 'Tags', $num_tags ) . '</td>';
$text = "<a href='edit-tags.php'>$text</a>";
}
echo '<td class="first b b-tags">' . $num . '</td>';
echo '<td class="t tags">' . $text . '</td>';
// Spam Comments
$num = number_format_i18n($num_comm->spam);
if ( current_user_can( 'moderate_comments' ) )
$text = __ngettext( 'Spam', 'Spam', $num_comm->spam );
if ( current_user_can( 'moderate_comments' ) ) {
$num = "<a href='edit-comments.php?comment_status=spam'><span class='spam-count'>$num</span></a>";
echo '<td class="b b-spam">'.$num.'</td>';
echo '<td class="last t spam">' . __ngettext( 'Spam', 'Spam', $num_comm->spam ) . '</td>';
$text = "<a class='spam' href='edit-comments.php?comment_status=spam'>$text</a>";
}
echo '<td class="b b-spam">' . $num . '</td>';
echo '<td class="last t">' . $text . '</td>';
echo "</tr>";
do_action('right_now_table_end');