Merge branch '3cl' into 1.0.x

This commit is contained in:
Evan Prodromou 2011-03-07 14:30:30 -05:00
commit 55b4303ea4
37 changed files with 682 additions and 430 deletions

View File

@ -127,12 +127,6 @@ class AllAction extends ProfileAction
);
}
function showLocalNav()
{
$nav = new PersonalGroupNav($this);
$nav->show();
}
function showEmptyListMessage()
{
// TRANS: Empty list message. %s is a user nickname.

View File

@ -122,7 +122,7 @@ class BlockedfromgroupAction extends GroupDesignAction
_('A list of the users blocked from joining this group.'));
}
function showLocalNav()
function showObjectNav()
{
$nav = new GroupNav($this, $this->group);
$nav->show();

View File

@ -139,7 +139,7 @@ class EditgroupAction extends GroupDesignAction
$this->showPage();
}
function showLocalNav()
function showObjectNav()
{
$nav = new GroupNav($this, $this->group);
$nav->show();

View File

@ -163,19 +163,6 @@ class FavoritedAction extends Action
$this->elementEnd('div');
}
/**
* Local navigation
*
* This page is part of the public group, so show that.
*
* @return void
*/
function showLocalNav()
{
$nav = new PublicGroupNav($this);
$nav->show();
}
/**
* Content area
*

View File

@ -90,12 +90,6 @@ class FeaturedAction extends Action
$this->elementEnd('div');
}
function showLocalNav()
{
$nav = new PublicGroupNav($this);
$nav->show();
}
function getInstructions()
{
// TRANS: Description on page displaying featured users.

View File

@ -163,12 +163,22 @@ class GroupDesignSettingsAction extends DesignSettingsAction
*
* @return nothing
*/
function showLocalNav()
function showObjectNav()
{
$nav = new GroupNav($this, $this->group);
$nav->show();
}
/**
* Override to show default nav stuff
*
* @return nothing
*/
function showLocalNav()
{
Action::showLocalNav();
}
/**
* Get the design we want to edit
*

View File

@ -458,7 +458,7 @@ class GrouplogoAction extends GroupDesignAction
$this->autofocus('avatarfile');
}
function showLocalNav()
function showObjectNav()
{
$nav = new GroupNav($this, $this->group);
$nav->show();

View File

@ -125,7 +125,7 @@ class GroupmembersAction extends GroupDesignAction
_('A list of the users in this group.'));
}
function showLocalNav()
function showObjectNav()
{
$nav = new GroupNav($this, $this->group);
$nav->show();

View File

@ -80,12 +80,6 @@ class GroupsAction extends Action
$this->showPage();
}
function showLocalNav()
{
$nav = new PublicGroupNav($this);
$nav->show();
}
function showPageNotice()
{
$notice =

View File

@ -289,7 +289,7 @@ class InviteAction extends CurrentUserDesignAction
mail_send($recipients, $headers, $body);
}
function showLocalNav()
function showObjectNav()
{
$nav = new SubGroupNav($this, common_current_user());
$nav->show();

View File

@ -168,21 +168,6 @@ class PublicAction extends Action
_('Public Stream Feed (Atom)')));
}
/**
* Show tabset for this page
*
* Uses the PublicGroupNav widget
*
* @return void
* @see PublicGroupNav
*/
function showLocalNav()
{
$nav = new PublicGroupNav($this);
$nav->show();
}
function showEmptyList()
{
$message = _('This is the public timeline for %%site.name%% but no one has posted anything yet.') . ' ';

View File

@ -92,12 +92,6 @@ class PublictagcloudAction extends Action
$this->elementEnd('div');
}
function showLocalNav()
{
$nav = new PublicGroupNav($this);
$nav->show();
}
function handle($args)
{
parent::handle($args);

View File

@ -160,18 +160,6 @@ class RepliesAction extends OwnerDesignAction
$this->user->nickname)));
}
/**
* show the personal group nav
*
* @return void
*/
function showLocalNav()
{
$nav = new PersonalGroupNav($this);
$nav->show();
}
/**
* Show the content
*

View File

@ -189,17 +189,6 @@ class ShowfavoritesAction extends OwnerDesignAction
$this->user->nickname)));
}
/**
* show the personal group nav
*
* @return void
*/
function showLocalNav()
{
$nav = new PersonalGroupNav($this);
$nav->show();
}
function showEmptyListMessage()
{
if (common_logged_in()) {

View File

@ -167,7 +167,7 @@ class ShowgroupAction extends GroupDesignAction
*
* @return void
*/
function showLocalNav()
function showObjectNav()
{
$nav = new GroupNav($this, $this->group);
$nav->show();

View File

@ -104,7 +104,7 @@ class ShowstreamAction extends ProfileAction
$this->showNotices();
}
function showLocalNav()
function showObjectNav()
{
$nav = new SubGroupNav($this, $this->user);
$nav->show();

View File

@ -112,7 +112,7 @@ class UsergroupsAction extends OwnerDesignAction
$this->showPage();
}
function showLocalNav()
function showObjectNav()
{
$nav = new SubGroupNav($this, $this->user);
$nav->show();

View File

@ -476,14 +476,7 @@ class Action extends HTMLOutputter // lawsuit
Event::handle('EndShowSiteNotice', array($this));
}
if (common_logged_in()) {
if (Event::handle('StartShowNoticeForm', array($this))) {
$this->showNoticeForm();
Event::handle('EndShowNoticeForm', array($this));
}
} else {
$this->showAnonymousMessage();
}
$this->elementEnd('div');
}
@ -555,69 +548,10 @@ 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');
$this->elementStart('div', array('id' => 'site_nav_global_primary'));
$pn = new PrimaryNav($this);
$pn->show();
$this->elementEnd('div');
}
/**
@ -733,6 +667,10 @@ class Action extends HTMLOutputter // lawsuit
$this->showContentBlock();
Event::handle('EndShowContentBlock', array($this));
}
if (Event::handle('StartShowObjectNavBlock', array($this))) {
$this->showObjectNavBlock();
Event::handle('EndShowObjectNavBlock', array($this));
}
if (Event::handle('StartShowAside', array($this))) {
$this->showAside();
Event::handle('EndShowAside', array($this));
@ -763,7 +701,34 @@ class Action extends HTMLOutputter // lawsuit
*/
function showLocalNav()
{
// does nothing by default
$nav = new DefaultLocalNav($this);
$nav->show();
}
/**
* Show menu for an object (group, profile)
*
* @return nothing
*/
function showObjectNavBlock()
{
// Need to have this ID for CSS; I'm too lazy to add it to
// all menus
$this->elementStart('div', array('id' => 'site_nav_object'));
$this->showObjectNav();
$this->elementEnd('div');
}
/**
* Show object navigation.
*
* If there are things to do with this object, show it here.
*
* @return nothing
*/
function showObjectNav()
{
/* Nothing here. */
}
/**
@ -774,6 +739,12 @@ class Action extends HTMLOutputter // lawsuit
function showContentBlock()
{
$this->elementStart('div', array('id' => 'content'));
if (common_logged_in()) {
if (Event::handle('StartShowNoticeForm', array($this))) {
$this->showNoticeForm();
Event::handle('EndShowNoticeForm', array($this));
}
}
if (Event::handle('StartShowPageTitle', array($this))) {
$this->showPageTitle();
Event::handle('EndShowPageTitle', array($this));
@ -915,43 +886,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();
}
/**

View File

@ -291,129 +291,3 @@ class AdminPanelAction extends Action
return $isOK;
}
}
/**
* Menu for public group of actions
*
* @category Output
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @author Sarven Capadisli <csarven@status.net>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*
* @see Widget
*/
class AdminPanelNav extends Widget
{
var $action = null;
/**
* Construction
*
* @param Action $action current action, used for output
*/
function __construct($action=null)
{
parent::__construct($action);
$this->action = $action;
}
/**
* Show the menu
*
* @return void
*/
function show()
{
$action_name = $this->action->trimmed('action');
$this->action->elementStart('ul', array('class' => 'nav'));
if (Event::handle('StartAdminPanelNav', array($this))) {
if (AdminPanelAction::canAdmin('site')) {
// TRANS: Menu item title/tooltip
$menu_title = _('Basic site configuration');
// TRANS: Menu item for site administration
$this->out->menuItem(common_local_url('siteadminpanel'), _m('MENU', 'Site'),
$menu_title, $action_name == 'siteadminpanel', 'nav_site_admin_panel');
}
if (AdminPanelAction::canAdmin('design')) {
// TRANS: Menu item title/tooltip
$menu_title = _('Design configuration');
// TRANS: Menu item for site administration
$this->out->menuItem(common_local_url('designadminpanel'), _m('MENU', 'Design'),
$menu_title, $action_name == 'designadminpanel', 'nav_design_admin_panel');
}
if (AdminPanelAction::canAdmin('user')) {
// TRANS: Menu item title/tooltip
$menu_title = _('User configuration');
// TRANS: Menu item for site administration
$this->out->menuItem(common_local_url('useradminpanel'), _('User'),
$menu_title, $action_name == 'useradminpanel', 'nav_user_admin_panel');
}
if (AdminPanelAction::canAdmin('access')) {
// TRANS: Menu item title/tooltip
$menu_title = _('Access configuration');
// TRANS: Menu item for site administration
$this->out->menuItem(common_local_url('accessadminpanel'), _('Access'),
$menu_title, $action_name == 'accessadminpanel', 'nav_access_admin_panel');
}
if (AdminPanelAction::canAdmin('paths')) {
// TRANS: Menu item title/tooltip
$menu_title = _('Paths configuration');
// TRANS: Menu item for site administration
$this->out->menuItem(common_local_url('pathsadminpanel'), _('Paths'),
$menu_title, $action_name == 'pathsadminpanel', 'nav_paths_admin_panel');
}
if (AdminPanelAction::canAdmin('sessions')) {
// TRANS: Menu item title/tooltip
$menu_title = _('Sessions configuration');
// TRANS: Menu item for site administration
$this->out->menuItem(common_local_url('sessionsadminpanel'), _('Sessions'),
$menu_title, $action_name == 'sessionsadminpanel', 'nav_sessions_admin_panel');
}
if (AdminPanelAction::canAdmin('sitenotice')) {
// TRANS: Menu item title/tooltip
$menu_title = _('Edit site notice');
// TRANS: Menu item for site administration
$this->out->menuItem(common_local_url('sitenoticeadminpanel'), _('Site notice'),
$menu_title, $action_name == 'sitenoticeadminpanel', 'nav_sitenotice_admin_panel');
}
if (AdminPanelAction::canAdmin('snapshot')) {
// TRANS: Menu item title/tooltip
$menu_title = _('Snapshots configuration');
// TRANS: Menu item for site administration
$this->out->menuItem(common_local_url('snapshotadminpanel'), _('Snapshots'),
$menu_title, $action_name == 'snapshotadminpanel', 'nav_snapshot_admin_panel');
}
if (AdminPanelAction::canAdmin('license')) {
// TRANS: Menu item title/tooltip
$menu_title = _('Set site license');
// TRANS: Menu item for site administration
$this->out->menuItem(common_local_url('licenseadminpanel'), _('License'),
$menu_title, $action_name == 'licenseadminpanel', 'nav_license_admin_panel');
}
if (AdminPanelAction::canAdmin('plugins')) {
// TRANS: Menu item title/tooltip
$menu_title = _('Plugins configuration');
// TRANS: Menu item for site administration
$this->out->menuItem(common_local_url('pluginsadminpanel'), _('Plugins'),
$menu_title, $action_name == 'pluginsadminpanel', 'nav_design_admin_panel');
}
Event::handle('EndAdminPanelNav', array($this));
}
$this->action->elementEnd('ul');
}
}

