Make WordPress Core


Ignore:
Timestamp:
12/20/2007 08:23:30 PM (17 years ago)
Author:
matt
Message:

To avoid monolithic commits I'm going to be bringing this in piece by piece. No need to file bug about lack of styling, it's on purpose right now. Trunk will be hit with the oogly stick for 2-3 days. This brings in structure for new dashboard.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/index.php

    r6026 r6431  
    88        jQuery('#incominglinks').load('index-extra.php?jax=incominglinks');
    99        jQuery('#devnews').load('index-extra.php?jax=devnews');
    10         jQuery('#planetnews').load('index-extra.php?jax=planetnews');
     10//      jQuery('#planetnews').load('index-extra.php?jax=planetnews');
    1111    });
    1212</script>
     
    2626<div class="wrap">
    2727
    28 <h2><?php _e('Welcome to WordPress'); ?></h2>
     28<h2><?php _e('Dashboard'); ?></h2>
    2929
    30 <div id="zeitgeist">
    31 <h2><?php _e('Latest Activity'); ?></h2>
     30<div id="rightnow">
     31<h3><?php _e('Right Now'); ?> <a href="post-new.php"><?php _e('Write a New Page'); ?></a> <a href="page-new.php"><?php _e('Write a New Post'); ?></a></h3>
    3232
    33 <div id="incominglinks"></div>
     33<?php
     34// I'm not sure how to internationalize this, Nikolay?
     35
     36$num_posts = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish'" );
     37
     38$num_pages = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'page' AND post_status = 'publish'" );
     39
     40$num_drafts = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'draft'" );
     41
     42$num_future = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'future'" );
     43
     44$num_comments = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '1'");
     45
     46$num_cats  = wp_count_terms('category');
     47
     48$num_tags = wp_count_terms('post_tag');
     49
     50$sentence = 'You have ';
     51if ( $num_posts )
     52    $sentence .= '<a href="edit.php">' . number_format( $num_posts ) . ' posts</a>, ';
     53
     54if ( $num_pages )
     55    $sentence .= '<a href="edit-pages.php">' . number_format( $num_pages ) . ' pages</a>, ';
     56
     57if ( $num_drafts )
     58    $sentence .= '<a href="edit.php?post_status=draft">' . number_format( $num_drafts ) . ' drafts</a>, ';
     59
     60if ( $num_future )
     61    $sentence .= '<a href="edit.php?post_status=future">' . number_format( $num_future ) . ' scheduled posts</a>, ';
     62
     63// There is always a category
     64$sentence .= 'contained within <a href="categories.php">' . number_format( $num_cats ) . ' categories</a> and ' . number_format( $num_tags ) . ' tags.';
     65
     66?>
     67<p><?php echo $sentence; ?></p>
     68<?php
     69$ct = current_theme_info();
     70$sidebars_widgets = wp_get_sidebars_widgets();
     71$num_widgets = count( $sidebar_widgets );
     72?>
     73<p>You use the <?php echo $ct->title; ?> theme with <a href='widgets.php'><?php echo $num_widgets; ?> widgets</a>. <a href="themes.php">Change Theme</a>. You're using BetaPress TODO.</p>
     74<?php do_action( 'rightnow_end' ); ?>
     75<?php do_action( 'activity_box_end' ); ?>
     76</div>
     77
     78<div id="dashboard-widgets">
     79
     80<div class="dashboard-widget">
     81<div class="dashboard-widget-edit"><a href="">See All</a> | <a href="">Edit</a></div>
     82<h3>Recent Comments</h3>
    3483
    3584<?php
     
    3988if ( $comments || $numcomments ) :
    4089?>
    41 <div>
    42 <h3><?php printf( __( 'Comments <a href="%s" title="More comments&#8230;">&raquo;</a>' ), 'edit-comments.php' ); ?></h3>
    4390
    4491<?php if ( $numcomments ) : ?>
     
    57104?>
    58105</ul>
     106<?php endif; ?>
    59107</div>
    60 <?php endif; ?>
    61108
     109
     110<div class="dashboard-widget">
    62111<?php
    63 if ( $recentposts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_type = 'post' AND " . get_private_posts_cap_sql('post') . " AND post_date_gmt < '$today' ORDER BY post_date DESC LIMIT 5") ) :
     112$more_link = apply_filters( 'dashboard_incoming_links_link', 'http://blogsearch.google.com/blogsearch?hl=en&scoring=d&partner=wordpress&q=link:' . trailingslashit( get_option('home') ) );
    64113?>
    65 <div>
    66 <h3><?php printf( __( 'Posts <a href="%s" title="More posts&#8230;">&raquo;</a>' ), 'edit.php' ); ?></h3>
     114<div class="dashboard-widget-edit"><a href="<?php echo htmlspecialchars( $more_link ); ?>"><?php _e('See All'); ?></a> | <a href="">Edit</a></div>
     115<h3>Incoming Links</h3>
     116
     117<div id="incominglinks"></div>
     118</div>
     119
     120<div class="dashboard-widget">
     121<?php
     122$recentposts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_type = 'post' AND " . get_private_posts_cap_sql('post') . " AND post_date_gmt < '$today' ORDER BY post_date DESC LIMIT 5");
     123?>
     124<div class="dashboard-widget-edit"><a href="<?php echo htmlspecialchars( $more_link ); ?>"><?php _e('See All'); ?></a> | <a href="">Edit</a></div>
     125<h3>Recent Posts</h3>
     126
    67127<ul>
    68128<?php
     
    77137</ul>
    78138</div>
    79 <?php endif; ?>
    80139
    81 <?php
    82 if ( $scheduled = $wpdb->get_results("SELECT ID, post_title, post_date_gmt FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'future' ORDER BY post_date ASC") ) :
    83 ?>
    84 <div>
    85 <h3><?php _e('Scheduled Entries:') ?></h3>
    86 <ul>
    87 <?php
    88 foreach ($scheduled as $post) {
    89     if ($post->post_title == '')
    90         $post->post_title = sprintf(__('Post #%s'), $post->ID);
    91     echo "<li>" . sprintf(__('%1$s in %2$s'), "<a href='post.php?action=edit&amp;post=$post->ID' title='" . __('Edit this post') . "'>$post->post_title</a>", human_time_diff( current_time('timestamp', 1), strtotime($post->post_date_gmt. ' GMT') ))  . "</li>";
    92 }
    93 ?>
    94 </ul>
    95 </div>
    96 <?php endif; ?>
     140<div class="dashboard-widget">
     141<div class="dashboard-widget-edit"><a href="<?php echo htmlspecialchars( $more_link ); ?>"><?php _e('See All'); ?></a> | <a href="">Edit</a> | <a href="">RSS</a></div>
     142<h3><?php echo apply_filters( 'dashboard_primary_title', __('Blog') ); ?></h3>
    97143
    98 <div>
    99 <h3><?php _e('Blog Stats'); ?></h3>
    100 <?php
    101 $numposts = (int) $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish'");
    102 $numcomms = (int) $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '1'");
    103 $numcats  = wp_count_terms('category');
    104 $numtags = wp_count_terms('post_tag');
    105 
    106 $post_str = sprintf(__ngettext('%1$s <a href="%2$s" title="Posts">post</a>', '%1$s <a href="%2$s" title="Posts">posts</a>', $numposts), number_format_i18n($numposts), 'edit.php');
    107 $comm_str = sprintf(__ngettext('%1$s <a href="%2$s" title="Comments">comment</a>', '%1$s <a href="%2$s" title="Comments">comments</a>', $numcomms), number_format_i18n($numcomms), 'edit-comments.php');
    108 $cat_str  = sprintf(__ngettext('%1$s <a href="%2$s" title="Categories">category</a>', '%1$s <a href="%2$s" title="Categories">categories</a>', $numcats), number_format_i18n($numcats), 'categories.php');
    109 $tag_str  = sprintf(__ngettext('%1$s tag', '%1$s tags', $numtags), number_format_i18n($numtags));
    110 ?>
    111 
    112 <p><?php printf(__('There are currently %1$s and %2$s, contained within %3$s and %4$s.'), $post_str, $comm_str, $cat_str, $tag_str); ?></p>
     144<div id="devnews"></div>
    113145</div>
    114146
    115 <?php do_action('activity_box_end'); ?>
     147<?php do_action( 'dashboard_widgets' ); ?>
     148
     149<p><a href="">Customize this page</a>.</p>
     150
    116151</div>
    117152
    118 <p><?php _e('Use these links to get started:'); ?></p>
    119 
    120 <ul>
    121 <?php if ( current_user_can('edit_posts') ) : ?>
    122     <li><a href="post-new.php"><?php _e('Write a post'); ?></a></li>
    123 <?php endif; ?>
    124     <li><a href="profile.php"><?php _e('Update your profile or change your password'); ?></a></li>
    125 <?php if ( current_user_can('manage_links') ) : ?>
    126     <li><a href="link-add.php"><?php _e('Add a link to your blogroll'); ?></a></li>
    127 <?php endif; ?>
    128 <?php if ( current_user_can('switch_themes') ) : ?>
    129     <li><a href="themes.php"><?php _e('Change your site&#8217;s look or theme'); ?></a></li>
    130 <?php endif; ?>
    131 </ul>
    132 <p><?php _e("Need help with WordPress? Please see our <a href='http://codex.wordpress.org/'>documentation</a> or visit the <a href='http://wordpress.org/support/'>support forums</a>."); ?></p>
    133 
    134 <div id="devnews"></div>
    135153
    136154<div id="planetnews"></div>
Note: See TracChangeset for help on using the changeset viewer.