]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Merged messages interface changes.
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Thu, 4 Mar 2010 02:21:28 +0000 (02:21 +0000)
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Thu, 4 Mar 2010 02:21:28 +0000 (02:21 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@5270 36083f99-b078-4883-b0ff-0f9b5a30f544

19 files changed:
mod/messages/actions/delete.php
mod/messages/actions/send.php
mod/messages/index.php
mod/messages/languages/en.php
mod/messages/read.php
mod/messages/readme.txt
mod/messages/send.php
mod/messages/sent.php
mod/messages/start.php
mod/messages/views/default/messages/css.php
mod/messages/views/default/messages/forms/message.php [deleted file]
mod/messages/views/default/messages/forms/reply.php [deleted file]
mod/messages/views/default/messages/forms/send.php [new file with mode: 0644]
mod/messages/views/default/messages/forms/view.php
mod/messages/views/default/messages/menu.php
mod/messages/views/default/messages/messages.php
mod/messages/views/default/messages/topbar.php
mod/messages/views/default/messages/view.php
mod/messages/views/default/object/messages.php [deleted file]

index 17bae28084979df34d424ec6389188596c19c6d6..e8a7dfd58dc0f9d6055fe30a8bdb20b972aa925a 100644 (file)
@@ -1,73 +1,69 @@
 <?php
+/**
+* Elgg delete a message action page
+* It is worth noting that due to the nature of a messaging system and the fact 2 people access
+* the same message, messages don't actually delete, they are just removed from view for the user who deletes
+* 
+* @package ElggMessages
+* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+* @author Curverider Ltd <info@elgg.com>
+* @copyright Curverider Ltd 2008-2010
+* @link http://elgg.com/
+*/
 
-    /**
-        * Elgg delete a message action page
-        * It is worth noting that due to the nature of a messaging system and the fact 2 people access
-        * the same message, messages don't actually delete, they are just removed from view for the user who deletes
-        * 
-        * @package ElggMessages
-        * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
-        * @author Curverider Ltd <info@elgg.com>
-        * @copyright Curverider Ltd 2008-2010
-        * @link http://elgg.com/
-        */
-        
-       // Need to be logged in to do this
-           gatekeeper();
-    // grab details sent from the form
-        $message_id_array = get_input('message_id');
-        if (!is_array($message_id_array)) $message_id_array = array($message_id_array);
-        $type = get_input('type'); // sent message or inbox
-        $success = true;
-        $submit = get_input('submit');
-        $offset = get_input('offset');
+// Need to be logged in to do this
+gatekeeper();
+
+// grab details sent from the form
+$message_id_array = get_input('message_id');
+if (!is_array($message_id_array)) $message_id_array = array($message_id_array);
+$type = get_input('type'); // sent message or inbox
+$success = true;
+$submit = get_input('submit');
+$offset = get_input('offset');
+
+foreach($message_id_array as $message_id) {
+
+// get the message object
+    $message = get_entity($message_id);
+    
+// Make sure we actually have permission to edit and that the object is of sub-type messages
+       if ($message && $message->getSubtype() == "messages") {
+               
+               if ($submit == elgg_echo('delete')) {
+                       if ($message->delete()) {
+                       } else {
+                               $success = false;
+                       }
+               } else {
+                       if ($message->readYet = 1) {
+                       } else {
+                               $success = false;
+                       }
+               }
         
-        foreach($message_id_array as $message_id) {
+    }else{
         
-           // get the message object
-               $message = get_entity($message_id);
-               
-           // Make sure we actually have permission to edit and that the object is of sub-type messages
-                       if ($message && $message->getSubtype() == "messages") {
-                       
-                               if ($submit == elgg_echo('delete')) {
-                                       if ($message->delete()) {
-                                       } else {
-                                               $success = false;
-                                       }
-                               } else {
-                                       if ($message->readYet = 1) {
-                                       } else {
-                                               $success = false;
-                                       }
-                               }
-                   
-               }else{
-                   
-                   // display the error message
-                   $success = false;
-                               
-                       }
+        // display the error message
+        $success = false;
                
-        }
-        
-        if ($success) {
-               if ($submit == elgg_echo('delete')) {
-                       system_message(elgg_echo("messages:deleted"));
-               } else {
-                       system_message(elgg_echo("messages:markedread"));
-               }
-                       // check to see if it is a sent message to be deleted
-                   if($type == 'sent'){
-                           forward("mod/messages/sent.php?offset={$offset}");
-                   }else{
-                   forward("mod/messages/?username=" . $_SESSION['user']->username . "&offset={$offset}");
-                   }
-        } else {
-               register_error(elgg_echo("messages:notfound"));
-               forward($_SERVER['HTTP_REFERER']);
-        }
-                 
-    
-?>
\ No newline at end of file
+       }
+
+}
+
+if ($success) {
+       if ($submit == elgg_echo('delete')) {
+               system_message(elgg_echo("messages:deleted"));
+       } else {
+               system_message(elgg_echo("messages:markedread"));
+       }
+       // check to see if it is a sent message to be deleted
+    if($type == 'sent'){
+           forward("mod/messages/sent.php?offset={$offset}");
+    }else{
+           forward("mod/messages/?username=" . $_SESSION['user']->username . "&offset={$offset}");
+    }
+} else {
+       register_error(elgg_echo("messages:notfound"));
+       forward($_SERVER['HTTP_REFERER']);
+}
\ No newline at end of file
index e48703e5af276d3346b93d1fe060cfdba8ecd687..cf9de8ba59b28d9a9b45d4ff9acaabe484d9148a 100644 (file)
@@ -1,64 +1,61 @@
 <?php
+/**
+* Elgg send a message action page
+* 
+* @package ElggMessages
+* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+* @author Curverider Ltd <info@elgg.com>
+* @copyright Curverider Ltd 2008-2010
+* @link http://elgg.com/
+*/
 
-       /**
-        * Elgg send a message action page
-        * 
-        * @package ElggMessages
-        * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
-        * @author Curverider Ltd <info@elgg.com>
-        * @copyright Curverider Ltd 2008-2010
-        * @link http://elgg.com/
-        */
-        
-        // Make sure we're logged in (send us to the front page if not)
-               if (!isloggedin()) forward();
+// Make sure we're logged in (send us to the front page if not)
+if (!isloggedin()) forward();
 
-       // Get input data
-               $title = get_input('title'); // message title
-               $message_contents = get_input('message'); // the message
-               $send_to = get_input('send_to'); // this is the user guid to whom the message is going to be sent
-               $reply = get_input('reply',0); // this is the guid of the message replying to
-               
-       // Cache to the session to make form sticky
-               $_SESSION['msg_to'] = $send_to;
-               $_SESSION['msg_title'] = $title;
-               $_SESSION['msg_contents'] = $message_contents;
+// Get input data
+$title = get_input('title'); // message title
+$message_contents = get_input('message'); // the message
+$send_to = get_input('send_to'); // this is the user guid to whom the message is going to be sent
+$reply = get_input('reply',0); // this is the guid of the message replying to
 
-               if (empty($send_to)) {
-                       register_error(elgg_echo("messages:user:blank"));
-                       forward("mod/messages/send.php");
-               }
-               
-               $user = get_user($send_to);
-               if (!$user) {
-                       register_error(elgg_echo("messages:user:nonexist"));
-                       forward("mod/messages/send.php");
-               }
+// Cache to the session to make form sticky
+$_SESSION['msg_to'] = $send_to;
+$_SESSION['msg_title'] = $title;
+$_SESSION['msg_contents'] = $message_contents;
 
-       // Make sure the message field, send to field and title are not blank
-               if (empty($message_contents) || empty($title)) {
-                       register_error(elgg_echo("messages:blank"));
-                       forward("mod/messages/send.php");
-               }
-               
-       // Otherwise, 'send' the message 
-               $result = messages_send($title,$message_contents,$send_to,0,$reply);
-                       
-       // Save 'send' the message
-               if (!$result) {
-                       register_error(elgg_echo("messages:error"));
-                       forward("mod/messages/send.php");
-               }
+if (empty($send_to)) {
+       register_error(elgg_echo("messages:user:blank"));
+       forward("mod/messages/send.php");
+}
 
-       // successful so uncache form values
-               unset($_SESSION['msg_to']);
-               unset($_SESSION['msg_title']);
-               unset($_SESSION['msg_contents']);
-                       
-       // Success message
-               system_message(elgg_echo("messages:posted"));
+$user = get_user($send_to);
+if (!$user) {
+       register_error(elgg_echo("messages:user:nonexist"));
+       forward("mod/messages/send.php");
+}
+
+// Make sure the message field, send to field and title are not blank
+if (empty($message_contents) || empty($title)) {
+       register_error(elgg_echo("messages:blank"));
+       forward("mod/messages/send.php");
+}
+
+// Otherwise, 'send' the message 
+$result = messages_send($title,$message_contents,$send_to,0,$reply);
+       
+// Save 'send' the message
+if (!$result) {
+       register_error(elgg_echo("messages:error"));
+       forward("mod/messages/send.php");
+}
+
+// successful so uncache form values
+unset($_SESSION['msg_to']);
+unset($_SESSION['msg_title']);
+unset($_SESSION['msg_contents']);
        
-       // Forward to the users inbox
-               forward('mod/messages/sent.php');       
+// Success message
+system_message(elgg_echo("messages:posted"));
 
-?>
+// Forward to the users inbox
+forward('mod/messages/sent.php');
\ No newline at end of file
index b9cfd109737ace06b1070bcbc8bae1088b511483..e5124a71aa20bc9bf1a6c371f9b349700b3f729e 100644 (file)
@@ -1,55 +1,52 @@
 <?php
-
-       /**
-        * Elgg messages inbox page
-        *
-        * @package ElggMessages
-        * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
-        * @author Curverider Ltd <info@elgg.com>
-        * @copyright Curverider Ltd 2008-2010
-        * @link http://elgg.com/
-        */
-
-       // Load Elgg engine
-               require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
-
-       // You need to be logged in!
-               gatekeeper();
-
-       // Get offset
-               $offset = get_input('offset',0);
-
-       // Set limit
-               $limit = 10;
-
-       // Get the logged in user, you can't see other peoples messages so use session id
-               $page_owner = $_SESSION['user'];
-               set_page_owner($page_owner->getGUID());
-
-       // Get the user's inbox, this will be all messages where the 'toId' field matches their guid
-               $messages = elgg_get_entities_from_metadata(array(
-                       'type' => 'object',
-                       'subtype' => 'messages',
-                       'metadata_name' => 'toId',
-                       'metadata_value' => $page_owner->getGUID(),
-                       'owner_guid' => $page_owner->guid,
-                       'limit' => $limit + 1,
-                       'offset' => $offset
-               ));
-
-       // Set the page title
-               $area2 = elgg_view_title(elgg_echo("messages:inbox"));
-
-       // Display them. The last variable 'page_view' is to allow the view page to know where this data is coming from,
-       // in this case it is the inbox, this is necessary to ensure the correct display
-               // $area2 .= elgg_view("messages/view",array('entity' => $messages, 'page_view' => "inbox", 'limit' => $limit, 'offset' => $offset));
-               $area2 .= elgg_view("messages/forms/view",array('entity' => $messages, 'page_view' => "inbox", 'limit' => $limit, 'offset' => $offset));
-
-       // format
-               $body = elgg_view_layout("two_column_left_sidebar", '', $area2);
-
-
-       // Draw page
-               page_draw(sprintf(elgg_echo('messages:user'),$page_owner->name),$body);
-
-?>
+/**
+ * Elgg messages inbox page
+ *
+ * @package ElggMessages
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+*/
+
+
+require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+gatekeeper();
+global $CONFIG;
+
+$offset = get_input('offset', 0);
+$limit = 10;
+
+// Get the logged in user, you can't see other peoples messages so use session id
+$page_owner = get_loggedin_user();
+set_page_owner($page_owner->getGUID());
+
+// Get the user's inbox, this will be all messages where the 'toId' field matches their guid
+$messages = elgg_get_entities_from_metadata(array(
+       'type' => 'object',
+       'subtype' => 'messages',
+       'metadata_name' => 'toId',
+       'metadata_value' => $page_owner->getGUID(),
+       'owner_guid' => $page_owner->guid,
+       'limit' => $limit + 1,
+       'offset' => $offset
+));
+
+// Set the page title
+$area2 = "<div id='content_header'><div class='content_header_title'>";
+$area2 .= elgg_view_title(elgg_echo("messages:inbox"))."</div>";
+$area2 .= "<div class='content_header_options'><a class='action_button' href='{$CONFIG->wwwroot}mod/messages/send.php'>" . elgg_echo('messages:compose') . "</a></div></div>";
+
+// Display them. The last variable 'page_view' is to allow the view page to know where this data is coming from,
+// in this case it is the inbox, this is necessary to ensure the correct display
+$area2 .= elgg_view("messages/forms/view",array('entity' => $messages, 'page_view' => "inbox", 'limit' => $limit, 'offset' => $offset));
+
+// Sidebar menu options
+//$area3 = elgg_view("messages/menu_options", array('context' => 'inbox'));
+
+// format
+$body = elgg_view_layout("one_column_with_sidebar",'',$area2);
+
+
+// Draw page
+page_draw(sprintf(elgg_echo('messages:user'),$page_owner->name),$body);
\ No newline at end of file
index ab83eedf2a8c6a3e9951a76720617b9fb4c9643e..d49d83cc21c990eed710a26ec1f37bb1c479f2c9 100644 (file)
@@ -1,87 +1,93 @@
 <?php
+/**
+* Elgg send a message action page
+* 
+* @package ElggMessages
+* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+* @author Curverider Ltd <info@elgg.com>
+* @copyright Curverider Ltd 2008-2010
+* @link http://elgg.com/
+*/
 
-       $english = array(
-       
-               /**
-                * Menu items and titles
-                */
-       
-                       'messages' => "Messages",
-            'messages:back' => "back to messages",
-                       'messages:user' => "Your inbox",
-                       'messages:sentMessages' => "Sent messages",
-                       'messages:posttitle' => "%s's messages: %s",
-                       'messages:inbox' => "Inbox",
-                       'messages:send' => "Send a message",
-                       'messages:sent' => "Sent messages",
-                       'messages:message' => "Message",
-                       'messages:title' => "Title",
-                       'messages:to' => "To",
-            'messages:from' => "From",
-                       'messages:fly' => "Send",
-                       'messages:replying' => "Message replying to",
-                       'messages:inbox' => "Inbox",
-                       'messages:sendmessage' => "Send a message",
-                       'messages:compose' => "Compose a message",
-                       'messages:sentmessages' => "Sent messages",
-                       'messages:recent' => "Recent messages",
-            'messages:original' => "Original message",
-            'messages:yours' => "Your message",
-            'messages:answer' => "Reply",
-                       'messages:toggle' => 'Toggle all',
-                       'messages:markread' => 'Mark read',
-                       
-                       'messages:new' => 'New message',
-       
-                       'notification:method:site' => 'Site',
-       
-                       'messages:error' => 'There was a problem saving your message. Please try again.',
-       
-                       'item:object:messages' => 'Messages',
-       
-               /**
-                * Status messages
-                */
-       
-                       'messages:posted' => "Your message was successfully sent.",
-                       'messages:deleted' => "Your messages were successfully deleted.",
-                       'messages:markedread' => "Your messages were successfully marked as read.",
-       
-               /**
-                * Email messages
-                */
-       
-                       'messages:email:subject' => 'You have a new message!',
-                       'messages:email:body' => "You have a new message from %s. It reads:
-
-                       
-%s
-
-
-To view your messages, click here:
+$english = array(
+       /**
+       * Menu items and titles
+       */
+
+       'messages' => "Messages",
+       'messages:back' => "back to messages",
+       'messages:user' => "Your inbox",
+       'messages:sentMessages' => "Sent messages",
+       'messages:posttitle' => "%s's messages: %s",
+       'messages:inbox' => "Inbox",
+       'messages:send' => "Send a message",
+       'messages:sent' => "Sent messages",
+       'messages:message' => "Message",
+       'messages:title' => "Title",
+       'messages:to' => "To",
+       'messages:from' => "From",
+       'messages:fly' => "Send",
+       'messages:replying' => "Message replying to",
+       'messages:inbox' => "Inbox",
+       'messages:sendmessage' => "Send a message",
+       'messages:compose' => "Compose a message",
+       'messages:sentmessages' => "Sent messages",
+       'messages:recent' => "Recent messages",
+       'messages:original' => "Original message",
+       'messages:yours' => "Your message",
+       'messages:answer' => "Reply",
+       'messages:toggle' => 'Toggle all',
+       'messages:markread' => 'Mark read',
+       'messages:recipient' => 'Choose a recipient&hellip;',
+
+       'messages:new' => 'New message',
+
+       'notification:method:site' => 'Messages',
+
+       'messages:error' => 'There was a problem saving your message. Please try again.',
+
+       'item:object:messages' => 'Messages',
+
+       /**
+       * Status messages
+       */
+
+       'messages:posted' => "Your message was successfully sent.",
+       'messages:deleted' => "Your messages were successfully deleted.",
+       'messages:markedread' => "Your messages were successfully marked as read.",
+
+       /**
+       * Email messages
+       */
+
+       'messages:email:subject' => 'You have a new message!',
+       'messages:email:body' => "You have a new message from %s. It reads:
+
+
+       %s
+
+
+       To view your messages, click here:
 
        %s
 
-To send %s a message, click here:
+       To send %s a message, click here:
 
        %s
 
-You cannot reply to this email.",
-       
-               /**
-                * Error messages
-                */
-       
-                       'messages:blank' => "Sorry; you need to actually put something in the message body before we can save it.",
-                       'messages:notfound' => "Sorry; we could not find the specified message.",
-                       'messages:notdeleted' => "Sorry; we could not delete this message.",
-                       'messages:nopermission' => "You do not have permission to alter that message.",
-                       'messages:nomessages' => "There are no messages to display.",
-                       'messages:user:nonexist' => "We could not find the recipient in the user database.",
-                       'messages:user:blank' => "You did not select someone to send this to.",
-       
-       );
-                                       
-       add_translation("en",$english);
-
-?>
\ No newline at end of file
+       You cannot reply to this email.",
+
+       /**
+       * Error messages
+       */
+
+       'messages:blank' => "Sorry; you need to actually put something in the message body before we can save it.",
+       'messages:notfound' => "Sorry; we could not find the specified message.",
+       'messages:notdeleted' => "Sorry; we could not delete this message.",
+       'messages:nopermission' => "You do not have permission to alter that message.",
+       'messages:nomessages' => "There are no messages to display.",
+       'messages:user:nonexist' => "We could not find the recipient in the user database.",
+       'messages:user:blank' => "You did not select someone to send this to.",
+);
+               
+add_translation("en", $english);
\ No newline at end of file
index f09bd116ff60e5a9955d52fdc094fa7bf9118c66..2c3c5af505b9fed4b3c7114fe521782c7a6a7a7e 100644 (file)
@@ -1,64 +1,58 @@
 <?php
-
-       /**
-        * Elgg read a message page
-        *
-        * @package ElggMessages
-        * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
-        * @author Curverider Ltd <info@elgg.com>
-        * @copyright Curverider Ltd 2008-2010
-        * @link http://elgg.com/
-        */
-
-       // Load Elgg engine
-               require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
-
-       // If we're not logged in, forward to the front page
-               gatekeeper();
-
-               $mbox_type = get_input('type', 'inbox');
-
-       // Get the full message object to read
-               $message = get_entity(get_input("message"));
-
-       // If no message, must have been deleted, send user to inbox/sent mail
-       if (!$message) {
-               $owner = get_loggedin_user();
-               if ($mbox_type == 'sent') {
-                       forward("mod/messages/sent.php");
-               } else {
-                       forward("pg/messages/{$owner->username}");
-               }
+/**
+* Elgg read a message page
+*
+* @package ElggMessages
+* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+* @author Curverider Ltd <info@elgg.com>
+* @copyright Curverider Ltd 2008-2010
+* @link http://elgg.com/
+*/
+
+// Load Elgg engine
+require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+
+// If we're not logged in, forward to the front page
+gatekeeper();
+
+$page_owner = get_loggedin_user();
+$mbox_type = get_input('type', 'inbox');
+
+// Get the full message object to read
+$message = get_entity(get_input("message"));
+
+// If no message, must have been deleted, send user to inbox/sent mail
+if (!$message) {
+       if ($mbox_type == 'sent') {
+               forward("mod/messages/sent.php");
+       } else {
+               forward("pg/messages/{$page_owner->username}");
        }
+}
+
+// If the message is being read from the inbox, mark it as read, otherwise don't.
+// This stops a user who checks out a message they have sent having it being marked
+// as read for the recipient
+if($mbox_type != "sent"){
+       // Mark the message as being read now
+       if ($message->getSubtype() == "messages") {
+               //set the message metadata to 1 which equals read
+               $message->readYet = 1;
+       }
+}
 
-       // If the message is being read from the inbox, mark it as read, otherwise don't.
-       // This stops a user who checks out a message they have sent having it being marked
-       // as read for the recipient
-               if(get_input('type') != "sent"){
-
-                       // Mark the message as being read now
-                       if ($message->getSubtype() == "messages") {
-
-                               //set the message metadata to 1 which equals read
-                               $message->readYet = 1;
-
-                       }
-
-               }
+set_page_owner($page_owner->getGUID());
 
-       // Get the logged in user
-               $page_owner = $_SESSION['user'];
-               set_page_owner($page_owner->getGUID());
+// Display it
+$content = elgg_view("messages/messages",array(
+                                                                       'entity' => $message,
+                                                                       'entity_owner' => $page_owner,
+                                                                       'full' => true
+                                                                       ));
 
-       // Display it
-               $area2 = elgg_view("messages/messages",array(
-                                                                                       'entity' => $message,
-                                                                                       'entity_owner' => $page_owner,
-                                                                                       'full' => true
-                                                                                       ));
-               $body = elgg_view_layout("two_column_left_sidebar", '', $area2);
+$sidebar = elgg_view("messages/menu_options");
 
-       // Display page
-               page_draw(sprintf(elgg_echo('messages:message')),$body);
+$body = elgg_view_layout("one_column_with_sidebar", $sidebar, $content);
 
-?>
\ No newline at end of file
+// Display page
+page_draw(sprintf(elgg_echo('messages:message')),$body);
\ No newline at end of file
index 52d7e6b4a7b4c9547272c475541590fea4a159a1..04142be1971508002a8208b8974a55dc792b1d4c 100644 (file)
@@ -1,11 +1,11 @@
 /**
       * Elgg readme
       
       * @package ElggMessages
       * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
       * @author Dave Tosh <dave@elgg.com>
       * @copyright Curverider Ltd 2008-2009
       * @link http://elgg.com/
+ * Elgg readme
+ * 
+ * @package ElggMessages
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Dave Tosh <dave@elgg.com>
+ * @copyright Curverider Ltd 2008-2009
+ * @link http://elgg.com/
 */
 
 Install: drop the plugin into your mod folder, that is it.
index 61e0c162df72b63f482f85151c82ae7b9dbe0181..ecab600730443379aa743936e95cbb830b4a69f5 100644 (file)
@@ -1,41 +1,42 @@
 <?php
-
-       /**
-        * Elgg send a message page
-        *
-        * @package ElggMessages
-        * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
-        * @author Curverider Ltd <info@elgg.com>
-        * @copyright Curverider Ltd 2008-2010
-        * @link http://elgg.com/
-        */
-
-       // Load Elgg engine
-               require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
-
-       // If we're not logged in, forward to the front page
-               gatekeeper(); // if (!isloggedin()) forward();
-
-       // Get the current page's owner
-               $page_owner = page_owner_entity();
-               if ($page_owner === false || is_null($page_owner)) {
-                       $page_owner = $_SESSION['user'];
-                       set_page_owner($page_owner->getGUID());
-               }
-
-       // Get the users friends; this is used in the drop down to select who to send the message to
-               $friends = $_SESSION['user']->getFriends('', 9999);
-
-       // Set the page title
-               $area2 = elgg_view_title(elgg_echo("messages:sendmessage"));
-
-       // Get the send form
-               $area2 .= elgg_view("messages/forms/message",array('friends' => $friends));
-
-       // Format
-               $body = elgg_view_layout("two_column_left_sidebar", '', $area2);
-
-       // Draw page
-               page_draw(sprintf(elgg_echo('messages:send'),$page_owner->name),$body);
-
-?>
\ No newline at end of file
+/**
+* Elgg send a message page
+*
+* @package ElggMessages
+* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+* @author Curverider Ltd <info@elgg.com>
+* @copyright Curverider Ltd 2008-2010
+* @link http://elgg.com/
+*/
+
+// Load Elgg engine
+require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+
+// If we're not logged in, forward to the front page
+gatekeeper();
+
+// Get the current page's owner
+$page_owner = page_owner_entity();
+if ($page_owner === false || is_null($page_owner)) {
+       $page_owner = $_SESSION['user'];
+       set_page_owner($page_owner->getGUID());
+}
+
+// Get the users friends; this is used in the drop down to select who to send the message to
+$user = get_loggedin_user();
+$friends = $user->getFriends('', 9999);
+
+// Set the page title
+$area2 = elgg_view_title(elgg_echo("messages:sendmessage"));
+
+// Get the send form
+$area2 .= elgg_view("messages/forms/send",array('friends' => $friends));
+
+// Sidebar menu options
+$area3 = elgg_view("messages/menu_options");
+
+// Format
+$body = elgg_view_layout("one_column_with_sidebar", $area3, $area2);
+
+// Draw page
+page_draw(sprintf(elgg_echo('messages:send'),$page_owner->name),$body);
\ No newline at end of file
index c6213de2c9eca8e53f568e3e006dff10855354d8..0d68899b25e04d20f28b001ec1042243b9cf7c1a 100644 (file)
@@ -1,46 +1,46 @@
 <?php
+/**
+* Elgg sent messages page
+* 
+* @package ElggMessages
+* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+* @author Curverider Ltd <info@elgg.com>
+* @copyright Curverider Ltd 2008-2010
+* @link http://elgg.com/
+*/
 
-       /**
-        * Elgg sent messages page
-        * 
-        * @package ElggMessages
-        * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
-        * @author Curverider Ltd <info@elgg.com>
-        * @copyright Curverider Ltd 2008-2010
-        * @link http://elgg.com/
-        */
-
-       // Load Elgg engine
-               require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
-               
-       // If we're not logged in, forward to the front page
-               if (!isloggedin()) forward(); 
-               
-       // Get the logged in user
-               $page_owner = $_SESSION['user'];
-               set_page_owner($page_owner->guid);
-               
-       // Get offset
-               $offset = get_input('offset',0);
-       
-       // Set limit
-               $limit = 10;
-               
-    // Display all the messages a user owns, these will make up the sentbox
-               $messages = elgg_get_entities_from_metadata(array('metadata_name' => 'fromId', 'metadata_value' => $_SESSION['user']->guid, 'types' => 'object', 'subtypes' => 'messages', 'owner_guid' => $page_owner->guid, 'limit' => $limit, 'offset' => $offset)); 
-               //$page_owner->getObjects('messages');
-               
-    // Set the page title
-           $area2 = elgg_view_title(elgg_echo("messages:sentmessages"));
-               
-       // Set content
-               // $area2 .= elgg_view("messages/view",array('entity' => $messages, 'page_view' => "sent", 'limit' => $limit, 'offset' => $offset));
-               $area2 .= elgg_view("messages/forms/view",array('entity' => $messages, 'page_view' => "sent", 'limit' => $limit, 'offset' => $offset));
-
-       // Format
-               $body = elgg_view_layout("two_column_left_sidebar", '', $area2);
-               
-       // Draw page
-               page_draw(sprintf(elgg_echo('messages:sentMessages'),$page_owner->name),$body);
-               
-?>
\ No newline at end of file
+require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+global $CONFIG;
+
+gatekeeper();
+
+// Get the logged in user
+$page_owner = get_loggedin_user();
+set_page_owner($page_owner->guid);
+
+// Get offset
+$offset = get_input('offset',0);
+
+// Set limit
+$limit = 10;
+
+// Display all the messages a user owns, these will make up the sentbox
+$messages = elgg_get_entities_from_metadata(array('metadata_name' => 'fromId', 'metadata_value' => $_SESSION['user']->guid, 'types' => 'object', 'subtypes' => 'messages', 'owner_guid' => $page_owner->guid, 'limit' => $limit, 'offset' => $offset)); 
+
+
+// Set the page title
+$area2 = "<div id='content_header'><div class='content_header_title'>";
+$area2 .= elgg_view_title(elgg_echo("messages:sentmessages"))."</div>";
+$area2 .= "<div class='content_header_options'><a class='action_button' href='{$CONFIG->wwwroot}mod/messages/send.php'>" . elgg_echo('messages:compose') . "</a></div></div>";
+
+// Set content
+$area2 .= elgg_view("messages/forms/view",array('entity' => $messages, 'page_view' => "sent", 'limit' => $limit, 'offset' => $offset));
+
+// Sidebar menu options
+//$area3 = elgg_view("messages/menu_options", array('context' => 'sent'));
+
+// Format
+$body = elgg_view_layout("one_column_with_sidebar",'',$area2);
+
+// Draw page
+page_draw(sprintf(elgg_echo('messages:sentMessages'),$page_owner->name),$body);
\ No newline at end of file
index 992d6090102d627b4f1710a44975144ce5508712..b74402ac3d64a509e8d7de0b3da9078886d44470 100644 (file)
 <?php
 
-       /**
-        * Elgg internal messages plugin
-        * This plugin lets user send each other messages.
-        
-        * @package ElggMessages
-        * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
-        * @author Curverider Ltd <info@elgg.com>
-        * @copyright Curverider Ltd 2008-2010
-        * @link http://elgg.com/
-        */
+/**
+* Elgg internal messages plugin
+* This plugin lets user send each other messages.
+* 
+* @package ElggMessages
+* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+* @author Curverider Ltd <info@elgg.com>
+* @copyright Curverider Ltd 2008-2010
+* @link http://elgg.com/
+*/
 
-       /**
-        * Messages initialisation
-        *
-        * These parameters are required for the event API, but we won't use them:
-        * 
-        * @param unknown_type $event
-        * @param unknown_type $object_type
-        * @param unknown_type $object
-        */
-        
-           function messages_init() {
-           
-           // Load system configuration
-                               global $CONFIG;
-                               
-                       //add submenu options
-                               if (get_context() == "messages") {
-                                       add_submenu_item(elgg_echo('messages:compose'), $CONFIG->wwwroot . "mod/messages/send.php");
-                                       add_submenu_item(elgg_echo('messages:inbox'), $CONFIG->wwwroot . "pg/messages/" . $_SESSION['user']->username);
-                                       add_submenu_item(elgg_echo('messages:sentmessages'), $CONFIG->wwwroot . "mod/messages/sent.php");
-                               }
-                               
-                       // Extend system CSS with our own styles, which are defined in the shouts/css view
-                               elgg_extend_view('css','messages/css');
-                               
-                       // Extend the elgg topbar
-                               elgg_extend_view('elgg_topbar/extend','messages/topbar');
-                       
-                       // Register a page handler, so we can have nice URLs
-                               register_page_handler('messages','messages_page_handler');
-                               
-                       // Register a URL handler for shouts posts
-                               register_entity_url_handler('messages_url','object','messages');
-                               
-               // Extend hover-over and profile menu   
-                               elgg_extend_view('profile/menu/links','messages/menu');
-                               
-                       // Register a notification handler for site messages
-                               register_notification_handler("site", "messages_site_notify_handler");
-                               register_plugin_hook('notify:entity:message','object','messages_notification_msg');
-                               if (is_callable('register_notification_object'))
-                                       register_notification_object('object','messages',elgg_echo('messages:new'));
-                               
-                   // Shares widget
-                         //  add_widget_type('messages',elgg_echo("messages:recent"),elgg_echo("messages:widget:description"));
-                           
-                       // Override metadata permissions
-                           register_plugin_hook('permissions_check:metadata','object','messages_can_edit_metadata');
+/**
+* Messages initialisation
+*
+* These parameters are required for the event API, but we won't use them:
+* 
+* @param unknown_type $event
+* @param unknown_type $object_type
+* @param unknown_type $object
+*/
+
+function messages_init() {
+    
+    // Load system configuration
+               global $CONFIG;
+               
+       //add submenu options
+               if (get_context() == "messages") {
+                       add_submenu_item(elgg_echo('messages:inbox'), $CONFIG->wwwroot . "pg/messages/" . $_SESSION['user']->username);
+                       add_submenu_item(elgg_echo('messages:sentmessages'), $CONFIG->wwwroot . "mod/messages/sent.php");
                }
                
-               /**
-                * Override the canEditMetadata function to return true for messages
-                *
-                */
-               function messages_can_edit_metadata($hook_name, $entity_type, $return_value, $parameters) {
+       // Extend system CSS with our own styles, which are defined in the shouts/css view
+               elgg_extend_view('css','messages/css');
+               
+       // Extend the elgg topbar
+               elgg_extend_view('elgg_topbar/extend','messages/topbar');
+       
+       // Register a page handler, so we can have nice URLs
+               register_page_handler('messages','messages_page_handler');
+               
+       // Register a URL handler for shouts posts
+               register_entity_url_handler('messages_url','object','messages');
+               
+    // Extend hover-over and profile menu      
+               elgg_extend_view('profile/menu/links','messages/menu');
+               
+       // Register a notification handler for site messages
+               register_notification_handler("site", "messages_site_notify_handler");
+               register_plugin_hook('notify:entity:message','object','messages_notification_msg');
+               if (is_callable('register_notification_object'))
+                       register_notification_object('object','messages',elgg_echo('messages:new'));
+               
+    // Shares widget
+         //  add_widget_type('messages',elgg_echo("messages:recent"),elgg_echo("messages:widget:description"));
+           
+       // Override metadata permissions
+           register_plugin_hook('permissions_check:metadata','object','messages_can_edit_metadata');
+}
 
-                       global $messagesendflag;
-                       
-                       if ($messagesendflag == 1) {
-                               $entity = $parameters['entity'];
-                               if ($entity->getSubtype() == "messages") {
-                                       return true;
-                               }
-                       }
-                       
-                       return $return_value;
-                       
+/**
+ * Override the canEditMetadata function to return true for messages
+ *
+ */
+function messages_can_edit_metadata($hook_name, $entity_type, $return_value, $parameters) {
+
+       global $messagesendflag;
+       
+       if ($messagesendflag == 1) {
+               $entity = $parameters['entity'];
+               if ($entity->getSubtype() == "messages") {
+                       return true;
                }
-               
-               /**
-                * Override the canEdit function to return true for messages within a particular context.
-                *
-                */
-               function messages_can_edit($hook_name, $entity_type, $return_value, $parameters) {
-                       
-                       global $messagesendflag;
-                       
-                       if ($messagesendflag == 1) {
-                               $entity = $parameters['entity'];
-                               if ($entity->getSubtype() == "messages") {
-                                       return true;
-                               }
-                       }
-                       
-                       return $return_value;
-                       
+       }
+       
+       return $return_value;
+       
+}
+
+/**
+ * Override the canEdit function to return true for messages within a particular context.
+ *
+ */
+function messages_can_edit($hook_name, $entity_type, $return_value, $parameters) {
+       
+       global $messagesendflag;
+       
+       if ($messagesendflag == 1) {
+               $entity = $parameters['entity'];
+               if ($entity->getSubtype() == "messages") {
+                       return true;
                }
-               
-               /**
-                * We really don't want to send a notification message when a message is sent, if the method is messages ...
-                *
-                */
-               function messages_notification_msg($hook_name, $entity_type, $return_value, $parameters) {
+       }
+       
+       return $return_value;
+       
+}
 
-                       global $CONFIG, $messages_pm;
-                       
-                       if ($parameters['entity'] instanceof ElggEntity) {
-                               
-                               if ($parameters['entity']->getSubtype() == 'messages') {
-                                       
-                                       return false;
-                                       /*if (!$messages_pm) return false;
-                                       if ($parameters['method'] == 'email') {
-                                               return sprintf(
-                                                                       elgg_echo('messages:email:body'),
-                                                                       get_loggedin_user()->name,
-                                                                       strip_tags($parameters['entity']->description),
-                                                                       $CONFIG->wwwroot . "pg/messages/" . $user->username,
-                                                                       get_loggedin_user()->name,
-                                                                       $CONFIG->wwwroot . "mod/messages/send.php?send_to=" . get_loggedin_user()->guid
-                                                               );
-                                       } else if ($parameters['method'] == 'site') return false;*/
-                               }
-                       }
-                       return null;
+/**
+ * We really don't want to send a notification message when a message is sent, if the method is messages ...
+ *
+ */
+function messages_notification_msg($hook_name, $entity_type, $return_value, $parameters) {
+
+       global $CONFIG, $messages_pm;
+       
+       if ($parameters['entity'] instanceof ElggEntity) {
+               
+               if ($parameters['entity']->getSubtype() == 'messages') {
                        
+                       return false;
+                       /*if (!$messages_pm) return false;
+                       if ($parameters['method'] == 'email') {
+                               return sprintf(
+                                                       elgg_echo('messages:email:body'),
+                                                       get_loggedin_user()->name,
+                                                       strip_tags($parameters['entity']->description),
+                                                       $CONFIG->wwwroot . "pg/messages/" . $user->username,
+                                                       get_loggedin_user()->name,
+                                                       $CONFIG->wwwroot . "mod/messages/send.php?send_to=" . get_loggedin_user()->guid
+                                               );
+                       } else if ($parameters['method'] == 'site') return false;*/
                }
+       }
+       return null;
+       
+}
+
+/**
+ * Override the canEdit function to return true for messages within a particular context.
+ *
+ */
+function messages_can_edit_container($hook_name, $entity_type, $return_value, $parameters) {
+       
+       global $messagesendflag;
+       
+       if ($messagesendflag == 1) {
+               return true;
+       }
+       
+       return $return_value;
+       
+}
+
+/**
+ * Send an internal message
+ *
+ * @param string $subject The subject line of the message
+ * @param string $body The body of the mesage
+ * @param int $send_to The GUID of the user to send to
+ * @param int $from Optionally, the GUID of the user to send from
+ * @param int $reply The GUID of the message to reply from (default: none)
+ * @param true|false $notify Send a notification (default: true)
+ * @param true|false $add_to_sent If true (default), will add a message to the sender's 'sent' tray
+ * @return true|false Depending on success
+ */
+function messages_send($subject, $body, $send_to, $from = 0, $reply = 0, $notify = true, $add_to_sent = true) {
+       
+               global $messagesendflag;
+               $messagesendflag = 1;
                
-               /**
-                * Override the canEdit function to return true for messages within a particular context.
-                *
-                */
-               function messages_can_edit_container($hook_name, $entity_type, $return_value, $parameters) {
-                       
-                       global $messagesendflag;
-                       
-                       if ($messagesendflag == 1) {
-                               return true;
-                       }
-                       
-                       return $return_value;
-                       
+               global $messages_pm;
+               if ($notify) {
+                       $messages_pm = 1;
+               } else {
+                       $messages_pm = 0;
                }
                
-               /**
-                * Send an internal message
-                *
-                * @param string $subject The subject line of the message
-                * @param string $body The body of the mesage
-                * @param int $send_to The GUID of the user to send to
-                * @param int $from Optionally, the GUID of the user to send from
-                * @param int $reply The GUID of the message to reply from (default: none)
-                * @param true|false $notify Send a notification (default: true)
-                * @param true|false $add_to_sent If true (default), will add a message to the sender's 'sent' tray
-                * @return true|false Depending on success
-                */
-               function messages_send($subject, $body, $send_to, $from = 0, $reply = 0, $notify = true, $add_to_sent = true) {
-                       
-                               global $messagesendflag;
-                               $messagesendflag = 1;
-                               
-                               global $messages_pm;
-                               if ($notify) {
-                                       $messages_pm = 1;
-                               } else {
-                                       $messages_pm = 0;
-                               }
+       // If $from == 0, set to current user
+                       if ($from == 0)
+                               $from = (int) get_loggedin_user()->guid;
                                
-                       // If $from == 0, set to current user
-                                       if ($from == 0)
-                                               $from = (int) get_loggedin_user()->guid;
-                                               
-                   // Initialise a new ElggObject
-                                       $message_to = new ElggObject();
-                                       $message_sent = new ElggObject();
-                       // Tell the system it's a message
-                                       $message_to->subtype = "messages";
-                                       $message_sent->subtype = "messages";
-                       // Set its owner to the current user
-                                       // $message_to->owner_guid = $_SESSION['user']->getGUID();
-                                       $message_to->owner_guid = $send_to;
-                                       $message_to->container_guid = $send_to;
-                                       $message_sent->owner_guid = $from;
-                                       $message_sent->container_guid = $from;
-                       // For now, set its access to public (we'll add an access dropdown shortly)
-                                       $message_to->access_id = ACCESS_PUBLIC;
-                                       $message_sent->access_id = ACCESS_PUBLIC;
-                       // Set its description appropriately
-                                       $message_to->title = $subject;
-                                       $message_to->description = $body;
-                                       $message_sent->title = $subject;
-                                       $message_sent->description = $body;
-                   // set the metadata
-                           $message_to->toId = $send_to; // the user receiving the message
-                           $message_to->fromId = $from; // the user receiving the message
-                           $message_to->readYet = 0; // this is a toggle between 0 / 1 (1 = read)
-                           $message_to->hiddenFrom = 0; // this is used when a user deletes a message in their sentbox, it is a flag
-                           $message_to->hiddenTo = 0; // this is used when a user deletes a message in their inbox
-                           $message_sent->toId = $send_to; // the user receiving the message
-                           $message_sent->fromId = $from; // the user receiving the message
-                           $message_sent->readYet = 0; // this is a toggle between 0 / 1 (1 = read)
-                           $message_sent->hiddenFrom = 0; // this is used when a user deletes a message in their sentbox, it is a flag
-                           $message_sent->hiddenTo = 0; // this is used when a user deletes a message in their inbox
-                           
-                           $message_to->msg = 1;
-                           $message_sent->msg = 1;
-                           
-                           // Save the copy of the message that goes to the recipient
-                                       $success = $message_to->save();
-                                       
-                               // Save the copy of the message that goes to the sender
-                                       if ($add_to_sent) $success2 = $message_sent->save();
-                                       
-                                       $message_to->access_id = ACCESS_PRIVATE;
-                                       $message_to->save();
-                                       
-                                       if ($add_to_sent) {
-                                               $message_sent->access_id = ACCESS_PRIVATE;
-                                               $message_sent->save();
-                                       }
-                                       
-                           // if the new message is a reply then create a relationship link between the new message
-                           // and the message it is in reply to
-                               if($reply && $success){
-                               $create_relationship = add_entity_relationship($message_sent->guid, "reply", $reply);                           
-                               }
-                               
-                               
-                               global $CONFIG;
-                                       $message_contents = strip_tags($body);
-                                       if ($send_to != get_loggedin_user() && $notify)
-                                       notify_user($send_to, get_loggedin_user()->guid, elgg_echo('messages:email:subject'), 
-                                               sprintf(
-                                                                       elgg_echo('messages:email:body'),
-                                                                       get_loggedin_user()->name,
-                                                                       $message_contents,
-                                                                       $CONFIG->wwwroot . "pg/messages/" . $user->username,
-                                                                       get_loggedin_user()->name,
-                                                                       $CONFIG->wwwroot . "mod/messages/send.php?send_to=" . get_loggedin_user()->guid
-                                                               )
-                                       );
-                                       
-                               $messagesendflag = 0;    
-                               return $success;
+    // Initialise a new ElggObject
+                       $message_to = new ElggObject();
+                       $message_sent = new ElggObject();
+       // Tell the system it's a message
+                       $message_to->subtype = "messages";
+                       $message_sent->subtype = "messages";
+       // Set its owner to the current user
+                       // $message_to->owner_guid = $_SESSION['user']->getGUID();
+                       $message_to->owner_guid = $send_to;
+                       $message_to->container_guid = $send_to;
+                       $message_sent->owner_guid = $from;
+                       $message_sent->container_guid = $from;
+       // For now, set its access to public (we'll add an access dropdown shortly)
+                       $message_to->access_id = ACCESS_PUBLIC;
+                       $message_sent->access_id = ACCESS_PUBLIC;
+       // Set its description appropriately
+                       $message_to->title = $subject;
+                       $message_to->description = $body;
+                       $message_sent->title = $subject;
+                       $message_sent->description = $body;
+    // set the metadata
+            $message_to->toId = $send_to; // the user receiving the message
+            $message_to->fromId = $from; // the user receiving the message
+            $message_to->readYet = 0; // this is a toggle between 0 / 1 (1 = read)
+            $message_to->hiddenFrom = 0; // this is used when a user deletes a message in their sentbox, it is a flag
+            $message_to->hiddenTo = 0; // this is used when a user deletes a message in their inbox
+            $message_sent->toId = $send_to; // the user receiving the message
+            $message_sent->fromId = $from; // the user receiving the message
+            $message_sent->readYet = 0; // this is a toggle between 0 / 1 (1 = read)
+            $message_sent->hiddenFrom = 0; // this is used when a user deletes a message in their sentbox, it is a flag
+            $message_sent->hiddenTo = 0; // this is used when a user deletes a message in their inbox
+            
+            $message_to->msg = 1;
+            $message_sent->msg = 1;
+            
+           // Save the copy of the message that goes to the recipient
+                       $success = $message_to->save();
                        
-               }
-               
-               /**
-                * messages page handler; allows the use of fancy URLs
-                *
-                * @param array $page From the page_handler function
-                * @return true|false Depending on success
-                */
-               function messages_page_handler($page) {
+               // Save the copy of the message that goes to the sender
+                       if ($add_to_sent) $success2 = $message_sent->save();
                        
-                       // The first component of a messages URL is the username
-                       if (isset($page[0])) {
-                               set_input('username',$page[0]);
-                       }
+                       $message_to->access_id = ACCESS_PRIVATE;
+                       $message_to->save();
                        
-                       // The second part dictates what we're doing
-                       if (isset($page[1])) {
-                               switch($page[1]) {
-                                       case "read":            set_input('message',$page[2]);
-                                                                               include(dirname(__FILE__) . "/read.php");
-                                                                               return true;
-                                                                               break;
-                               }
-                       // If the URL is just 'messages/username', or just 'messages/', load the standard messages index
-                       } else {
-                               include(dirname(__FILE__) . "/index.php");
-                               return true;
+                       if ($add_to_sent) {
+                               $message_sent->access_id = ACCESS_PRIVATE;
+                               $message_sent->save();
                        }
                        
-                       return false;
+           // if the new message is a reply then create a relationship link between the new message
+           // and the message it is in reply to
+               if($reply && $success){
+               $create_relationship = add_entity_relationship($message_sent->guid, "reply", $reply);                           
+               }
+               
+               
+               global $CONFIG;
+                       $message_contents = strip_tags($body);
+                       if ($send_to != get_loggedin_user() && $notify)
+                       notify_user($send_to, get_loggedin_user()->guid, elgg_echo('messages:email:subject'), 
+                               sprintf(
+                                                       elgg_echo('messages:email:body'),
+                                                       get_loggedin_user()->name,
+                                                       $message_contents,
+                                                       $CONFIG->wwwroot . "pg/messages/" . $user->username,
+                                                       get_loggedin_user()->name,
+                                                       $CONFIG->wwwroot . "mod/messages/send.php?send_to=" . get_loggedin_user()->guid
+                                               )
+                       );
                        
-               }
+               $messagesendflag = 0;    
+               return $success;
+       
+}
 
-               function messages_url($message) {
-                       
-                       global $CONFIG;
-                       return $CONFIG->url . "pg/messages/" . $message->getOwnerEntity()->username . "/read/" . $message->getGUID();
-                       
-               }
-               
-    // A simple function to count the number of messages that are unread in a user's inbox
-        function count_unread_messages() {
-            
-            //get the users inbox messages
-                   //$num_messages = get_entities_from_metadata("toId", $_SESSION['user']->getGUID(), "object", "messages", 0, 10, 0, "", 0, false);
-                   $num_messages = elgg_get_entities_from_metadata(array('metadata_name_value_pairs' => array(
-                                                                       'toId' => $_SESSION['user']->guid,
-                                                                       'readYet' => 0,
-                                                                       'msg' => 1
-                                                                                          ), 'types' => 'object', 'subtypes' => 'messages', 'owner_guid' => $_SESSION['user']->guid, 'limit' => 9999));
-               
-                       if (is_array($num_messages))
-                               $counter = sizeof($num_messages);
-                       else
-                               $counter = 0;
-                               
-                   return $counter;
-            
-        }
-        
-        function messages_site_notify_handler(ElggEntity $from, ElggUser $to, $subject, $message, array $params = NULL)
-               {
-                       global $CONFIG;
-                       
-                       if (!$from)
-                               throw new NotificationException(sprintf(elgg_echo('NotificationException:MissingParameter'), 'from'));
-                                
-                       if (!$to)
-                               throw new NotificationException(sprintf(elgg_echo('NotificationException:MissingParameter'), 'to'));
-                               
-                       global $messages_pm;
-                       if (!$messages_pm)
-                               return messages_send($subject,$message,$to->guid,$from->guid,0,false,false);
-                       else return true;
-                       
+/**
+ * messages page handler; allows the use of fancy URLs
+ *
+ * @param array $page From the page_handler function
+ * @return true|false Depending on success
+ */
+function messages_page_handler($page) {
+       
+       // The first component of a messages URL is the username
+       if (isset($page[0])) {
+               set_input('username',$page[0]);
+       }
+       
+       // The second part dictates what we're doing
+       if (isset($page[1])) {
+               switch($page[1]) {
+                       case "read":            set_input('message',$page[2]);
+                                                               include(dirname(__FILE__) . "/read.php");
+                                                               return true;
+                                                               break;
                }
+       // If the URL is just 'messages/username', or just 'messages/', load the standard messages index
+       } else {
+               include(dirname(__FILE__) . "/index.php");
+               return true;
+       }
        
+       return false;
+       
+}
+
+function messages_url($message) {
+       
+       global $CONFIG;
+       return $CONFIG->url . "pg/messages/" . $message->getOwnerEntity()->username . "/read/" . $message->getGUID();
+       
+}
+
+// A simple function to count the number of messages that are unread in a user's inbox
+function count_unread_messages() {
+    
+    //get the users inbox messages
+    //$num_messages = get_entities_from_metadata("toId", $_SESSION['user']->getGUID(), "object", "messages", 0, 10, 0, "", 0, false);
+    $num_messages = elgg_get_entities_from_metadata(array('metadata_name_value_pairs' => array(
+                                                       'toId' => $_SESSION['user']->guid,
+                                                       'readYet' => 0,
+                                                       'msg' => 1
+                                               )));
+
+       if (is_array($num_messages))
+               $counter = sizeof($num_messages);
+       else
+               $counter = 0;
                
-       // Make sure the messages initialisation function is called on initialisation
-               register_elgg_event_handler('init','system','messages_init');
-               
-               register_plugin_hook('permissions_check','object','messages_can_edit');
-               register_plugin_hook('container_permissions_check','object','messages_can_edit_container');
+    return $counter;
+    
+}
+
+function messages_site_notify_handler(ElggEntity $from, ElggUser $to, $subject, $message, array $params = NULL)
+{
+       global $CONFIG;
+       
+       if (!$from)
+               throw new NotificationException(sprintf(elgg_echo('NotificationException:MissingParameter'), 'from'));
+                
+       if (!$to)
+               throw new NotificationException(sprintf(elgg_echo('NotificationException:MissingParameter'), 'to'));
                
-       // Register actions
-               global $CONFIG;
-               register_action("messages/send",false,$CONFIG->pluginspath . "messages/actions/send.php");
-               register_action("messages/delete",false,$CONFIG->pluginspath . "messages/actions/delete.php");
-        
-?>
\ No newline at end of file
+       global $messages_pm;
+       if (!$messages_pm)
+               return messages_send($subject,$message,$to->guid,$from->guid,0,false,false);
+       else return true;
+       
+}
+
+
+// Make sure the messages initialisation function is called on initialisation
+register_elgg_event_handler('init','system','messages_init');
+
+register_plugin_hook('permissions_check','object','messages_can_edit');
+register_plugin_hook('container_permissions_check','object','messages_can_edit_container');
+
+// Register actions
+global $CONFIG;
+register_action("messages/send",false,$CONFIG->pluginspath . "messages/actions/send.php");
+register_action("messages/delete",false,$CONFIG->pluginspath . "messages/actions/delete.php");
\ No newline at end of file
index 6a8a6ed3066b6286e182658de260c3b86514d8ae..b73f8ff11d8f2ef921a7b87a03e11cf865ff8faf 100644 (file)
 <?php
-
-       /**
-        * Elgg Messages CSS extender
-        * 
-        * @package ElggMessages
-        * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
-        * @author Curverider Ltd <info@elgg.com>
-        * @copyright Curverider Ltd 2008-2010
-        * @link http://elgg.com/
-        */
-
+/**
+ * Elgg Messages CSS
+ * 
+ * @package ElggMessages
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ */
 ?>
 
-/*-------------------------------
-MESSAGING PLUGIN
--------------------------------*/
-#messages {
-       margin:0 10px 0 10px;
-}
-.actiontitle {
-       font-weight: bold;
-       font-size: 110%;
-       margin: 0 0 10px 0;
-}
-#messages .pagination {
-       margin:5px 0 5px 0;
-}
-#messages input[type="checkbox"] {
-       margin:0;
-       padding:0;
-       border:none;
-}
-.messages_buttonbank {
-       -webkit-border-radius: 8px; 
-       -moz-border-radius: 8px;
-       background:white;
-       margin:5px 10px;
-       padding:5px;
-       text-align: right;
-}
-.messages_buttonbank input {
-       margin:0 0 0 10px;
-}
-.messages_buttonbank input[type="button"] {
-       font: 12px/100% Arial, Helvetica, sans-serif;
-       font-weight: bold;
-       color: #4690D6;
-       background:#dddddd;
-       border: 1px solid #999999;
-       -webkit-border-radius: 4px; 
-       -moz-border-radius: 4px;
-       width: auto;
-       height: 25px;
-       padding: 2px 6px 2px 6px;
-       margin:0 0 0 10px;
-       cursor: pointer;
-}
-.messages_buttonbank input[type="button"]:hover {
-       background: #0054a7;
-       border: 1px solid #0054a7;
+/* messages/new messages icon & counter in elgg_topbar */
+a.privatemessages {
+       background:transparent url(<?php echo $vars['url']; ?>_graphics/toolbar_messages_icon.gif) no-repeat left 2px;
+       padding-left:16px;
+       margin:4px 15px 0 5px;
+       cursor:pointer;
+}
+a.privatemessages:hover {
+       text-decoration: none;
+       background:transparent url(<?php echo $vars['url']; ?>_graphics/toolbar_messages_icon.gif) no-repeat left -36px;
+}
+a.privatemessages.new {
+       background:transparent url(<?php echo $vars['url']; ?>_graphics/toolbar_messages_icon.gif) no-repeat left 2px;
+       padding-left:18px;
+       margin:4px 15px 0 5px;
        color:white;
 }
-
-#messages td {
-       text-align: left;
-       vertical-align:middle;
-       padding: 5px;
-}
-#messages .message_sent {
-       -webkit-border-radius: 5px; 
-       -moz-border-radius: 5px;
-       margin-bottom: 5px;
-       background: white;
-       border:1px solid #cccccc;       
+a.privatemessages.new:hover {
+       text-decoration: none;
+       background:transparent url(<?php echo $vars['url']; ?>_graphics/toolbar_messages_icon.gif) no-repeat left -36px;
 }
-#messages .message_notread {
-       -webkit-border-radius: 5px; 
-       -moz-border-radius: 5px;
-       margin-bottom: 5px;
-       background: #F7DAD8;
-       border:1px solid #ff6c7c; 
-}
-#messages .message_read {
-       -webkit-border-radius: 5px; 
-       -moz-border-radius: 5px;
-       margin-bottom: 5px;
-       background: white;
-       border:1px solid #cccccc; 
-}
-#messages .message_notread td {
-
-}
-#messages .message_read td {
-
-}
-
-#messages .delete_msg a {
+a.privatemessages.new span {
+       background-color: red;
+       -webkit-border-radius: 10px; 
+       -moz-border-radius: 10px;
+       -webkit-box-shadow: -2px 2px 4px rgba(0, 0, 0, 0.50); /* safari v3+ */
+       -moz-box-shadow: -2px 2px 4px rgba(0, 0, 0, 0.50); /* FF v3.5+ */
+       color:white;
        display:block;
-       cursor: pointer;
-       width:14px;
-       height:14px;
-       margin:0;
-       background: url("<?php echo $vars['url']; ?>_graphics/icon_customise_remove.png") no-repeat right 0;
-       text-indent: -9000px;
        float:right;
-}
-#messages .delete_msg a:hover {
-       background-position: right -16px;
-}
-/* IE6 */
-* html #messages .delete_msg a { background-position: right 4px; }
-* html #messages .delete_msg a:hover { background-position: right 4px; } 
-
-#messages .usericon,
-#messages .groupicon {
-       float: left;
-       margin: 0 15px 0 0;
-}
-
-#messages .msgsender {
-       color:#666666;
-       line-height: 1em;
-       margin:0;
        padding:0;
