<!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][9161] trunk/src: Improvements to the messages thread interface.</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 { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { 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" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="http://buddypress.trac.wordpress.org/changeset/9161">9161</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"http://buddypress.trac.wordpress.org/changeset/9161","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>boonebgorges</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2014-11-21 21:07:47 +0000 (Fri, 21 Nov 2014)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Improvements to the messages thread interface.

* Introduce noscript support for bulk actions.
* Revise structure and markup to better match the Notifications table.
* Add "Read/Unread" and "Delete" links for each message thread.
* Remove unnecessary "Select Read/Unread" dropdown.
* Introduce a number of new template functions in support of the new interface.

Props lakrisgubben.
See <a href="http://buddypress.trac.wordpress.org/ticket/6005">#6005</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcbpmessagesbpmessagesactionsphp">trunk/src/bp-messages/bp-messages-actions.php</a></li>
<li><a href="#trunksrcbpmessagesbpmessagestemplatephp">trunk/src/bp-messages/bp-messages-template.php</a></li>
<li><a href="#trunksrcbptemplatesbplegacybuddypressmemberssinglemessagesmessagesloopphp">trunk/src/bp-templates/bp-legacy/buddypress/members/single/messages/messages-loop.php</a></li>
<li><a href="#trunksrcbptemplatesbplegacycssbuddypresscss">trunk/src/bp-templates/bp-legacy/css/buddypress.css</a></li>
<li><a href="#trunksrcbptemplatesbplegacyjsbuddypressjs">trunk/src/bp-templates/bp-legacy/js/buddypress.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcbpmessagesbpmessagesactionsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-messages/bp-messages-actions.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-messages/bp-messages-actions.php     2014-11-21 20:22:03 UTC (rev 9160)
+++ trunk/src/bp-messages/bp-messages-actions.php       2014-11-21 21:07:47 UTC (rev 9161)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -92,6 +92,155 @@
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'bp_actions', 'messages_action_delete_message' );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Handle marking a single message thread as read.
+ *
+ * @since BuddyPress (2.2.0)
+ *
+ * @return bool|null Returns false on failure. Otherwise redirects back to the
+ *         message box URL.
+ */
+function bp_messages_action_mark_read() {
+
+       if ( ! bp_is_messages_component() || bp_is_current_action( 'notices' ) || ! bp_is_action_variable( 'read', 0 ) ) {
+               return false;
+       }
+
+       $action = ! empty( $_GET['action'] ) ? $_GET['action'] : '';
+       $nonce  = ! empty( $_GET['_wpnonce'] ) ? $_GET['_wpnonce'] : '';
+       $id     = ! empty( $_GET['message_id'] ) ? intval( $_GET['message_id'] ) : '';
+
+       // Bail if no action or no ID.
+       if ( 'read' !== $action || empty( $id ) || empty( $nonce ) ) {
+               return false;
+       }
+
+       // Check the nonce.
+       if ( ! bp_verify_nonce_request( 'bp_message_thread_mark_read_' . $id ) ) {
+               return false;
+       }
+
+       // Check access to the message and mark as read.
+       if ( messages_check_thread_access( $id ) ) {
+               messages_mark_thread_read( $id );
+               bp_core_add_message( __( 'Message marked as read.', 'buddypress' ) );
+       } else {
+               bp_core_add_message( __( 'There was a problem marking that message.', 'buddypress' ), 'error' );
+       }
+
+       // Redirect back to the message box.
+       bp_core_redirect( bp_displayed_user_domain() . bp_get_messages_slug() . '/' . bp_current_action() );
+}
+add_action( 'bp_actions', 'bp_messages_action_mark_read' );
+
+/**
+ * Handle marking a single message thread as unread.
+ *
+ * @since BuddyPress (2.2.0)
+ *
+ * @return bool|null Returns false on failure. Otherwise redirects back to the
+ *         message box URL.
+ */
+function bp_messages_action_mark_unread() {
+
+       if ( ! bp_is_messages_component() || bp_is_current_action( 'notices' ) || ! bp_is_action_variable( 'unread', 0 ) ) {
+               return false;
+       }
+
+       $action = ! empty( $_GET['action'] ) ? $_GET['action'] : '';
+       $nonce  = ! empty( $_GET['_wpnonce'] ) ? $_GET['_wpnonce'] : '';
+       $id     = ! empty( $_GET['message_id'] ) ? intval( $_GET['message_id'] ) : '';
+
+       // Bail if no action or no ID.
+       if ( 'unread' !== $action || empty( $id ) || empty( $nonce ) ) {
+               return false;
+       }
+
+       // Check the nonce.
+       if ( ! bp_verify_nonce_request( 'bp_message_thread_mark_unread_' . $id ) ) {
+               return false;
+       }
+
+       // Check access to the message and mark unread.
+       if ( messages_check_thread_access( $id ) ) {
+               messages_mark_thread_unread( $id );
+               bp_core_add_message( __( 'Message marked unread.', 'buddypress' ) );
+       } else {
+               bp_core_add_message( __( 'There was a problem marking that message.', 'buddypress' ), 'error' );
+       }
+
+       // Redirect back to the message box URL.
+       bp_core_redirect( bp_displayed_user_domain() . bp_get_messages_slug() . '/' . bp_current_action() );
+}
+add_action( 'bp_actions', 'bp_messages_action_mark_unread' );
+
+/**
+ * Handle bulk management (mark as read/unread, delete) of message threads.
+ *
+ * @since BuddyPress (2.2.0)
+ *
+ * @return bool Returns false on failure. Otherwise redirects back to the
+ *         message box URL.
+ */
+function bp_messages_action_bulk_manage() {
+
+       if ( ! bp_is_messages_component() || bp_is_current_action( 'notices' ) || ! bp_is_action_variable( 'bulk-manage', 0 ) ) {
+               return false;
+       }
+
+       $action   = ! empty( $_POST['messages_bulk_action'] ) ? $_POST['messages_bulk_action'] : '';
+       $nonce    = ! empty( $_POST['messages_bulk_nonce'] ) ? $_POST['messages_bulk_nonce'] : '';
+       $messages = ! empty( $_POST['message_ids'] ) ? $_POST['message_ids'] : '';
+
+       $messages = wp_parse_id_list( $messages );
+
+       // Bail if no action or no IDs.
+       if ( ( ! in_array( $action, array( 'delete', 'read', 'unread' ) ) ) || empty( $messages ) || empty( $nonce ) ) {
+               bp_core_redirect( bp_displayed_user_domain() . bp_get_messages_slug() . '/' . bp_current_action() . '/' );
+       }
+
+       // Check the nonce.
+       if ( ! wp_verify_nonce( $nonce, 'messages_bulk_nonce' ) ) {
+               return false;
+       }
+
+       // Make sure the user has access to all notifications before managing them.
+       foreach ( $messages as $message ) {
+               if ( ! messages_check_thread_access( $message ) ) {
+                       bp_core_add_message( __( 'There was a problem managing your messages.', 'buddypress' ), 'error' );
+                       bp_core_redirect( bp_displayed_user_domain() . bp_get_messages_slug() . '/' . bp_current_action() . '/' );
+               }
+       }
+
+       // Delete, mark as read or unread depending on the user 'action'.
+       switch ( $action ) {
+               case 'delete' :
+                       foreach ( $messages as $message ) {
+                               messages_delete_thread( $message );
+                       }
+                       bp_core_add_message( __( 'Messages deleted.', 'buddypress' ) );
+               break;
+
+               case 'read' :
+                       foreach ( $messages as $message ) {
+                               messages_mark_thread_read( $message );
+                       }
+                       bp_core_add_message( __( 'Messages marked as read', 'buddypress' ) );
+               break;
+
+               case 'unread' :
+                       foreach ( $messages as $message ) {
+                               messages_mark_thread_unread( $message );
+                       }
+                       bp_core_add_message( __( 'Messages marked as unread.', 'buddypress' ) );
+               break;
+       }
+
+       // Redirect back to message box.
+       bp_core_redirect( bp_displayed_user_domain() . bp_get_messages_slug() . '/' . bp_current_action() . '/' );
+}
+add_action( 'bp_actions', 'bp_messages_action_bulk_manage' );
+
+/**
</ins><span class="cx" style="display: block; padding: 0 10px">  * Process a request to bulk delete messages.
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="cx" style="display: block; padding: 0 10px">  * @return bool False on failure.
</span></span></pre></div>
<a id="trunksrcbpmessagesbpmessagestemplatephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-messages/bp-messages-template.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-messages/bp-messages-template.php    2014-11-21 20:22:03 UTC (rev 9160)
+++ trunk/src/bp-messages/bp-messages-template.php      2014-11-21 21:07:47 UTC (rev 9161)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -561,6 +561,88 @@
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Output the URL used for marking a single message thread as unread.
+ *
+ * Since this function directly outputs a URL, it is escaped.
+ *
+ * @since BuddyPress (2.2.0)
+ */
+function bp_the_message_thread_mark_unread_url() {
+       echo esc_url( bp_get_the_message_thread_mark_unread_url() );
+}
+       /**
+        * Return the URL used for marking a single message thread as unread.
+        *
+        * @since BuddyPress (2.2.0)
+        *
+        * @return string
+        */
+       function bp_get_the_message_thread_mark_unread_url() {
+
+               // Get the message ID.
+               $id = bp_get_message_thread_id();
+
+               // Get the args to add to the URL.
+               $args = array(
+                       'action'     => 'unread',
+                       'message_id' => $id
+               );
+
+               // Base unread URL.
+               $url = trailingslashit( bp_loggedin_user_domain() . bp_get_messages_slug() . '/' . bp_current_action() . '/unread' );
+
+               // Add the args to the URL.
+               $url = add_query_arg( $args, $url );
+
+               // Add the nonce.
+               $url = wp_nonce_url( $url, 'bp_message_thread_mark_unread_' . $id );
+
+               // Filter and return.
+               return apply_filters( 'bp_get_the_message_thread_mark_unread_url', $url );
+       }
+
+/**
+ * Output the URL used for marking a single message thread as read.
+ *
+ * Since this function directly outputs a URL, it is escaped.
+ *
+ * @since BuddyPress (2.2.0)
+ */
+function bp_the_message_thread_mark_read_url() {
+       echo esc_url( bp_get_the_message_thread_mark_read_url() );
+}
+       /**
+        * Return the URL used for marking a single message thread as read
+        *
+        * @since BuddyPress (2.2.0)
+        *
+        * @return string
+        */
+       function bp_get_the_message_thread_mark_read_url() {
+
+               // Get the message ID.
+               $id = bp_get_message_thread_id();
+
+               // Get the args to add to the URL.
+               $args = array(
+                       'action'     => 'read',
+                       'message_id' => $id
+               );
+
+               // Base read URL.
+               $url = trailingslashit( bp_loggedin_user_domain() . bp_get_messages_slug() . '/' . bp_current_action() . '/read' );
+
+               // Add the args to the URL.
+               $url = add_query_arg( $args, $url );
+
+               // Add the nonce.
+               $url = wp_nonce_url( $url, 'bp_message_thread_mark_read_' . $id );
+
+               // Filter and return.
+               return apply_filters( 'bp_get_the_message_thread_mark_read_url', $url );
+       }
+
+/**
</ins><span class="cx" style="display: block; padding: 0 10px">  * Output the CSS class for the current thread.
</span><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> function bp_message_css_class() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -620,6 +702,71 @@
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Output a thread's total message count.
+ *
+ * @since BuddyPress (2.2.0)
+ *
+ * @param int $thread_id Optional. ID of the thread. Defaults to current thread ID.
+ */
+function bp_message_thread_total_count( $thread_id = false ) {
+       echo bp_get_message_thread_total_count( $thread_id );
+}
+       /**
+        * Get the current thread's total message count.
+        *
+        * @since BuddyPress (2.2.0)
+        *
+        * @param int $thread_id Optional. ID of the thread. Defaults to
+        *        current thread ID.
+        * @return int
+        */
+       function bp_get_message_thread_total_count( $thread_id = false ) {
+               if ( false === $thread_id ) {
+                       $thread_id = bp_get_message_thread_id();
+               }
+
+               $thread_template = new BP_Messages_Thread_Template( $thread_id, 'ASC' );
+
+               $count = 0;
+               if ( ! empty( $thread_template->message_count ) ) {
+                       $count = intval( $thread_template->message_count );
+               }
+
+               return apply_filters( 'bp_get_message_thread_total_count', $count );
+       }
+
+/**
+ * Output markup for the current thread's total and unread count.
+ *
+ * @since Buddypress (2.2.0)
+ *
+ * @param int $thread_id Optional. ID of the thread. Default: current thread ID.
+ */
+function bp_message_thread_total_and_unread_count( $thread_id = false ) {
+       echo bp_get_message_thread_total_and_unread_count( $thread_id );
+}
+       /**
+        * Get markup for the current thread's total and unread count.
+        *
+        * @param int $thread_id Optional. ID of the thread. Default: current thread ID.
+        * @return string Markup displaying the total and unread count for the thread.
+        */
+       function bp_get_message_thread_total_and_unread_count( $thread_id = false ) {
+               if ( false === $thread_id ) {
+                       $thread_id = bp_get_message_thread_id();
+               }
+
+               $total  = bp_get_message_thread_total_count( $thread_id );
+               $unread = bp_get_message_thread_unread_count( $thread_id );
+
+               return sprintf(
+                       '<span class="thread-count">(%1$s)</span> <span class="bp-screen-reader-text">%2$s</span>',
+                       number_format_i18n( $total ),
+                       sprintf( _n( '%d unread', '%d unread', $unread, 'buddypress' ), number_format_i18n( $unread ) )
+               );
+       }
+
+/**
</ins><span class="cx" style="display: block; padding: 0 10px">  * Output the unformatted date of the last post in the current thread.
</span><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> function bp_message_thread_last_post_date_raw() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -856,10 +1003,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> function bp_messages_options() {
</span><span class="cx" style="display: block; padding: 0 10px"> ?>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        <?php _e( 'Select:', 'buddypress' ) ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <label for="message-type-select" class="bp-screen-reader-text">
+               <?php _e( 'Select:', 'buddypress' ) ?>
+        </label>
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        <select name="message-type-select" id="message-type-select">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                <option value=""></option>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         <option value=""><?php _e( 'Select', 'buddypress' ); ?></option>
</ins><span class="cx" style="display: block; padding: 0 10px">                 <option value="read"><?php _ex('Read', 'Message dropdown filter', 'buddypress') ?></option>
</span><span class="cx" style="display: block; padding: 0 10px">                <option value="unread"><?php _ex('Unread', 'Message dropdown filter', 'buddypress') ?></option>
</span><span class="cx" style="display: block; padding: 0 10px">                <option value="all"><?php _ex('All', 'Message dropdown filter', 'buddypress') ?></option>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -878,6 +1027,24 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Output the dropdown for bulk management of messages.
+ *
+ * @since BuddyPress (2.2.0)
+ */
+function bp_messages_bulk_management_dropdown() {
+       ?>
+       <label class="bp-screen-reader-text" for="messages-select"><?php _e( 'Select Bulk Action', 'buddypress' ); ?></label>
+       <select name="messages_bulk_action" id="messages-select">
+               <option value="" selected="selected"><?php _e( 'Bulk Actions', 'buddypress' ); ?></option>
+               <option value="read"><?php _e( 'Mark read', 'buddypress' ); ?></option>
+               <option value="unread"><?php _e( 'Mark unread', 'buddypress' ); ?></option>
+               <option value="delete"><?php _e( 'Delete', 'buddypress' ); ?></option>
+       </select>
+       <input type="submit" id="messages-bulk-manage" class="button action" value="<?php esc_attr_e( 'Apply', 'buddypress' ); ?>">
+       <?php
+}
+
+/**
</ins><span class="cx" style="display: block; padding: 0 10px">  * Return whether or not the notice is currently active.
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="cx" style="display: block; padding: 0 10px">  * @since BuddyPress (1.6.0)
</span></span></pre></div>
<a id="trunksrcbptemplatesbplegacybuddypressmemberssinglemessagesmessagesloopphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-templates/bp-legacy/buddypress/members/single/messages/messages-loop.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-templates/bp-legacy/buddypress/members/single/messages/messages-loop.php     2014-11-21 20:22:03 UTC (rev 9160)
+++ trunk/src/bp-templates/bp-legacy/buddypress/members/single/messages/messages-loop.php       2014-11-21 21:07:47 UTC (rev 9161)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -16,49 +16,77 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        <?php do_action( 'bp_after_member_messages_pagination' ); ?>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        <?php do_action( 'bp_before_member_messages_threads'   ); ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <?php do_action( 'bp_before_member_messages_threads' ); ?>
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        <table id="message-threads" class="messages-notices">
-               <?php while ( bp_message_threads() ) : bp_message_thread(); ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <form action="<?php echo bp_loggedin_user_domain() . bp_get_messages_slug() . '/' . bp_current_action() ?>/bulk-manage/" method="post" id="messages-bulk-management">
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        <tr id="m-<?php bp_message_thread_id(); ?>" class="<?php bp_message_css_class(); ?><?php if ( bp_message_thread_has_unread() ) : ?> unread<?php else: ?> read<?php endif; ?>">
-                               <td width="1%" class="thread-count">
-                                       <span class="unread-count"><?php bp_message_thread_unread_count(); ?></span>
-                               </td>
-                               <td width="1%" class="thread-avatar"><?php bp_message_thread_avatar(); ?></td>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         <table id="message-threads" class="messages-notices">
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                <?php if ( 'sentbox' != bp_current_action() ) : ?>
-                                       <td width="30%" class="thread-from">
-                                               <?php _e( 'From:', 'buddypress' ); ?> <?php bp_message_thread_from(); ?><br />
-                                               <span class="activity"><?php bp_message_thread_last_post_date(); ?></span>
-                                       </td>
-                               <?php else: ?>
-                                       <td width="30%" class="thread-from">
-                                               <?php _e( 'To:', 'buddypress' ); ?> <?php bp_message_thread_to(); ?><br />
-                                               <span class="activity"><?php bp_message_thread_last_post_date(); ?></span>
-                                       </td>
-                               <?php endif; ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 <thead>
+                               <tr>
+                                       <th scope="col" class="thread-checkbox"><label class="bp-screen-reader-text" for="select-all-messages"><?php _e( 'Select all', 'buddypress' ); ?></label><input id="select-all-messages" type="checkbox"></th>
+                                       <th scope="col" class="thread-from"><?php _e( 'From', 'buddypress' ); ?></th>
+                                       <th scope="col" class="thread-info"><?php _e( 'Subject', 'buddypress' ); ?></th>
+                                       <th scope="col" class="thread-options"><?php _e( 'Actions', 'buddypress' ); ?></th>
+                               </tr>
+                       </thead>
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                <td width="50%" class="thread-info">
-                                       <p><a href="<?php bp_message_thread_view_link(); ?>" title="<?php esc_attr_e( "View Message", "buddypress" ); ?>"><?php bp_message_thread_subject(); ?></a></p>
-                                       <p class="thread-excerpt"><?php bp_message_thread_excerpt(); ?></p>
-                               </td>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 <tbody>
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                <?php do_action( 'bp_messages_inbox_list_item' ); ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         <?php while ( bp_message_threads() ) : bp_message_thread(); ?>
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                <td width="13%" class="thread-options">
-                                       <input type="checkbox" name="message_ids[]" value="<?php bp_message_thread_id(); ?>" />
-                                       <a class="button confirm" href="<?php bp_message_thread_delete_link(); ?>" title="<?php esc_attr_e( "Delete Conversation", "buddypress" ); ?>"><?php _e( 'Delete', 'buddypress' ); ?></a> &nbsp;
-                               </td>
-                       </tr>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 <tr id="m-<?php bp_message_thread_id(); ?>" class="<?php bp_message_css_class(); ?><?php if ( bp_message_thread_has_unread() ) : ?> unread<?php else: ?> read<?php endif; ?>">
+                                               <td>
+                                                       <input type="checkbox" name="message_ids[]" class="message-check" value="<?php bp_message_thread_id(); ?>" />
+                                               </td>
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                <?php endwhile; ?>
-       </table><!-- #message-threads -->
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                         <?php if ( 'sentbox' != bp_current_action() ) : ?>
+                                                       <td class="thread-from">
+                                                               <?php bp_message_thread_avatar( array( 'width' => 25, 'height' => 25 ) ); ?>
+                                                               <span class="from"><?php _e( 'From:', 'buddypress' ); ?></span> <?php bp_message_thread_from(); ?>
+                                                               <?php bp_message_thread_total_and_unread_count(); ?>
+                                                               <span class="activity"><?php bp_message_thread_last_post_date(); ?></span>
+                                                       </td>
+                                               <?php else: ?>
+                                                       <td class="thread-from">
+                                                               <?php bp_message_thread_avatar( array( 'width' => 25, 'height' => 25 ) ); ?>
+                                                               <span class="to"><?php _e( 'To:', 'buddypress' ); ?></span> <?php bp_message_thread_to(); ?>
+                                                               <?php bp_message_thread_total_and_unread_count(); ?>
+                                                               <span class="activity"><?php bp_message_thread_last_post_date(); ?></span>
+                                                       </td>
+                                               <?php endif; ?>
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        <div class="messages-options-nav">
-               <?php bp_messages_options(); ?>
-       </div><!-- .messages-options-nav -->
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                         <td class="thread-info">
+                                                       <p><a href="<?php bp_message_thread_view_link(); ?>" title="<?php esc_attr_e( "View Message", "buddypress" ); ?>"><?php bp_message_thread_subject(); ?></a></p>
+                                                       <p class="thread-excerpt"><?php bp_message_thread_excerpt(); ?></p>
+                                               </td>
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                                <?php do_action( 'bp_messages_inbox_list_item' ); ?>
+
+                                               <td class="thread-options">
+                                                       <?php if ( bp_message_thread_has_unread() ) : ?>
+                                                               <a class="read" href="<?php bp_the_message_thread_mark_read_url();?>"><?php _e( 'Read', 'buddypress' ); ?></a>
+                                                       <?php else : ?>
+                                                               <a class="unread" href="<?php bp_the_message_thread_mark_unread_url();?>"><?php _e( 'Unread', 'buddypress' ); ?></a>
+                                                       <?php endif; ?>
+                                                        |
+                                                       <a class="delete" href="<?php bp_message_thread_delete_link(); ?>"><?php _e( 'Delete', 'buddypress' ); ?></a>
+                                               </td>
+                                       </tr>
+
+                               <?php endwhile; ?>
+
+                       </tbody>
+
+               </table><!-- #message-threads -->
+
+               <div class="messages-options-nav">
+                       <?php bp_messages_bulk_management_dropdown(); ?>
+               </div><!-- .messages-options-nav -->
+
+               <?php wp_nonce_field( 'messages_bulk_nonce', 'messages_bulk_nonce' ); ?>
+       </form>
+
</ins><span class="cx" style="display: block; padding: 0 10px">         <?php do_action( 'bp_after_member_messages_threads' ); ?>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        <?php do_action( 'bp_after_member_messages_options' ); ?>
</span></span></pre></div>
<a id="trunksrcbptemplatesbplegacycssbuddypresscss"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-templates/bp-legacy/css/buddypress.css</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-templates/bp-legacy/css/buddypress.css       2014-11-21 20:22:03 UTC (rev 9160)
+++ trunk/src/bp-templates/bp-legacy/css/buddypress.css 2014-11-21 21:07:47 UTC (rev 9161)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -738,7 +738,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> body.no-js #buddypress #message-type-select,
</span><span class="cx" style="display: block; padding: 0 10px"> body.no-js #buddypress #delete_inbox_messages,
</span><span class="cx" style="display: block; padding: 0 10px"> body.no-js #buddypress #delete_sentbox_messages,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-body.no-js #buddypress #notifications-bulk-management #select-all-notifications {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+body.no-js #buddypress #messages-bulk-management #select-all-messages {
</ins><span class="cx" style="display: block; padding: 0 10px">         display: none;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> #buddypress .standard-form input:focus,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -974,8 +974,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> #buddypress table#message-threads {
</span><span class="cx" style="display: block; padding: 0 10px">        clear: both;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        margin: 0;
-       width: auto;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> #buddypress table.profile-fields {
</span><span class="cx" style="display: block; padding: 0 10px">        margin-bottom: 20px;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1015,6 +1013,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">        font-weight: bold;
</span><span class="cx" style="display: block; padding: 0 10px">        width: 25%;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+#buddypress #message-threads .thread-info {
+       min-width: 40%;
+}
</ins><span class="cx" style="display: block; padding: 0 10px"> #buddypress table tr td.thread-info p {
</span><span class="cx" style="display: block; padding: 0 10px">        margin: 0;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1384,6 +1385,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">        border-bottom: 1px solid #ffe8c4;
</span><span class="cx" style="display: block; padding: 0 10px">        font-weight: bold;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+#buddypress table#message-threads tr.unread td .thread-excerpt,
+#buddypress table#message-threads tr.unread td .activity,
+#buddypress table#message-threads tr.unread td.thread-options {
+       font-weight: normal;
+}
</ins><span class="cx" style="display: block; padding: 0 10px"> #buddypress li span.unread-count,
</span><span class="cx" style="display: block; padding: 0 10px"> #buddypress tr.unread span.unread-count {
</span><span class="cx" style="display: block; padding: 0 10px">        background: #dd0000;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1395,13 +1401,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">        padding: 1px 6px;
</span><span class="cx" style="display: block; padding: 0 10px">        color: #fff;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-#buddypress div.messages-options-nav {
-       background: #eee;
-       font-size: 80%;
-       margin: 0;
-       padding: 5px 15px;
-       text-align: right;
-}
</del><span class="cx" style="display: block; padding: 0 10px"> #buddypress div#message-thread div.message-box {
</span><span class="cx" style="display: block; padding: 0 10px">        margin: 0;
</span><span class="cx" style="display: block; padding: 0 10px">        padding: 15px;
</span></span></pre></div>
<a id="trunksrcbptemplatesbplegacyjsbuddypressjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-templates/bp-legacy/js/buddypress.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-templates/bp-legacy/js/buddypress.js 2014-11-21 20:22:03 UTC (rev 9160)
+++ trunk/src/bp-templates/bp-legacy/js/buddypress.js   2014-11-21 21:07:47 UTC (rev 9161)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1525,6 +1525,27 @@
</span><span class="cx" style="display: block; padding: 0 10px">                return false;
</span><span class="cx" style="display: block; padding: 0 10px">        });
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        /* Selecting/Deselecting all messages */
+       jq('#select-all-messages').click(function(event) {
+               if( this.checked ) {
+                       jq('.message-check').each(function() {
+                               this.checked = true;
+                       });
+               } else {
+                       jq('.message-check').each(function() {
+                               this.checked = false;
+                       });
+               }
+       });
+
+       /* Make sure a 'Bulk Action' is selected before submiting the messages bulk action form */
+       jq('#messages-bulk-manage').attr('disabled', 'disabled');
+
+       /* Remove the disabled attribute from the messages form submit button when bulk action has a value */
+       jq('#messages-select').on('change', function(){
+               jq('#messages-bulk-manage').attr('disabled', jq(this).val().length <= 0);
+       });
+
</ins><span class="cx" style="display: block; padding: 0 10px">         /* Selecting/Deselecting all notifications */
</span><span class="cx" style="display: block; padding: 0 10px">        jq('#select-all-notifications').click(function(event) {
</span><span class="cx" style="display: block; padding: 0 10px">                if( this.checked ) {
</span></span></pre>
</div>
</div>

</body>
</html>