From 43c33492d2ab65a783c17559cf8dabd7832e9ea1 Mon Sep 17 00:00:00 2001 From: cash Date: Sat, 15 Jan 2011 22:28:46 +0000 Subject: Updated the messages plugin to use the new CSS/HTML git-svn-id: http://code.elgg.org/elgg/trunk@7886 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/messages/actions/delete.php | 62 ----------- mod/messages/actions/messages/delete.php | 20 ++++ mod/messages/actions/messages/process.php | 35 ++++++ mod/messages/actions/messages/send.php | 46 ++++++++ mod/messages/actions/send.php | 57 ---------- mod/messages/inbox.php | 41 +++++++ mod/messages/index.php | 49 --------- mod/messages/languages/en.php | 18 +-- mod/messages/lib/messages.php | 32 ++++++ mod/messages/read.php | 82 +++++++------- mod/messages/readme.txt | 9 +- mod/messages/send.php | 44 +++----- mod/messages/sent.php | 63 +++++------ mod/messages/start.php | 97 +++++++++++------ .../views/default/forms/messages/process.php | 41 +++++++ .../views/default/forms/messages/reply.php | 47 ++++++++ mod/messages/views/default/forms/messages/send.php | 47 ++++++++ mod/messages/views/default/messages/css.php | 112 ++++++++----------- .../views/default/messages/forms/reply.php | 44 -------- mod/messages/views/default/messages/forms/send.php | 74 ------------- mod/messages/views/default/messages/forms/view.php | 22 ---- mod/messages/views/default/messages/menu.php | 12 -- mod/messages/views/default/messages/messages.php | 118 -------------------- mod/messages/views/default/messages/topbar.php | 32 +++--- mod/messages/views/default/messages/view.php | 121 --------------------- mod/messages/views/default/object/messages.php | 75 +++++++++++++ 26 files changed, 608 insertions(+), 792 deletions(-) delete mode 100644 mod/messages/actions/delete.php create mode 100644 mod/messages/actions/messages/delete.php create mode 100644 mod/messages/actions/messages/process.php create mode 100644 mod/messages/actions/messages/send.php delete mode 100644 mod/messages/actions/send.php create mode 100644 mod/messages/inbox.php delete mode 100644 mod/messages/index.php create mode 100644 mod/messages/lib/messages.php create mode 100644 mod/messages/views/default/forms/messages/process.php create mode 100644 mod/messages/views/default/forms/messages/reply.php create mode 100644 mod/messages/views/default/forms/messages/send.php delete mode 100644 mod/messages/views/default/messages/forms/reply.php delete mode 100644 mod/messages/views/default/messages/forms/send.php delete mode 100644 mod/messages/views/default/messages/forms/view.php delete mode 100644 mod/messages/views/default/messages/menu.php delete mode 100644 mod/messages/views/default/messages/messages.php delete mode 100644 mod/messages/views/default/messages/view.php create mode 100644 mod/messages/views/default/object/messages.php diff --git a/mod/messages/actions/delete.php b/mod/messages/actions/delete.php deleted file mode 100644 index 4ccc1d2ba..000000000 --- a/mod/messages/actions/delete.php +++ /dev/null @@ -1,62 +0,0 @@ -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; - - } - -} - -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=" . get_loggedin_user()->username . "&offset={$offset}"); - } -} else { - register_error(elgg_echo("messages:notfound")); - forward(REFERER); -} \ No newline at end of file diff --git a/mod/messages/actions/messages/delete.php b/mod/messages/actions/messages/delete.php new file mode 100644 index 000000000..ffdb3b3a3 --- /dev/null +++ b/mod/messages/actions/messages/delete.php @@ -0,0 +1,20 @@ +canEdit()) { + register_error(elgg_echo('messages:error:delete:single')); + forward(REFERER); +} + +if (!$message->delete()) { + register_error(elgg_echo('messages:error:delete:single')); +} else { + system_message(elgg_echo('messages:success:delete:single')); +} + +forward(REFERER); diff --git a/mod/messages/actions/messages/process.php b/mod/messages/actions/messages/process.php new file mode 100644 index 000000000..d929ae190 --- /dev/null +++ b/mod/messages/actions/messages/process.php @@ -0,0 +1,35 @@ +getSubtype() == 'messages' && $message->canEdit()) { + $message->delete(); + } + } +} else { + $success_msg = elgg_echo('messages:success:read'); + foreach ($message_ids as $guid) { + $message = get_entity($guid); + if ($message && $message->getSubtype() == 'messages' && $message->canEdit()) { + $message->readYet = 1; + } + } +} + +system_message($success_msg); +forward(REFERER); diff --git a/mod/messages/actions/messages/send.php b/mod/messages/actions/messages/send.php new file mode 100644 index 000000000..f6bac606d --- /dev/null +++ b/mod/messages/actions/messages/send.php @@ -0,0 +1,46 @@ +username); diff --git a/mod/messages/actions/send.php b/mod/messages/actions/send.php deleted file mode 100644 index 59d90a9d2..000000000 --- a/mod/messages/actions/send.php +++ /dev/null @@ -1,57 +0,0 @@ -name)); + +$list = elgg_list_entities_from_metadata(array( + 'type' => 'object', + 'subtype' => 'messages', + 'metadata_name' => 'toId', + 'metadata_value' => elgg_get_page_owner_guid(), + 'owner_guid' => elgg_get_page_owner_guid(), + 'full_view' => false, +)); + +$body_vars = array( + 'folder' => 'inbox', + 'list' => $list, +); +$content = elgg_view_form('messages/process', array(), $body_vars); + +$body = elgg_view_layout('content', array( + 'content' => $content, + 'title' => elgg_echo('messages:inbox'), + 'filter' => '', +)); + +echo elgg_view_page($title, $body); diff --git a/mod/messages/index.php b/mod/messages/index.php deleted file mode 100644 index 02257551e..000000000 --- a/mod/messages/index.php +++ /dev/null @@ -1,49 +0,0 @@ -getGUID()); - -// Get the user's inbox, this will be all messages where the 'toId' field matches their guid -// @todo - fix hack where limit + 1 messages are requested -$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 = "
"; -$area2 .= elgg_view_title(elgg_echo("messages:inbox"))."
"; -$area2 .= "
"; - -// 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", array('content' => $area2)); - - -// Draw page -echo elgg_view_page(elgg_echo('messages:user', array($page_owner->name)), $body); diff --git a/mod/messages/languages/en.php b/mod/messages/languages/en.php index f1ad22623..4ad6b7617 100644 --- a/mod/messages/languages/en.php +++ b/mod/messages/languages/en.php @@ -12,14 +12,13 @@ $english = array( 'messages' => "Messages", 'messages:back' => "back to messages", - 'messages:user' => "Your inbox", - 'messages:sentMessages' => "Sent messages", + 'messages:user' => "%s's inbox", 'messages:posttitle' => "%s's messages: %s", 'messages:inbox' => "Inbox", - 'messages:send' => "Send a message", - 'messages:sent' => "Sent messages", + 'messages:send' => "Send", + 'messages:sent' => "Sent", 'messages:message' => "Message", - 'messages:title' => "Title", + 'messages:title' => "Subject", 'messages:to' => "To", 'messages:from' => "From", 'messages:fly' => "Send", @@ -27,6 +26,7 @@ $english = array( 'messages:inbox' => "Inbox", 'messages:sendmessage' => "Send a message", 'messages:compose' => "Compose a message", + 'messages:add' => "Compose a message", 'messages:sentmessages' => "Sent messages", 'messages:recent' => "Recent messages", 'messages:original' => "Original message", @@ -35,6 +35,7 @@ $english = array( 'messages:toggle' => 'Toggle all', 'messages:markread' => 'Mark read', 'messages:recipient' => 'Choose a recipient…', + 'messages:to_user' => 'To: %s', 'messages:new' => 'New message', @@ -49,8 +50,11 @@ $english = array( */ 'messages:posted' => "Your message was successfully sent.", - 'messages:deleted' => "Your messages were successfully deleted.", - 'messages:markedread' => "Your messages were successfully marked as read.", + 'messages:success:delete:single' => 'Message was deleted', + 'messages:success:delete' => 'Messages deleted', + 'messages:success:read' => 'Messages marked as read', + 'messages:error:messages_not_selected' => 'No messages selected', + 'messages:error:delete:single' => 'Unable to delete the message', /** * Email messages diff --git a/mod/messages/lib/messages.php b/mod/messages/lib/messages.php new file mode 100644 index 000000000..062670fe9 --- /dev/null +++ b/mod/messages/lib/messages.php @@ -0,0 +1,32 @@ + defaults + $values = array( + 'subject' => '', + 'body' => '', + 'recipient_guid' => $recipient_guid, + ); + + if (elgg_is_sticky_form('messages')) { + foreach (array_keys($values) as $field) { + $values[$field] = elgg_get_sticky_value('messages', $field); + } + } + + elgg_clear_sticky_form('messages'); + + return $values; +} + diff --git a/mod/messages/read.php b/mod/messages/read.php index 4e404de5c..0c0fa60dd 100644 --- a/mod/messages/read.php +++ b/mod/messages/read.php @@ -1,58 +1,56 @@ 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; - } + forward(); } -set_page_owner($page_owner->getGUID()); +elgg_set_page_owner_guid($message->getOwnerGUID()); +$page_owner = elgg_get_page_owner(); -// Display it -$content = elgg_view("messages/messages",array( - 'entity' => $message, - 'entity_owner' => $page_owner, - 'full' => true - )); +$title = $message->title; -$sidebar = elgg_view("messages/menu_options"); +$inbox = false; +if ($page_owner->getGUID() == $message->toId) { + $inbox = true; + elgg_push_breadcrumb(elgg_echo('messages:inbox'), 'pg/messages/inbox/' . $page_owner->username); +} else { + elgg_push_breadcrumb(elgg_echo('messages:sent'), 'pg/messages/sent/' . $page_owner->username); +} +elgg_push_breadcrumb($title); + +$buttons = ''; +$content = elgg_view_entity($message, true); +if ($inbox) { + $form_params = array( + 'internalid' => 'messages-reply-form', + 'class' => 'hidden', + 'action' => 'messages/send', + ); + $body_params = array('message' => $message); + $content .= elgg_view_form('messages/reply', $form_params, $body_params); + + if (get_loggedin_userid() == elgg_get_page_owner_guid()) { + $buttons = elgg_view('output/url', array( + 'text' => elgg_echo('messages:answer'), + 'class' => 'elgg-action-button', + 'internalid' => 'messages-show-reply', + )); + } +} -$params = array( +$body = elgg_view_layout('content', array( 'content' => $content, - 'sidebar' => $sidebar -); -$body = elgg_view_layout("one_column_with_sidebar", $params); + 'title' => $title, + 'filter' => '', + 'buttons' => $buttons, +)); -// Display page -echo elgg_view_page(elgg_echo('messages:message'), $body); \ No newline at end of file +echo elgg_view_page($title, $body); diff --git a/mod/messages/readme.txt b/mod/messages/readme.txt index 04142be19..9d267f3fb 100644 --- a/mod/messages/readme.txt +++ b/mod/messages/readme.txt @@ -1,12 +1,11 @@ /** - * Elgg readme + * Elgg messages readme * * @package ElggMessages * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Dave Tosh - * @copyright Curverider Ltd 2008-2009 - * @link http://elgg.com/ -*/ + * @author Dave Tosh + * @link http://elgg.org/ + */ Install: drop the plugin into your mod folder, that is it. diff --git a/mod/messages/send.php b/mod/messages/send.php index 3e1baa496..1f31e9e02 100644 --- a/mod/messages/send.php +++ b/mod/messages/send.php @@ -1,42 +1,28 @@ 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); +$page_owner = get_loggedin_user(); +set_page_owner($page_owner->getGUID()); -// Set the page title -$area2 = elgg_view_title(elgg_echo("messages:sendmessage")); +$title = elgg_echo('messages:add'); -// Get the send form -$area2 .= elgg_view("messages/forms/send",array('friends' => $friends)); +elgg_push_breadcrumb($title); -// Sidebar menu options -$area3 = elgg_view("messages/menu_options"); +$params = messages_prepare_form_vars(get_input('send_to')); +$params['friends'] = $page_owner->getFriends(); +$content = elgg_view_form('messages/send', array(), $params); -// Format -$params = array( - 'content' => $area2, - 'sidebar' => $area3 -); -$body = elgg_view_layout("one_column_with_sidebar", $params); +$body = elgg_view_layout('content', array( + 'content' => $content, + 'title' => $title, + 'filter' => '', + 'buttons' => '', +)); -// Draw page -echo elgg_view_page(elgg_echo('messages:send', array($page_owner->name)), $body); \ No newline at end of file +echo elgg_view_page($title, $body); diff --git a/mod/messages/sent.php b/mod/messages/sent.php index e70d34711..36c9badd3 100644 --- a/mod/messages/sent.php +++ b/mod/messages/sent.php @@ -5,36 +5,37 @@ * @package ElggMessages */ -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 -// @todo - fix hack where limit + 1 is passed -$messages = elgg_get_entities_from_metadata(array('metadata_name' => 'fromId', 'metadata_value' => get_loggedin_userid(), 'types' => 'object', 'subtypes' => 'messages', 'owner_guid' => $page_owner->guid, 'limit' => $limit + 1, 'offset' => $offset)); - - -// Set the page title -$area2 = "
"; -$area2 .= elgg_view_title(elgg_echo("messages:sentmessages"))."
"; -$area2 .= "
"; - -// Set content -$area2 .= elgg_view("messages/forms/view",array('entity' => $messages, 'page_view' => "sent", 'limit' => $limit, 'offset' => $offset)); - -// Format -$body = elgg_view_layout("one_column_with_sidebar", array('content' => $area2)); - -// Draw page -echo elgg_view_page(elgg_echo('messages:sentMessages', array($page_owner->name)), $body); +$page_owner = elgg_get_page_owner(); +if (!$page_owner) { + register_error(elgg_echo()); + forward(); +} + +elgg_push_breadcrumb(elgg_echo('messages:sent')); + +$title = elgg_echo('messages:sentmessages', array($page_owner->name)); + +$list = elgg_list_entities_from_metadata(array( + 'type' => 'object', + 'subtype' => 'messages', + 'metadata_name' => 'fromId', + 'metadata_value' => elgg_get_page_owner_guid(), + 'owner_guid' => elgg_get_page_owner_guid(), + 'full_view' => false, +)); + +$body_vars = array( + 'folder' => 'sent', + 'list' => $list, +); +$content = elgg_view_form('messages/process', array(), $body_vars); + +$body = elgg_view_layout('content', array( + 'content' => $content, + 'title' => $title, + 'filter' => '', +)); + +echo elgg_view_page($title, $body); diff --git a/mod/messages/start.php b/mod/messages/start.php index cf17ee013..ccb92d94f 100644 --- a/mod/messages/start.php +++ b/mod/messages/start.php @@ -11,19 +11,24 @@ elgg_register_event_handler('init', 'system', 'messages_init'); function messages_init() { + // register a library of helper functions + elgg_register_library('elgg:messages', elgg_get_plugin_path() . 'messages/lib/messages.php'); + // add page menu items - elgg_register_menu_item('page', array( - 'name' => 'messages:inbox', - 'title' => elgg_echo('messages:inbox'), - 'url' => "pg/messages/" . get_loggedin_user()->username, - 'context' => 'messages', - )); - elgg_register_menu_item('page', array( - 'name' => 'messages:sentmessages', - 'title' => elgg_echo('messages:sentmessages'), - 'url' => "mod/messages/sent.php", - 'context' => 'messages', - )); + if (isloggedin()) { + elgg_register_menu_item('page', array( + 'name' => 'messages:inbox', + 'title' => elgg_echo('messages:inbox'), + 'url' => "pg/messages/inbox/" . get_loggedin_user()->username, + 'context' => 'messages', + )); + elgg_register_menu_item('page', array( + 'name' => 'messages:sentmessages', + 'title' => elgg_echo('messages:sentmessages'), + 'url' => "pg/messages/sent/" . get_loggedin_user()->username, + 'context' => 'messages', + )); + } // Extend system CSS with our own styles, which are defined in the shouts/css view elgg_extend_view('css/screen', 'messages/css'); @@ -54,9 +59,10 @@ function messages_init() { elgg_register_plugin_hook_handler('container_permissions_check', 'object', 'messages_can_edit_container'); // Register actions - $action_path = elgg_get_plugin_path() . 'messages/actions'; + $action_path = elgg_get_plugin_path() . 'messages/actions/messages'; elgg_register_action("messages/send", "$action_path/send.php"); elgg_register_action("messages/delete", "$action_path/delete.php"); + elgg_register_action("messages/process", "$action_path/process.php"); } /** @@ -67,27 +73,49 @@ function messages_init() { */ function messages_page_handler($page) { - // The first component of a messages URL is the username - if (isset($page[0])) { - set_input('username', $page[0]); + elgg_load_library('elgg:messages'); + + elgg_push_breadcrumb(elgg_echo('messages'), 'pg/messages/inbox/' . get_loggedin_user()->username); + + if (!isset($page[0])) { + $page[0] = 'inbox'; } - // 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; + // supporting the old inbox url /pg/messages/ + $user = get_user_by_username($page[0]); + if ($user) { + $page[1] = $page[0]; + $page[0] = 'inbox'; + } + + if (!isset($page[1])) { + $page[1] = get_loggedin_user()->username; } - return false; + $base_dir = elgg_get_plugin_path() . 'messages'; + + switch ($page[0]) { + case 'inbox': + set_input('username', $page[1]); + include("$base_dir/inbox.php"); + break; + case 'sent': + set_input('username', $page[1]); + include("$base_dir/sent.php"); + break; + case 'read': + set_input('guid', $page[1]); + include("$base_dir/read.php"); + break; + case 'compose': + case 'add': + include("$base_dir/send.php"); + break; + default: + return false; + } + + return true; } /** @@ -239,9 +267,9 @@ function messages_send($subject, $body, $send_to, $from = 0, $reply = 0, $notify $body = elgg_echo('messages:email:body', array( get_loggedin_user()->name, $message_contents, - elgg_get_site_url() . "pg/messages/" . $user->username, + elgg_get_site_url() . "pg/messages/inbox/" . $user->username, get_loggedin_user()->name, - elgg_get_site_url() . "mod/messages/send.php?send_to=" . get_loggedin_userid() + elgg_get_site_url() . "pg/messages/compose?send_to=" . get_loggedin_userid() )); notify_user($send_to, get_loggedin_userid(), $subject, $body); @@ -258,8 +286,7 @@ function messages_send($subject, $body, $send_to, $from = 0, $reply = 0, $notify * @return string */ function messages_url($message) { - $url = elgg_get_site_url() . 'pg/messages/'; - $url .= $message->getOwnerEntity()->username . '/read/' . $message->getGUID(); + $url = elgg_get_site_url() . 'pg/messages/read/' . $message->getGUID(); return $url; } @@ -322,7 +349,7 @@ function messages_user_hover_menu($hook, $type, $return, $params) { $user = $params['entity']; if (isloggedin() && get_loggedin_userid() != $user->guid) { - $url = "mod/messages/send.php?send_to={$user->guid}"; + $url = "pg/messages/compose?send_to={$user->guid}"; $item = new ElggMenuItem('send', elgg_echo('messages:sendmessage'), $url); $item->setSection('action'); $return[] = $item; diff --git a/mod/messages/views/default/forms/messages/process.php b/mod/messages/views/default/forms/messages/process.php new file mode 100644 index 000000000..2c97fcb6f --- /dev/null +++ b/mod/messages/views/default/forms/messages/process.php @@ -0,0 +1,41 @@ +'; +echo elgg_view('input/submit', array( + 'value' => elgg_echo('delete'), + 'internalname' => 'delete', +)); + +if ($vars['folder'] == "inbox") { + echo elgg_view('input/submit', array( + 'value' => elgg_echo('messages:markread'), + 'internalname' => 'read', + )); +} + +echo elgg_view('input/button', array( + 'value' => elgg_echo('messages:toggle'), + 'class' => 'elgg-cancel-button', + 'internalid' => 'messages-toggle', +)); + +echo ''; + +?> + diff --git a/mod/messages/views/default/forms/messages/reply.php b/mod/messages/views/default/forms/messages/reply.php new file mode 100644 index 000000000..22c982ec2 --- /dev/null +++ b/mod/messages/views/default/forms/messages/reply.php @@ -0,0 +1,47 @@ +title; +if (strncmp($reply_title, "RE:", 3) != 0) { + $reply_title = "RE: " . $reply_title; +} + +echo elgg_view('input/hidden', array( + 'internalname' => 'recipient_guid', + 'value' => $vars['message']->fromId, +)); +?> + +

