<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[16237] trunk/wp-admin/includes/dashboard.php:
  Add the former contents of ms-admin.
 php to a right now widget for the network admin.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/16237">16237</a></dd>
<dt>Author</dt> <dd>ryan</dd>
<dt>Date</dt> <dd>2010-11-08 17:31:00 +0000 (Mon, 08 Nov 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Add the former contents of ms-admin.php to a right now widget for the network admin. see <a href="http://trac.wordpress.org/ticket/14435">#14435</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminincludesdashboardphp">trunk/wp-admin/includes/dashboard.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminincludesdashboardphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/dashboard.php (16236 => 16237)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/dashboard.php        2010-11-08 17:15:14 UTC (rev 16236)
+++ trunk/wp-admin/includes/dashboard.php        2010-11-08 17:31:00 UTC (rev 16237)
</span><span class="lines">@@ -29,6 +29,9 @@
</span><span class="cx">         if ( is_blog_admin() &amp;&amp; current_user_can('edit_posts') )
</span><span class="cx">                 wp_add_dashboard_widget( 'dashboard_right_now', __( 'Right Now' ), 'wp_dashboard_right_now' );
</span><span class="cx"> 
</span><ins>+        if ( is_network_admin() )
+                wp_add_dashboard_widget( 'network_dashboard_right_now', __( 'Right Now' ), 'wp_network_dashboard_right_now' );
+
</ins><span class="cx">         // Recent Comments Widget
</span><span class="cx">         if ( is_blog_admin() &amp;&amp; current_user_can('moderate_comments') ) {
</span><span class="cx">                 if ( !isset( $widget_options['dashboard_recent_comments'] ) || !isset( $widget_options['dashboard_recent_comments']['items'] ) ) {
</span><span class="lines">@@ -146,10 +149,14 @@
</span><span class="cx">                 list($url) = explode( '#', add_query_arg( 'edit', $widget_id ), 2 );
</span><span class="cx">                 $widget_name .= ' &lt;span class=&quot;postbox-title-action&quot;&gt;&lt;a href=&quot;' . esc_url( &quot;$url#$widget_id&quot; ) . '&quot; class=&quot;edit-box open-box&quot;&gt;' . __( 'Configure' ) . '&lt;/a&gt;&lt;/span&gt;';
</span><span class="cx">         }
</span><del>-        if ( is_user_admin() )
</del><ins>+        
+        if ( is_blog_admin () )
+                $side_widgets = array('dashboard_quick_press', 'dashboard_recent_drafts', 'dashboard_primary', 'dashboard_secondary');
+        else if (is_network_admin() )
+                $side_widgets = array('dashboard_primary', 'dashboard_secondary');
+        else
</ins><span class="cx">                 $side_widgets = array();
</span><del>-        else
-                $side_widgets = array('dashboard_quick_press', 'dashboard_recent_drafts', 'dashboard_primary', 'dashboard_secondary');
</del><ins>+
</ins><span class="cx">         $location = 'normal';
</span><span class="cx">         if ( in_array($widget_id, $side_widgets) )
</span><span class="cx">                 $location = 'side';
</span><span class="lines">@@ -402,6 +409,56 @@
</span><span class="cx">         do_action( 'activity_box_end' );
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+function wp_network_dashboard_right_now() {
+        $actions = array();
+        if ( current_user_can('create_sites') )
+                $actions['create-site'] = '&lt;a href=&quot;' . network_admin_url('site-new.php') . '&quot;&gt;' . __( 'Create a New Site' ) . '&lt;/a&gt;';
+        if ( current_user_can('create_users') )
+                $actions['create-user'] = '&lt;a href=&quot;' . network_admin_url('user-new.php') . '&quot;&gt;' . __( 'Create a New User' ) . '&lt;/a&gt;';
+
+        $c_users = get_user_count();
+        $c_blogs = get_blog_count();
+
+        $user_text = sprintf( _n( '%s user', '%s users', $c_users ), number_format_i18n( $c_users ) );
+        $blog_text = sprintf( _n( '%s site', '%s sites', $c_blogs ), number_format_i18n( $c_blogs ) );
+        
+        $sentence = sprintf( __( 'You have %1$s and %2$s.' ), $blog_text, $user_text );
+
+        if ( $actions ) {
+                echo '&lt;ul class=&quot;subsubsub&quot;&gt;';
+                foreach ( $action as $class =&gt; $action ) {
+                         $actions[ $class ] = &quot;\t&lt;li class='$class'&gt;$action&quot;;
+                }
+                echo implode( &quot; |&lt;/li&gt;\n&quot;, $actions ) . &quot;&lt;/li&gt;\n&quot;;
+                echo '&lt;/ul&gt;';
+        }
+?&gt;
+        &lt;br class=&quot;clear&quot; /&gt;
+
+        &lt;p class=&quot;youhave&quot;&gt;&lt;?php echo $sentence; ?&gt;&lt;/p&gt;
+        &lt;?php do_action( 'wpmuadminresult', '' ); ?&gt;
+
+        &lt;form name=&quot;searchform&quot; action=&quot;ms-users.php&quot; method=&quot;get&quot;&gt;
+                &lt;p&gt;
+                        &lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;users&quot; /&gt;
+                        &lt;input type=&quot;text&quot; name=&quot;s&quot; value=&quot;&quot; size=&quot;17&quot; /&gt;
+                        &lt;input class=&quot;button&quot; type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;&lt;?php esc_attr_e( 'Search Users' ); ?&gt;&quot; /&gt;
+                &lt;/p&gt;
+        &lt;/form&gt;
+
+        &lt;form name=&quot;searchform&quot; action=&quot;ms-sites.php&quot; method=&quot;get&quot;&gt;
+                &lt;p&gt;
+                        &lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;blogs&quot; /&gt;
+                        &lt;input type=&quot;hidden&quot; name=&quot;searchaction&quot; value=&quot;name&quot; /&gt;
+                        &lt;input type=&quot;text&quot; name=&quot;s&quot; value=&quot;&quot; size=&quot;17&quot; /&gt;
+                        &lt;input class=&quot;button&quot; type=&quot;submit&quot; name=&quot;blog_name&quot; value=&quot;&lt;?php esc_attr_e( 'Search Sites' ); ?&gt;&quot; /&gt;
+                &lt;/p&gt;
+        &lt;/form&gt;
+&lt;?php
+        do_action( 'mu_rightnow_end' );
+        do_action( 'mu_activity_box_end' );
+}
+
</ins><span class="cx"> function wp_dashboard_quick_press_output() {
</span><span class="cx">         global $post_ID;
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>