]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
menu on home and profile
authorEvan Prodromou <evan@prodromou.name>
Wed, 11 Jun 2008 15:52:58 +0000 (11:52 -0400)
committerEvan Prodromou <evan@prodromou.name>
Wed, 11 Jun 2008 15:52:58 +0000 (11:52 -0400)
darcs-hash:20080611155258-84dde-7afab3908ff3464975f8478fcd41f065466170ae.gz

actions/all.php
actions/showstream.php
lib/stream.php
lib/util.php

index e51dc375c8d7c38fa1e20829e25f066b47836083..83401d422d22cc667396ab726eed86c367062c1b 100644 (file)
@@ -46,7 +46,9 @@ class AllAction extends StreamAction {
 
                common_show_header($profile->nickname . _t(" and friends"),
                                                   array($this, 'show_header'), $user);
-
+               
+               $this->views_menu();
+               
                $this->show_notices($profile);
                
                common_show_footer();
index f8446e008a67dbc655f2b412928b6122edccd6c4..2130251ce170936173dd218fe6ea56ace2e8fdbc 100644 (file)
@@ -53,7 +53,9 @@ class ShowstreamAction extends StreamAction {
                                                                                                                                   $user->nickname)));
 
                common_show_header($profile->nickname, array($this, 'show_header'), $user);
-
+               
+               $this->views_menu();
+               
                $this->show_profile($profile);
 
                $this->show_notices($profile);
index 9a4cf41ebe0464104dcb224ec2a423c7f5563288..d8bd1f5629103aa8aa47c1ab5e5f76ee3a8d8e11 100644 (file)
@@ -27,6 +27,24 @@ class StreamAction extends Action {
                parent::handle($args);
        }
 
+       function views_menu() {
+               $action = $this->trimmed('action');
+               $nickname = $this->trimmed('nickname');
+               
+               common_element_start('ul', array('id' => 'nav_views'));
+               common_menu_item(common_local_url('showstream', array('nickname' =>
+                                                                                                                         $nickname)),
+                                                _t('Profile'),  
+                                                ($user->fullname) ? $user->fullname : $nickname,
+                                                $action == 'showstream');
+               common_element_end('ul');
+               common_menu_item(common_local_url('all', array('nickname' =>
+                                                                                                          $nickname)),
+                                                _t('All'),
+                                                _t('All'),
+                                                $action == 'all');
+       }
+       
        function show_notice($notice) {
                global $config;
                $profile = $notice->getProfile();
index 172b7a6b924f7671f2071a51bbb83617866edbb5..def3a57506f9037c4d85fea46bd23ae15cb6f2ab 100644 (file)
@@ -232,19 +232,6 @@ function common_nav_menu() {
        common_element_end('ul');
 }
 
-function common_views_menu($selected=NULL) {
-       $user = common_current_user();
-       common_element_start('ul', array('id' => 'nav_views'));
-       common_menu_item(common_local_url('all', array('nickname' =>
-                                                                                                  $user->nickname)),
-                                        _t('Home'));
-       common_menu_item(common_local_url('showstream', array('nickname' =>
-                                                                                                                 $user->nickname)),
-                                        _t('Profile'),  
-                                        ($user->fullname) ? $user->fullname : $user->nickname);
-       common_element_end('ul');
-}
-
 function common_foot_menu() {
        common_element_start('ul', array('id' => 'nav_sub'));
        common_menu_item(common_local_url('doc', array('title' => 'about')),
@@ -256,12 +243,16 @@ function common_foot_menu() {
        common_element_end('ul');
 }
 
-function common_menu_item($url, $text, $title=NULL) {
+function common_menu_item($url, $text, $title=NULL, $is_selected) {
+       $lattrs = array();
+       if ($is_selected) {
+               $lattrs['class'] = 'current';
+       }
+       common_element_start('li', $lattrs);
        $attrs['href'] = $url;
        if ($title) {
                $attrs['title'] = $title;
        }
-       common_element_start('li');
        common_element('a', $attrs, $text);
        common_element_end('li');
 }