aboutsummaryrefslogtreecommitdiff
path: root/mod/messages/views/default
diff options
context:
space:
mode:
Diffstat (limited to 'mod/messages/views/default')
-rw-r--r--mod/messages/views/default/forms/messages/process.php43
-rw-r--r--mod/messages/views/default/forms/messages/reply.php38
-rw-r--r--mod/messages/views/default/forms/messages/send.php54
-rw-r--r--mod/messages/views/default/messages/css.php63
-rw-r--r--mod/messages/views/default/messages/js.php7
-rw-r--r--mod/messages/views/default/object/messages.php86
6 files changed, 291 insertions, 0 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..cb30792e9
--- /dev/null
+++ b/mod/messages/views/default/forms/messages/process.php
@@ -0,0 +1,43 @@
+<?php
+/**
+ * Messages folder view (inbox, sent)
+ *
+ * Provides form body for mass deleting messages
+ *
+ * @uses $vars['list'] List of messages
+ *
+ */
+
+$messages = $vars['list'];
+if (!$messages) {
+ echo elgg_echo('messages:nomessages');
+ return true;
+}
+
+echo '<div class="messages-container">';
+echo $messages;
+echo '</div>';
+
+echo '<div class="elgg-foot messages-buttonbank">';
+
+echo elgg_view('input/submit', array(
+ 'value' => elgg_echo('delete'),
+ 'name' => 'delete',
+ 'class' => 'elgg-button-delete elgg-requires-confirmation',
+ 'title' => elgg_echo('deleteconfirm:plural'),
+));
+
+if ($vars['folder'] == "inbox") {
+ echo elgg_view('input/submit', array(
+ 'value' => elgg_echo('messages:markread'),
+ 'name' => 'read',
+ ));
+}
+
+echo elgg_view('input/button', array(
+ 'value' => elgg_echo('messages:toggle'),
+ 'class' => 'elgg-button elgg-button-cancel',
+ 'id' => 'messages-toggle',
+));
+
+echo '</div>';
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..9f3f4b57e
--- /dev/null
+++ b/mod/messages/views/default/forms/messages/reply.php
@@ -0,0 +1,38 @@
+<?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(
+ 'name' => 'recipient_guid',
+ 'value' => $vars['message']->fromId,
+));
+?>
+
+<div>
+ <label><?php echo elgg_echo("messages:title"); ?>: <br /></label>
+ <?php echo elgg_view('input/text', array(
+ 'name' => 'subject',
+ 'value' => $reply_title,
+ ));
+ ?>
+</div>
+<div>
+ <label><?php echo elgg_echo("messages:message"); ?>:</label>
+ <?php echo elgg_view("input/longtext", array(
+ 'name' => 'body',
+ 'value' => '',
+ ));
+ ?>
+</div>
+<div class="elgg-foot">
+ <?php echo elgg_view('input/submit', array('value' => elgg_echo('messages:send'))); ?>
+</div> \ 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..5b7e7830e
--- /dev/null
+++ b/mod/messages/views/default/forms/messages/send.php
@@ -0,0 +1,54 @@
+<?php
+/**
+ * Compose message form
+ *
+ * @package ElggMessages
+ * @uses $vars['friends']
+ */
+
+$recipient_guid = elgg_extract('recipient_guid', $vars, 0);
+$subject = elgg_extract('subject', $vars, '');
+$body = elgg_extract('body', $vars, '');
+
+$recipients_options = array();
+foreach ($vars['friends'] as $friend) {
+ $recipients_options[$friend->guid] = $friend->name;
+}
+
+if (!array_key_exists($recipient_guid, $recipients_options)) {
+ $recipient = get_entity($recipient_guid);
+ if (elgg_instanceof($recipient, 'user')) {
+ $recipients_options[$recipient_guid] = $recipient->name;
+ }
+}
+
+$recipient_drop_down = elgg_view('input/dropdown', array(
+ 'name' => 'recipient_guid',
+ 'value' => $recipient_guid,
+ 'options_values' => $recipients_options,
+));
+
+?>
+<div>
+ <label><?php echo elgg_echo("messages:to"); ?>: </label>
+ <?php echo $recipient_drop_down; ?>
+</div>
+<div>
+ <label><?php echo elgg_echo("messages:title"); ?>: <br /></label>
+ <?php echo elgg_view('input/text', array(
+ 'name' => 'subject',
+ 'value' => $subject,
+ ));
+ ?>
+</div>
+<div>
+ <label><?php echo elgg_echo("messages:message"); ?>:</label>
+ <?php echo elgg_view("input/longtext", array(
+ 'name' => 'body',
+ 'value' => $body,
+ ));
+ ?>
+</div>
+<div class="elgg-foot">
+ <?php echo elgg_view('input/submit', array('value' => elgg_echo('messages:send'))); ?>
+</div>
diff --git a/mod/messages/views/default/messages/css.php b/mod/messages/views/default/messages/css.php
new file mode 100644
index 000000000..f304e0f15
--- /dev/null
+++ b/mod/messages/views/default/messages/css.php
@@ -0,0 +1,63 @@
+<?php
+/**
+ * Elgg Messages CSS
+ *
+ * @package ElggMessages
+ */
+?>
+
+.messages-container {
+ min-height: 200px;
+}
+.message.unread a {
+ color: #d40005;
+}
+.messages-buttonbank {
+ text-align: right;
+}
+.messages-buttonbank input {
+ margin-left: 10px;
+}
+
+/*** message metadata ***/
+.messages-owner {
+ float: left;
+ width: 20%;
+ margin-right: 2%;
+}
+.messages-subject {
+ float: left;
+ width: 55%;
+ margin-right: 2%;
+}
+.messages-timestamp {
+ float: left;
+ width: 14%;
+ margin-right: 2%;
+}
+.messages-delete {
+ float: left;
+ width: 5%;
+}
+/*** topbar icon ***/
+.messages-new {
+ color: white;
+ background-color: red;
+
+ -webkit-border-radius: 10px;
+ -moz-border-radius: 10px;
+ border-radius: 10px;
+
+ -webkit-box-shadow: -2px 2px 4px rgba(0, 0, 0, 0.50);
+ -moz-box-shadow: -2px 2px 4px rgba(0, 0, 0, 0.50);
+ box-shadow: -2px 2px 4px rgba(0, 0, 0, 0.50);
+
+ position: absolute;
+ text-align: center;
+ top: 0px;
+ left: 26px;
+ min-width: 16px;
+ height: 16px;
+ font-size: 10px;
+ font-weight: bold;
+}
diff --git a/mod/messages/views/default/messages/js.php b/mod/messages/views/default/messages/js.php
new file mode 100644
index 000000000..60cf36b92
--- /dev/null
+++ b/mod/messages/views/default/messages/js.php
@@ -0,0 +1,7 @@
+
+// messages plugin toggle
+elgg.register_hook_handler('init', 'system', function() {
+ $("#messages-toggle").click(function() {
+ $('input[type=checkbox]').click();
+ });
+});
diff --git a/mod/messages/views/default/object/messages.php b/mod/messages/views/default/object/messages.php
new file mode 100644
index 000000000..b12f98522
--- /dev/null
+++ b/mod/messages/views/default/object/messages.php
@@ -0,0 +1,86 @@
+<?php
+/**
+ * File renderer.
+ *
+ * @package ElggFile
+ */
+
+$full = elgg_extract('full_view', $vars, false);
+$message = elgg_extract('entity', $vars, false);
+
+if (!$message) {
+ return true;
+}
+
+if ($message->toId == elgg_get_page_owner_guid()) {
+ // received
+ $user = get_entity($message->fromId);
+ if ($user) {
+ $icon = elgg_view_entity_icon($user, 'tiny');
+ $user_link = elgg_view('output/url', array(
+ 'href' => "messages/compose?send_to=$user->guid",
+ 'text' => $user->name,
+ 'is_trusted' => true,
+ ));
+ } else {
+ $icon = '';
+ $user_link = elgg_echo('messages:deleted_sender');
+ }
+
+ if ($message->readYet) {
+ $class = 'message read';
+ } else {
+ $class = 'message unread';
+ }
+
+} else {
+ // sent
+ $user = get_entity($message->toId);
+
+ if ($user) {
+ $icon = elgg_view_entity_icon($user, 'tiny');
+ $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 = '';
+ $user_link = elgg_echo('messages:deleted_sender');
+ }
+
+ $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,
+ '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 float-alt\"></span>",
+ 'confirm' => elgg_echo('deleteconfirm'),
+ 'encode_text' => false,
+ ));
+
+$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