diff options
author | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-03-04 02:21:28 +0000 |
---|---|---|
committer | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-03-04 02:21:28 +0000 |
commit | e209ef52571b1e0f6a3937d3e88c9150c384994c (patch) | |
tree | 099090098a2b955af06a9ba02762d0fe79e08ae4 /mod/messages/views | |
parent | 59da34fb0c7a590db505777742ca21e1dd5b5cba (diff) | |
download | elgg-e209ef52571b1e0f6a3937d3e88c9150c384994c.tar.gz elgg-e209ef52571b1e0f6a3937d3e88c9150c384994c.tar.bz2 |
Merged messages interface changes.
git-svn-id: http://code.elgg.org/elgg/trunk@5270 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/messages/views')
-rw-r--r-- | mod/messages/views/default/messages/css.php | 277 | ||||
-rw-r--r-- | mod/messages/views/default/messages/forms/message.php | 94 | ||||
-rw-r--r-- | mod/messages/views/default/messages/forms/reply.php | 53 | ||||
-rw-r--r-- | mod/messages/views/default/messages/forms/send.php | 74 | ||||
-rw-r--r-- | mod/messages/views/default/messages/forms/view.php | 33 | ||||
-rw-r--r-- | mod/messages/views/default/messages/menu.php | 31 | ||||
-rw-r--r-- | mod/messages/views/default/messages/messages.php | 280 | ||||
-rw-r--r-- | mod/messages/views/default/messages/topbar.php | 44 | ||||
-rw-r--r-- | mod/messages/views/default/messages/view.php | 273 | ||||
-rw-r--r-- | mod/messages/views/default/object/messages.php | 0 |
10 files changed, 439 insertions, 720 deletions
diff --git a/mod/messages/views/default/messages/css.php b/mod/messages/views/default/messages/css.php index 6a8a6ed30..b73f8ff11 100644 --- a/mod/messages/views/default/messages/css.php +++ b/mod/messages/views/default/messages/css.php @@ -1,234 +1,83 @@ <?php - - /** - * Elgg Messages CSS extender - * - * @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/ - */ - +/** + * Elgg Messages CSS + * + * @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/ + */ ?> -/*------------------------------- -MESSAGING PLUGIN --------------------------------*/ -#messages { - margin:0 10px 0 10px; -} -.actiontitle { - font-weight: bold; - font-size: 110%; - margin: 0 0 10px 0; -} -#messages .pagination { - margin:5px 0 5px 0; -} -#messages input[type="checkbox"] { - margin:0; - padding:0; - border:none; -} -.messages_buttonbank { - -webkit-border-radius: 8px; - -moz-border-radius: 8px; - background:white; - margin:5px 10px; - padding:5px; - text-align: right; -} -.messages_buttonbank input { - margin:0 0 0 10px; -} -.messages_buttonbank input[type="button"] { - font: 12px/100% Arial, Helvetica, sans-serif; - font-weight: bold; - color: #4690D6; - background:#dddddd; - border: 1px solid #999999; - -webkit-border-radius: 4px; - -moz-border-radius: 4px; - width: auto; - height: 25px; - padding: 2px 6px 2px 6px; - margin:0 0 0 10px; - cursor: pointer; -} -.messages_buttonbank input[type="button"]:hover { - background: #0054a7; - border: 1px solid #0054a7; +/* messages/new messages icon & counter in elgg_topbar */ +a.privatemessages { + background:transparent url(<?php echo $vars['url']; ?>_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 $vars['url']; ?>_graphics/toolbar_messages_icon.gif) no-repeat left -36px; +} +a.privatemessages.new { + background:transparent url(<?php echo $vars['url']; ?>_graphics/toolbar_messages_icon.gif) no-repeat left 2px; + padding-left:18px; + margin:4px 15px 0 5px; color:white; } - -#messages td { - text-align: left; - vertical-align:middle; - padding: 5px; -} -#messages .message_sent { - -webkit-border-radius: 5px; - -moz-border-radius: 5px; - margin-bottom: 5px; - background: white; - border:1px solid #cccccc; +a.privatemessages.new:hover { + text-decoration: none; + background:transparent url(<?php echo $vars['url']; ?>_graphics/toolbar_messages_icon.gif) no-repeat left -36px; } -#messages .message_notread { - -webkit-border-radius: 5px; - -moz-border-radius: 5px; - margin-bottom: 5px; - background: #F7DAD8; - border:1px solid #ff6c7c; -} -#messages .message_read { - -webkit-border-radius: 5px; - -moz-border-radius: 5px; - margin-bottom: 5px; - background: white; - border:1px solid #cccccc; -} -#messages .message_notread td { - -} -#messages .message_read td { - -} - -#messages .delete_msg a { +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; - cursor: pointer; - width:14px; - height:14px; - margin:0; - background: url("<?php echo $vars['url']; ?>_graphics/icon_customise_remove.png") no-repeat right 0; - text-indent: -9000px; float:right; -} -#messages .delete_msg a:hover { - background-position: right -16px; -} -/* IE6 */ -* html #messages .delete_msg a { background-position: right 4px; } -* html #messages .delete_msg a:hover { background-position: right 4px; } - -#messages .usericon, -#messages .groupicon { - float: left; - margin: 0 15px 0 0; -} - -#messages .msgsender { - color:#666666; - line-height: 1em; - margin:0; padding:0; - float:left; -} -#messages .msgsender small { - color:#AAAAAA; -} - - -#messages .msgsubject { - font-size: 120%; - line-height: 100%; -} - -.msgsubject { + position:relative; + text-align:center; + top:-3px; + right:5px; + min-width: 15px; + font-size:9px; font-weight:bold; } -.messages_single_icon { - float: left; - width:110px; -} - -.messages_single_icon .usericon, -.messages_single_icon .groupicon { - float: left; - margin: 0 10px 10px 0; -} - -/* view and reply to message view */ -.message_body { - margin-left: 120px; -} -.message_body .messagebody { - padding:0; - margin:10px 0 10px 0; - font-size: 120%; - border-bottom:1px solid #cccccc; -} - -/* drop down message reply form */ -#message_reply_form { display:none; } - -.new_messages_count { - color:#666666; -} -/* tinyMCE container */ -#message_reply_editor #message_tbl { - width:680px !important; -} -/* IE6 */ -* html #message_reply_editor #message_tbl { width:676px !important;} - -#messages_return { - margin:4px 0 4px 10px; -} -#messages_return p { - margin:0; -} -.messages_single { - background: white; - -webkit-border-radius: 8px; - -moz-border-radius: 8px; - margin:0 10px 10px 10px; - padding:10px; +/* page content */ +.message { + border-bottom:1px dotted #cccccc; + padding:5px 0 7px 0; } -/* when displaying original msg in reply view */ -.previous_message { - background:#dedede; - -webkit-border-radius: 5px; - -moz-border-radius: 5px; - padding:10px; - margin:0 0 20px 0; +.message.notread .entity_listing_info p.entity_title a { + color:#d40005; } -.previous_message p { - padding:0; - margin:0 0 5px 0; - font-size: 100%; +.message_sender { + float:left; + width:180px; + overflow: hidden; } - - - - -#notificationstable td.sitetogglefield { - width:50px; - text-align: center; - vertical-align: middle; +.message_subject { + float:left; + width:513px; + padding-top:6px; } -#notificationstable td.sitetogglefield input { - margin-right:36px; - margin-top:5px; +.message .delete_button { + margin-top:3px; } -#notificationstable td.sitetogglefield a { - width:46px; - height:24px; - cursor: pointer; - display: block; - outline: none; +.entity_listing.messages:hover { + background-color:white; } -#notificationstable td.sitetogglefield a.sitetoggleOff { - background: url(<?php echo $vars['url']; ?>mod/messages/graphics/icon_notifications_site.gif) no-repeat right 2px; +.messages_buttonbank { + margin:5px 0; + text-align: right; } -#notificationstable td.sitetogglefield a.sitetoggleOn { - background: url(<?php echo $vars['url']; ?>mod/messages/graphics/icon_notifications_site.gif) no-repeat right -36px; +.messages_buttonbank input { + margin:0 0 0 10px; } - - - - - - diff --git a/mod/messages/views/default/messages/forms/message.php b/mod/messages/views/default/messages/forms/message.php deleted file mode 100644 index 3a926b0d3..000000000 --- a/mod/messages/views/default/messages/forms/message.php +++ /dev/null @@ -1,94 +0,0 @@ -<?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 deleted file mode 100644 index 7b949ec36..000000000 --- a/mod/messages/views/default/messages/forms/reply.php +++ /dev/null @@ -1,53 +0,0 @@ -<?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/send.php b/mod/messages/views/default/messages/forms/send.php new file mode 100644 index 000000000..93abe2e64 --- /dev/null +++ b/mod/messages/views/default/messages/forms/send.php @@ -0,0 +1,74 @@ +<?php +/** +* Elgg send a message view +* +* @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']); +?> +<form id="messages_send_form" action="<?php echo $vars['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 clearfloat'><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='{$vars['url']}pg/profile/".$user->username."'>".$user->username."</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="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> diff --git a/mod/messages/views/default/messages/forms/view.php b/mod/messages/views/default/messages/forms/view.php index adcd3a589..643953064 100644 --- a/mod/messages/views/default/messages/forms/view.php +++ b/mod/messages/views/default/messages/forms/view.php @@ -1,15 +1,26 @@ <?php +/** +* View message +* +* @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/ +*/ - $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 = 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 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')); +} + +$body .= '<input class="cancel_button" type="button" onclick="javascript:$(\'input[type=checkbox]\').click();" value="'.elgg_echo('messages:toggle').'" />'; +$body .= '</div>'; -?>
\ No newline at end of file +echo elgg_view('input/form',array('body' => $body, 'action' => $vars['url'] . 'action/messages/delete', 'method' => 'post'));
\ No newline at end of file diff --git a/mod/messages/views/default/messages/menu.php b/mod/messages/views/default/messages/menu.php index 9f8da1fb1..06cdde060 100644 --- a/mod/messages/views/default/messages/menu.php +++ b/mod/messages/views/default/messages/menu.php @@ -1,18 +1,16 @@ <?php - - /** - * Elgg hoverover extender for messages - * - * @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/ - */ - - //need to be logged in to send a message - if (isloggedin()) { - +/** + * Elgg hoverover extender for messages + * + * @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/ + */ + + //need to be logged in to send a message + if (isloggedin()) { ?> <p class="user_menu_messages"> @@ -20,7 +18,4 @@ </p> <?php - - } - -?>
\ No newline at end of file +}
\ No newline at end of file diff --git a/mod/messages/views/default/messages/messages.php b/mod/messages/views/default/messages/messages.php index cdc6e4483..2e179b00f 100644 --- a/mod/messages/views/default/messages/messages.php +++ b/mod/messages/views/default/messages/messages.php @@ -1,165 +1,131 @@ <?php - - /** - * Elgg messages individual view - * - * @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'] 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 = $vars['url'] . "mod/messages/sent.php"; - - //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 = $vars['url'] . "pg/messages/" . $vars['user']->username; - - //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()) +/** + * Elgg messages individual view + * + * @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'] 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 = $vars['url'] . "mod/messages/sent.php"; + // set up breadcrumbs context + $breadcrumb_root_text = elgg_echo('messages:sent'); + //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 = $vars['url'] . "pg/messages/" . $vars['user']->username; + // set up breadcrumbs context + $breadcrumb_root_text = elgg_echo('messages:inbox'); + //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 == $vars['user']->guid || $vars['entity']->owner_guid == $vars['user']->guid) { - + // display breadcrumbs + echo elgg_view('page_elements/breadcrumbs', array( + 'breadcrumb_root_url' => $url, + 'breadcrumb_root_text' => $breadcrumb_root_text, +/* + 'breadcrumb_level1_url' => $url, + 'breadcrumb_level1_text' => $vars['entity']->title, + 'breadcrumb_level2_url' => $url, + 'breadcrumb_level2_text' => $vars['entity']->title, +*/ + 'breadcrumb_currentpage' => $vars['entity']->title + )); ?> - <!-- get the correct return url --> - <div id="messages_return"><!-- start of messages_return div --> - <p><a href="<?php echo $url; ?>">« <?php echo elgg_echo('messages:back'); ?></a></p> - </div><!-- end of messages_return div --> - - <div class="messages_single"><!-- start of the message div --> - - <div class="messages_single_icon"><!-- start of the message_user_icon div --> - <!-- get the user icon, name and date --> - <?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); - echo " " . elgg_view("profile/icon",array('entity' => $user_object, 'size' => 'tiny')); - echo "<br class=\"clearfloat\" /><p>".elgg_echo('messages:to').": <b>" . $user_object->name . "</b><br />"; - } else { - echo " " . elgg_view("profile/icon",array('entity' => get_entity($vars['entity']->fromId), 'size' => 'tiny')); - echo "<br class=\"clearfloat\" /><p>".elgg_echo('messages:from').": <b>" . get_entity($vars['entity']->fromId)->name . "</b><br />"; - } - ?> - <!-- get the time the message was sent --> - <small><?php echo friendly_time($vars['entity']->time_created); ?></small> - </p> - </div><!-- end of the message_user_icon div --> - - <div class="message_body"><!-- start of div message_body --> - - <?php - //if the message is a reply, display the message the reply was for - //I need to figure out how to get the description out using -> (anyone?) - if($main_message = $vars['entity']->getEntitiesFromRelationship("reply")){ - - if($type == "sent"){ - echo "<div class='previous_message'><h3>".elgg_echo('messages:original').":</h3><p>"; - }else{ - echo "<div class='previous_message'><h3>".elgg_echo('messages:yours').":</h3><p>"; - } - - echo $main_message[0][description] . "</p></div>"; - - } - ?> - - <!-- display the title --> - <div class="actiontitle"> - <h3><?php echo $vars['entity']->title; ?></h3> - </div> - - <!-- display the message --> - <div class="messagebody"> - <p><?php echo elgg_view('output/longtext',array('value' => $vars['entity']->description)); ?></p> - </div> - - <!-- display the edit options, reply and delete --> - <div class="message_options"><!-- start of the message_options div --> - - <script type="text/javascript"> - $(document).ready(function () { - // click function to toggle reply panel - $('a.message_reply').click(function () { - $('div#message_reply_form').slideToggle("medium"); - return false; - }); - }); - </script> - - - <p><?php if($type != "sent")echo "<a href=\"javascript:void(0);\" class='message_reply'>".elgg_echo('messages:answer')."</a> "; ?> <?php echo elgg_view("output/confirmlink", array( - 'href' => $vars['url'] . "action/messages/delete?message_id=" . $vars['entity']->getGUID() . "&type={$type}&submit=" . elgg_echo('delete'), - 'text' => elgg_echo('delete'), - 'confirm' => elgg_echo('deleteconfirm'), - )); ?> - </p> - </div><!-- end of the message_options div --> - - </div><!-- end of div message_body --> - - <!-- display the reply form --> - <div id="message_reply_form"> - <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 htmlentities($reply_title); ?>" /></label></p> - <p class="longtext_editarea"><label><?php echo elgg_echo("messages:message"); ?>:</label></p> - <div id="message_reply_editor"> - <?php - - echo elgg_view("input/longtext", array( - "internalname" => "message", - "value" => '', - )); - - ?></div> - - <p> - <?php - // security tokens required. - 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='" . $vars['entity']->fromId . "' />"; - - ?> - <input type="submit" class="submit_button" value="<?php echo elgg_echo("messages:fly"); ?>" /> - </p> - </form> - </div><!-- end of div reply_form --> - - </div><!-- end of the message div --> +<!-- display the content header block --> + <div id="content_header" class="clearfloat"> + <div class="content_header_title"><h2><?php echo $vars['entity']->title; ?></h2></div> + <div class="content_header_options"> + <a class="action_button message_reply" href="#" 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' => $vars['url'] . "action/messages/delete?message_id=" . $vars['entity']->getGUID() . "&type={$type}&submit=" . elgg_echo('delete'), + 'text' => elgg_echo('delete'), + 'confirm' => elgg_echo('deleteconfirm'), + 'class' => "action_button disabled" + )); + ?> + </div> + </div> + + <div class="entity_listing messages clearfloat"> + <?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='{$vars['url']}pg/profile/".$user_object->username."'>".$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='{$vars['url']}pg/profile/".$user_object->username."'>".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 friendly_time($vars['entity']->time_created); ?></p> + </div> + </div> + + <div class="messagebody margin_top clearfloat"> + <?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 $vars['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="input_text" value='<?php echo $reply_title; ?>' /></label></p> + <p class="longtext_editarea"><label><?php echo elgg_echo("messages:message"); ?>:</label></p> + <div id="message_reply_editor"> + <?php echo elgg_view("input/longtext", array( + "internalname" => "message", + "value" => '', + )); + ?></div> + + <?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 . "' />"; + ?> + <input type="submit" class="submit_button" value="<?php echo 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 179167561..7a607f035 100644 --- a/mod/messages/views/default/messages/topbar.php +++ b/mod/messages/views/default/messages/topbar.php @@ -1,38 +1,34 @@ <?php +/** + * Elgg messages topbar extender + * + * @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/ + */ - /** - * Elgg messages topbar extender - * - * @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/ - */ - - //need to be logged in to send a message - gatekeeper(); +gatekeeper(); - //get unread messages - $num_messages = count_unread_messages(); - if($num_messages){ - $num = $num_messages; - } else { - $num = 0; - } - - if($num == 0){ +//get unread messages +$num_messages = count_unread_messages(); +if($num_messages){ + $num = $num_messages; +} else { + $num = 0; +} +if($num == 0) { ?> <a href="<?php echo $vars['url']; ?>pg/messages/<?php echo $_SESSION['user']->username; ?>" class="privatemessages" > </a> <?php - }else{ + } else { ?> <a href="<?php echo $vars['url']; ?>pg/messages/<?php echo $_SESSION['user']->username; ?>" class="privatemessages_new" >[<?php echo $num; ?>]</a> <?php - } -?>
\ No newline at end of file + }
\ No newline at end of file diff --git a/mod/messages/views/default/messages/view.php b/mod/messages/views/default/messages/view.php index 501be8bb3..cedd4bb5a 100644 --- a/mod/messages/views/default/messages/view.php +++ b/mod/messages/views/default/messages/view.php @@ -1,150 +1,125 @@ <?php - - /** - * Elgg messages view 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['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) { - -?> - <div id="messages" /><!-- start the main messages wrapper div --> - -<?php - - // get the correct display for the inbox view - if($vars['page_view'] == "inbox") { - - $counter = 0; - - foreach($vars['entity'] as $message) { - if ($message->owner_guid == $vars['user']->guid - || $message->toId == $vars['user']->guid) { - - //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, get the correct background color - if($message->readYet == 1){ - echo "<div class=\"message_read\" />"; - }else{ - echo "<div class=\"message_notread\" />"; - } - - //set the table - echo "<table width=\"100%\" cellspacing='0'><tr>"; - //get the icon of the user who owns the message - $from = get_entity($message->fromId); - echo "<td width='200px'>" . elgg_view("profile/icon",array('entity' => $from, 'size' => 'tiny')) . "<div class='msgsender'><b>" . $from->name . "</b><br /><small>" . friendly_time($message->time_created) . "</small></div></td>"; - //display the message title - echo "<td><div class='msgsubject'>"; - echo "<input type=\"checkbox\" name=\"message_id[]\" value=\"{$message->guid}\" /> "; - echo "<a href=\"{$message->getURL()}\">" . $message->title . "</a></div></td>"; - //display the link to 'delete' - - echo "<td width='70px'>"; - echo "<div class='delete_msg'>" . elgg_view("output/confirmlink", array( - 'href' => $vars['url'] . "action/messages/delete?message_id=" . $message->getGUID() . "&type=inbox&submit=" . urlencode(elgg_echo('delete')), - 'text' => elgg_echo('delete'), - 'confirm' => elgg_echo('deleteconfirm'), - )) . "</div>"; - - echo "</td></tr></table>"; - echo "</div>"; // close the message background div - - }//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\" />"; - echo "<table width=\"100%\" cellspacing='0'><tr>"; - - //get the icon for the user the message was sent to - echo "<tr><td width='200px'>" . elgg_view("profile/icon",array('entity' => $user, 'size' => 'tiny')) . "<div class='msgsender'><b>" . $user->name . "</b><br /><small>" . friendly_time($message->time_created) . "</small></div></td>"; - //display the message title - echo "<td><div class='msgsubject'>"; - echo "<input type=\"checkbox\" name=\"message_id[]\" value=\"{$message->guid}\" /> "; - echo "<a href=\"{$message->getURL()}?type=sent\">" . $message->title . "</a></div></td>"; - //display the link to 'delete' - - echo "<td width='70px'>"; - echo "<div class='delete_msg'>" . elgg_view("output/confirmlink", array( - 'href' => $vars['url'] . "action/messages/delete?message_id=" . $message->getGUID() . "&type=sent&submit=" . urlencode(elgg_echo('delete')), - 'text' => elgg_echo('delete'), - 'confirm' => elgg_echo('deleteconfirm'), - )) . "</div>"; - echo "</td></tr></table></div>"; - - }//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.'">« ' . 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') . ' »</a> '; - } - - - if (!empty($nav)) { - echo '<div class="pagination"><p>'.$nav.'</p><div class="clearfloat"></div></div>'; - } - - echo "</div>"; // close the main messages wrapper div - - } else { - - echo "<div class=\"contentWrapper\"><p class='messages_nomessage_message'>" . elgg_echo("messages:nomessages") . "</p></div>"; - - }//end of the first if statement -?> +/** + * Elgg messages view 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['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 == $vars['user']->guid || $message->toId == $vars['user']->guid) { + + //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 clearfloat'>"; + }else{ + echo "<div class='message notread clearfloat'>"; + } + // 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'>".friendly_time($message->time_created)."</p></div>"; + // display message subject + echo "<div class='message_subject'>"; + // display delete button + echo "<div class='delete_button'>" . elgg_view("output/confirmlink", array( + 'href' => $vars['url'] . "action/messages/delete?message_id=" . $message->getGUID() . "&type=inbox&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()}\">" . $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 clearfloat'>"; + //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'>".$_SESSION['user']->name."<p class='entity_subtext'>".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' => $vars['url'] . "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.'">« ' . 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') . ' »</a> '; + } + + + if (!empty($nav)) { + echo '<div class="pagination"><p>'.$nav.'</p><div class="clearfloat"></div></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 deleted file mode 100644 index e69de29bb..000000000 --- a/mod/messages/views/default/object/messages.php +++ /dev/null |