primary and secondary nav use menu superclass
This commit is contained in:
parent
c8d6a77d8a
commit
903053caec
104
lib/action.php
104
lib/action.php
|
@ -543,69 +543,8 @@ class Action extends HTMLOutputter // lawsuit
|
|||
*/
|
||||
function showPrimaryNav()
|
||||
{
|
||||
$user = common_current_user();
|
||||
$this->elementStart('ul', array('class' => 'nav',
|
||||
'id' => 'site_nav_global_primary'));
|
||||
if (Event::handle('StartPrimaryNav', array($this))) {
|
||||
if (!empty($user)) {
|
||||
$this->menuItem(common_local_url('all',
|
||||
array('nickname' => $user->nickname)),
|
||||
_m('Home'),
|
||||
_m('Friends timeline'),
|
||||
false,
|
||||
'nav_home');
|
||||
$this->menuItem(common_local_url('showstream',
|
||||
array('nickname' => $user->nickname)),
|
||||
_m('Profile'),
|
||||
_m('Your profile'),
|
||||
false,
|
||||
'nav_profile');
|
||||
$this->menuItem(common_local_url('public'),
|
||||
_m('Public'),
|
||||
_m('Everyone on this site'),
|
||||
false,
|
||||
'nav_public');
|
||||
$this->menuItem(common_local_url('profilesettings'),
|
||||
_m('Settings'),
|
||||
_m('Change your personal settings'),
|
||||
false,
|
||||
'nav_account');
|
||||
if ($user->hasRight(Right::CONFIGURESITE)) {
|
||||
$this->menuItem(common_local_url('siteadminpanel'),
|
||||
_m('Admin'),
|
||||
_m('Site configuration'),
|
||||
false,
|
||||
'nav_admin');
|
||||
}
|
||||
$this->menuItem(common_local_url('logout'),
|
||||
_m('Logout'),
|
||||
_m('Logout from the site'),
|
||||
false,
|
||||
'nav_logout');
|
||||
} else {
|
||||
$this->menuItem(common_local_url('public'),
|
||||
_m('Public'),
|
||||
_m('Everyone on this site'),
|
||||
false,
|
||||
'nav_public');
|
||||
$this->menuItem(common_local_url('login'),
|
||||
_m('Login'),
|
||||
_m('Login to the site'),
|
||||
false,
|
||||
'nav_login');
|
||||
}
|
||||
|
||||
if (!empty($user) || !common_config('site', 'private')) {
|
||||
$this->menuItem(common_local_url('noticesearch'),
|
||||
_m('Search'),
|
||||
_m('Search the site'),
|
||||
false,
|
||||
'nav_search');
|
||||
}
|
||||
|
||||
Event::handle('EndPrimaryNav', array($this));
|
||||
}
|
||||
$this->elementEnd('ul');
|
||||
$pn = new PrimaryNav($this);
|
||||
$pn->show();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -850,43 +789,8 @@ class Action extends HTMLOutputter // lawsuit
|
|||
*/
|
||||
function showSecondaryNav()
|
||||
{
|
||||
$this->elementStart('ul', array('class' => 'nav',
|
||||
'id' => 'site_nav_global_secondary'));
|
||||
if (Event::handle('StartSecondaryNav', array($this))) {
|
||||
$this->menuItem(common_local_url('doc', array('title' => 'help')),
|
||||
// TRANS: Secondary navigation menu option leading to help on StatusNet.
|
||||
_('Help'));
|
||||
$this->menuItem(common_local_url('doc', array('title' => 'about')),
|
||||
// TRANS: Secondary navigation menu option leading to text about StatusNet site.
|
||||
_('About'));
|
||||
$this->menuItem(common_local_url('doc', array('title' => 'faq')),
|
||||
// TRANS: Secondary navigation menu option leading to Frequently Asked Questions.
|
||||
_('FAQ'));
|
||||
$bb = common_config('site', 'broughtby');
|
||||
if (!empty($bb)) {
|
||||
$this->menuItem(common_local_url('doc', array('title' => 'tos')),
|
||||
// TRANS: Secondary navigation menu option leading to Terms of Service.
|
||||
_('TOS'));
|
||||
}
|
||||
$this->menuItem(common_local_url('doc', array('title' => 'privacy')),
|
||||
// TRANS: Secondary navigation menu option leading to privacy policy.
|
||||
_('Privacy'));
|
||||
$this->menuItem(common_local_url('doc', array('title' => 'source')),
|
||||
// TRANS: Secondary navigation menu option. Leads to information about StatusNet and its license.
|
||||
_('Source'));
|
||||
$this->menuItem(common_local_url('version'),
|
||||
// TRANS: Secondary navigation menu option leading to version information on the StatusNet site.
|
||||
_('Version'));
|
||||
$this->menuItem(common_local_url('doc', array('title' => 'contact')),
|
||||
// TRANS: Secondary navigation menu option leading to e-mail contact information on the
|
||||
// TRANS: StatusNet site, where to report bugs, ...
|
||||
_('Contact'));
|
||||
$this->menuItem(common_local_url('doc', array('title' => 'badge')),
|
||||
// TRANS: Secondary navigation menu option. Leads to information about embedding a timeline widget.
|
||||
_('Badge'));
|
||||
Event::handle('EndSecondaryNav', array($this));
|
||||
}
|
||||
$this->elementEnd('ul');
|
||||
$sn = new SecondaryNav($this);
|
||||
$sn->show();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
116
lib/primarynav.php
Normal file
116
lib/primarynav.php
Normal file
|
@ -0,0 +1,116 @@
|
|||
<?php
|
||||
/**
|
||||
* StatusNet - the distributed open-source microblogging tool
|
||||
* Copyright (C) 2011, StatusNet, Inc.
|
||||
*
|
||||
* Primary nav, show on all pages
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @category Menu
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @copyright 2011 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
||||
if (!defined('STATUSNET')) {
|
||||
// This check helps protect against security problems;
|
||||
// your code file can't be executed directly from the web.
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Primary, top-level menu
|
||||
*
|
||||
* @category General
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @copyright 2011 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
||||
class PrimaryNav extends Menu
|
||||
{
|
||||
function show()
|
||||
{
|
||||
$user = common_current_user();
|
||||
$this->action->elementStart('ul', array('class' => 'nav',
|
||||
'id' => 'site_nav_global_primary'));
|
||||
if (Event::handle('StartPrimaryNav', array($this->action))) {
|
||||
if (!empty($user)) {
|
||||
$this->action->menuItem(common_local_url('all',
|
||||
array('nickname' => $user->nickname)),
|
||||
_m('Home'),
|
||||
_m('Friends timeline'),
|
||||
false,
|
||||
'nav_home');
|
||||
$this->action->menuItem(common_local_url('showstream',
|
||||
array('nickname' => $user->nickname)),
|
||||
_m('Profile'),
|
||||
_m('Your profile'),
|
||||
false,
|
||||
'nav_profile');
|
||||
$this->action->menuItem(common_local_url('public'),
|
||||
_m('Public'),
|
||||
_m('Everyone on this site'),
|
||||
false,
|
||||
'nav_public');
|
||||
$this->action->menuItem(common_local_url('profilesettings'),
|
||||
_m('Settings'),
|
||||
_m('Change your personal settings'),
|
||||
false,
|
||||
'nav_account');
|
||||
if ($user->hasRight(Right::CONFIGURESITE)) {
|
||||
$this->action->menuItem(common_local_url('siteadminpanel'),
|
||||
_m('Admin'),
|
||||
_m('Site configuration'),
|
||||
false,
|
||||
'nav_admin');
|
||||
}
|
||||
$this->action->menuItem(common_local_url('logout'),
|
||||
_m('Logout'),
|
||||
_m('Logout from the site'),
|
||||
false,
|
||||
'nav_logout');
|
||||
} else {
|
||||
$this->action->menuItem(common_local_url('public'),
|
||||
_m('Public'),
|
||||
_m('Everyone on this site'),
|
||||
false,
|
||||
'nav_public');
|
||||
$this->action->menuItem(common_local_url('login'),
|
||||
_m('Login'),
|
||||
_m('Login to the site'),
|
||||
false,
|
||||
'nav_login');
|
||||
}
|
||||
|
||||
if (!empty($user) || !common_config('site', 'private')) {
|
||||
$this->action->menuItem(common_local_url('noticesearch'),
|
||||
_m('Search'),
|
||||
_m('Search the site'),
|
||||
false,
|
||||
'nav_search');
|
||||
}
|
||||
|
||||
Event::handle('EndPrimaryNav', array($this->action));
|
||||
}
|
||||
$this->action->elementEnd('ul');
|
||||
}
|
||||
}
|
90
lib/secondarynav.php
Normal file
90
lib/secondarynav.php
Normal file
|
@ -0,0 +1,90 @@
|
|||
<?php
|
||||
/**
|
||||
* StatusNet - the distributed open-source microblogging tool
|
||||
* Copyright (C) 2011, StatusNet, Inc.
|
||||
*
|
||||
* Secondary menu, shown at foot of all pages
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @category Cache
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @copyright 2011 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
||||
if (!defined('STATUSNET')) {
|
||||
// This check helps protect against security problems;
|
||||
// your code file can't be executed directly from the web.
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Secondary menu, shown at the bottom of all pages
|
||||
*
|
||||
* @category General
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @copyright 2011 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
||||
class SecondaryNav extends Menu
|
||||
{
|
||||
function show()
|
||||
{
|
||||
$this->out->elementStart('ul', array('class' => 'nav',
|
||||
'id' => 'site_nav_global_secondary'));
|
||||
if (Event::handle('StartSecondaryNav', array($this->action))) {
|
||||
$this->out->menuItem(common_local_url('doc', array('title' => 'help')),
|
||||
// TRANS: Secondary navigation menu option leading to help on StatusNet.
|
||||
_('Help'));
|
||||
$this->out->menuItem(common_local_url('doc', array('title' => 'about')),
|
||||
// TRANS: Secondary navigation menu option leading to text about StatusNet site.
|
||||
_('About'));
|
||||
$this->out->menuItem(common_local_url('doc', array('title' => 'faq')),
|
||||
// TRANS: Secondary navigation menu option leading to Frequently Asked Questions.
|
||||
_('FAQ'));
|
||||
$bb = common_config('site', 'broughtby');
|
||||
if (!empty($bb)) {
|
||||
$this->out->menuItem(common_local_url('doc', array('title' => 'tos')),
|
||||
// TRANS: Secondary navigation menu option leading to Terms of Service.
|
||||
_('TOS'));
|
||||
}
|
||||
$this->out->menuItem(common_local_url('doc', array('title' => 'privacy')),
|
||||
// TRANS: Secondary navigation menu option leading to privacy policy.
|
||||
_('Privacy'));
|
||||
$this->out->menuItem(common_local_url('doc', array('title' => 'source')),
|
||||
// TRANS: Secondary navigation menu option. Leads to information about StatusNet and its license.
|
||||
_('Source'));
|
||||
$this->out->menuItem(common_local_url('version'),
|
||||
// TRANS: Secondary navigation menu option leading to version information on the StatusNet site.
|
||||
_('Version'));
|
||||
$this->out->menuItem(common_local_url('doc', array('title' => 'contact')),
|
||||
// TRANS: Secondary navigation menu option leading to e-mail contact information on the
|
||||
// TRANS: StatusNet site, where to report bugs, ...
|
||||
_('Contact'));
|
||||
$this->out->menuItem(common_local_url('doc', array('title' => 'badge')),
|
||||
// TRANS: Secondary navigation menu option. Leads to information about embedding a timeline widget.
|
||||
_('Badge'));
|
||||
Event::handle('EndSecondaryNav', array($this->action));
|
||||
}
|
||||
$this->out->elementEnd('ul');
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user