aboutsummaryrefslogtreecommitdiff
path: root/mod/messages/views
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-01-15 22:28:46 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-01-15 22:28:46 +0000
commit43c33492d2ab65a783c17559cf8dabd7832e9ea1 (patch)
tree7107fed1b5424db1405b842972c7e4c47f11bfd3 /mod/messages/views
parente8d148970261207efbe5435e1abcf68c5ed59cc8 (diff)
downloadelgg-43c33492d2ab65a783c17559cf8dabd7832e9ea1.tar.gz
elgg-43c33492d2ab65a783c17559cf8dabd7832e9ea1.tar.bz2
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
Diffstat (limited to 'mod/messages/views')
-rw-r--r--mod/messages/views/default/forms/messages/process.php41
-rw-r--r--mod/messages/views/default/forms/messages/reply.php47
-rw-r--r--mod/messages/views/default/forms/messages/send.php47
-rw-r--r--mod/messages/views/default/messages/css.php112
-rw-r--r--mod/messages/views/default/messages/forms/reply.php44
-rw-r--r--mod/messages/views/default/messages/forms/send.php74
-rw-r--r--mod/messages/views/default/messages/forms/view.php22
-rw-r--r--mod/messages/views/default/messages/menu.php12
-rw-r--r--mod/messages/views/default/messages/messages.php118
-rw-r--r--mod/messages/views/default/messages/topbar.php32
-rw-r--r--mod/messages/views/default/messages/view.php121
-rw-r--r--mod/messages/views/default/object/messages.php75
12 files changed, 270 insertions, 475 deletions
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 @@
+<?php
+/**
+ * Messages folder view (inbox, sent)
+ *
+ * Provides form body for mass deleting messages
+ *
+ * @uses $vars['list'] List of messages
+ *
+ */
+
+echo $vars['list'];
+
+echo '<div class="messages-buttonbank">';
+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 '</div>';
+
+?>
+<script type="text/javascript">
+$(document).ready(function() {
+ $("#messages-toggle").click(function() {
+ $('input[type=checkbox]').click();
+ });
+});
+</script>
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 @@
+<?php
+/**
+ * Reply form
+ *
+ * @uses $vars['message']
+ */
+
+// fix for RE: RE: RE: that builds on replies
+$reply_title = $vars['message']->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,
+));
+?>
+
+<p>
+ <label><?php echo elgg_echo("messages:title"); ?>: <br /></label>
+ <?php echo elgg_view('input/text', array(
+ 'internalname' => 'subject',
+ 'value' => $reply_title,
+ ));
+ ?>
+</p>
+<p>
+ <label><?php echo elgg_echo("messages:message"); ?>:</label>
+ <?php echo elgg_view("input/longtext", array(
+ 'internalname' => 'body',
+ 'value' => '',
+ ));
+ ?>
+</p>
+<p>
+ <?php echo elgg_view('input/submit', array('value' => elgg_echo('messages:send'))); ?>
+</p>
+
+<script type="text/javascript">
+$(document).ready(function() {
+ $("#messages-show-reply").click(function() {
+ $('#messages-reply-form').slideToggle('medium');
+ });
+});
+
+</script> \ 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 @@
+<?php
+/**
+ * Compse message form
+ *
+ * @package ElggMessages
+ * @uses $vars['friends']
+ */
+
+$recipient_guid = elgg_get_array_value('recipient_guid', $vars, 0);
+$subject = elgg_get_array_value('subject', $vars, '');
+$body = elgg_get_array_value('body', $vars, '');
+
+$recipients_options = array();
+foreach ($vars['friends'] as $friend) {
+ $recipients_options[$friend->guid] = $friend->name;
+}
+
+$recipient_drop_down = elgg_view('input/pulldown', array(
+ 'internalname' => 'recipient_guid',
+ 'value' => $recipient_guid,
+ 'options_values' => $recipients_options,
+));
+
+?>
+<p>
+ <label><?php echo elgg_echo("messages:to"); ?>: </label>
+ <?php echo $recipient_drop_down; ?>
+</p>
+<p>
+ <label><?php echo elgg_echo("messages:title"); ?>: <br /></label>
+ <?php echo elgg_view('input/text', array(
+ 'internalname' => 'subject',
+ 'value' => $subject,
+ ));
+ ?>
+</p>
+<p>
+ <label><?php echo elgg_echo("messages:message"); ?>:</label>
+ <?php echo elgg_view("input/longtext", array(
+ 'internalname' => 'body',
+ 'value' => $body,
+ ));
+ ?>
+</p>
+<p>
+ <?php echo elgg_view('input/submit', array('value' => elgg_echo('messages:send'))); ?>
+</p>
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(<?php echo elgg_get_site_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(<?php echo elgg_get_site_url(); ?>mod/messages/graphics/toolbar_messages_icon.gif) no-repeat left -36px;
+
+.message.unread a {
+ color: #d40005;
}
-a.privatemessages.new {
- background:transparent url(<?php echo elgg_get_site_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(<?php echo elgg_get_site_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(<?php echo elgg_get_site_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 @@
-<?php
-
- /**
- * Elgg reply to a message form
- * @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;
- }
-?>
-
-<form class="margin-top" id="messages_reply_form" action="<?php echo elgg_get_site_url(); ?>action/messages/send" method="post" name="messageForm">
- <?php echo elgg_view('action/securitytoken'); ?>
-
- <!-- 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="elgg-input-text" value='<?php echo $reply_title; ?>' /></label></p>
- <p><label><?php echo elgg_echo("messages:message"); ?>: <br /><textarea name='message' value='' class="elgg-input-textarea" /></textarea></label></p>
-
- <p>
- <?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='BAAA" . $vars['entity']->fromId . "' />";
-
- echo elgg_view('input/submit', array('value' => 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
deleted file mode 100644
index 6ddf7e543..000000000
--- a/mod/messages/views/default/messages/forms/send.php
+++ /dev/null
@@ -1,74 +0,0 @@
-<?php
-/**
-* Elgg send a message view
-*
-* @package ElggMessages
- * @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 elgg_get_site_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 clearfix'><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='" . $user->getURL() . "'>".$user->name."</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="elgg-input-text" /></label></p>
- <p class="longtext_inputarea"><label><?php echo elgg_echo("messages:message"); ?>:</label>
- <?php
- echo elgg_view("input/longtext", array(
- "internalname" => "message",
- "value" => $msg_content,
- ));
- ?>
- </p>
- <p>
- <?php
- echo elgg_view('input/submit', array('value' => elgg_echo("messages:fly")));
- ?>
- </p>
-</form>
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 @@
-<?php
-/**
-* View message
-*
-* @package ElggMessages
-*/
-
-$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 class="elgg-cancel-button" type="button" onclick="javascript:$(\'input[type=checkbox]\').click();" value="'.elgg_echo('messages:toggle').'" />';
-$body .= '</div>';
-
-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 @@
-<?php
-/**
- * Elgg hoverover extender for messages
- *
- * @package ElggMessages
- */
-
-// login check already performed in profile/icon
-?>
-<li class="user_menu_profile">
- <a class="send_message" href="<?php echo elgg_get_site_url(); ?>mod/messages/send.php?send_to=<?php echo $vars['entity']->guid; ?>"><?php echo elgg_echo("messages:sendmessage"); ?></a>
-</li> \ 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 @@
-<?php
-/**
- * Elgg messages individual view
- *
- * @package ElggMessages
- *
- *
- * @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 = elgg_get_site_url() . "mod/messages/sent.php";
- // set up breadcrumbs context
- elgg_push_breadcrumb(elgg_echo('messages:sent'), $url);
- //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 = elgg_get_site_url() . "pg/messages/" . get_loggedin_user()->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');
-?>
-<!-- display the content header block -->
- <div id="content-header" class="clearfix">
- <div class="content-header-title"><h2><?php echo $vars['entity']->title; ?></h2></div>
- <div class="content-header-options">
- <a class="elgg-action-button message_reply" 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' => "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"
- ));
- ?>
- </div>
- </div>
-
- <div class="entity-listing messages clearfix">
- <?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='" . $user_object->getURL() . "'>".$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='". $user_object->getURL() ."'>".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 elgg_view_friendly_time($vars['entity']->time_created); ?></p>
- </div>
- </div>
-
- <div class="messagebody margin-top clearfix">
- <?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 elgg_get_site_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="elgg-input-text" value='<?php echo $reply_title; ?>' /></label></p>
- <p class="longtext_inputarea"><label><?php echo elgg_echo("messages:message"); ?>:</label>
- <?php echo elgg_view("input/longtext", array(
- "internalname" => "message",
- "value" => '',
- ));
- ?></p>
-
- <?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 . "' />";
-
- echo elgg_view('input/submit', array('value' => elgg_echo("messages:fly")));
- ?>
- </form>
- </div>
-
-<?php
- }
-} \ No newline at end of file
diff --git a/mod/messages/views/default/messages/topbar.php b/mod/messages/views/default/messages/topbar.php
index 9e880201f..20c2f4396 100644
--- a/mod/messages/views/default/messages/topbar.php
+++ b/mod/messages/views/default/messages/topbar.php
@@ -5,22 +5,22 @@
* @package ElggMessages
*/
-gatekeeper();
+if (!isloggedin()) {
+ return true;
+}
+
+// get unread messages
+$num_messages = (int)messages_count_unread();
-//get unread messages
-$num_messages = messages_count_unread();
-if($num_messages){
- $num = $num_messages;
-} else {
- $num = 0;
+$class = "elgg-icon messages-icon";
+$text = "&nbsp;";
+if ($num_messages != 0) {
+ $class = "$class new";
+ $text = "<span>$num_messages</span>";
}
-if($num == 0) {
-?>
- <a href="<?php echo elgg_get_site_url(); ?>pg/messages/<?php echo get_loggedin_user()->username; ?>" class="privatemessages" >&nbsp;</a>
-<?php
- }else{
-?>
- <a href="<?php echo elgg_get_site_url(); ?>pg/messages/<?php echo get_loggedin_user()->username; ?>" class="privatemessages new" ><span><?php echo $num; ?></span></a>
-<?php
- }
+echo elgg_view('output/url', array(
+ 'href' => '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 @@
-<?php
-/**
- * Elgg messages view page
- *
- * @package ElggMessages
- *
- * @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 == 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 "<div class='message read clearfix'>";
- }else{
- echo "<div class='message notread clearfix'>";
- }
- // 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'>".elgg_view_friendly_time($message->time_created)."</p></div>";
- // display message subject
- echo "<div class='message_subject'>";
- // display delete button
- echo "<span class='delete-button'>" . 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'),
- )) . "</span>";
- 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 clearfix'>";
- //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'>".get_loggedin_user()->name."<p class='entity-subtext'>".elgg_view_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' => "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>';
- }
-
-} 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
new file mode 100644
index 000000000..9aae6b7a8
--- /dev/null
+++ b/mod/messages/views/default/object/messages.php
@@ -0,0 +1,75 @@
+<?php
+/**
+ * File renderer.
+ *
+ * @package ElggFile
+ */
+
+$full = elgg_get_array_value('full', $vars, false);
+$message = elgg_get_array_value('entity', $vars, false);
+
+if (!$message) {
+ return true;
+}
+
+if ($full) {
+ $message->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 .= "<input type='checkbox' name=\"message_id[]\" value=\"{$message->guid}\" />";
+}
+$subject_info .= elgg_view('output/url', array(
+ 'href' => $message->getURL(),
+ 'text' => $message->title,
+));
+
+$delete_link = "<span class='delete-button'>" . elgg_view("output/confirmlink", array(
+ 'href' => "action/messages/delete?guid=" . $message->getGUID(),
+ 'text' => elgg_echo('delete'),
+ 'confirm' => elgg_echo('deleteconfirm'),
+ )) . "</span>";
+
+$body = <<<HTML
+<div class="messages-owner">$user_link</div>
+<div class="messages-subject">$subject_info</div>
+<div class="messages-timestamp">$timestamp</div>
+<div class="messages-delete">$delete_link</div>
+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