<!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>[15878] trunk/wp-admin: Dashboard widgets in the network admin.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/15878">15878</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2010-10-21 10:06:17 +0000 (Thu, 21 Oct 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Dashboard widgets in the network admin. props PeteMall. see <a href="http://trac.wordpress.org/ticket/15163">#15163</a>.</pre>

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

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkwpadminnetworkindexextraphp">trunk/wp-admin/network/index-extra.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 (15877 => 15878)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/dashboard.php        2010-10-20 22:44:15 UTC (rev 15877)
+++ trunk/wp-admin/includes/dashboard.php        2010-10-21 10:06:17 UTC (rev 15878)
</span><span class="lines">@@ -58,7 +58,7 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         // WP Plugins Widget
</span><del>-        if ( is_blog_admin() &amp;&amp; current_user_can( 'install_plugins' ) )
</del><ins>+        if ( ( is_blog_admin() &amp;&amp; current_user_can( 'install_plugins' ) ) || ( is_network_admin() &amp;&amp; current_user_can( 'manage_network_plugins' ) ) )
</ins><span class="cx">                 wp_add_dashboard_widget( 'dashboard_plugins', __( 'Plugins' ), 'wp_dashboard_plugins' );
</span><span class="cx"> 
</span><span class="cx">         // QuickPress Widget
</span><span class="lines">@@ -100,10 +100,14 @@
</span><span class="cx">         wp_add_dashboard_widget( 'dashboard_secondary', $widget_options['dashboard_secondary']['title'], 'wp_dashboard_secondary', 'wp_dashboard_secondary_control' );
</span><span class="cx"> 
</span><span class="cx">         // Hook to register new widgets
</span><del>-        do_action( 'wp_dashboard_setup' );
-
</del><span class="cx">         // Filter widget order
</span><del>-        $dashboard_widgets = apply_filters( 'wp_dashboard_widgets', array() );
</del><ins>+        if ( is_network_admin() ) {
+                do_action( 'wp_network_dashboard_setup' );
+                $dashboard_widgets = apply_filters( 'wp_network_dashboard_widgets', array() );
+        } else {
+                do_action( 'wp_dashboard_setup' );
+                $dashboard_widgets = apply_filters( 'wp_dashboard_widgets', array() );
+        }
</ins><span class="cx"> 
</span><span class="cx">         foreach ( $dashboard_widgets as $widget_id ) {
</span><span class="cx">                 $name = empty( $wp_registered_widgets[$widget_id]['all_link'] ) ? $wp_registered_widgets[$widget_id]['name'] : $wp_registered_widgets[$widget_id]['name'] . &quot; &lt;a href='{$wp_registered_widgets[$widget_id]['all_link']}' class='edit-box open-box'&gt;&quot; . __('View all') . '&lt;/a&gt;';
</span></span></pre></div>
<a id="trunkwpadminnetworkindexextraphp"></a>
<div class="addfile"><h4>Added: trunk/wp-admin/network/index-extra.php (0 => 15878)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/network/index-extra.php                                (rev 0)
+++ trunk/wp-admin/network/index-extra.php        2010-10-21 10:06:17 UTC (rev 15878)
</span><span class="lines">@@ -0,0 +1,5 @@
</span><ins>+&lt;?php
+
+require_once( './admin.php' );
+
+require( '../index-extra.php' );
</ins></span></pre></div>
<a id="trunkwpadminnetworkindexphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/network/index.php (15877 => 15878)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/network/index.php        2010-10-20 22:44:15 UTC (rev 15877)
+++ trunk/wp-admin/network/index.php        2010-10-21 10:06:17 UTC (rev 15878)
</span><span class="lines">@@ -7,15 +7,19 @@
</span><span class="cx">  * @since 3.0.0
</span><span class="cx">  */
</span><span class="cx"> 
</span><ins>+/** Load WordPress Bootstrap */
</ins><span class="cx"> require_once( './admin.php' );
</span><span class="cx"> 
</span><ins>+/** Load WordPress dashboard API */
+require_once(ABSPATH . 'wp-admin/includes/dashboard.php');
+
</ins><span class="cx"> if ( !is_multisite() )
</span><span class="cx">         wp_die( __( 'Multisite support is not enabled.' ) );
</span><span class="cx"> 
</span><span class="cx"> if ( ! current_user_can( 'manage_network' ) )
</span><span class="cx">         wp_die( __( 'You do not have permission to access this page.' ) );
</span><span class="cx"> 
</span><del>-$title = __( 'Network Admin' );
</del><ins>+$title = __( 'Network Dashboard' );
</ins><span class="cx"> $parent_file = 'index.php';
</span><span class="cx"> 
</span><span class="cx"> add_contextual_help($current_screen,
</span><span class="lines">@@ -28,49 +32,29 @@
</span><span class="cx">         '&lt;p&gt;' . __('&lt;a href=&quot;http://wordpress.org/support/&quot; target=&quot;_blank&quot;&gt;Support Forums&lt;/a&gt;') . '&lt;/p&gt;'
</span><span class="cx"> );
</span><span class="cx"> 
</span><del>-require_once( '../admin-header.php' );
</del><ins>+wp_dashboard_setup();
</ins><span class="cx"> 
</span><del>-$c_users = get_user_count();
-$c_blogs = get_blog_count();
</del><ins>+wp_enqueue_script( 'dashboard' );
+wp_admin_css( 'dashboard' );
+add_thickbox();
</ins><span class="cx"> 
</span><del>-$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 ) );
</del><ins>+add_screen_option('layout_columns', array('max' =&gt; 4, 'default' =&gt; 2) );
</ins><span class="cx"> 
</span><del>-$sentence = sprintf( __( 'You have %1$s and %2$s.' ), $blog_text, $user_text );
</del><ins>+require_once( '../admin-header.php' );
+
</ins><span class="cx"> ?&gt;
</span><span class="cx"> 
</span><span class="cx"> &lt;div class=&quot;wrap&quot;&gt;
</span><del>-        &lt;?php screen_icon(); ?&gt;
-        &lt;h2&gt;&lt;?php echo esc_html( $title ); ?&gt;&lt;/h2&gt;
</del><ins>+&lt;?php screen_icon(); ?&gt;
+&lt;h2&gt;&lt;?php echo esc_html( $title ); ?&gt;&lt;/h2&gt;
</ins><span class="cx"> 
</span><del>-        &lt;ul class=&quot;subsubsub&quot;&gt;
-        &lt;li&gt;&lt;a href=&quot;sites.php#form-add-site&quot;&gt;&lt;?php _e( 'Create a New Site' ); ?&gt;&lt;/a&gt; |&lt;/li&gt;
-        &lt;li&gt;&lt;a href=&quot;users.php#form-add-user&quot;&gt;&lt;?php _e( 'Create a New User' ); ?&gt;&lt;/a&gt;&lt;/li&gt;
-        &lt;/ul&gt;
-        &lt;br class=&quot;clear&quot; /&gt;
</del><ins>+&lt;div id=&quot;dashboard-widgets-wrap&quot;&gt;
</ins><span class="cx"> 
</span><del>-        &lt;p class=&quot;youhave&quot;&gt;&lt;?php echo $sentence; ?&gt;&lt;/p&gt;
-        &lt;?php do_action( 'wpmuadminresult', '' ); ?&gt;
</del><ins>+&lt;?php wp_dashboard(); ?&gt;
</ins><span class="cx"> 
</span><del>-        &lt;form name=&quot;searchform&quot; action=&quot;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;
</del><ins>+&lt;div class=&quot;clear&quot;&gt;&lt;/div&gt;
+&lt;/div&gt;&lt;!-- dashboard-widgets-wrap --&gt;
</ins><span class="cx"> 
</span><del>-        &lt;form name=&quot;searchform&quot; action=&quot;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;
</del><ins>+&lt;/div&gt;&lt;!-- wrap --&gt;
</ins><span class="cx"> 
</span><del>-        &lt;?php do_action( 'mu_rightnow_end' ); ?&gt;
-        &lt;?php do_action( 'mu_activity_box_end' ); ?&gt;
-&lt;/div&gt;
-
</del><span class="cx"> &lt;?php include( '../admin-footer.php' ); ?&gt;
</span></span></pre>
</div>
</div>

</body>
</html>