+ + 'subject', + 'value' => $reply_title, + )); + ?> +

+

+ + 'body', + 'value' => '', + )); + ?> +

+

+ elgg_echo('messages:send'))); ?> +

+ + \ No newline at end of file diff --git a/mod/messages/views/default/forms/messages/send.php b/mod/messages/views/default/forms/messages/send.php new file mode 100644 index 000000000..0a251091b --- /dev/null +++ b/mod/messages/views/default/forms/messages/send.php @@ -0,0 +1,47 @@ +guid] = $friend->name; +} + +$recipient_drop_down = elgg_view('input/pulldown', array( + 'internalname' => 'recipient_guid', + 'value' => $recipient_guid, + 'options_values' => $recipients_options, +)); + +?> +

+ + +

+

+ + 'subject', + 'value' => $subject, + )); + ?> +

+

+ + 'body', + 'value' => $body, + )); + ?> +

+

+ elgg_echo('messages:send'))); ?> +

diff --git a/mod/messages/views/default/messages/css.php b/mod/messages/views/default/messages/css.php index 3e58c2607..ba8444f03 100644 --- a/mod/messages/views/default/messages/css.php +++ b/mod/messages/views/default/messages/css.php @@ -6,84 +6,60 @@ */ ?> -/* messages/new messages icon & counter in elgg-topbar */ -a.privatemessages { - background:transparent url(mod/messages/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(mod/messages/graphics/toolbar_messages_icon.gif) no-repeat left -36px; + +.message.unread a { + color: #d40005; } -a.privatemessages.new { - background:transparent url(mod/messages/graphics/toolbar_messages_icon.gif) no-repeat left 2px; - padding-left:18px; - margin:4px 15px 0 5px; - color:white; +.messages-buttonbank { + text-align: right; } -a.privatemessages.new:hover { - text-decoration: none; - background:transparent url(mod/messages/graphics/toolbar_messages_icon.gif) no-repeat left -36px; -} -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; - float:right; - padding:0; - position:relative; - text-align:center; - top:-3px; - right:5px; - min-width: 16px; - height:16px; - font-size:10px; - font-weight:bold; +.messages-buttonbank input { + margin-left: 10px; } -/* page content */ -.message { - border-bottom:1px dotted #cccccc; - padding:5px 0 7px 0; +/*** message metadata ***/ +.messages-owner { + float: left; + width: 20%; + margin-right: 2%; } -.message.notread .entity-listing-info p.entity-title a { - color:#d40005; +.messages-subject { + float: left; + width: 55%; + margin-right: 2%; } -.message_sender { - float:left; - width:180px; - overflow: hidden; +.messages-timestamp { + float: left; + width: 14%; + margin-right: 2%; } -.messages_to { +.messages-delete { float: left; - margin-right: 10px; + width: 5%; } -/* view and reply to message view */ -.message_body { - margin-left: 120px; -} -.message_subject { - float:left; - width:513px; - padding-top:6px; -} -.message .delete-button { - margin-top:3px; -} -.entity-listing.messages:hover { - background-color:white; +/*** messages/new messages icon & counter in elgg-topbar ***/ +.messages-icon { + background:transparent url(mod/messages/graphics/toolbar_messages_icon.gif) no-repeat left 2px; + position: relative; } -.messages_buttonbank { - margin:5px 0; - text-align: right; +.messages-icon:hover { + text-decoration: none; + background-position: left -36px; } -.messages_buttonbank input { - margin:0 0 0 10px; +.messages-icon.new span { + color: white; + 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+ */ + position: absolute; + text-align: center; + top: -2px; + left: 10px; + min-width: 16px; + height: 16px; + font-size: 10px; + font-weight: bold; } diff --git a/mod/messages/views/default/messages/forms/reply.php b/mod/messages/views/default/messages/forms/reply.php deleted file mode 100644 index 107b86166..000000000 --- a/mod/messages/views/default/messages/forms/reply.php +++ /dev/null @@ -1,44 +0,0 @@ -title; - if (strncmp($reply_title, "RE:", 3) != 0) { - $reply_title = "RE: " . $reply_title; - } -?> - -
- - - -

-

- -

- getGUID() . "' />"; - //pass along the owner of the message being replied to - echo "fromId . "' />"; - - echo elgg_view('input/submit', array('value' => elgg_echo("messages:fly"))); - ?> -

- -
- - " . elgg_echo("messages:replying") . ""; - echo $vars['entity']->description; - - } - ?> diff --git a/mod/messages/views/default/messages/forms/send.php b/mod/messages/views/default/messages/forms/send.php deleted file mode 100644 index 6ddf7e543..000000000 --- a/mod/messages/views/default/messages/forms/send.php +++ /dev/null @@ -1,74 +0,0 @@ - -
-
".elgg_view("profile/icon",array('entity' => $user, 'size' => 'tiny'))."
"; - - //draw it - echo "
".elgg_echo("messages:to").": ".$user->name.""; - //set the hidden input field to the recipients guid - echo ""; - echo "
"; - - } else { - ?> - -

-

- - -

-

- "message", - "value" => $msg_content, - )); - ?> -

-

- elgg_echo("messages:fly"))); - ?> -

