aboutsummaryrefslogtreecommitdiff
path: root/mod/messages
diff options
context:
space:
mode:
Diffstat (limited to 'mod/messages')
-rw-r--r--mod/messages/languages/en.php2
-rw-r--r--mod/messages/manifest.xml7
-rw-r--r--mod/messages/pages/messages/read.php3
-rw-r--r--mod/messages/pages/messages/send.php4
-rw-r--r--mod/messages/start.php44
-rw-r--r--mod/messages/views/default/forms/messages/send.php2
-rw-r--r--mod/messages/views/default/object/messages.php11
7 files changed, 41 insertions, 32 deletions
diff --git a/mod/messages/languages/en.php b/mod/messages/languages/en.php
index 2002905b7..308c3d519 100644
--- a/mod/messages/languages/en.php
+++ b/mod/messages/languages/en.php
@@ -39,7 +39,7 @@ $english = array(
'messages:new' => 'New message',
- 'notification:method:site' => 'Messages',
+ 'notification:method:site' => 'Site',
'messages:error' => 'There was a problem saving your message. Please try again.',
diff --git a/mod/messages/manifest.xml b/mod/messages/manifest.xml
index 66ca4b444..73a58d9d4 100644
--- a/mod/messages/manifest.xml
+++ b/mod/messages/manifest.xml
@@ -8,11 +8,10 @@
<description>Elgg internal messages plugin. This plugin lets user send each other messages.</description>
<copyright>See COPYRIGHT.txt</copyright>
<website>http://www.elgg.org/</website>
- <license>GNU Public License version 2</license>
+ <license>GNU General Public License version 2</license>
<requires>
- <type>elgg_version</type>
- <version>2010030101</version>
+ <type>elgg_release</type>
+ <version>1.8</version>
</requires>
<activate_on_install>true</activate_on_install>
- <admin_interface>simple</admin_interface>
</plugin_manifest>
diff --git a/mod/messages/pages/messages/read.php b/mod/messages/pages/messages/read.php
index 310485ee2..d41551be4 100644
--- a/mod/messages/pages/messages/read.php
+++ b/mod/messages/pages/messages/read.php
@@ -12,6 +12,9 @@ if (!$message) {
forward();
}
+// mark the message as read
+$message->readYet = true;
+
elgg_set_page_owner_guid($message->getOwnerGUID());
$page_owner = elgg_get_page_owner_entity();
diff --git a/mod/messages/pages/messages/send.php b/mod/messages/pages/messages/send.php
index 1b821d185..b46d0ba52 100644
--- a/mod/messages/pages/messages/send.php
+++ b/mod/messages/pages/messages/send.php
@@ -8,14 +8,14 @@
gatekeeper();
$page_owner = elgg_get_logged_in_user_entity();
-set_page_owner($page_owner->getGUID());
+elgg_set_page_owner_guid($page_owner->getGUID());
$title = elgg_echo('messages:add');
elgg_push_breadcrumb($title);
$params = messages_prepare_form_vars((int)get_input('send_to'));
-$params['friends'] = $page_owner->getFriends();
+$params['friends'] = $page_owner->getFriends('', 50);
$content = elgg_view_form('messages/send', array(), $params);
$body = elgg_view_layout('content', array(
diff --git a/mod/messages/start.php b/mod/messages/start.php
index 14fc4c3bb..e4ef4d43a 100644
--- a/mod/messages/start.php
+++ b/mod/messages/start.php
@@ -28,25 +28,11 @@ function messages_init() {
'text' => elgg_echo('messages:sentmessages'),
'href' => "messages/sent/" . elgg_get_logged_in_user_entity()->username,
'context' => 'messages',
- ));
-
- $class = "elgg-icon elgg-icon-mail";
- $text = "<span class='$class'></span>";
-
- // get unread messages
- $num_messages = (int)messages_count_unread();
- if ($num_messages != 0) {
- $text .= "<span class=\"messages-new\">$num_messages</span>";
- }
-
- elgg_register_menu_item('topbar', array(
- 'name' => 'messages',
- 'href' => 'messages/inbox/' . elgg_get_logged_in_user_entity()->username,
- 'text' => $text,
- 'priority' => 600,
- ));
+ ));
}
+ elgg_register_event_handler('pagesetup', 'system', 'messages_notifier');
+
// Extend system CSS with our own styles, which are defined in the messages/css view
elgg_extend_view('css/elgg', 'messages/css');
elgg_extend_view('js/elgg', 'messages/js');
@@ -129,11 +115,33 @@ function messages_page_handler($page) {
default:
return false;
}
-
return true;
}
/**
+ * Display notification of new messages in topbar
+ */
+function messages_notifier() {
+ if (elgg_is_logged_in()) {
+ $class = "elgg-icon elgg-icon-mail";
+ $text = "<span class='$class'></span>";
+
+ // get unread messages
+ $num_messages = (int)messages_count_unread();
+ if ($num_messages != 0) {
+ $text .= "<span class=\"messages-new\">$num_messages</span>";
+ }
+
+ elgg_register_menu_item('topbar', array(
+ 'name' => 'messages',
+ 'href' => 'messages/inbox/' . elgg_get_logged_in_user_entity()->username,
+ 'text' => $text,
+ 'priority' => 600,
+ ));
+ }
+}
+
+/**
* Override the canEditMetadata function to return true for messages
*
*/
diff --git a/mod/messages/views/default/forms/messages/send.php b/mod/messages/views/default/forms/messages/send.php
index b0638e0c0..5b7e7830e 100644
--- a/mod/messages/views/default/forms/messages/send.php
+++ b/mod/messages/views/default/forms/messages/send.php
@@ -1,6 +1,6 @@
<?php
/**
- * Compse message form
+ * Compose message form
*
* @package ElggMessages
* @uses $vars['friends']
diff --git a/mod/messages/views/default/object/messages.php b/mod/messages/views/default/object/messages.php
index b2d127d85..b12f98522 100644
--- a/mod/messages/views/default/object/messages.php
+++ b/mod/messages/views/default/object/messages.php
@@ -12,10 +12,6 @@ if (!$message) {
return true;
}
-if ($full) {
- $message->readYet = true;
-}
-
if ($message->toId == elgg_get_page_owner_guid()) {
// received
$user = get_entity($message->fromId);
@@ -24,6 +20,7 @@ if ($message->toId == elgg_get_page_owner_guid()) {
$user_link = elgg_view('output/url', array(
'href' => "messages/compose?send_to=$user->guid",
'text' => $user->name,
+ 'is_trusted' => true,
));
} else {
$icon = '';
@@ -45,6 +42,7 @@ if ($message->toId == elgg_get_page_owner_guid()) {
$user_link = elgg_view('output/url', array(
'href' => "messages/compose?send_to=$user->guid",
'text' => elgg_echo('messages:to_user', array($user->name)),
+ 'is_trusted' => true,
));
} else {
$icon = '';
@@ -63,13 +61,14 @@ if (!$full) {
$subject_info .= elgg_view('output/url', array(
'href' => $message->getURL(),
'text' => $message->title,
+ 'is_trusted' => true,
));
$delete_link = elgg_view("output/confirmlink", array(
'href' => "action/messages/delete?guid=" . $message->getGUID(),
- 'text' => "<span class=\"elgg-icon elgg-icon-delete right\"></span>",
+ 'text' => "<span class=\"elgg-icon elgg-icon-delete float-alt\"></span>",
'confirm' => elgg_echo('deleteconfirm'),
- 'text_encode' => false,
+ 'encode_text' => false,
));
$body = <<<HTML