diff options
author | ewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-02-25 21:28:28 +0000 |
---|---|---|
committer | ewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-02-25 21:28:28 +0000 |
commit | 119017304ba7669c6596ccb3f6020959e0d629fd (patch) | |
tree | fad750ec8fbec6fe2abb794cf159f88674a0f42d /mod | |
parent | 9b89225ec25b131117e7ef0a7befc80a25f3e0e9 (diff) | |
download | elgg-119017304ba7669c6596ccb3f6020959e0d629fd.tar.gz elgg-119017304ba7669c6596ccb3f6020959e0d629fd.tar.bz2 |
Refs #2895: Messages now uses new topbar menu
git-svn-id: http://code.elgg.org/elgg/trunk@8475 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod')
-rw-r--r-- | mod/messages/start.php | 24 | ||||
-rw-r--r-- | mod/messages/views/default/messages/topbar.php | 26 |
2 files changed, 20 insertions, 30 deletions
diff --git a/mod/messages/start.php b/mod/messages/start.php index 44f024024..5e258824f 100644 --- a/mod/messages/start.php +++ b/mod/messages/start.php @@ -22,20 +22,36 @@ function messages_init() { 'href' => "pg/messages/inbox/" . elgg_get_logged_in_user_entity()->username, 'context' => 'messages', )); + elgg_register_menu_item('page', array( 'name' => 'messages:sentmessages', 'text' => elgg_echo('messages:sentmessages'), 'href' => "pg/messages/sent/" . elgg_get_logged_in_user_entity()->username, 'context' => 'messages', )); + + $class = "elgg-icon messages-icon"; + $text = " "; + + // get unread messages + $num_messages = (int)messages_count_unread(); + if ($num_messages != 0) { + $class .= " new"; + $text = $num_messages; + } + $text = "<span class='$class'>$text</span>"; + + elgg_register_menu_item('topbar', array( + 'name' => 'messages', + 'href' => 'pg/messages/inbox/' . elgg_get_logged_in_user_entity()->username, + 'text' => $text, + 'weight' => 600, + )); } - // Extend system CSS with our own styles, which are defined in the shouts/css view + // Extend system CSS with our own styles, which are defined in the messages/css view elgg_extend_view('css/elgg', 'messages/css'); - // Add icon to the topbar - elgg_extend_view('elgg_topbar/extend', 'messages/topbar'); - // Register a page handler, so we can have nice URLs elgg_register_page_handler('messages', 'messages_page_handler'); diff --git a/mod/messages/views/default/messages/topbar.php b/mod/messages/views/default/messages/topbar.php deleted file mode 100644 index 90a227f80..000000000 --- a/mod/messages/views/default/messages/topbar.php +++ /dev/null @@ -1,26 +0,0 @@ -<?php -/** - * Elgg messages topbar extender - * - * @package ElggMessages - */ - -if (!elgg_is_logged_in()) { - return true; -} - -// get unread messages -$num_messages = (int)messages_count_unread(); - -$class = "elgg-icon messages-icon"; -$text = " "; -if ($num_messages != 0) { - $class = "$class new"; - $text = $num_messages; -} -$text = "<span class='$class'>$text</span>"; - -echo elgg_view('output/url', array( - 'href' => 'pg/messages/inbox/' . elgg_get_logged_in_user_entity()->username, - 'text' => $text, -)); |