<!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" />
<title>[BuddyPress][4122] trunk/bp-core: Adds column to the Pages Dashboard panel with information about associated BP components, if any.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { 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 #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg > ul, #logmsg > ol { margin-left: 0; margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#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>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd>4122</dd>
<dt>Author</dt> <dd>boonebgorges</dd>
<dt>Date</dt> <dd>2011-03-11 23:59:27 +0000 (Fri, 11 Mar 2011)</dd>
</dl>
<h3>Log Message</h3>
<pre>Adds column to the Pages Dashboard panel with information about associated BP components, if any. Adds meta box to Edit Page panel with information about the associated page. Fixes #3027. Fixes #3028</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpcorebpcorecssjsphp">trunk/bp-core/bp-core-cssjs.php</a></li>
<li><a href="#trunkbpcorebpcorefunctionsphp">trunk/bp-core/bp-core-functions.php</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkbpcoreimageslogocolumnheaderpng">trunk/bp-core/images/logo-column-header.png</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbpcorebpcorecssjsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/bp-core-cssjs.php (4121 => 4122)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/bp-core-cssjs.php        2011-03-11 22:51:08 UTC (rev 4121)
+++ trunk/bp-core/bp-core-cssjs.php        2011-03-11 23:59:27 UTC (rev 4122)
</span><span class="lines">@@ -25,6 +25,8 @@
</span><span class="cx">                 ul#adminmenu li.toplevel_page_bp-general-settings.wp-has-current-submenu .wp-menu-image a {
</span><span class="cx">                         background-position: -1px 0;
</span><span class="cx">                 }
</span><ins>+                
+                .fixed .column-bp-pages { width: 10em; margin: auto 5px; }
</ins><span class="cx">         </style>
</span><span class="cx">
</span><span class="cx"> <?php
</span></span></pre></div>
<a id="trunkbpcorebpcorefunctionsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/bp-core-functions.php (4121 => 4122)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/bp-core-functions.php        2011-03-11 22:51:08 UTC (rev 4121)
+++ trunk/bp-core/bp-core-functions.php        2011-03-11 23:59:27 UTC (rev 4122)
</span><span class="lines">@@ -77,6 +77,115 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><ins>+ * Adds an addition column to the Pages screen (edit.php?post_type=page) to display whether a
+ * page is linked to a BP component
+ *
+ * @package BuddyPress Core
+ * @since 1.3
+ *
+ * @param array $columns The column setup array, passed by manage_pages_columns
+ * @return array $columns The column setup array with the BP column added
+ */
+function bp_core_add_pages_column_header( $columns ) {
+        $columns['bp-pages'] = '<div class="vers"><img src="' . BP_PLUGIN_URL . '/bp-core/images/logo-column-header.png" title="' . __( 'Is this page associated with a BuddyPress component?', 'buddypress' ) . '" /></div>';
+        
+        return $columns;
+}
+add_filter( 'manage_pages_columns', 'bp_core_add_pages_column_header' );
+
+/**
+ * Adds the associated component name to the Pages column
+ *
+ * For most components, the translatable name can be fetched out of the $bp global. 'register' and
+ * 'activate' are handled as special cases.
+ *
+ * @package BuddyPress Core
+ * @since 1.3
+ */
+function bp_core_add_pages_column_content() {
+        global $bp;
+        
+        foreach( (array)$bp->pages as $component => $page_data ) {
+                if ( $page_data->id == get_the_ID() ) {
+                        if ( isset( $bp->{$component}->name ) ) {
+                                $text = $bp->{$component}->name;
+                        } else if ( 'register' == $component ) {
+                                $text = __( 'Register', 'buddypress' );
+                        } else if ( 'activate' == $component ) {
+                                $text = __( 'Activate', 'buddypress' );
+                        } else {
+                                $text = '';
+                        }
+                        
+                        echo apply_filters( 'bp_core_pages_column_text', $text, $component );
+                        break;
+                }
+        }
+        
+}
+add_filter( 'manage_pages_custom_column', 'bp_core_add_pages_column_content' );
+
+
+/**
+ * Adds a meta box to the Edit Page panel containing BP information
+ *
+ * @package BuddyPress Core
+ * @since 1.3
+ * @uses add_meta_box() to add the meta box
+ */
+function bp_core_add_meta_box() {
+        $post_id = isset( $_GET['post'] ) ? $_GET['post'] : false;
+        
+        // Don't show the meta box on the New Page screen
+        if ( !$post_id )
+                return;
+        
+        add_meta_box( 'bp_pages_meta', __( 'BuddyPress', 'buddypress' ), 'bp_core_meta_box_content', 'page', 'side' );
+}
+add_action( 'admin_init', 'bp_core_add_meta_box' );
+
+/**
+ * Renders the content of the Edit Page meta box
+ *
+ * @package BuddyPress Core
+ * @since 1.3
+ */
+function bp_core_meta_box_content() {
+        global $bp;
+
+        $post_id = isset( $_GET['post'] ) ? $_GET['post'] : false;
+        
+        // Get the name of the associated component
+        foreach( (array)$bp->pages as $component => $page_data ) {
+                if ( $page_data->id == $post_id ) {
+                        if ( isset( $bp->{$component}->name ) ) {
+                                $text = $bp->{$component}->name;
+                        } else if ( 'register' == $component ) {
+                                $text = __( 'Register', 'buddypress' );
+                        } else if ( 'activate' == $component ) {
+                                $text = __( 'Activate', 'buddypress' );
+                        } else {
+                                $text = '';
+                        }
+                        
+                        $bp->this_dashboard_edit_page_name = apply_filters( 'bp_core_meta_box_page_name', $text, $component );
+                        break;
+                }
+        }
+?>
+
+        <?php if ( !empty( $bp->this_dashboard_edit_page_name ) ) : ?>
+                <p><?php printf( __( 'This page is associated with a BuddyPress component: <strong>%1$s</strong>.', 'buddypress' ), $bp->this_dashboard_edit_page_name ) ?></p>
+        <?php else : ?>
+                <p><?php _e( 'This page is not associated with a BuddyPress component.', 'buddypress' ) ?></p>
+        <?php endif ?>
+        
+        <p><?php printf( __( 'Visit the <a href="%1$s">BuddyPress component setup panel</a> to change your BuddyPress component settings.', 'buddypress' ), network_admin_url( 'admin.php?page=bp-general-settings' ) ) ?></p>
+
+<?php
+}
+
+/**
</ins><span class="cx"> * Creates a default component slug from a WP page root_slug
</span><span class="cx"> *
</span><span class="cx"> * Since 1.3, BP components get their root_slug (the slug used immediately
</span></span></pre></div>
<a id="trunkbpcoreimageslogocolumnheaderpng"></a>
<div class="addfile"><h4>Added: trunk/bp-core/images/logo-column-header.png (0 => 4122)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/images/logo-column-header.png         (rev 0)
+++ trunk/bp-core/images/logo-column-header.png        2011-03-11 23:59:27 UTC (rev 4122)
</span><span class="lines">@@ -0,0 +1,18 @@
</span><ins>+\x89PNG
+
+
+IHDR B \x95 \xEEiCCPICC Profile x\x85T\xCFkA\xFE6n\xA9\xD0"Zk\xB2x\x90"IY\xABhE\xD46\xFDbk\xDB\xB6E\x90d3I\xD6n6\xEB\xEE&\xB5\xA5\x88\xE4\xE2\xD1*\xDEE\xED\xA1\xFF\x80z\xF0d/J\x85ZE(ޫ(b\xA1-\xF1\xCDnL\xB6\xA5\xEA\xC0\xCE~\xF3\xDE7\xEF}ov\xDF
+r\xD24\xF5\x80\xE4
+\xC7R\xA2il|Bj\xFC\x88 \x8E\xA2        A4%U\xDB\xECN$A\x83s\xF9{\xE7\xD8z\x81[V\xC3{\xFBw\x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