Fix public group nav to highlight properly when our group directory is selected
This commit is contained in:
parent
3a3a53dfcc
commit
e188a11ef6
|
@ -47,6 +47,9 @@ require_once INSTALLDIR.'/lib/widget.php';
|
||||||
*/
|
*/
|
||||||
class PublicGroupNav extends Menu
|
class PublicGroupNav extends Menu
|
||||||
{
|
{
|
||||||
|
|
||||||
|
var $actionName = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show the menu
|
* Show the menu
|
||||||
*
|
*
|
||||||
|
@ -54,7 +57,7 @@ class PublicGroupNav extends Menu
|
||||||
*/
|
*/
|
||||||
function show()
|
function show()
|
||||||
{
|
{
|
||||||
$action_name = $this->action->trimmed('action');
|
$this->actionName = $this->action->trimmed('action');
|
||||||
|
|
||||||
$this->action->elementStart('ul', array('class' => 'nav'));
|
$this->action->elementStart('ul', array('class' => 'nav'));
|
||||||
|
|
||||||
|
@ -62,35 +65,35 @@ class PublicGroupNav extends Menu
|
||||||
// TRANS: Menu item in search group navigation panel.
|
// TRANS: Menu item in search group navigation panel.
|
||||||
$this->out->menuItem(common_local_url('public'), _m('MENU','Public'),
|
$this->out->menuItem(common_local_url('public'), _m('MENU','Public'),
|
||||||
// TRANS: Menu item title in search group navigation panel.
|
// TRANS: Menu item title in search group navigation panel.
|
||||||
_('Public timeline'), $action_name == 'public', 'nav_timeline_public');
|
_('Public timeline'), $this->actionName == 'public', 'nav_timeline_public');
|
||||||
|
|
||||||
// TRANS: Menu item in search group navigation panel.
|
// TRANS: Menu item in search group navigation panel.
|
||||||
$this->out->menuItem(common_local_url('groups'), _m('MENU','Groups'),
|
$this->out->menuItem(common_local_url('groups'), _m('MENU','Groups'),
|
||||||
// TRANS: Menu item title in search group navigation panel.
|
// TRANS: Menu item title in search group navigation panel.
|
||||||
_('User groups'), $action_name == 'groups', 'nav_groups');
|
_('User groups'), $this->actionName == 'groups', 'nav_groups');
|
||||||
|
|
||||||
// TRANS: Menu item in search group navigation panel.
|
// TRANS: Menu item in search group navigation panel.
|
||||||
$this->out->menuItem(common_local_url('publictagcloud'), _m('MENU','Recent tags'),
|
$this->out->menuItem(common_local_url('publictagcloud'), _m('MENU','Recent tags'),
|
||||||
// TRANS: Menu item title in search group navigation panel.
|
// TRANS: Menu item title in search group navigation panel.
|
||||||
_('Recent tags'), $action_name == 'publictagcloud', 'nav_recent-tags');
|
_('Recent tags'), $this->actionName == 'publictagcloud', 'nav_recent-tags');
|
||||||
|
|
||||||
// TRANS: Menu item in search group navigation panel.
|
// TRANS: Menu item in search group navigation panel.
|
||||||
$this->out->menuItem(common_local_url('publicpeopletagcloud'), _m('MENU','People tags'),
|
$this->out->menuItem(common_local_url('publicpeopletagcloud'), _m('MENU','People tags'),
|
||||||
// TRANS: Menu item title in search group navigation panel.
|
// TRANS: Menu item title in search group navigation panel.
|
||||||
_('People tags'), in_array($action_name, array('publicpeopletagcloud',
|
_('People tags'), in_array($this->actionName, array('publicpeopletagcloud',
|
||||||
'peopletag', 'selftag')), 'nav_people-tags');
|
'peopletag', 'selftag')), 'nav_people-tags');
|
||||||
|
|
||||||
if (count(common_config('nickname', 'featured')) > 0) {
|
if (count(common_config('nickname', 'featured')) > 0) {
|
||||||
// TRANS: Menu item in search group navigation panel.
|
// TRANS: Menu item in search group navigation panel.
|
||||||
$this->out->menuItem(common_local_url('featured'), _m('MENU','Featured'),
|
$this->out->menuItem(common_local_url('featured'), _m('MENU','Featured'),
|
||||||
// TRANS: Menu item title in search group navigation panel.
|
// TRANS: Menu item title in search group navigation panel.
|
||||||
_('Featured users'), $action_name == 'featured', 'nav_featured');
|
_('Featured users'), $this->actionName == 'featured', 'nav_featured');
|
||||||
}
|
}
|
||||||
|
|
||||||
// TRANS: Menu item in search group navigation panel.
|
// TRANS: Menu item in search group navigation panel.
|
||||||
$this->out->menuItem(common_local_url('favorited'), _m('MENU','Popular'),
|
$this->out->menuItem(common_local_url('favorited'), _m('MENU','Popular'),
|
||||||
// TRANS: Menu item title in search group navigation panel.
|
// TRANS: Menu item title in search group navigation panel.
|
||||||
_('Popular notices'), $action_name == 'favorited', 'nav_timeline_favorited');
|
_('Popular notices'), $this->actionName == 'favorited', 'nav_timeline_favorited');
|
||||||
|
|
||||||
Event::handle('EndPublicGroupNav', array($this));
|
Event::handle('EndPublicGroupNav', array($this));
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,6 +155,9 @@ class DirectoryPlugin extends Plugin
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The following three function are to replace the existing groups
|
||||||
|
// list page with the directory plugin's group directory page
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hijack the mapping (Action -> URL) and return the URL to our
|
* Hijack the mapping (Action -> URL) and return the URL to our
|
||||||
* group directory page instead of the normal groups page
|
* group directory page instead of the normal groups page
|
||||||
|
@ -193,6 +196,24 @@ class DirectoryPlugin extends Plugin
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fool the public nav into thinking it's on the regular
|
||||||
|
* group page when it's actually on our injected group
|
||||||
|
* directory page. This way "Groups" gets hilighted when
|
||||||
|
* when we're on the groups directory page.
|
||||||
|
*
|
||||||
|
* @param type $action the current action
|
||||||
|
*
|
||||||
|
* @return boolean hook flag
|
||||||
|
*/
|
||||||
|
function onStartPublicGroupNav($action)
|
||||||
|
{
|
||||||
|
if ($action->trimmed('action') == 'groupdirectory') {
|
||||||
|
$action->actionName = 'groups';
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Modify the public local nav to add a link to the user directory
|
* Modify the public local nav to add a link to the user directory
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue
Block a user