148
lib/adminpanelnav.php Normal file
View File

@ -0,0 +1,148 @@
<?php
/**
* StatusNet - the distributed open-source microblogging tool
* Copyright (C) 2011, StatusNet, Inc.
*
* Menu for admin panels
*
* 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);
}
/**
* Menu for admin panels
*
* @category Output
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @author Sarven Capadisli <csarven@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 AdminPanelNav extends Menu
{
/**
* Show the menu
*
* @return void
*/
function show()
{
$action_name = $this->action->trimmed('action');
$this->action->elementStart('ul', array('class' => 'nav'));
if (Event::handle('StartAdminPanelNav', array($this))) {
if (AdminPanelAction::canAdmin('site')) {
// TRANS: Menu item title/tooltip
$menu_title = _('Basic site configuration');
// TRANS: Menu item for site administration
$this->out->menuItem(common_local_url('siteadminpanel'), _m('MENU', 'Site'),
$menu_title, $action_name == 'siteadminpanel', 'nav_site_admin_panel');
}
if (AdminPanelAction::canAdmin('design')) {
// TRANS: Menu item title/tooltip
$menu_title = _('Design configuration');
// TRANS: Menu item for site administration
$this->out->menuItem(common_local_url('designadminpanel'), _m('MENU', 'Design'),
$menu_title, $action_name == 'designadminpanel', 'nav_design_admin_panel');
}
if (AdminPanelAction::canAdmin('user')) {
// TRANS: Menu item title/tooltip
$menu_title = _('User configuration');
// TRANS: Menu item for site administration
$this->out->menuItem(common_local_url('useradminpanel'), _('User'),
$menu_title, $action_name == 'useradminpanel', 'nav_user_admin_panel');
}
if (AdminPanelAction::canAdmin('access')) {
// TRANS: Menu item title/tooltip
$menu_title = _('Access configuration');
// TRANS: Menu item for site administration
$this->out->menuItem(common_local_url('accessadminpanel'), _('Access'),
$menu_title, $action_name == 'accessadminpanel', 'nav_access_admin_panel');
}
if (AdminPanelAction::canAdmin('paths')) {
// TRANS: Menu item title/tooltip
$menu_title = _('Paths configuration');
// TRANS: Menu item for site administration
$this->out->menuItem(common_local_url('pathsadminpanel'), _('Paths'),
$menu_title, $action_name == 'pathsadminpanel', 'nav_paths_admin_panel');
}
if (AdminPanelAction::canAdmin('sessions')) {
// TRANS: Menu item title/tooltip
$menu_title = _('Sessions configuration');
// TRANS: Menu item for site administration
$this->out->menuItem(common_local_url('sessionsadminpanel'), _('Sessions'),
$menu_title, $action_name == 'sessionsadminpanel', 'nav_sessions_admin_panel');
}
if (AdminPanelAction::canAdmin('sitenotice')) {
// TRANS: Menu item title/tooltip
$menu_title = _('Edit site notice');
// TRANS: Menu item for site administration
$this->out->menuItem(common_local_url('sitenoticeadminpanel'), _('Site notice'),
$menu_title, $action_name == 'sitenoticeadminpanel', 'nav_sitenotice_admin_panel');
}
if (AdminPanelAction::canAdmin('snapshot')) {
// TRANS: Menu item title/tooltip
$menu_title = _('Snapshots configuration');
// TRANS: Menu item for site administration
$this->out->menuItem(common_local_url('snapshotadminpanel'), _('Snapshots'),
$menu_title, $action_name == 'snapshotadminpanel', 'nav_snapshot_admin_panel');
}
if (AdminPanelAction::canAdmin('license')) {
// TRANS: Menu item title/tooltip
$menu_title = _('Set site license');
// TRANS: Menu item for site administration
$this->out->menuItem(common_local_url('licenseadminpanel'), _('License'),
$menu_title, $action_name == 'licenseadminpanel', 'nav_license_admin_panel');
}
if (AdminPanelAction::canAdmin('plugins')) {
// TRANS: Menu item title/tooltip
$menu_title = _('Plugins configuration');
// TRANS: Menu item for site administration
$this->out->menuItem(common_local_url('pluginsadminpanel'), _('Plugins'),
$menu_title, $action_name == 'pluginsadminpanel', 'nav_design_admin_panel');
}
Event::handle('EndAdminPanelNav', array($this));
}
$this->action->elementEnd('ul');
}
}