-
diff --git a/mod/messages/views/default/messages/forms/view.php b/mod/messages/views/default/messages/forms/view.php deleted file mode 100644 index 5b9263382..000000000 --- a/mod/messages/views/default/messages/forms/view.php +++ /dev/null @@ -1,22 +0,0 @@ -'; -$body .= ''; -$body .= ''; -$body .= ' '; - -if($vars['page_view'] == "inbox"){ - $body .= ' '; -} - -$body .= ''; -$body .= ''; - -echo elgg_view('input/form',array('body' => $body, 'action' => 'action/messages/delete', 'method' => 'post', 'internalid' => 'messages_list_form')); \ No newline at end of file diff --git a/mod/messages/views/default/messages/menu.php b/mod/messages/views/default/messages/menu.php deleted file mode 100644 index 566a87179..000000000 --- a/mod/messages/views/default/messages/menu.php +++ /dev/null @@ -1,12 +0,0 @@ - -
  • - -
  • \ No newline at end of file diff --git a/mod/messages/views/default/messages/messages.php b/mod/messages/views/default/messages/messages.php deleted file mode 100644 index a1a7fd9ca..000000000 --- a/mod/messages/views/default/messages/messages.php +++ /dev/null @@ -1,118 +0,0 @@ -username; - // set up breadcrumbs context - elgg_push_breadcrumb(elgg_echo('messages:inbox'), $url); - //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 == get_loggedin_userid() - || $vars['entity']->owner_guid == get_loggedin_userid()) { - // display breadcrumbs - elgg_push_breadcrumb($vars['entity']->title); - echo elgg_view('navigation/breadcrumbs'); -?> - -
    -

    title; ?>

    -
    - - "action/messages/delete?message_id=" . $vars['entity']->getGUID() . "&type={$type}&submit=" . elgg_echo('delete'), - 'text' => elgg_echo('delete'), - 'confirm' => elgg_echo('deleteconfirm'), - 'class' => "elgg-action-button disabled" - )); - ?> -
    -
    - -
    - toId); - $message_icon = elgg_view("profile/icon",array('entity' => $user_object, 'size' => 'tiny')); - $message_owner = elgg_echo('messages:to').": ".$user_object->name.""; - }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').": ".get_entity($vars['entity']->fromId)->name.""; - } - ?> -
    -

    -

    time_created); ?>

    -
    -
    - -
    - (anyone?) - if($main_message = $vars['entity']->getEntitiesFromRelationship("reply")){ - echo $main_message[0][description]; - } - ?> - - $vars['entity']->description)); ?> -
    - - - - -$num_messages"; } -if($num == 0) { -?> -   - - - 'pg/messages/inbox/' . get_loggedin_user()->username, + 'text' => $text, + 'class' => $class, +)); diff --git a/mod/messages/views/default/messages/view.php b/mod/messages/views/default/messages/view.php deleted file mode 100644 index cc0b5ec3a..000000000 --- a/mod/messages/views/default/messages/view.php +++ /dev/null @@ -1,121 +0,0 @@ - 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 == get_loggedin_userid() || $message->toId == get_loggedin_userid()) { - - //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 "
    "; - }else{ - echo "
    "; - } - // get the icon of the user who owns the message - $from = get_entity($message->fromId); - echo "
    ".elgg_view("profile/icon",array('entity' => $from, 'size' => 'tiny'))."
    "; - // message block (message sender, message subject, delete checkbox) - echo "
    ".$from->name."

    ".elgg_view_friendly_time($message->time_created)."

    "; - // display message subject - echo "
    "; - // display delete button - echo "" . elgg_view("output/confirmlink", array( - 'href' => "action/messages/delete?message_id=" . $message->getGUID() . "&type=inbox&submit=" . urlencode(elgg_echo('delete')), - 'text' => elgg_echo('delete'), - 'confirm' => elgg_echo('deleteconfirm'), - )) . ""; - echo "

    guid}\" />"; - echo "getURL()}\">" . $message->title . "

    "; - echo "
    "; // 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 "
    "; - //get the icon for the user the message was sent to - echo "
    ".elgg_view("profile/icon",array('entity' => $user, 'size' => 'tiny'))."
    "; - echo "
    ".get_loggedin_user()->name."

    ".elgg_view_friendly_time($message->time_created)."

    "; - // display message subject - echo "
    "; - //display the link to 'delete' - echo "
    " . elgg_view("output/confirmlink", array( - 'href' => "action/messages/delete?message_id=" . $message->getGUID() . "&type=sent&submit=" . urlencode(elgg_echo('delete')), - 'text' => elgg_echo('delete'), - 'confirm' => elgg_echo('deleteconfirm'), - )) . "
    "; - echo "

    guid}\" /> "; - echo "getURL()}?type=sent\">" . $message->title . "

    "; - echo "
    "; // 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 .= '« ' . elgg_echo('previous') . ' '; - } - - if ($offset > 0) { - $newoffset = $offset - $limit; - if ($newoffset < 0) $newoffset = 0; - - $prevurl = elgg_http_add_url_query_elements($baseurl, array('offset' => $newoffset)); - - $nav .= '' . elgg_echo('next') . ' » '; - } - - - if (!empty($nav)) { - echo ''; - } - -} else { - echo "

    ".elgg_echo("messages:nomessages")."

    "; -} diff --git a/mod/messages/views/default/object/messages.php b/mod/messages/views/default/object/messages.php new file mode 100644 index 000000000..9aae6b7a8 --- /dev/null +++ b/mod/messages/views/default/object/messages.php @@ -0,0 +1,75 @@ +readYet = true; +} + +if ($message->toId == elgg_get_page_owner_guid()) { + // received + $user = get_entity($message->fromId); + $icon = elgg_view('profile/icon', array('entity' => $user, 'size' => 'tiny')); + $user_link = elgg_view('output/url', array( + 'href' => "pg/messages/compose?send_to=$user->guid", + 'text' => $user->name, + )); + + if ($message->readYet) { + $class = 'message read'; + } else { + $class = 'message unread'; + } + +} else { + // sent + $user = get_entity($message->toId); + $icon = elgg_view('profile/icon', array('entity' => $user, 'size' => 'tiny')); + $user_link = elgg_view('output/url', array( + 'href' => "pg/messages/compose?send_to=$user->guid", + 'text' => elgg_echo('messages:to_user', array($user->name)), + )); + + $class = 'message read'; +} + +$timestamp = elgg_view_friendly_time($message->time_created); + +$subject_info = ''; +if (!$full) { + $subject_info .= "guid}\" />"; +} +$subject_info .= elgg_view('output/url', array( + 'href' => $message->getURL(), + 'text' => $message->title, +)); + +$delete_link = "" . elgg_view("output/confirmlink", array( + 'href' => "action/messages/delete?guid=" . $message->getGUID(), + 'text' => elgg_echo('delete'), + 'confirm' => elgg_echo('deleteconfirm'), + )) . ""; + +$body = <<$user_link
    +
    $subject_info
    +
    $timestamp
    +
    $delete_link
    +HTML; + +if ($full) { + echo elgg_view_image_block($icon, $body, array('class' => $class)); + echo elgg_view('output/longtext', array('value' => $message->description)); +} else { + echo elgg_view_image_block($icon, $body, array('class' => $class)); +} \ No newline at end of file -- cgit v1.2.3