]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
half way through converting submenu to new menu code - pages and groups are the two...
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Sat, 18 Dec 2010 17:47:50 +0000 (17:47 +0000)
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Sat, 18 Dec 2010 17:47:50 +0000 (17:47 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@7669 36083f99-b078-4883-b0ff-0f9b5a30f544

14 files changed:
engine/classes/ElggMenuItem.php
engine/lib/users.php
engine/lib/usersettings.php
mod/invitefriends/index.php [deleted file]
mod/invitefriends/start.php
mod/invitefriends/views/default/invitefriends/formitems.php
mod/notifications/groups.php
mod/notifications/index.php
mod/notifications/start.php
mod/notifications/views/default/notifications/subscriptions/form.php
mod/notifications/views/default/notifications/subscriptions/groupsform.php
views/default/css/elements/navigation.php
views/default/layout/elements/sidebar.php
views/default/navigation/menu/default.php [new file with mode: 0644]

index af7bbc9c240459ef6872267c253c1762c118ada5..f2eb1534f71a15278501585aee953657deca61df 100644 (file)
@@ -87,6 +87,9 @@ class ElggMenuItem {
                }
 
                $item = new ElggMenuItem($options['name'], $options['title'], $options['url']);
+               unset($options['name']);
+               unset($options['title']);
+               unset($options['url']);
 
                // special catch in case someone uses context rather than contexts
                if (isset($options['context'])) {
index d22e42ebfd4e1b443057d932062dfdb47b2fb30f..d69461c2b92def41fee65005afc6bc900e5d7988 100644 (file)
@@ -1336,6 +1336,7 @@ function friends_page_handler($page_elements) {
  * @return void
  */
 function friends_of_page_handler($page_elements) {
+       elgg_set_context('friends');
        if (isset($page_elements[0]) && $user = get_user_by_username($page_elements[0])) {
                set_page_owner($user->getGUID());
        }
@@ -1490,22 +1491,23 @@ function elgg_members_page_handler($page) {
  * @return void
  */
 function users_pagesetup() {
-       // Load config
-       global $CONFIG;
-
-       //add submenu options
-       if (elgg_get_context() == "friends" || elgg_get_context() == "friendsof") {
-               // || elgg_get_context() == "collections") { - disabled as we no longer use collections
-
-               add_submenu_item(elgg_echo('friends'), $CONFIG->wwwroot . "pg/friends/"
-                       . elgg_get_page_owner()->username);
 
-               add_submenu_item(elgg_echo('friends:of'), $CONFIG->wwwroot . "pg/friendsof/"
-                       . elgg_get_page_owner()->username);
-
-               if (is_plugin_enabled('members')) {
-                       add_submenu_item(elgg_echo('members:browse'), $CONFIG->wwwroot . "mod/members/index.php");
-               }
+       if (elgg_get_page_owner_guid()) {
+               $params = array(
+                       'name' => 'friends',
+                       'title' => elgg_echo('friends'),
+                       'url' => 'pg/friends/' . elgg_get_page_owner()->username,
+                       'contexts' => array('friends')
+               );
+               elgg_register_menu_item('page', $params);
+
+               $params = array(
+                       'name' => 'friendsof',
+                       'title' => elgg_echo('friends:of'),
+                       'url' => 'pg/friendsof/' . elgg_get_page_owner()->username,
+                       'contexts' => array('friends')
+               );
+               elgg_register_menu_item('page', $params);
        }
 }
 
index 7192ea0fa9146dad226719370056eeb1f9609c22..f6bbaea063c6672ce41a6829f4b9b140ebbcf875 100644 (file)
@@ -42,20 +42,27 @@ $priority = 500) {
  * @return void
  */
 function usersettings_pagesetup() {
-       // Get config
-       global $CONFIG;
-
-       // Menu options
-       if (elgg_get_context() == "settings") {
+       if (elgg_get_context() == "settings" && get_loggedin_userid()) {
                $user = get_loggedin_user();
-               add_submenu_item(elgg_echo('usersettings:user:opt:linktext'),
-                       $CONFIG->wwwroot . "pg/settings/user/{$user->username}/");
-
-               add_submenu_item(elgg_echo('usersettings:plugins:opt:linktext'),
-                       $CONFIG->wwwroot . "pg/settings/plugins/{$user->username}/");
 
-               add_submenu_item(elgg_echo('usersettings:statistics:opt:linktext'),
-                       $CONFIG->wwwroot . "pg/settings/statistics/{$user->username}/");
+               $params = array(
+                       'name' => '1_account',
+                       'title' => elgg_echo('usersettings:user:opt:linktext'),
+                       'url' => "pg/settings/user/{$user->username}",
+               );
+               elgg_register_menu_item('page', $params);
+               $params = array(
+                       'name' => '1_plugins',
+                       'title' => elgg_echo('usersettings:plugins:opt:linktext'),
+                       'url' => "pg/settings/plugins/{$user->username}",
+               );
+               elgg_register_menu_item('page', $params);
+               $params = array(
+                       'name' => '1_statistics',
+                       'title' => elgg_echo('usersettings:statistics:opt:linktext'),
+                       'url' => "pg/settings/statistics/{$user->username}",
+               );
+               elgg_register_menu_item('page', $params);
        }
 }
 
diff --git a/mod/invitefriends/index.php b/mod/invitefriends/index.php
deleted file mode 100644 (file)
index 7b4c345..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-<?php
-
-/**
- * Elgg invite page
- *
- * @package ElggInviteFriends
- */
-
-require_once(dirname(dirname(dirname(__FILE__))) . '/engine/start.php');
-
-gatekeeper();
-
-elgg_set_context('friends');
-set_page_owner(get_loggedin_userid());
-
-$body = elgg_view('invitefriends/form');
-$body = elgg_view_layout('one_column_with_sidebar', array('content' => $body));
-
-echo elgg_view_page(elgg_echo('friends:invite'), $body);
index abba12f20ea13b392bce40e6884d0d2f752b7892..bd470f144c08ce3f534bc26079ed1bc5b46db19e 100644 (file)
@@ -5,16 +5,42 @@
  * @package ElggInviteFriends
  */
 
+elgg_register_event_handler('init', 'system', 'invitefriends_init');
+
+function invitefriends_init() {
+       register_page_handler('invite', 'invitefriends_page_handler');
+
+       elgg_register_action('invitefriends/invite', elgg_get_plugin_path() . 'invitefriends/actions/invite.php');
+
+       $params = array(
+               'name' => 'invite',
+               'title' => elgg_echo('friends:invite'),
+               'url' => "pg/invite/",
+               'contexts' => array('friends'),
+       );
+       elgg_register_menu_item('page', $params);
+}
+
 /**
- * Add menu item for invite friends
+ * Page handler function
+ * 
+ * @param array $page Page URL segments
  */
-function invitefriends_pagesetup() {
-       if (elgg_get_context() == "friends" ||
-               elgg_get_context() == "friendsof" ||
-               elgg_get_context() == "collections") {
-                       add_submenu_item(elgg_echo('friends:invite'), "mod/invitefriends/",'invite');
-       }
-}
+function invitefriends_page_handler($page) {
+       gatekeeper();
 
-elgg_register_action('invitefriends/invite', elgg_get_plugin_path() . 'invitefriends/actions/invite.php');
-elgg_register_event_handler('pagesetup', 'system', 'invitefriends_pagesetup');
+       elgg_set_context('friends');
+       set_page_owner(get_loggedin_userid());
+
+       $title = elgg_echo('friends:invite');
+
+       $body = elgg_view('invitefriends/form');
+
+       $params = array(
+               'content' => $body,
+               'title' => $title,
+       );
+       $body = elgg_view_layout('one_sidebar', $params);
+
+       echo elgg_view_page($title, $body);
+}
index dceac6bbc76f6aefda41bdf42a8076736ed4d635..6d381a8ed59d652101da23a64e796f72ed9bd746 100644 (file)
@@ -7,13 +7,11 @@
  */
 
 if ($CONFIG->allow_registration) {
-       $invite = elgg_echo('friends:invite');
        $introduction = elgg_echo('invitefriends:introduction');
        $message = elgg_echo('invitefriends:message');
        $default = elgg_echo('invitefriends:message:default', array($CONFIG->site->name));
 
        echo <<< HTML
-<h2>$invite</h2>
 <p class="margin-top">
        <label>
                $introduction
index 10e3200325b6cb6dde2fdd31fc8f368e2abbd0e9..c4f59c049e799f3969163e1ed222c1b9e5400452 100644 (file)
@@ -1,5 +1,4 @@
 <?php
-
 /**
  * Elgg notifications plugin group index
  *
@@ -17,6 +16,8 @@ set_page_owner(get_loggedin_userid());
 // Set the context to settings
 elgg_set_context('settings');
 
+$title = elgg_echo('notifications:subscriptions:changesettings:groups');
+
 // Get the form
 $people = array();
 
@@ -29,8 +30,10 @@ $body = elgg_view('input/form',array(
                'action' => 'action/notificationsettings/groupsave'
 ));
 
-// Insert it into the correct canvas layout
-$body = elgg_view_layout('one_column_with_sidebar', array('content' => $body));
-
+$params = array(
+       'content' => $body,
+       'title' => $title,
+);
+$body = elgg_view_layout('one_sidebar', $params);
 
-echo elgg_view_page(elgg_echo('notifications:subscriptions:changesettings:groups'), $body);
+echo elgg_view_page($title, $body);
index c162c34b3d9a898ea1cdae85be97e15e72f0b410..4536b8788299c5e365b8d380556d32980217d632 100644 (file)
@@ -1,5 +1,4 @@
 <?php
-
 /**
  * Elgg notifications plugin index
  *
@@ -20,6 +19,8 @@ elgg_register_js($js_url, 'friendsPicker');
 // Set the context to settings
 elgg_set_context('settings');
 
+$title = elgg_echo('notifications:subscriptions:changesettings');
+
 // Get the form
 $people = array();
 if ($people_ents = elgg_get_entities_from_relationship(array('relationship' => 'notify', 'relationship_guid' => get_loggedin_userid(), 'types' => 'user', 'limit' => 99999))) {
@@ -30,8 +31,10 @@ if ($people_ents = elgg_get_entities_from_relationship(array('relationship' => '
 
 $body = elgg_view('notifications/subscriptions/form', array('people' => $people));
 
-// Insert it into the correct canvas layout
-$body = elgg_view_layout('one_column_with_sidebar', array('content' => $body));
-
+$params = array(
+       'content' => $body,
+       'title' => $title,
+);
+$body = elgg_view_layout('one_sidebar', $params);
 
-echo elgg_view_page(elgg_echo('notifications:subscriptions:changesettings'), $body);
+echo elgg_view_page($title, $body);
index 1bb99da3588e123a44335758f99bbbf9f74d2075..859f4ac14e89c4214deb89e7967b952548397a4b 100644 (file)
@@ -60,11 +60,23 @@ function notifications_page_handler($page) {
  *
  */
 function notifications_plugin_pagesetup() {
-       global $CONFIG;
-       if (elgg_get_context() == 'settings') {
-               add_submenu_item(elgg_echo('notifications:subscriptions:changesettings'), "pg/notifications/personal");
+       if (elgg_get_context() == "settings" && get_loggedin_userid()) {
+               $user = get_loggedin_user();
+
+               $params = array(
+                       'name' => '2_a_user_notify',
+                       'title' => elgg_echo('notifications:subscriptions:changesettings'),
+                       'url' => "pg/notifications/personal",
+               );
+               elgg_register_menu_item('page', $params);
+               
                if (is_plugin_enabled('groups')) {
-                       add_submenu_item(elgg_echo('notifications:subscriptions:changesettings:groups'), "pg/notifications/group");
+                       $params = array(
+                               'name' => '2_group_notify',
+                               'title' => elgg_echo('notifications:subscriptions:changesettings:groups'),
+                               'url' => "pg/notifications/group",
+                       );
+                       elgg_register_menu_item('page', $params);
                }
        }
 }
index 449f908a705e69e80e452ce4d807f7bd41260188..b7a34f98ea38f4eab0b01325128c29526ee68e2e 100644 (file)
@@ -1,14 +1,8 @@
 <?php
-
 /**
- * Elgg SMS Client
- * 
- * @package ElggSMS
+ * Elgg personal notifications
  */
 
-
-// Echo title
-       echo elgg_view_title(elgg_echo('notifications:subscriptions:changesettings'));
        
        echo elgg_view('subscriptions/form/additions',$vars);
        
index bf75f59319d0f235306d6c3b8c89668db158bbc3..b5328e5abf55fac493e9b87bfcf49fb90e486df9 100644 (file)
@@ -17,7 +17,6 @@ foreach($NOTIFICATION_HANDLERS as $method => $foo) {
        $subsbig[$method] = $tmparray;
 }
 
-echo elgg_view_title(elgg_echo('notifications:subscriptions:changesettings:groups'));
 ?>
 
 <div class="user-settings margin-top">
index 5ea94798a2b35eaede5e71c7faf0108db467e210..f9488c64d94c45106b806245f0060ec7c098b7e9 100644 (file)
 /* ***************************************
        PAGE MENU
 *************************************** */
+.elgg-sidebar .elgg-menu a {
+       display: block;
+       -webkit-border-radius: 8px;
+       -moz-border-radius: 8px;
+       background-color: white;
+       margin: 0 0 3px 0;
+       padding: 2px 4px 2px 8px;
+}
+.elgg-sidebar .elgg-menu a:hover {
+       background-color: #0054A7;
+       color: white;
+       text-decoration: none;
+}
+.elgg-sidebar .elgg-menu .selected a {
+       background-color: #4690D6;
+       color: white;
+}
+
 .submenu {
        margin:0;
        padding:0;
index d1323f2cd29ffa468a85797db6dc5a331e1865b0..7605c4e70e7f66ad9bfe79e56641c9416e8c7553 100644 (file)
@@ -8,6 +8,7 @@
 echo elgg_view('layout/elements/owner_block');
 
 echo elgg_view('navigation/sidebar_menu');
+echo elgg_view_menu('page', array('sort_by' => 'name'));
 
 // optional 'sidebar' parameter
 if (isset($vars['sidebar'])) {
diff --git a/views/default/navigation/menu/default.php b/views/default/navigation/menu/default.php
new file mode 100644 (file)
index 0000000..a63a267
--- /dev/null
@@ -0,0 +1,9 @@
+<?php
+
+foreach ($vars['menu'] as $section => $menu_items) {
+       echo '<ul class="elgg-menu">';
+       foreach ($menu_items as $menu_item) {
+               echo elgg_view('navigation/menu/elements/item', array('item' => $menu_item));
+       }
+       echo '</ul>';
+}
\ No newline at end of file