forked from GNUsocial/gnu-social
		
	Move streams nav to groups nav
This commit is contained in:
		@@ -63,8 +63,10 @@ class DefaultLocalNav extends Menu
 | 
				
			|||||||
        $this->submenu(_m('MENU','Public'), $bn);
 | 
					        $this->submenu(_m('MENU','Public'), $bn);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (!empty($user)) {
 | 
					        if (!empty($user)) {
 | 
				
			||||||
            $sn = new StreamsNav($this->action);
 | 
					            $sn = new GroupsNav($this->action, $user);
 | 
				
			||||||
            $this->submenu(_m('MENU', 'Streams'), $sn);
 | 
					            if ($sn->haveGroups()) {
 | 
				
			||||||
 | 
					                $this->submenu(_m('MENU', 'Groups'), $sn);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $this->action->elementEnd('ul');
 | 
					        $this->action->elementEnd('ul');
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -45,8 +45,23 @@ if (!defined('STATUSNET')) {
 | 
				
			|||||||
 * @link      http://status.net/
 | 
					 * @link      http://status.net/
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class StreamsNav extends Menu
 | 
					class GroupsNav extends Menu
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    protected $user;
 | 
				
			||||||
 | 
					    protected $groups;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    function __construct($action, $user)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        parent::__construct($action);
 | 
				
			||||||
 | 
					        $this->user = $user;
 | 
				
			||||||
 | 
					        $this->groups = $user->getGroups();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    function haveGroups()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return (!empty($this->groups) && ($this->groups->N > 0));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Show the menu
 | 
					     * Show the menu
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
@@ -54,28 +69,24 @@ class StreamsNav extends Menu
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    function show()
 | 
					    function show()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $user         = common_current_user();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (empty($user)) {
 | 
					 | 
				
			||||||
            throw new ServerException('Cannot show personal group navigation without a current user.');
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        $action = $this->actionName;
 | 
					        $action = $this->actionName;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $this->out->elementStart('ul', array('class' => 'nav'));
 | 
					        $this->out->elementStart('ul', array('class' => 'nav'));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (Event::handle('StartStreamsNav', array($this))) {
 | 
					        if (Event::handle('StartGroupsNav', array($this))) {
 | 
				
			||||||
            $group = $user->getGroups();
 | 
					 | 
				
			||||||
            
 | 
					            
 | 
				
			||||||
            while ($group->fetch()) {
 | 
					            while ($this->groups->fetch()) {
 | 
				
			||||||
                $this->out->menuItem(($group->mainpage) ? $group->mainpage : common_local_url('showgroup',
 | 
					                $this->out->menuItem(($this->groups->mainpage) ?
 | 
				
			||||||
                                                                                              array('nickname' => $group->nickname)),
 | 
					                                     $this->groups->mainpage :
 | 
				
			||||||
                                     $group->getBestName(),
 | 
					                                     common_local_url('showgroup',
 | 
				
			||||||
 | 
					                                                      array('nickname' => $this->groups->nickname)),
 | 
				
			||||||
 | 
					                                     $this->groups->getBestName(),
 | 
				
			||||||
                                     '',
 | 
					                                     '',
 | 
				
			||||||
                                     $action == 'showgroup' && $this->action->arg('nickname') == $group->nickname,
 | 
					                                     $action == 'showgroup' && 
 | 
				
			||||||
                                     'nav_timeline_group_'.$group->nickname);
 | 
					                                     $this->action->arg('nickname') == $this->groups->nickname,
 | 
				
			||||||
 | 
					                                     'nav_timeline_group_'.$this->groups->nickname);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            Event::handle('EndStreamsNav', array($this));
 | 
					            Event::handle('EndGroupsNav', array($this));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $this->out->elementEnd('ul');
 | 
					        $this->out->elementEnd('ul');
 | 
				
			||||||
		Reference in New Issue
	
	Block a user