66
lib/defaultlocalnav.php Normal file
View File

@ -0,0 +1,66 @@
<?php
/**
* StatusNet - the distributed open-source microblogging tool
* Copyright (C) 2011, StatusNet, Inc.
*
* Default local nav
*
* 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);
}
/**
* Default menu
*
* @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/
*/
class DefaultLocalNav extends Menu
{
function show()
{
$this->action->elementStart('ul', array('id' => 'nav_local_default'));
$user = common_current_user();
if (!empty($user)) {
$pn = new PersonalGroupNav($this->action);
$this->submenu(_m('Home'), $pn);
}
$bn = new PublicGroupNav($this->action);
$this->submenu(_('Public'), $bn);
$this->action->elementEnd('ul');
}
}

View File

@ -94,7 +94,7 @@ class GalleryAction extends OwnerDesignAction
$this->showPage();
}
function showLocalNav()
function showObjectNav()
{
$nav = new SubGroupNav($this, $this->user);
$nav->show();

View File

@ -49,9 +49,8 @@ require_once INSTALLDIR.'/lib/widget.php';
* @see HTMLOutputter
*/
class GroupNav extends Widget
class GroupNav extends Menu
{
var $action = null;
var $group = null;
/**
@ -63,7 +62,6 @@ class GroupNav extends Widget
function __construct($action=null, $group=null)
{
parent::__construct($action);
$this->action = $action;
$this->group = $group;
}

View File

@ -44,21 +44,8 @@ require_once INSTALLDIR.'/lib/widget.php';
*
* @see Widget
*/
class LoginGroupNav extends Widget
class LoginGroupNav extends Menu
{
var $action = null;
/**
* Construction
*
* @param Action $action current action, used for output
*/
function __construct($action=null)
{
parent::__construct($action);
$this->action = $action;
}
/**
* Show the menu
*

View File

@ -168,4 +168,10 @@ class MailboxAction extends CurrentUserDesignAction
{
return true;
}
function showObjectNav()
{
$mm = new MailboxMenu($this);
$mm->show();
}
}

70
lib/mailboxmenu.php Normal file
View File

@ -0,0 +1,70 @@
<?php
/**
* StatusNet - the distributed open-source microblogging tool
* Copyright (C) 2011, StatusNet, Inc.
*
* Private mailboxes menu
*
* 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);
}
/**
* Menu of existing mailboxes
*
* @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 MailboxMenu extends Menu
{
function show()
{
$cur = common_current_user();
$nickname = $cur->nickname;
$this->out->elementStart('ul', array('class' => 'nav'));
$this->item('inbox',
array('nickname' => $nickname),
_('Inbox'),
_('Your incoming messages'));
$this->item('outbox',
array('nickname' => $nickname),
_('Outbox'),
_('Your sent messages'));
$this->out->elementEnd('ul');
}
}

92
lib/menu.php Normal file
View File

@ -0,0 +1,92 @@
<?php
/**
* StatusNet - the distributed open-source microblogging tool
* Copyright (C) 2011, StatusNet, Inc.
*
* Menu widget
*
* 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 Widget
* @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);
}
/**
* Superclass for menus
*
* @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 Menu extends Widget
{
var $action = null;
var $actionName = null;
/**
* Construction
*
* @param Action $action current action, used for output
*/
function __construct($action=null)
{
parent::__construct($action);
$this->action = $action;
$this->actionName = $action->trimmed('action');
}
function item($actionName, $args, $label, $description, $id=null)
{
if (empty($id)) {
$id = $this->menuItemID($actionName);
}
$url = common_local_url($actionName, $args);
$this->out->menuItem($url,
$label,
$description,
$actionName == $this->actionName,
$id);
}
function menuItemID($actionName)
{
return sprintf('nav_%s', $actionName);
}
function submenu($label, $menu)
{
$this->action->elementStart('li');
$this->action->element('h3', null, $label);
$menu->show();
$this->action->elementEnd('li');
}
}

View File

@ -2,7 +2,7 @@
/**
* StatusNet, the distributed open-source microblogging tool
*
* Base class for all actions (~views)
* Menu for personal group of actions
*
* PHP version 5
*
@ -19,11 +19,11 @@
* 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 Action
* @category Menu
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @author Sarven Capadisli <csarven@status.net>
* @copyright 2008 StatusNet, Inc.
* @copyright 2008-2011 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
@ -32,41 +32,20 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1);
}
require_once INSTALLDIR.'/lib/widget.php';
/**
* Base class for all actions
* Menu for personal group of actions
*
* This is the base class for all actions in the package. An action is
* more or less a "view" in an MVC framework.
*
* Actions are responsible for extracting and validating parameters; using
* model classes to read and write to the database; and doing ouput.
*
* @category Output
* @category Menu
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @author Sarven Capadisli <csarven@status.net>
* @copyright 2008-2011 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*
* @see HTMLOutputter
*/
class PersonalGroupNav extends Widget
{
var $action = null;
/**
* Construction
*
* @param Action $action current action, used for output
*/
function __construct($action=null)
class PersonalGroupNav extends Menu
{
parent::__construct($action);
$this->action = $action;
}
/**
* Show the menu
*
@ -74,23 +53,16 @@ class PersonalGroupNav extends Widget
*/
function show()
{
$user = null;
$user = common_current_user();
// FIXME: we should probably pass this in
$action = $this->action->trimmed('action');
$nickname = $this->action->trimmed('nickname');
if ($nickname) {
$user = User::staticGet('nickname', $nickname);
$user_profile = $user->getProfile();
$name = $user_profile->getBestName();
} else {
// @fixme can this happen? is this valid?
$user_profile = false;
$name = $nickname;
if (empty($user)) {
throw new ServerException('Do not show personal group nav with no current user.');
}
$user_profile = $user->getProfile();
$nickname = $user->nickname;
$name = $user_profile->getBestName();
$this->out->elementStart('ul', array('class' => 'nav'));
if (Event::handle('StartPersonalGroupNav', array($this))) {
@ -99,6 +71,12 @@ class PersonalGroupNav extends Widget
_('Home'),
sprintf(_('%s and friends'), $name),
$action == 'all', 'nav_timeline_personal');
$this->out->menuItem(common_local_url('showstream', array('nickname' =>
$nickname)),
_('Profile'),
_('Your profile'),
$action == 'showstream',
'nav_profile');
$this->out->menuItem(common_local_url('replies', array('nickname' =>
$nickname)),
_('Replies'),
@ -117,15 +95,11 @@ class PersonalGroupNav extends Widget
$this->out->menuItem(common_local_url('inbox', array('nickname' =>
$nickname)),
_('Inbox'),
_('Messages'),
_('Your incoming messages'),
$action == 'inbox');
$this->out->menuItem(common_local_url('outbox', array('nickname' =>
$nickname)),
_('Outbox'),
_('Your sent messages'),
$action == 'outbox');
}
Event::handle('EndPersonalGroupNav', array($this));
}
$this->out->elementEnd('ul');

94
lib/primarynav.php Normal file
View File

@ -0,0 +1,94 @@
<?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'));
if (Event::handle('StartPrimaryNav', array($this->action))) {
if (!empty($user)) {
$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('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');
}
}

View File

@ -46,22 +46,8 @@ require_once INSTALLDIR.'/lib/widget.php';
* @see Widget
*/
class PublicGroupNav extends Widget
class PublicGroupNav extends Menu
{
var $action = null;
/**
* Construction
*
* @param Action $action current action, used for output
*/
function __construct($action=null)
{
parent::__construct($action);
$this->action = $action;
}
/**
* Show the menu
*

View File

@ -70,7 +70,7 @@ class SearchAction extends Action
* @return void
* @see SearchGroupNav
*/
function showLocalNav()
function showObjectNav()
{
$nav = new SearchGroupNav($this, $this->trimmed('q'));
$nav->show();

View File

@ -2,7 +2,7 @@
/**
* StatusNet, the distributed open-source microblogging tool
*
* Menu for search actions
* Menu for search group of actions
*
* PHP version 5
*
@ -22,7 +22,7 @@
* @category Menu
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @copyright 2008 StatusNet, Inc.
* @copyright 2008-2011 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
@ -31,12 +31,10 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1);
}
require_once INSTALLDIR.'/lib/widget.php';
/**
* Menu for public group of actions
*
* @category Output
* @category Menu
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
@ -45,9 +43,8 @@ require_once INSTALLDIR.'/lib/widget.php';
* @see Widget
*/
class SearchGroupNav extends Widget
class SearchGroupNav extends Menu
{
var $action = null;
var $q = null;
/**
@ -59,7 +56,6 @@ class SearchGroupNav extends Widget
function __construct($action=null, $q = null)
{
parent::__construct($action);
$this->action = $action;
$this->q = $q;
}

90
lib/secondarynav.php Normal file
View 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');
}
}

View File

@ -163,4 +163,15 @@ class SettingsAction extends CurrentUserDesignAction
$menu = new SettingsNav($this);
$menu->show();
}
/**
* Show notice form.
*
* @return nothing
*/
function showNoticeForm()
{
return;
}
}

View File

@ -1,7 +1,7 @@
<?php
/**
* StatusNet - the distributed open-source microblogging tool
* Copyright (C) 2010, StatusNet, Inc.
* Copyright (C) 2010,2011, StatusNet, Inc.
*
* Settings menu
*
@ -23,7 +23,7 @@
* @category Widget
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @copyright 2010 StatusNet, Inc.
* @copyright 2010,2011 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
* @link http://status.net/
*/
@ -46,21 +46,8 @@ if (!defined('STATUSNET')) {
* @see HTMLOutputter
*/
class SettingsNav extends Widget
class SettingsNav extends Menu
{
var $action = null;
/**
* Construction
*
* @param Action $action current action, used for output
*/
function __construct($action=null)
{
parent::__construct($action);
$this->action = $action;
}
/**
* Show the menu
*

View File

@ -22,7 +22,7 @@
* @category Subs
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @copyright 2008-2009 StatusNet, Inc.
* @copyright 2008-2011 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
@ -43,9 +43,8 @@ require_once INSTALLDIR.'/lib/widget.php';
* @link http://status.net/
*/
class SubGroupNav extends Widget
class SubGroupNav extends Menu
{
var $action = null;
var $user = null;
/**
@ -57,7 +56,6 @@ class SubGroupNav extends Widget
function __construct($action=null, $user=null)
{
parent::__construct($action);
$this->action = $action;
$this->user = $user;
}

View File

@ -95,6 +95,8 @@ class UserProfile extends Widget
function showAvatar()
{
$this->out->elementStart('div', 'ur_face');
if (Event::handle('StartProfilePageAvatar', array($this->out, $this->profile))) {
$avatar = $this->profile->getAvatar(AVATAR_PROFILE_SIZE);
@ -119,6 +121,8 @@ class UserProfile extends Widget
Event::handle('EndProfilePageAvatar',
array($this->out, $this->profile));
}
$this->out->elementEnd('div');
}
function showNickname()