-       float:left;
-}
-#messages .msgsender small {
-       color:#AAAAAA;
-}
-
-
-#messages .msgsubject {
-       font-size: 120%;
-       line-height: 100%;
-}
-
-.msgsubject {
+       position:relative;
+       text-align:center;
+       top:-3px;
+       right:5px;
+       min-width: 15px;
+       font-size:9px;
        font-weight:bold;
 }
 
-.messages_single_icon  {
-       float: left;
-       width:110px;
-}
-
-.messages_single_icon .usericon,
-.messages_single_icon .groupicon {
-       float: left;
-       margin: 0 10px 10px 0;
-}
-
-/* view and reply to message view */
-.message_body {
-       margin-left: 120px;
-}
-.message_body .messagebody {
-       padding:0;
-       margin:10px 0 10px 0;
-       font-size: 120%;
-       border-bottom:1px solid #cccccc;
-}
-
-/* drop down message reply form */
-#message_reply_form { display:none; }
-
-.new_messages_count {
-       color:#666666;
-}
-/* tinyMCE container */
-#message_reply_editor #message_tbl {
-       width:680px !important;
-}
-/* IE6 */
-* html #message_reply_editor #message_tbl { width:676px !important;}
-
-#messages_return {
-       margin:4px 0 4px 10px;
-}
-#messages_return p {
-       margin:0;
-}
-.messages_single {
-       background: white;
-       -webkit-border-radius: 8px; 
-       -moz-border-radius: 8px;
-       margin:0 10px 10px 10px;
-       padding:10px;   
+/* page content */
+.message {
+       border-bottom:1px dotted #cccccc;
+       padding:5px 0 7px 0;
 }
-/* when displaying original msg in reply view */
-.previous_message {
-    background:#dedede;
-       -webkit-border-radius: 5px; 
-       -moz-border-radius: 5px;
-    padding:10px;
-    margin:0 0 20px 0;
+.message.notread .entity_listing_info p.entity_title a {
+       color:#d40005;
 }
-.previous_message p {
-    padding:0;
-    margin:0 0 5px 0;
-    font-size: 100%;
+.message_sender {
+       float:left;
+       width:180px;
+       overflow: hidden;
 }
-
-
-
-
-#notificationstable td.sitetogglefield {
-       width:50px;
-       text-align: center;
-       vertical-align: middle;
+.message_subject {
+       float:left;
+       width:513px;
+       padding-top:6px;
 }
-#notificationstable td.sitetogglefield input {
-       margin-right:36px;
-       margin-top:5px;
+.message .delete_button {
+       margin-top:3px;
 }
-#notificationstable td.sitetogglefield a {
-       width:46px;
-       height:24px;
-       cursor: pointer;
-       display: block;
-       outline: none;
+.entity_listing.messages:hover {
+       background-color:white;
 }
-#notificationstable td.sitetogglefield a.sitetoggleOff {
-       background: url(<?php echo $vars['url']; ?>mod/messages/graphics/icon_notifications_site.gif) no-repeat right 2px;
+.messages_buttonbank {
+       margin:5px 0;
+       text-align: right;
 }
-#notificationstable td.sitetogglefield a.sitetoggleOn {
-       background: url(<?php echo $vars['url']; ?>mod/messages/graphics/icon_notifications_site.gif) no-repeat right -36px;
+.messages_buttonbank input {
+       margin:0 0 0 10px;
 }
-
-
-
-
-
-
diff --git a/mod/messages/views/default/messages/forms/message.php b/mod/messages/views/default/messages/forms/message.php
deleted file mode 100644 (file)
index 3a926b0..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-<?php
-
-    /**
-        * Elgg send a message page
-        *
-        * 
-        * @package ElggMessages
-        * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
-        * @author Curverider Ltd <info@elgg.com>
-        * @copyright Curverider Ltd 2008-2010
-        * @link http://elgg.com/
-        *
-        * @uses $vars['friends'] This is an array of a user's friends and is used to populate the list of
-        * people the user can message
-        *
-        */
-        
-       //grab the user id to send a message to. This will only happen if a user clicks on the 'send a message'
-       //link on a user's profile or hover-over menu
-       $send_to = get_input('send_to');
-       if ($send_to === "")
-               $send_to = $_SESSION['msg_to'];
-
-       $msg_title = $_SESSION['msg_title'];
-       $msg_content = $_SESSION['msg_contents'];
-       
-       // clear sticky form cache in case user browses away from page and comes back 
-       unset($_SESSION['msg_to']);
-       unset($_SESSION['msg_title']);
-       unset($_SESSION['msg_contents']);
-               
-       
-        
-?>
-       <div class="contentWrapper">
-       <form action="<?php echo $vars['url']; ?>action/messages/send" method="post" name="messageForm">
-                       
-           <?php
-               // security tokens.
-               echo elgg_view('input/securitytoken');
-                           
-               //check to see if the message recipient has already been selected
-                       if($send_to){
-                       
-                       //get the user object  
-               $user = get_user($send_to);
-               
-               //draw it
-                       echo "<label>" . elgg_echo("messages:to") . ":</label><div class=\"messages_single_icon\">" . elgg_view("profile/icon",array('entity' => $user, 'size' => 'tiny')) . $user->username;
-                       echo "</div><br class=\"clearfloat\" />";
-                       //set the hidden input field to the recipients guid
-               echo "<input type=\"hidden\" name=\"send_to\" value=\"{$send_to}\" />";
-               
-                           
-               }else{
-                   
-        ?>
-                       
-            <p><label><?php echo elgg_echo("messages:to"); ?>: </label>
-           <select name='send_to'>
-           <?php 
-                       //make the first option blank
-               echo "<option value=''></option>";
-               foreach($vars['friends'] as $friend){
-                                  
-                       //populate the send to box with a user's friends
-                           echo "<option value='{$friend->guid}'>" . $friend->name . "</option>";
-                               
-                   }
-                       
-            ?>
-               </select></p>
-                   
-        <?php
-               
-               }//end send_to if statement
-                       
-           ?>
-           
-               <p><label><?php echo elgg_echo("messages:title"); ?>: <br /><input type='text' name='title' value='<?php echo $msg_title; ?>' class="input-text" /></label></p>
-               <p class="longtext_editarea"><label><?php echo elgg_echo("messages:message"); ?>: <br />
-               <?php
-
-                                   echo elgg_view("input/longtext", array(
-                                                                       "internalname" => "message",
-                                                                       "value" => $msg_content,
-                                                                                                       ));
-                       
-               ?>
-               </label></p>
-               <p><input type="submit" class="submit_button" value="<?php echo elgg_echo("messages:fly"); ?>" /></p>
-       
-       </form>
-       </div>
diff --git a/mod/messages/views/default/messages/forms/reply.php b/mod/messages/views/default/messages/forms/reply.php
deleted file mode 100644 (file)
index 7b949ec..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-<?php
-
-    /**
-        * Elgg reply to a message form
-        * 
-        * @package ElggMessages
-        * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
-        * @author Curverider Ltd <info@elgg.com>
-        * @copyright Curverider Ltd 2008-2010
-        * @link http://elgg.com/
-        *
-        * @uses $vars['entity'] This is the message being replied to
-        *
-        */
-       
-       // fix for RE: RE: RE: that builds on replies
-       $reply_title = $vars['entity']->title;
-       if (strncmp($reply_title, "RE:", 3) != 0) {
-               $reply_title = "RE: " . $reply_title;
-       }
-exit;
-       $reply_title = str_replace("'", "\\'", $reply_title);
-?>
-
-<form action="<?php echo $vars['url']; ?>action/messages/send" method="post" name="messageForm">
-
-    <!-- populate the title space with the orginal message title, inserting re: before it -->                                                  
-       <p><label><?php echo elgg_echo("messages:title"); ?>: <br /><input type='text' name='title' class="input-text" value='<?php echo $reply_title; ?>' /></label></p>
-       <p><label><?php echo elgg_echo("messages:message"); ?>: <br /><textarea name='message' value='' class="input-textarea" /></textarea></label></p>
-               
-       <p>
-           <?php
-               echo elgg_view('input/securitytoken'); 
-               //pass across the guid of the message being replied to
-           echo "<input type='hidden' name='reply' value='" . $vars['entity']->getGUID() . "' />";
-           //pass along the owner of the message being replied to
-           echo "<input type='hidden' name='send_to' value='BAAA" . $vars['entity']->fromId . "' />";
-       
-           ?>
-           <input type="submit" class="submit_button" value="<?php echo elgg_echo("messages:fly"); ?>" />
-       </p>
-       
-</form>
-       
-       <?php
-        //display the message you are replying to
-               if (isset($vars['entity'])) {
-               
-               echo "<h3>" . elgg_echo("messages:replying") . "</h3>";
-               echo $vars['entity']->description;
-               
-               }
-    ?>
diff --git a/mod/messages/views/default/messages/forms/send.php b/mod/messages/views/default/messages/forms/send.php
new file mode 100644 (file)
index 0000000..93abe2e
--- /dev/null
@@ -0,0 +1,74 @@
+<?php
+/**
+* Elgg send a message view
+* 
+* @package ElggMessages
+* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+* @author Curverider Ltd <info@elgg.com>
+* @copyright Curverider Ltd 2008-2010
+* @link http://elgg.com/
+ * @uses $vars['friends'] This is an array of a user's friends and is used to populate the list of
+ * people the user can message
+ *
+ */
+//grab the user id to send a message to. This will only happen if a user clicks on the 'send a message'
+//link on a user's profile or hover-over menu
+$send_to = get_input('send_to');
+if ($send_to === "")
+       $send_to = $_SESSION['msg_to'];
+
+$msg_title = $_SESSION['msg_title'];
+$msg_content = $_SESSION['msg_contents'];
+
+// clear sticky form cache in case user browses away from page and comes back 
+unset($_SESSION['msg_to']);
+unset($_SESSION['msg_title']);
+unset($_SESSION['msg_contents']);
+?>
+<form id="messages_send_form" action="<?php echo $vars['url']; ?>action/messages/send" method="post" name="messageForm">
+<?php
+       echo elgg_view('input/securitytoken'); 
+        //check to see if the message recipient has already been selected
+               if($send_to){
+                       
+                       //get the user object  
+               $user = get_user($send_to);
+               
+               echo "<div class='entity_listing messages clearfloat'><div class='entity_listing_icon'>".elgg_view("profile/icon",array('entity' => $user, 'size' => 'tiny'))."</div>";
+               
+               //draw it
+                       echo "<div class='entity_listing_info'>".elgg_echo("messages:to").": <a href='{$vars['url']}pg/profile/".$user->username."'>".$user->username."</a>";
+                       //set the hidden input field to the recipients guid
+               echo "<input type='hidden' name='send_to' value=\"{$send_to}\" />";     
+                       echo "</div></div>";
+                   
+        } else {
+    ?>
+        
+        <p class="margin_top"><label><?php echo elgg_echo("messages:to"); ?>: </label>
+           <select name='send_to'>
+           <?php 
+                       // make the first option blank
+               echo "<option value=''>".elgg_echo("messages:recipient")."</option>";
+               foreach($vars['friends'] as $friend){
+               //populate the send to box with a user's friends
+                           echo "<option value='{$friend->guid}'>" . $friend->name . "</option>";
+                   }
+        ?>
+               </select></p>
+    <?php
+        }
+    ?>
+    
+       <p class="margin_top"><label><?php echo elgg_echo("messages:title"); ?>: <br /><input type='text' name='title' value='<?php echo $msg_title; ?>' class="input_text" /></label></p>
+       <p class="longtext_editarea"><label><?php echo elgg_echo("messages:message"); ?>: <br />
+       <?php
+               echo elgg_view("input/longtext", array(
+                                               "internalname" => "message",
+                                               "value" => $msg_content,
+               ));
+       ?>
+       </label></p>
+       <p><input type="submit" class="submit_button" value="<?php echo elgg_echo("messages:fly"); ?>" /></p>
+</form>
index adcd3a589b7113d7d4be6f273f8e3a9420506224..64395306468c495ce33047a8668c696f4c8d55d1 100644 (file)
@@ -1,15 +1,26 @@
 <?php
+/**
+* View message
+* 
+* @package ElggMessages
+* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+* @author Curverider Ltd <info@elgg.com>
+* @copyright Curverider Ltd 2008-2010
+* @link http://elgg.com/
+*/
 
-       $body = elgg_view("messages/view",$vars);
-       
-       $body .= '<div class="messages_buttonbank">';
-       $body .= '<input type="hidden" name="type" value="'.$vars['page_view'].'" />';
-       $body .= '<input type="hidden" name="offset" value="'.$vars['offset'].'" />';
-       $body .= '<input type="submit" name="submit" value="'.elgg_echo('delete').'" /> ';
+$body = elgg_view("messages/view",$vars);
+
+$body .= '<div class="messages_buttonbank">';
+$body .= '<input type="hidden" name="type" value="'.$vars['page_view'].'" />';
+$body .= '<input type="hidden" name="offset" value="'.$vars['offset'].'" />';
+$body .= '<input type="submit" name="submit" value="'.elgg_echo('delete').'" /> ';
+
+if($vars['page_view'] == "inbox"){
        $body .= '<input type="submit" name="submit" value="'.elgg_echo('messages:markread').'" /> ';
-       $body .= '<input type="button" onclick="javascript:$(\'input[type=checkbox]\').click();" value="'.elgg_echo('messages:toggle').'" />';
-       $body .= '</div>';
-       
-       echo elgg_view('input/form',array('body' => $body, 'action' => $vars['url'] . 'action/messages/delete', 'method' => 'post'));
+}
+
+$body .= '<input class="cancel_button" type="button" onclick="javascript:$(\'input[type=checkbox]\').click();" value="'.elgg_echo('messages:toggle').'" />';
+$body .= '</div>';
 
-?>
\ No newline at end of file
+echo elgg_view('input/form',array('body' => $body, 'action' => $vars['url'] . 'action/messages/delete', 'method' => 'post'));
\ No newline at end of file
index 9f8da1fb108f5f55bbf9f2f0ffb14ec47bbad1f1..06cdde060a711ff41e658061888c9873ece8edf8 100644 (file)
@@ -1,18 +1,16 @@
 <?php
-
-       /**
-        * Elgg hoverover extender for messages
-        * 
-        * @package ElggMessages
-        * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
-        * @author Curverider Ltd <info@elgg.com>
-        * @copyright Curverider Ltd 2008-2010
-        * @link http://elgg.com/
-        */
-        
-        //need to be logged in to send a message
-        if (isloggedin()) {
-
+/**
+ * Elgg hoverover extender for messages
+ * 
+ * @package ElggMessages
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ */
+ //need to be logged in to send a message
+ if (isloggedin()) {
 ?>
 
        <p class="user_menu_messages">
@@ -20,7 +18,4 @@
        </p>
        
 <?php
-
-       }
-
-?>
\ No newline at end of file
+}
\ No newline at end of file
index cdc6e44838417d870e193d4a49c60078cf931aeb..2e179b00f3b5068e36b4538775866291fe2abe66 100644 (file)
 <?php
-
-       /**
-        * Elgg messages individual view
-        *
-        * @package ElggMessages
-        * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
-        * @author Curverider Ltd <info@elgg.com>
-        * @copyright Curverider Ltd 2008-2010
-        * @link http://elgg.com/
-        *
-        *
-        * @uses $vars['entity'] Optionally, the message to view
-        * @uses get_input('type') If the user accesses the message from their sentbox, this variable is passed
-        * and used to make sure the correct icon and name is displayed
-        */
-       // set some variables to use below
-       if(get_input("type") == "sent"){
-
-               // send back to the users sentbox
-               $url = $vars['url'] . "mod/messages/sent.php";
-
-               //this is used on the delete link so we know which type of message it is
-               $type = "sent";
-
-       } else {
-
-               //send back to the users inbox
-               $url = $vars['url'] . "pg/messages/" . $vars['user']->username;
-
-               //this is used on the delete link so we know which type of message it is
-               $type = "inbox";
-
-       }
-
-       // fix for RE: RE: RE: that builds on replies
-       $reply_title = $vars['entity']->title;
-       if (strncmp($reply_title, "RE:", 3) != 0) {
-               $reply_title = "RE: " . $reply_title;
-       }
-
-       if (isloggedin())
+/**
+ * Elgg messages individual view
+ *
+ * @package ElggMessages
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ *
+ *
+ * @uses $vars['entity'] Optionally, the message to view
+ * @uses get_input('type') If the user accesses the message from their sentbox, this variable is passed
+ * and used to make sure the correct icon and name is displayed
+ */
+// set some variables to use below
+if(get_input("type") == "sent"){
+       // send back to the users sentbox
+       $url = $vars['url'] . "mod/messages/sent.php";
+    // set up breadcrumbs context
+    $breadcrumb_root_text = elgg_echo('messages:sent');
+       //this is used on the delete link so we know which type of message it is
+       $type = "sent";
+} else {
+       //send back to the users inbox
+       $url = $vars['url'] . "pg/messages/" . $vars['user']->username;
+    // set up breadcrumbs context
+    $breadcrumb_root_text = elgg_echo('messages:inbox');
+       //this is used on the delete link so we know which type of message it is
+       $type = "inbox";
+}
+
+// fix for RE: RE: RE: that builds on replies
+$reply_title = $vars['entity']->title;
+if (strncmp($reply_title, "RE:", 3) != 0) {
+       $reply_title = "RE: " . $reply_title;
+}
+
+if (isloggedin())
        if (isset($vars['entity'])) {
                if ($vars['entity']->toId == $vars['user']->guid
                        || $vars['entity']->owner_guid == $vars['user']->guid) {
-
+                       // display breadcrumbs
+                       echo elgg_view('page_elements/breadcrumbs', array( 
+                               'breadcrumb_root_url' => $url,
+                               'breadcrumb_root_text' => $breadcrumb_root_text,
+/*
+                               'breadcrumb_level1_url' => $url,
+                               'breadcrumb_level1_text' => $vars['entity']->title,
+                               'breadcrumb_level2_url' => $url,
+                               'breadcrumb_level2_text' => $vars['entity']->title,
+*/
+                               'breadcrumb_currentpage' => $vars['entity']->title
+                               )); 
 ?>
-       <!-- get the correct return url -->
-       <div id="messages_return"><!-- start of messages_return div -->
-               <p><a href="<?php echo $url; ?>">&laquo; <?php echo elgg_echo('messages:back'); ?></a></p>
-       </div><!-- end of messages_return div -->
-
-       <div class="messages_single"><!-- start of the message div -->
-
-               <div class="messages_single_icon"><!-- start of the message_user_icon div -->
-                       <!-- get the user icon, name and date -->
-                       <?php
-                               // we need a different user icon and name depending on whether the user is reading the message
-                               // from their inbox or sentbox. If it is the inbox, then the icon and name will be the person who sent
-                               // the message. If it is the sentbox, the icon and name will be the user the message was sent to
-                               if ($type == "sent") {
-                                       //get an instance of the user who the message has been sent to so we can access the name and icon
-                                       $user_object = get_entity($vars['entity']->toId);
-                                       echo " " . elgg_view("profile/icon",array('entity' => $user_object, 'size' => 'tiny'));
-                                       echo "<br class=\"clearfloat\" /><p>".elgg_echo('messages:to').": <b>" . $user_object->name . "</b><br />";
-                               } else {
-                                       echo " " . elgg_view("profile/icon",array('entity' => get_entity($vars['entity']->fromId), 'size' => 'tiny'));
-                                       echo "<br class=\"clearfloat\" /><p>".elgg_echo('messages:from').": <b>" . get_entity($vars['entity']->fromId)->name . "</b><br />";
-                               }
-                       ?>
-                       <!-- get the time the message was sent -->
-                       <small><?php echo friendly_time($vars['entity']->time_created); ?></small>
-                       </p>
-               </div><!-- end of the message_user_icon div -->
-
-               <div class="message_body"><!-- start of div message_body -->
-
-               <?php
-                       //if the message is a reply, display the message the reply was for
-                       //I need to figure out how to get the description out using -> (anyone?)
-                       if($main_message = $vars['entity']->getEntitiesFromRelationship("reply")){
-
-                               if($type == "sent"){
-                                       echo "<div class='previous_message'><h3>".elgg_echo('messages:original').":</h3><p>";
-                               }else{
-                                       echo "<div class='previous_message'><h3>".elgg_echo('messages:yours').":</h3><p>";
-                               }
-
-                               echo $main_message[0][description] . "</p></div>";
-
-                       }
-               ?>
-
-               <!-- display the title -->
-               <div class="actiontitle">
-               <h3><?php echo $vars['entity']->title; ?></h3>
-               </div>
-
-               <!-- display the message -->
-               <div class="messagebody">
-               <p><?php echo elgg_view('output/longtext',array('value' => $vars['entity']->description)); ?></p>
-               </div>
-
-               <!-- display the edit options, reply and delete -->
-               <div class="message_options"><!-- start of the message_options div -->
-
-               <script type="text/javascript">
-               $(document).ready(function () {
-                       // click function to toggle reply panel
-                       $('a.message_reply').click(function () {
-                               $('div#message_reply_form').slideToggle("medium");
-                               return false;
-                       });
-               });
-               </script>
-
-
-                       <p><?php if($type != "sent")echo "<a href=\"javascript:void(0);\" class='message_reply'>".elgg_echo('messages:answer')."</a> &nbsp; "; ?> <?php echo elgg_view("output/confirmlink", array(
-                                                                                                                               'href' => $vars['url'] . "action/messages/delete?message_id=" . $vars['entity']->getGUID() . "&type={$type}&submit=" . elgg_echo('delete'),
-                                                                                                                               'text' => elgg_echo('delete'),
-                                                                                                                               'confirm' => elgg_echo('deleteconfirm'),
-                                                                                                                       )); ?>
-                       </p>
-               </div><!-- end of the message_options div -->
-
-               </div><!-- end of div message_body -->
-
-               <!-- display the reply form -->
-               <div id="message_reply_form">
-                       <form action="<?php echo $vars['url']; ?>action/messages/send" method="post" name="messageForm">
-                               <!-- populate the title space with the orginal message title, inserting re: before it -->
-                               <p><label><?php echo elgg_echo("messages:title"); ?>: <br /><input type='text' name='title' class="input-text" value="<?php echo htmlentities($reply_title); ?>" /></label></p>
-                               <p class="longtext_editarea"><label><?php echo elgg_echo("messages:message"); ?>:</label></p>
-                               <div id="message_reply_editor">
-                               <?php
-
-                                       echo elgg_view("input/longtext", array(
-                                                                       "internalname" => "message",
-                                                                       "value" => '',
-                                                                                                       ));
-
-                               ?></div>
-
-                               <p>
-                                               <?php
-                                               // security tokens required.
-                                               echo elgg_view('input/securitytoken');
-
-                                                               //pass across the guid of the message being replied to
-                                                               echo "<input type='hidden' name='reply' value='" . $vars['entity']->getGUID() . "' />";
-                                                               //pass along the owner of the message being replied to
-                                                               echo "<input type='hidden' name='send_to' value='" . $vars['entity']->fromId . "' />";
-
-                                               ?>
-                                               <input type="submit" class="submit_button" value="<?php echo elgg_echo("messages:fly"); ?>" />
-                               </p>
-                       </form>
-               </div><!-- end of div reply_form -->
-
-       </div><!-- end of the message div -->
+<!-- display the content header block -->
+                       <div id="content_header" class="clearfloat">
+                               <div class="content_header_title"><h2><?php echo $vars['entity']->title; ?></h2></div>
+                               <div class="content_header_options">
+                                       <a class="action_button message_reply" href="#" onclick="elgg_slide_toggle(this,'#elgg_page_contents','#message_reply_form');"><?php echo elgg_echo('messages:answer'); ?></a>
+                                       <?php echo elgg_view("output/confirmlink", array(
+                                               'href' => $vars['url'] . "action/messages/delete?message_id=" . $vars['entity']->getGUID() . "&type={$type}&submit=" . elgg_echo('delete'),
+                                               'text' => elgg_echo('delete'),
+                                               'confirm' => elgg_echo('deleteconfirm'),
+                                               'class' => "action_button disabled"
+                                               )); 
+                               ?>
+                               </div>
+                       </div>
+                   
+                       <div class="entity_listing messages clearfloat">
+                           <?php
+                               // we need a different user icon and name depending on whether the user is reading the message
+                               // from their inbox or sentbox. If it is the inbox, then the icon and name will be the person who sent
+                               // the message. If it is the sentbox, the icon and name will be the user the message was sent to
+                               if($type == "sent"){
+                                   //get an instance of the user who the message has been sent to so we can access the name and icon
+                                   $user_object = get_entity($vars['entity']->toId);
+                                   $message_icon = elgg_view("profile/icon",array('entity' => $user_object, 'size' => 'tiny'));
+                                   $message_owner = elgg_echo('messages:to').": <a href='{$vars['url']}pg/profile/".$user_object->username."'>".$user_object->name."</a>";
+                               }else{
+                                       $user_object = get_entity($vars['entity']->fromId);
+                                   $message_icon = elgg_view("profile/icon",array('entity' => $user_object, 'size' => 'tiny'));
+                                   $message_owner = elgg_echo('messages:from').": <a href='{$vars['url']}pg/profile/".$user_object->username."'>".get_entity($vars['entity']->fromId)->name."</a>";
+                               }
+                           ?>
+                           <div class="entity_listing_icon"><?php echo $message_icon ?></div>
+                           <div class="entity_listing_info"><p><?php echo $message_owner ?></p>
+                                               <p class="entity_subtext"><?php echo friendly_time($vars['entity']->time_created); ?></p>
+                                       </div>
+                       </div>
+                       
+                       <div class="messagebody margin_top clearfloat">        
+                               <?php
+                                           // if the message is a reply, display the message the reply was for
+                                           // @todo I need to figure out how to get the description out using -> (anyone?)
+                                           if($main_message = $vars['entity']->getEntitiesFromRelationship("reply")){
+                                           echo $main_message[0][description];
+                                   }
+                               ?>
+                                       <!-- display the message -->
+                                       <?php echo elgg_view('output/longtext',array('value' => $vars['entity']->description)); ?>
+                               </div>
+               
+                               <!-- reply form -->
+                               <div id="message_reply_form" class="hidden margin_top">
+                                       <h2><?php echo elgg_echo('messages:answer'); ?></h2>
+                                       <form action="<?php echo $vars['url']; ?>action/messages/send" method="post" name="messageForm" class="margin_top" id="messages_send_form">
+                                               <?php echo elgg_view('input/securitytoken'); ?>
+                                               <p><label><?php echo elgg_echo("messages:title"); ?>: <br /><input type='text' name='title' class="input_text" value='<?php echo $reply_title; ?>' /></label></p>
+                                               <p class="longtext_editarea"><label><?php echo elgg_echo("messages:message"); ?>:</label></p>
+                                               <div id="message_reply_editor">
+                                               <?php echo elgg_view("input/longtext", array(
+                                                                                       "internalname" => "message",
+                                                                                       "value" => '',
+                                                                                                                       ));
+                                       ?></div>
+                                               
+                                       <?php
+                                               //pass across the guid of the message being replied to
+                                               echo "<input type='hidden' name='reply' value='" . $vars['entity']->getGUID() . "' />";
+                                               //pass along the owner of the message being replied to
+                                               echo "<input type='hidden' name='send_to' value='" . $vars['entity']->fromId . "' />";
+                                       ?>
+                                       <input type="submit" class="submit_button" value="<?php echo elgg_echo("messages:fly"); ?>" />
+                                       </form>
+                               </div>
 
 <?php
-                       }
        }
-?>
+}
\ No newline at end of file
index 1791675614083aa126fc5c26bde94af578b2f63b..7a607f035b08ef60fb159f0f9cda080114de4e30 100644 (file)
@@ -1,38 +1,34 @@
 <?php
+/**
+ * Elgg messages topbar extender
+ * 
+ * @package ElggMessages
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ */
 
-       /**
-        * Elgg messages topbar extender
-        * 
-        * @package ElggMessages
-        * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
-        * @author Curverider Ltd <info@elgg.com>
-        * @copyright Curverider Ltd 2008-2010
-        * @link http://elgg.com/
-        */
-        
-        //need to be logged in to send a message
-        gatekeeper();
+gatekeeper();
 
-       //get unread messages
-       $num_messages = count_unread_messages();
-       if($num_messages){
-               $num = $num_messages;
-       } else {
-               $num = 0;
-       }
-
-       if($num == 0){
+//get unread messages
+$num_messages = count_unread_messages();
+if($num_messages){
+       $num = $num_messages;
+} else {
+       $num = 0;
+}
 
+if($num == 0) {
 ?>
 
        <a href="<?php echo $vars['url']; ?>pg/messages/<?php echo $_SESSION['user']->username; ?>" class="privatemessages" >&nbsp;</a>
        
 <?php
-    }else{
+    } else {
 ?>
 
     <a href="<?php echo $vars['url']; ?>pg/messages/<?php echo $_SESSION['user']->username; ?>" class="privatemessages_new" >[<?php echo $num; ?>]</a>
        
 <?php
-    }
-?>
\ No newline at end of file
+    }
\ No newline at end of file
index 501be8bb3c86a3ca0ad1a66b1208c713ed8e2857..cedd4bb5aa7cbd8c5c4d8a15708ddd0b70010be9 100644 (file)
 <?php
-
-       /**
-        * Elgg messages view page
-        *
-        * @package ElggMessages
-        * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
-        * @author Curverider Ltd <info@elgg.com>
-        * @copyright Curverider Ltd 2008-2010
-        * @link http://elgg.com/
-        *
-        * @uses $vars['entity'] An array of messages to view
-        * @uses $vars['page_view'] This is the page the messages are being accessed from; inbox or sentbox
-        *
-        */
-
-       $limit = $vars['limit']; if (empty($limit)) $limit = 10;
-       $offset = $vars['offset']; if (!isset($offset)) $offset = 0;
-
-       // If there are any messages to view, view them
-       if (isloggedin())
-       if (is_array($vars['entity']) && sizeof($vars['entity']) > 0) {
-
-?>
-       <div id="messages" /><!-- start the main messages wrapper div -->
-
-<?php
-
-                       // get the correct display for the inbox view
-                       if($vars['page_view'] == "inbox") {
-
-                               $counter = 0;
-
-                               foreach($vars['entity'] as $message) {
-                                       if ($message->owner_guid == $vars['user']->guid
-                                               || $message->toId == $vars['user']->guid) {
-
-                                       //make sure to only display the messages that have not been 'deleted' (1 = deleted)
-                                       if($message->hiddenFrom != 1){
-
-                                               // check to see if the message has been read, if so, get the correct background color
-                                               if($message->readYet == 1){
-                                                       echo "<div class=\"message_read\" />";
-                                               }else{
-                                                       echo "<div class=\"message_notread\" />";
-                                               }
-
-                                               //set the table
-                                               echo "<table width=\"100%\" cellspacing='0'><tr>";
-                                               //get the icon of the user who owns the message
-                                               $from = get_entity($message->fromId);
-                                               echo "<td width='200px'>" . elgg_view("profile/icon",array('entity' => $from, 'size' => 'tiny')) . "<div class='msgsender'><b>" . $from->name . "</b><br /><small>" . friendly_time($message->time_created) . "</small></div></td>";
-                                               //display the message title
-                                               echo "<td><div class='msgsubject'>";
-                                               echo "<input type=\"checkbox\" name=\"message_id[]\" value=\"{$message->guid}\" /> ";
-                                               echo "<a href=\"{$message->getURL()}\">" . $message->title . "</a></div></td>";
-                                               //display the link to 'delete'
-
-                                               echo "<td width='70px'>";
-                                               echo "<div class='delete_msg'>" . elgg_view("output/confirmlink", array(
-                                                                                                                               'href' => $vars['url'] . "action/messages/delete?message_id=" . $message->getGUID() . "&type=inbox&submit=" . urlencode(elgg_echo('delete')),
-                                                                                                                               'text' => elgg_echo('delete'),
-                                                                                                                               'confirm' => elgg_echo('deleteconfirm'),
-                                                                                                                       )) . "</div>";
-
-                                               echo "</td></tr></table>";
-                                               echo "</div>"; // close the message background div
-
-                                       }//end of hiddenFrom if statement
-                                       } // end of user check
-
-                                       $counter++;
-                                       if ($counter == $limit) break;
-
-                               }//end of for each loop
-
-                       }//end of inbox if statement
-
-                       // get the correct display for the sentbox view
-                       if($vars['page_view'] == "sent") {
-
-                               $counter = 0;
-
-                               foreach($vars['entity'] as $message) {
-
-                                       //make sure to only display the messages that have not been 'deleted' (1 = deleted)
-                                       if($message->hiddenTo != 1){
-
-                                               //get the correct user entity
-                                               $user = get_entity($message->toId);
-                                               echo "<div class=\"message_sent\" />";
-                                               echo "<table width=\"100%\" cellspacing='0'><tr>";
-
-                                               //get the icon for the user the message was sent to
-                                               echo "<tr><td width='200px'>" . elgg_view("profile/icon",array('entity' => $user, 'size' => 'tiny')) . "<div class='msgsender'><b>" . $user->name . "</b><br /><small>" . friendly_time($message->time_created) . "</small></div></td>";
-                                               //display the message title
-                                               echo "<td><div class='msgsubject'>";
-                                               echo "<input type=\"checkbox\" name=\"message_id[]\" value=\"{$message->guid}\" /> ";
-                                               echo "<a href=\"{$message->getURL()}?type=sent\">" . $message->title . "</a></div></td>";
-                                               //display the link to 'delete'
-
-                                               echo "<td width='70px'>";
-                                                       echo "<div class='delete_msg'>" . elgg_view("output/confirmlink", array(
-                                                       'href' => $vars['url'] . "action/messages/delete?message_id=" . $message->getGUID() . "&type=sent&submit=" . urlencode(elgg_echo('delete')),
-                                                       'text' => elgg_echo('delete'),
-                                                       'confirm' => elgg_echo('deleteconfirm'),
-                                               )) . "</div>";
-                                               echo "</td></tr></table></div>";
-
-                                       }//close hiddeTo if statement
-
-                                       $counter++;
-                                       if ($counter == $limit) break;
-
-                               }//close foreach
-
-                       }//close page_view sent if statement
-
-                       $baseurl = $_SERVER['REQUEST_URI'];
-                       $nav = '';
-
-                       if (sizeof($vars['entity']) > $limit) {
-                               $newoffset = $offset + $limit;
-                               $nexturl = elgg_http_add_url_query_elements($baseurl, array('offset' => $newoffset));
-
-                               $nav .= '<a class="pagination_previous" href="'.$nexturl.'">&laquo; ' . elgg_echo('previous') . '</a> ';
-                       }
-
-                       if ($offset > 0) {
-                               $newoffset = $offset - $limit;
-                               if ($newoffset < 0) $newoffset = 0;
-
-                               $prevurl = elgg_http_add_url_query_elements($baseurl, array('offset' => $newoffset));
-
-                               $nav .= '<a class="pagination_next" href="'.$prevurl.'">' . elgg_echo('next') . ' &raquo;</a> ';
-                       }
-
-
-                       if (!empty($nav)) {
-                               echo '<div class="pagination"><p>'.$nav.'</p><div class="clearfloat"></div></div>';
-                       }
-
-                       echo "</div>"; // close the main messages wrapper div
-
-       } else {
-
-               echo "<div class=\"contentWrapper\"><p class='messages_nomessage_message'>" . elgg_echo("messages:nomessages") . "</p></div>";
-
-       }//end of the first if statement
-?>
+/**
+ * Elgg messages view page
+ *
+ * @package ElggMessages
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ *
+ * @uses $vars['entity'] An array of messages to view
+ * @uses $vars['page_view'] This is the page the messages are being accessed from; inbox or sentbox
+ *
+ */
+
+$limit = $vars['limit']; if (empty($limit)) $limit = 10;
+$offset = $vars['offset']; if (!isset($offset)) $offset = 0;
+
+// If there are any messages to view, view them
+if (isloggedin())
+if (is_array($vars['entity']) && sizeof($vars['entity']) > 0) {
+
+       // get the correct display for the inbox view
+       if($vars['page_view'] == "inbox") {
+
+               $counter = 0;
+
+               foreach($vars['entity'] as $message) {
+                       if ($message->owner_guid == $vars['user']->guid || $message->toId == $vars['user']->guid) {
+                               
+                               //make sure to only display the messages that have not been 'deleted' (1 = deleted)
+                               if($message->hiddenFrom != 1){
+                                       // check to see if the message has been read, if so, set the correct container class
+                                       if($message->readYet == 1){
+                               echo "<div class='message read clearfloat'>";
+                           }else{
+                               echo "<div class='message notread clearfloat'>";
+                           }
+                                   // get the icon of the user who owns the message
+                                   $from = get_entity($message->fromId);
+                                       echo "<div class='entity_listing_icon'>".elgg_view("profile/icon",array('entity' => $from, 'size' => 'tiny'))."</div>";
+                                       // message block (message sender, message subject, delete checkbox)
+                                       echo "<div class='entity_listing_info'><div class='message_sender'>".$from->name."<p class='entity_subtext'>".friendly_time($message->time_created)."</p></div>";
+                                       // display message subject
+                                       echo "<div class='message_subject'>";
+                                       // display delete button
+                                       echo "<div class='delete_button'>" . elgg_view("output/confirmlink", array(
+                                               'href' => $vars['url'] . "action/messages/delete?message_id=" . $message->getGUID() . "&type=inbox&submit=" . urlencode(elgg_echo('delete')),
+                                               'text' => elgg_echo('delete'),
+                                               'confirm' => elgg_echo('deleteconfirm'),
+                                       )) . "</div>";
+                                       echo "<p class='entity_title'><input type='checkbox' name=\"message_id[]\" value=\"{$message->guid}\" />";
+                                       echo "<a href=\"{$message->getURL()}\">" . $message->title . "</a></p>";                                                                
+                                   echo "</div></div></div>"; // close the message container
+                               }//end of hiddenFrom if statement
+                               } // end of user check 
+                               $counter++;
+                               if ($counter == $limit) break;
+
+                       }//end of for each loop
+               }//end of inbox if statement
+
+               // get the correct display for the sentbox view
+               if($vars['page_view'] == "sent") {
+
+                       $counter = 0;
+
+                       foreach($vars['entity'] as $message) {
+
+                               //make sure to only display the messages that have not been 'deleted' (1 = deleted)
+                               if($message->hiddenTo != 1){
+
+                                       //get the correct user entity
+                                       $user = get_entity($message->toId);
+                                       echo "<div class='message sent clearfloat'>";                           
+                                       //get the icon for the user the message was sent to
+                                       echo "<div class='entity_listing_icon'>".elgg_view("profile/icon",array('entity' => $user, 'size' => 'tiny'))."</div>";
+                                       echo "<div class='entity_listing_info'><div class='message_sender'>".$_SESSION['user']->name."<p class='entity_subtext'>".friendly_time($message->time_created)."</p></div>";
+                                       // display message subject
+                                       echo "<div class='message_subject'>";
+                                       //display the link to 'delete'
+                                       echo "<div class='delete_button'>" . elgg_view("output/confirmlink", array(
+                                               'href' => $vars['url'] . "action/messages/delete?message_id=" . $message->getGUID() . "&type=sent&submit=" . urlencode(elgg_echo('delete')),
+                                               'text' => elgg_echo('delete'),
+                                               'confirm' => elgg_echo('deleteconfirm'),
+                                       )) . "</div>";
+                                       echo "<p class='entity_title'><input type='checkbox' name=\"message_id[]\" value=\"{$message->guid}\" /> ";
+                                       echo "<a href=\"{$message->getURL()}?type=sent\">" . $message->title . "</a></p>";
+                                       echo "</div></div></div>"; // close the message container
+                               }//close hiddeTo if statement
+
+                               $counter++;
+                               if ($counter == $limit) break;
+
+                       }//close foreach
+
+               }//close page_view sent if statement
+
+               $baseurl = $_SERVER['REQUEST_URI'];
+               $nav = '';
+
+               if (sizeof($vars['entity']) > $limit) {
+                       $newoffset = $offset + $limit;
+                       $nexturl = elgg_http_add_url_query_elements($baseurl, array('offset' => $newoffset));
+
+                       $nav .= '<a class="pagination_previous" href="'.$nexturl.'">&laquo; ' . elgg_echo('previous') . '</a> ';
+               }
+
+               if ($offset > 0) {
+                       $newoffset = $offset - $limit;
+                       if ($newoffset < 0) $newoffset = 0;
+
+                       $prevurl = elgg_http_add_url_query_elements($baseurl, array('offset' => $newoffset));
+
+                       $nav .= '<a class="pagination_next" href="'.$prevurl.'">' . elgg_echo('next') . ' &raquo;</a> ';
+               }
+
+
+               if (!empty($nav)) {
+                       echo '<div class="pagination"><p>'.$nav.'</p><div class="clearfloat"></div></div>';
+               }
+
+} else {
+       echo "<p>".elgg_echo("messages:nomessages")."</p>";
+}
diff --git a/mod/messages/views/default/object/messages.php b/mod/messages/views/default/object/messages.php
deleted file mode 100644 (file)
index e69de29..0000000