aboutsummaryrefslogtreecommitdiff
path: root/mod/messages/views/default/messages/forms
diff options
context:
space:
mode:
Diffstat (limited to 'mod/messages/views/default/messages/forms')
-rw-r--r--mod/messages/views/default/messages/forms/message.php94
-rw-r--r--mod/messages/views/default/messages/forms/reply.php53
-rw-r--r--mod/messages/views/default/messages/forms/view.php15
3 files changed, 162 insertions, 0 deletions
diff --git a/mod/messages/views/default/messages/forms/message.php b/mod/messages/views/default/messages/forms/message.php
new file mode 100644
index 000000000..3a926b0d3
--- /dev/null
+++ b/mod/messages/views/default/messages/forms/message.php
@@ -0,0 +1,94 @@
+<?php
+
+ /**
+ * Elgg send a message page
+ *
+ *
+ * @package ElggMessages
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ *
+ * @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']);
+
+
+
+?>
+ <div class="contentWrapper">
+ <form action="<?php echo $vars['url']; ?>action/messages/send" method="post" name="messageForm">
+
+ <?php
+ // security tokens.
+ 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);
+
+ //draw it
+ echo "<label>" . elgg_echo("messages:to") . ":</label><div class=\"messages_single_icon\">" . elgg_view("profile/icon",array('entity' => $user, 'size' => 'tiny')) . $user->username;
+ echo "</div><br class=\"clearfloat\" />";
+ //set the hidden input field to the recipients guid
+ echo "<input type=\"hidden\" name=\"send_to\" value=\"{$send_to}\" />";
+
+
+ }else{
+
+ ?>
+
+ <p><label><?php echo elgg_echo("messages:to"); ?>: </label>
+ <select name='send_to'>
+ <?php
+ //make the first option blank
+ echo "<option value=''></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
+
+ }//end send_to if statement
+
+ ?>
+
+ <p><label><?php echo elgg_echo("messages:title"); ?>: <br /><input type='text' name='title' value='<?php echo $msg_title; ?>' class="input-text" /></label></p>
+ <p class="longtext_editarea"><label><?php echo elgg_echo("messages:message"); ?>: <br />
+ <?php
+
+ echo elgg_view("input/longtext", array(
+ "internalname" => "message",
+ "value" => $msg_content,
+ ));
+
+ ?>
+ </label></p>
+ <p><input type="submit" class="submit_button" value="<?php echo elgg_echo("messages:fly"); ?>" /></p>
+
+ </form>
+ </div>
diff --git a/mod/messages/views/default/messages/forms/reply.php b/mod/messages/views/default/messages/forms/reply.php
new file mode 100644
index 000000000..7b949ec36
--- /dev/null
+++ b/mod/messages/views/default/messages/forms/reply.php
@@ -0,0 +1,53 @@
+<?php
+
+ /**
+ * Elgg reply to a message form
+ *
+ * @package ElggMessages
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ *
+ * @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;
+ }
+exit;
+ $reply_title = str_replace("'", "\\'", $reply_title);
+?>
+
+<form action="<?php echo $vars['url']; ?>action/messages/send" method="post" name="messageForm">
+
+ <!-- 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="input-text" value='<?php echo $reply_title; ?>' /></label></p>
+ <p><label><?php echo elgg_echo("messages:message"); ?>: <br /><textarea name='message' value='' class="input-textarea" /></textarea></label></p>
+
+ <p>
+ <?php
+ echo elgg_view('input/securitytoken');
+ //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 . "' />";
+
+ ?>
+ <input type="submit" class="submit_button" value="<?php echo 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/view.php b/mod/messages/views/default/messages/forms/view.php
new file mode 100644
index 000000000..adcd3a589
--- /dev/null
+++ b/mod/messages/views/default/messages/forms/view.php
@@ -0,0 +1,15 @@
+<?php
+
+ $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').'" /> ';
+ $body .= '<input type="submit" name="submit" value="'.elgg_echo('messages:markread').'" /> ';
+ $body .= '<input type="button" onclick="javascript:$(\'input[type=checkbox]\').click();" value="'.elgg_echo('messages:toggle').'" />';
+ $body .= '</div>';
+
+ echo elgg_view('input/form',array('body' => $body, 'action' => $vars['url'] . 'action/messages/delete', 'method' => 'post'));
+
+?> \ No newline at end of file