aboutsummaryrefslogtreecommitdiff
path: root/mod/messages/pages
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-03-19 15:10:41 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-03-19 15:10:41 +0000
commite603c947a5ae2869164b11fee827d4c595e4a3f8 (patch)
tree7826bcb38858e86d43485f7f18e02f8d22a5808c /mod/messages/pages
parenteec475fb1272a99134784b18b0451b306c5dbc4a (diff)
downloadelgg-e603c947a5ae2869164b11fee827d4c595e4a3f8.tar.gz
elgg-e603c947a5ae2869164b11fee827d4c595e4a3f8.tar.bz2
Refs #3158 update messages plugin
git-svn-id: http://code.elgg.org/elgg/trunk@8768 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/messages/pages')
-rw-r--r--mod/messages/pages/messages/inbox.php41
-rw-r--r--mod/messages/pages/messages/read.php57
-rw-r--r--mod/messages/pages/messages/send.php28
-rw-r--r--mod/messages/pages/messages/sent.php41
4 files changed, 167 insertions, 0 deletions
diff --git a/mod/messages/pages/messages/inbox.php b/mod/messages/pages/messages/inbox.php
new file mode 100644
index 000000000..4b2d11bbf
--- /dev/null
+++ b/mod/messages/pages/messages/inbox.php
@@ -0,0 +1,41 @@
+<?php
+/**
+ * Elgg messages inbox page
+ *
+ * @package ElggMessages
+*/
+
+gatekeeper();
+
+$page_owner = elgg_get_page_owner_entity();
+if (!$page_owner) {
+ register_error(elgg_echo());
+ forward();
+}
+
+elgg_push_breadcrumb(elgg_echo('messages:inbox'));
+
+$title = elgg_echo('messages:user', array($page_owner->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/pages/messages/read.php b/mod/messages/pages/messages/read.php
new file mode 100644
index 000000000..c5d1d4941
--- /dev/null
+++ b/mod/messages/pages/messages/read.php
@@ -0,0 +1,57 @@
+<?php
+/**
+* Read a message page
+*
+* @package ElggMessages
+*/
+
+gatekeeper();
+
+$message = get_entity(get_input('guid'));
+if (!$message) {
+ forward();
+}
+
+elgg_set_page_owner_guid($message->getOwnerGUID());
+$page_owner = elgg_get_page_owner_entity();
+
+$title = $message->title;
+
+$inbox = false;
+if ($page_owner->getGUID() == $message->toId) {
+ $inbox = true;
+ elgg_push_breadcrumb(elgg_echo('messages:inbox'), 'messages/inbox/' . $page_owner->username);
+} else {
+ elgg_push_breadcrumb(elgg_echo('messages:sent'), 'messages/sent/' . $page_owner->username);
+}
+elgg_push_breadcrumb($title);
+
+$buttons = '';
+$content = elgg_view_entity($message, true);
+if ($inbox) {
+ $form_params = array(
+ 'id' => 'messages-reply-form',
+ 'class' => 'hidden',
+ 'action' => 'action/messages/send',
+ );
+ $body_params = array('message' => $message);
+ $content .= elgg_view_form('messages/reply', $form_params, $body_params);
+
+ if (elgg_get_logged_in_user_guid() == elgg_get_page_owner_guid()) {
+ $buttons = elgg_view('output/url', array(
+ 'text' => elgg_echo('messages:answer'),
+ 'class' => 'elgg-button elgg-button-action',
+ 'id' => 'messages-show-reply',
+ ));
+ $buttons = "<ul class=\"elgg-menu elgg-menu-title\"><li>$buttons</li></ul>";
+ }
+}
+
+$body = elgg_view_layout('content', array(
+ 'content' => $content,
+ 'title' => $title,
+ 'filter' => '',
+ 'buttons' => $buttons,
+));
+
+echo elgg_view_page($title, $body);
diff --git a/mod/messages/pages/messages/send.php b/mod/messages/pages/messages/send.php
new file mode 100644
index 000000000..884c20cca
--- /dev/null
+++ b/mod/messages/pages/messages/send.php
@@ -0,0 +1,28 @@
+<?php
+/**
+* Compose a message
+*
+* @package ElggMessages
+*/
+
+gatekeeper();
+
+$page_owner = elgg_get_logged_in_user_entity();
+set_page_owner($page_owner->getGUID());
+
+$title = elgg_echo('messages:add');
+
+elgg_push_breadcrumb($title);
+
+$params = messages_prepare_form_vars(get_input('send_to'));
+$params['friends'] = $page_owner->getFriends();
+$content = elgg_view_form('messages/send', array(), $params);
+
+$body = elgg_view_layout('content', array(
+ 'content' => $content,
+ 'title' => $title,
+ 'filter' => '',
+ 'buttons' => '',
+));
+
+echo elgg_view_page($title, $body);
diff --git a/mod/messages/pages/messages/sent.php b/mod/messages/pages/messages/sent.php
new file mode 100644
index 000000000..f884643e0
--- /dev/null
+++ b/mod/messages/pages/messages/sent.php
@@ -0,0 +1,41 @@
+<?php
+/**
+* Elgg sent messages page
+*
+* @package ElggMessages
+*/
+
+gatekeeper();
+
+$page_owner = elgg_get_page_owner_entity();
+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);