Make new menu the default menu
There's a new menu layout in this version of the software. It was implemented as a plugin in 0.9.x to avoid clashes with existing themes, but we're going to break that compatibility in this version, so we're just going for it. This change involved moving all the changes in NewMenuPlugin into the default code that was calling it. In addition, since accountsettingsaction and connectsettingsaction differed only by menu, I removed them, changed all references to them to the settingsmenu, and moved the combined nav to its own class. Let's put that episode behind us. The CSS shim that was loaded by NewMenuPlugin for certain themes and certain actions was removed.
This commit is contained in:
parent
7699bb3dba
commit
592e2be5e1
|
@ -32,7 +32,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once INSTALLDIR.'/lib/accountsettingsaction.php';
|
|
||||||
|
|
||||||
define('MAX_ORIGINAL', 480);
|
define('MAX_ORIGINAL', 480);
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ define('MAX_ORIGINAL', 480);
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
class AvatarsettingsAction extends AccountSettingsAction
|
class AvatarsettingsAction extends SettingsAction
|
||||||
{
|
{
|
||||||
var $mode = null;
|
var $mode = null;
|
||||||
var $imagefile = null;
|
var $imagefile = null;
|
||||||
|
|
|
@ -32,7 +32,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once INSTALLDIR.'/lib/accountsettingsaction.php';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Settings for email
|
* Settings for email
|
||||||
|
@ -47,7 +47,7 @@ require_once INSTALLDIR.'/lib/accountsettingsaction.php';
|
||||||
* @see Widget
|
* @see Widget
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class EmailsettingsAction extends AccountSettingsAction
|
class EmailsettingsAction extends SettingsAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Title of the page
|
* Title of the page
|
||||||
|
|
|
@ -32,7 +32,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once INSTALLDIR.'/lib/accountsettingsaction.php';
|
|
||||||
|
|
||||||
define('MAX_ORIGINAL', 480);
|
define('MAX_ORIGINAL', 480);
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
||||||
* @see SettingsAction
|
* @see SettingsAction
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ImsettingsAction extends ConnectSettingsAction
|
class ImsettingsAction extends SettingsAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Title of the page
|
* Title of the page
|
||||||
|
|
|
@ -31,9 +31,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once INSTALLDIR . '/lib/settingsaction.php';
|
|
||||||
require_once INSTALLDIR . '/lib/applicationlist.php';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show a user's registered OAuth applications
|
* Show a user's registered OAuth applications
|
||||||
*
|
*
|
||||||
|
|
|
@ -31,8 +31,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once INSTALLDIR . '/lib/connectsettingsaction.php';
|
|
||||||
require_once INSTALLDIR . '/lib/applicationlist.php';
|
|
||||||
require_once INSTALLDIR . '/lib/apioauthstore.php';
|
require_once INSTALLDIR . '/lib/apioauthstore.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -46,7 +44,7 @@ require_once INSTALLDIR . '/lib/apioauthstore.php';
|
||||||
*
|
*
|
||||||
* @see SettingsAction
|
* @see SettingsAction
|
||||||
*/
|
*/
|
||||||
class OauthconnectionssettingsAction extends ConnectSettingsAction
|
class OauthconnectionssettingsAction extends SettingsAction
|
||||||
{
|
{
|
||||||
var $page = null;
|
var $page = null;
|
||||||
var $oauth_token = null;
|
var $oauth_token = null;
|
||||||
|
|
|
@ -32,7 +32,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once INSTALLDIR.'/lib/accountsettingsaction.php';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change password
|
* Change password
|
||||||
|
@ -45,7 +45,7 @@ require_once INSTALLDIR.'/lib/accountsettingsaction.php';
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class PasswordsettingsAction extends AccountSettingsAction
|
class PasswordsettingsAction extends SettingsAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Title of the page
|
* Title of the page
|
||||||
|
|
|
@ -33,7 +33,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once INSTALLDIR.'/lib/accountsettingsaction.php';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change profile settings
|
* Change profile settings
|
||||||
|
@ -47,7 +47,7 @@ require_once INSTALLDIR.'/lib/accountsettingsaction.php';
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ProfilesettingsAction extends AccountSettingsAction
|
class ProfilesettingsAction extends SettingsAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Title of the page
|
* Title of the page
|
||||||
|
|
|
@ -106,7 +106,7 @@ class ShowstreamAction extends ProfileAction
|
||||||
|
|
||||||
function showLocalNav()
|
function showLocalNav()
|
||||||
{
|
{
|
||||||
$nav = new PersonalGroupNav($this);
|
$nav = new SubGroupNav($this, $this->user);
|
||||||
$nav->show();
|
$nav->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,8 +31,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once INSTALLDIR.'/lib/connectsettingsaction.php';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Settings for SMS
|
* Settings for SMS
|
||||||
*
|
*
|
||||||
|
@ -45,7 +43,7 @@ require_once INSTALLDIR.'/lib/connectsettingsaction.php';
|
||||||
* @see SettingsAction
|
* @see SettingsAction
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class SmssettingsAction extends ConnectSettingsAction
|
class SmssettingsAction extends SettingsAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Title of the page
|
* Title of the page
|
||||||
|
|
|
@ -32,7 +32,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once INSTALLDIR.'/lib/accountsettingsaction.php';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Miscellaneous settings actions
|
* Miscellaneous settings actions
|
||||||
|
@ -47,7 +47,7 @@ require_once INSTALLDIR.'/lib/accountsettingsaction.php';
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class UrlsettingsAction extends AccountSettingsAction
|
class UrlsettingsAction extends SettingsAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Title of the page
|
* Title of the page
|
||||||
|
|
|
@ -1,159 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* StatusNet, the distributed open-source microblogging tool
|
|
||||||
*
|
|
||||||
* Base class for account settings actions
|
|
||||||
*
|
|
||||||
* PHP version 5
|
|
||||||
*
|
|
||||||
* LICENCE: 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 Settings
|
|
||||||
* @package StatusNet
|
|
||||||
* @author Evan Prodromou <evan@status.net>
|
|
||||||
* @copyright 2008-2009 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/
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (!defined('STATUSNET') && !defined('LACONICA')) {
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
require_once INSTALLDIR.'/lib/settingsaction.php';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Base class for account settings actions
|
|
||||||
*
|
|
||||||
* @category Settings
|
|
||||||
* @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
|
|
||||||
* @link http://status.net/
|
|
||||||
*
|
|
||||||
* @see Widget
|
|
||||||
*/
|
|
||||||
class AccountSettingsAction extends SettingsAction
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Show the local navigation menu
|
|
||||||
*
|
|
||||||
* This is the same for all settings, so we show it here.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
function showLocalNav()
|
|
||||||
{
|
|
||||||
$menu = new AccountSettingsNav($this);
|
|
||||||
$menu->show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A widget for showing the settings group local nav menu
|
|
||||||
*
|
|
||||||
* @category Widget
|
|
||||||
* @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
|
|
||||||
* @link http://status.net/
|
|
||||||
*
|
|
||||||
* @see HTMLOutputter
|
|
||||||
*/
|
|
||||||
class AccountSettingsNav 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('StartAccountSettingsNav', array(&$this->action))) {
|
|
||||||
$user = common_current_user();
|
|
||||||
|
|
||||||
if(Event::handle('StartAccountSettingsProfileMenuItem', array($this, &$menu))){
|
|
||||||
// TRANS: Link title attribute in user account settings menu.
|
|
||||||
$title = _('Change your profile settings');
|
|
||||||
// TRANS: Link description in user account settings menu.
|
|
||||||
$this->showMenuItem('profilesettings',_('Profile'),$title);
|
|
||||||
Event::handle('EndAccountSettingsProfileMenuItem', array($this, &$menu));
|
|
||||||
}
|
|
||||||
if(Event::handle('StartAccountSettingsAvatarMenuItem', array($this, &$menu))){
|
|
||||||
// TRANS: Link title attribute in user account settings menu.
|
|
||||||
$title = _('Upload an avatar');
|
|
||||||
// TRANS: Link description in user account settings menu.
|
|
||||||
$this->showMenuItem('avatarsettings',_('Avatar'),$title);
|
|
||||||
Event::handle('EndAccountSettingsAvatarMenuItem', array($this, &$menu));
|
|
||||||
}
|
|
||||||
if(Event::handle('StartAccountSettingsPasswordMenuItem', array($this, &$menu))){
|
|
||||||
// TRANS: Link title attribute in user account settings menu.
|
|
||||||
$title = _('Change your password');
|
|
||||||
// TRANS: Link description in user account settings menu.
|
|
||||||
$this->showMenuItem('passwordsettings',_('Password'),$title);
|
|
||||||
Event::handle('EndAccountSettingsPasswordMenuItem', array($this, &$menu));
|
|
||||||
}
|
|
||||||
if(Event::handle('StartAccountSettingsEmailMenuItem', array($this, &$menu))){
|
|
||||||
// TRANS: Link title attribute in user account settings menu.
|
|
||||||
$title = _('Change email handling');
|
|
||||||
// TRANS: Link description in user account settings menu.
|
|
||||||
$this->showMenuItem('emailsettings',_('Email'),$title);
|
|
||||||
Event::handle('EndAccountSettingsEmailMenuItem', array($this, &$menu));
|
|
||||||
}
|
|
||||||
if(Event::handle('StartAccountSettingsDesignMenuItem', array($this, &$menu))){
|
|
||||||
// TRANS: Link title attribute in user account settings menu.
|
|
||||||
$title = _('Design your profile');
|
|
||||||
// TRANS: Link description in user account settings menu.
|
|
||||||
$this->showMenuItem('userdesignsettings',_('Design'),$title);
|
|
||||||
Event::handle('EndAccountSettingsDesignMenuItem', array($this, &$menu));
|
|
||||||
}
|
|
||||||
if(Event::handle('StartAccountSettingsUrlMenuItem', array($this, &$menu))){
|
|
||||||
// TRANS: Link title attribute in user account settings menu.
|
|
||||||
$title = _('URL shortener settings');
|
|
||||||
// TRANS: Link description in user account settings menu.
|
|
||||||
$this->showMenuItem('urlsettings',_('URL'),$title);
|
|
||||||
Event::handle('EndAccountSettingsUrlMenuItem', array($this, &$menu));
|
|
||||||
}
|
|
||||||
|
|
||||||
Event::handle('EndAccountSettingsNav', array(&$this->action));
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->action->elementEnd('ul');
|
|
||||||
}
|
|
||||||
|
|
||||||
function showMenuItem($menuaction, $desc1, $desc2)
|
|
||||||
{
|
|
||||||
$action_name = $this->action->trimmed('action');
|
|
||||||
$this->action->menuItem(common_local_url($menuaction),
|
|
||||||
$desc1,
|
|
||||||
$desc2,
|
|
||||||
$action_name === $menuaction);
|
|
||||||
}
|
|
||||||
}
|
|
112
lib/action.php
112
lib/action.php
|
@ -476,9 +476,13 @@ class Action extends HTMLOutputter // lawsuit
|
||||||
$user = User::singleUser();
|
$user = User::singleUser();
|
||||||
$url = common_local_url('showstream',
|
$url = common_local_url('showstream',
|
||||||
array('nickname' => $user->nickname));
|
array('nickname' => $user->nickname));
|
||||||
|
} else if (common_logged_in()) {
|
||||||
|
$cur = common_current_user();
|
||||||
|
$url = common_local_url('all', array('nickname' => $cur->nickname));
|
||||||
} else {
|
} else {
|
||||||
$url = common_local_url('public');
|
$url = common_local_url('public');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->elementStart('a', array('class' => 'url home bookmark',
|
$this->elementStart('a', array('class' => 'url home bookmark',
|
||||||
'href' => $url));
|
'href' => $url));
|
||||||
|
|
||||||
|
@ -513,7 +517,8 @@ class Action extends HTMLOutputter // lawsuit
|
||||||
$this->text(' ');
|
$this->text(' ');
|
||||||
$this->element('span', array('class' => 'fn org'), common_config('site', 'name'));
|
$this->element('span', array('class' => 'fn org'), common_config('site', 'name'));
|
||||||
$this->elementEnd('a');
|
$this->elementEnd('a');
|
||||||
Event::handle('EndAddressData', array($this));
|
|
||||||
|
Event::handle('EndAddressData', array($action));
|
||||||
}
|
}
|
||||||
$this->elementEnd('address');
|
$this->elementEnd('address');
|
||||||
}
|
}
|
||||||
|
@ -529,71 +534,62 @@ class Action extends HTMLOutputter // lawsuit
|
||||||
$this->elementStart('ul', array('class' => 'nav',
|
$this->elementStart('ul', array('class' => 'nav',
|
||||||
'id' => 'site_nav_global_primary'));
|
'id' => 'site_nav_global_primary'));
|
||||||
if (Event::handle('StartPrimaryNav', array($this))) {
|
if (Event::handle('StartPrimaryNav', array($this))) {
|
||||||
if ($user) {
|
if (!empty($user)) {
|
||||||
// TRANS: Tooltip for main menu option "Personal"
|
$this->menuItem(common_local_url('all',
|
||||||
$tooltip = _m('TOOLTIP', 'Personal profile and friends timeline');
|
array('nickname' => $user->nickname)),
|
||||||
$this->menuItem(common_local_url('all', array('nickname' => $user->nickname)),
|
_m('Home'),
|
||||||
// TRANS: Main menu option when logged in for access to personal profile and friends timeline
|
_m('Friends timeline'),
|
||||||
_m('MENU', 'Personal'), $tooltip, false, 'nav_home');
|
false,
|
||||||
// TRANS: Tooltip for main menu option "Account"
|
'nav_home');
|
||||||
$tooltip = _m('TOOLTIP', 'Change your email, avatar, password, profile');
|
$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'),
|
$this->menuItem(common_local_url('profilesettings'),
|
||||||
// TRANS: Main menu option when logged in for access to user settings
|
_m('Settings'),
|
||||||
_('Account'), $tooltip, false, 'nav_account');
|
_m('Change your personal settings'),
|
||||||
// TRANS: Tooltip for main menu option "Services"
|
false,
|
||||||
$tooltip = _m('TOOLTIP', 'Connect to services');
|
'nav_account');
|
||||||
$this->menuItem(common_local_url('oauthconnectionssettings'),
|
|
||||||
// TRANS: Main menu option when logged in and connection are possible for access to options to connect to other services
|
|
||||||
_('Connect'), $tooltip, false, 'nav_connect');
|
|
||||||
if ($user->hasRight(Right::CONFIGURESITE)) {
|
if ($user->hasRight(Right::CONFIGURESITE)) {
|
||||||
// TRANS: Tooltip for menu option "Admin"
|
|
||||||
$tooltip = _m('TOOLTIP', 'Change site configuration');
|
|
||||||
$this->menuItem(common_local_url('siteadminpanel'),
|
$this->menuItem(common_local_url('siteadminpanel'),
|
||||||
// TRANS: Main menu option when logged in and site admin for access to site configuration
|
_m('Admin'),
|
||||||
_m('MENU', 'Admin'), $tooltip, false, 'nav_admin');
|
_m('Site configuration'),
|
||||||
|
false,
|
||||||
|
'nav_admin');
|
||||||
}
|
}
|
||||||
if (common_config('invite', 'enabled')) {
|
|
||||||
// TRANS: Tooltip for main menu option "Invite"
|
|
||||||
$tooltip = _m('TOOLTIP', 'Invite friends and colleagues to join you on %s');
|
|
||||||
$this->menuItem(common_local_url('invite'),
|
|
||||||
// TRANS: Main menu option when logged in and invitations are allowed for inviting new users
|
|
||||||
_m('MENU', 'Invite'),
|
|
||||||
sprintf($tooltip,
|
|
||||||
common_config('site', 'name')),
|
|
||||||
false, 'nav_invitecontact');
|
|
||||||
}
|
|
||||||
// TRANS: Tooltip for main menu option "Logout"
|
|
||||||
$tooltip = _m('TOOLTIP', 'Logout from the site');
|
|
||||||
$this->menuItem(common_local_url('logout'),
|
$this->menuItem(common_local_url('logout'),
|
||||||
// TRANS: Main menu option when logged in to log out the current user
|
_m('Logout'),
|
||||||
_m('MENU', 'Logout'), $tooltip, false, 'nav_logout');
|
_m('Logout from the site'),
|
||||||
}
|
false,
|
||||||
else {
|
'nav_logout');
|
||||||
if (!common_config('site', 'closed') && !common_config('site', 'inviteonly')) {
|
} else {
|
||||||
// TRANS: Tooltip for main menu option "Register"
|
$this->menuItem(common_local_url('public'),
|
||||||
$tooltip = _m('TOOLTIP', 'Create an account');
|
_m('Public'),
|
||||||
$this->menuItem(common_local_url('register'),
|
_m('Everyone on this site'),
|
||||||
// TRANS: Main menu option when not logged in to register a new account
|
false,
|
||||||
_m('MENU', 'Register'), $tooltip, false, 'nav_register');
|
'nav_public');
|
||||||
}
|
|
||||||
// TRANS: Tooltip for main menu option "Login"
|
|
||||||
$tooltip = _m('TOOLTIP', 'Login to the site');
|
|
||||||
$this->menuItem(common_local_url('login'),
|
$this->menuItem(common_local_url('login'),
|
||||||
// TRANS: Main menu option when not logged in to log in
|
_m('Login'),
|
||||||
_m('MENU', 'Login'), $tooltip, false, 'nav_login');
|
_m('Login to the site'),
|
||||||
|
false,
|
||||||
|
'nav_login');
|
||||||
}
|
}
|
||||||
// TRANS: Tooltip for main menu option "Help"
|
|
||||||
$tooltip = _m('TOOLTIP', 'Help me!');
|
if (!empty($user) || !common_config('site', 'private')) {
|
||||||
$this->menuItem(common_local_url('doc', array('title' => 'help')),
|
$this->menuItem(common_local_url('noticesearch'),
|
||||||
// TRANS: Main menu option for help on the StatusNet site
|
_m('Search'),
|
||||||
_m('MENU', 'Help'), $tooltip, false, 'nav_help');
|
_m('Search the site'),
|
||||||
if ($user || !common_config('site', 'private')) {
|
false,
|
||||||
// TRANS: Tooltip for main menu option "Search"
|
'nav_search');
|
||||||
$tooltip = _m('TOOLTIP', 'Search for people or text');
|
|
||||||
$this->menuItem(common_local_url('peoplesearch'),
|
|
||||||
// TRANS: Main menu option when logged in or when the StatusNet instance is not private
|
|
||||||
_m('MENU', 'Search'), $tooltip, false, 'nav_search');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Event::handle('EndPrimaryNav', array($this));
|
Event::handle('EndPrimaryNav', array($this));
|
||||||
}
|
}
|
||||||
$this->elementEnd('ul');
|
$this->elementEnd('ul');
|
||||||
|
|
|
@ -1,139 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* StatusNet, the distributed open-source microblogging tool
|
|
||||||
*
|
|
||||||
* Base class for connection settings actions
|
|
||||||
*
|
|
||||||
* PHP version 5
|
|
||||||
*
|
|
||||||
* LICENCE: 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 Settings
|
|
||||||
* @package StatusNet
|
|
||||||
* @author Evan Prodromou <evan@status.net>
|
|
||||||
* @copyright 2008-2009 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/
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (!defined('STATUSNET') && !defined('LACONICA')) {
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
require_once INSTALLDIR.'/lib/settingsaction.php';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Base class for connection settings actions
|
|
||||||
*
|
|
||||||
* @category Settings
|
|
||||||
* @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
|
|
||||||
* @link http://status.net/
|
|
||||||
*
|
|
||||||
* @see Widget
|
|
||||||
*/
|
|
||||||
class ConnectSettingsAction extends SettingsAction
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Show the local navigation menu
|
|
||||||
*
|
|
||||||
* This is the same for all settings, so we show it here.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
function showLocalNav()
|
|
||||||
{
|
|
||||||
$menu = new ConnectSettingsNav($this);
|
|
||||||
$menu->show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A widget for showing the connect group local nav menu
|
|
||||||
*
|
|
||||||
* @category Widget
|
|
||||||
* @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
|
|
||||||
* @link http://status.net/
|
|
||||||
*
|
|
||||||
* @see HTMLOutputter
|
|
||||||
*/
|
|
||||||
class ConnectSettingsNav 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('StartConnectSettingsNav', array(&$this->action))) {
|
|
||||||
|
|
||||||
# action => array('prompt', 'title')
|
|
||||||
$menu = array();
|
|
||||||
$transports = array();
|
|
||||||
Event::handle('GetImTransports', array(&$transports));
|
|
||||||
if ($transports) {
|
|
||||||
$menu['imsettings'] =
|
|
||||||
// TRANS: Menu item for Instant Messaging settings.
|
|
||||||
array(_m('MENU','IM'),
|
|
||||||
// TRANS: Tooltip for Instant Messaging menu item.
|
|
||||||
_('Updates by instant messenger (IM)'));
|
|
||||||
}
|
|
||||||
if (common_config('sms', 'enabled')) {
|
|
||||||
$menu['smssettings'] =
|
|
||||||
// TRANS: Menu item for Short Message Service settings.
|
|
||||||
array(_m('MENU','SMS'),
|
|
||||||
// TRANS: Tooltip for Short Message Service menu item.
|
|
||||||
_('Updates by SMS'));
|
|
||||||
}
|
|
||||||
|
|
||||||
$menu['oauthconnectionssettings'] = array(
|
|
||||||
// TRANS: Menu item for OuAth connection settings.
|
|
||||||
_m('MENU','Connections'),
|
|
||||||
// TRANS: Tooltip for connected applications (Connections through OAuth) menu item.
|
|
||||||
_('Authorized connected applications')
|
|
||||||
);
|
|
||||||
|
|
||||||
foreach ($menu as $menuaction => $menudesc) {
|
|
||||||
$this->action->menuItem(common_local_url($menuaction),
|
|
||||||
$menudesc[0],
|
|
||||||
$menudesc[1],
|
|
||||||
$action_name === $menuaction);
|
|
||||||
}
|
|
||||||
|
|
||||||
Event::handle('EndConnectSettingsNav', array(&$this->action));
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->action->elementEnd('ul');
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -32,9 +32,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once INSTALLDIR . '/lib/accountsettingsaction.php';
|
|
||||||
require_once INSTALLDIR . '/lib/webcolor.php';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for setting a user or group design
|
* Base class for setting a user or group design
|
||||||
*
|
*
|
||||||
|
@ -48,7 +45,8 @@ require_once INSTALLDIR . '/lib/webcolor.php';
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
class DesignSettingsAction extends AccountSettingsAction
|
|
||||||
|
class DesignSettingsAction extends SettingsAction
|
||||||
{
|
{
|
||||||
var $submitaction = null;
|
var $submitaction = null;
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,7 @@ class PersonalGroupNav extends Widget
|
||||||
if (Event::handle('StartPersonalGroupNav', array($this))) {
|
if (Event::handle('StartPersonalGroupNav', array($this))) {
|
||||||
$this->out->menuItem(common_local_url('all', array('nickname' =>
|
$this->out->menuItem(common_local_url('all', array('nickname' =>
|
||||||
$nickname)),
|
$nickname)),
|
||||||
_('Personal'),
|
_('Home'),
|
||||||
sprintf(_('%s and friends'), $name),
|
sprintf(_('%s and friends'), $name),
|
||||||
$action == 'all', 'nav_timeline_personal');
|
$action == 'all', 'nav_timeline_personal');
|
||||||
$this->out->menuItem(common_local_url('replies', array('nickname' =>
|
$this->out->menuItem(common_local_url('replies', array('nickname' =>
|
||||||
|
@ -107,11 +107,6 @@ class PersonalGroupNav extends Widget
|
||||||
_('Replies'),
|
_('Replies'),
|
||||||
sprintf(_('Replies to %s'), $name),
|
sprintf(_('Replies to %s'), $name),
|
||||||
$action == 'replies', 'nav_timeline_replies');
|
$action == 'replies', 'nav_timeline_replies');
|
||||||
$this->out->menuItem(common_local_url('showstream', array('nickname' =>
|
|
||||||
$nickname)),
|
|
||||||
_('Profile'),
|
|
||||||
$name,
|
|
||||||
$action == 'showstream', 'nav_profile');
|
|
||||||
$this->out->menuItem(common_local_url('showfavorites', array('nickname' =>
|
$this->out->menuItem(common_local_url('showfavorites', array('nickname' =>
|
||||||
$nickname)),
|
$nickname)),
|
||||||
_('Favorites'),
|
_('Favorites'),
|
||||||
|
|
|
@ -150,4 +150,17 @@ class SettingsAction extends CurrentUserDesignAction
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the local navigation menu
|
||||||
|
*
|
||||||
|
* This is the same for all settings, so we show it here.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
|
||||||
|
function showLocalNav()
|
||||||
|
{
|
||||||
|
$menu = new SettingsNav($this);
|
||||||
|
$menu->show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
132
lib/settingsnav.php
Normal file
132
lib/settingsnav.php
Normal file
|
@ -0,0 +1,132 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* StatusNet - the distributed open-source microblogging tool
|
||||||
|
* Copyright (C) 2010, StatusNet, Inc.
|
||||||
|
*
|
||||||
|
* Settings 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 Widget
|
||||||
|
* @package StatusNet
|
||||||
|
* @author Evan Prodromou <evan@status.net>
|
||||||
|
* @copyright 2010 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A widget for showing the settings group local nav menu
|
||||||
|
*
|
||||||
|
* @category Widget
|
||||||
|
* @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
|
||||||
|
* @link http://status.net/
|
||||||
|
*
|
||||||
|
* @see HTMLOutputter
|
||||||
|
*/
|
||||||
|
|
||||||
|
class SettingsNav 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()
|
||||||
|
{
|
||||||
|
$actionName = $this->action->trimmed('action');
|
||||||
|
$this->action->elementStart('ul', array('class' => 'nav'));
|
||||||
|
|
||||||
|
if (Event::handle('StartAccountSettingsNav', array(&$this->action))) {
|
||||||
|
$this->action->menuItem(common_local_url('profilesettings'),
|
||||||
|
_('Profile'),
|
||||||
|
_('Change your profile settings'),
|
||||||
|
$actionName == 'profilesettings');
|
||||||
|
|
||||||
|
$this->action->menuItem(common_local_url('avatarsettings'),
|
||||||
|
_('Avatar'),
|
||||||
|
_('Upload an avatar'),
|
||||||
|
$actionName == 'avatarsettings');
|
||||||
|
|
||||||
|
$this->action->menuItem(common_local_url('passwordsettings'),
|
||||||
|
_('Password'),
|
||||||
|
_('Change your password'),
|
||||||
|
$actionName == 'passwordsettings');
|
||||||
|
|
||||||
|
$this->action->menuItem(common_local_url('emailsettings'),
|
||||||
|
_('Email'),
|
||||||
|
_('Change email handling'),
|
||||||
|
$actionName == 'emailsettings');
|
||||||
|
|
||||||
|
$this->action->menuItem(common_local_url('userdesignsettings'),
|
||||||
|
_('Design'),
|
||||||
|
_('Design your profile'),
|
||||||
|
$actionName == 'userdesignsettings');
|
||||||
|
|
||||||
|
$this->action->menuItem(common_local_url('urlsettings'),
|
||||||
|
_('URL'),
|
||||||
|
_('URL shorteners'),
|
||||||
|
$actionName == 'urlsettings');
|
||||||
|
|
||||||
|
Event::handle('EndAccountSettingsNav', array(&$this->action));
|
||||||
|
|
||||||
|
if (common_config('xmpp', 'enabled')) {
|
||||||
|
$this->action->menuItem(common_local_url('imsettings'),
|
||||||
|
_m('IM'),
|
||||||
|
_('Updates by instant messenger (IM)'),
|
||||||
|
$actionName == 'imsettings');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (common_config('sms', 'enabled')) {
|
||||||
|
$this->action->menuItem(common_local_url('smssettings'),
|
||||||
|
_m('SMS'),
|
||||||
|
_('Updates by SMS'),
|
||||||
|
$actionName == 'smssettings');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->action->menuItem(common_local_url('oauthconnectionssettings'),
|
||||||
|
_('Connections'),
|
||||||
|
_('Authorized connected applications'),
|
||||||
|
$actionName == 'oauthconnectionsettings');
|
||||||
|
|
||||||
|
Event::handle('EndConnectSettingsNav', array(&$this->action));
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->action->elementEnd('ul');
|
||||||
|
}
|
||||||
|
}
|
|
@ -76,6 +76,12 @@ class SubGroupNav extends Widget
|
||||||
|
|
||||||
if (Event::handle('StartSubGroupNav', array($this))) {
|
if (Event::handle('StartSubGroupNav', array($this))) {
|
||||||
|
|
||||||
|
$this->out->menuItem(common_local_url('showstream', array('nickname' =>
|
||||||
|
$this->user->nickname)),
|
||||||
|
_('Profile'),
|
||||||
|
(empty($profile)) ? $this->user->nickname : $profile->getBestName(),
|
||||||
|
$action == 'showstream',
|
||||||
|
'nav_profile');
|
||||||
$this->out->menuItem(common_local_url('subscriptions',
|
$this->out->menuItem(common_local_url('subscriptions',
|
||||||
array('nickname' =>
|
array('nickname' =>
|
||||||
$this->user->nickname)),
|
$this->user->nickname)),
|
||||||
|
|
|
@ -42,7 +42,7 @@ require_once INSTALLDIR.'/lib/connectsettingsaction.php';
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
class FBConnectSettingsAction extends ConnectSettingsAction
|
class FBSettingsAction extends ConnectSettingsAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Title of the page
|
* Title of the page
|
||||||
|
|
|
@ -150,7 +150,7 @@ class FacebookPlugin extends Plugin
|
||||||
return false;
|
return false;
|
||||||
case 'FBConnectAuthAction':
|
case 'FBConnectAuthAction':
|
||||||
case 'FBConnectLoginAction':
|
case 'FBConnectLoginAction':
|
||||||
case 'FBConnectSettingsAction':
|
case 'FBSettingsAction':
|
||||||
case 'FBC_XDReceiverAction':
|
case 'FBC_XDReceiverAction':
|
||||||
include_once INSTALLDIR . '/plugins/Facebook/' .
|
include_once INSTALLDIR . '/plugins/Facebook/' .
|
||||||
mb_substr($cls, 0, -6) . '.php';
|
mb_substr($cls, 0, -6) . '.php';
|
||||||
|
@ -357,7 +357,7 @@ class FacebookPlugin extends Plugin
|
||||||
// List of actions that require FB stuff
|
// List of actions that require FB stuff
|
||||||
$needy = array('FBConnectLoginAction',
|
$needy = array('FBConnectLoginAction',
|
||||||
'FBConnectauthAction',
|
'FBConnectauthAction',
|
||||||
'FBConnectSettingsAction');
|
'FBSettingsAction');
|
||||||
|
|
||||||
if (in_array(get_class($action), $needy)) {
|
if (in_array(get_class($action), $needy)) {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -41,7 +41,7 @@ if (!defined('STATUSNET')) {
|
||||||
*
|
*
|
||||||
* @see SettingsAction
|
* @see SettingsAction
|
||||||
*/
|
*/
|
||||||
class FacebooksettingsAction extends ConnectSettingsAction {
|
class FacebooksettingsAction extends SettingsAction {
|
||||||
private $facebook; // Facebook PHP-SDK client obj
|
private $facebook; // Facebook PHP-SDK client obj
|
||||||
private $flink;
|
private $flink;
|
||||||
private $user;
|
private $user;
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
*
|
*
|
||||||
* @category Sample
|
* @category Sample
|
||||||
* @package StatusNet
|
* @package StatusNet
|
||||||
* @author Brion Vibber <brionv@status.net>
|
|
||||||
* @author Evan Prodromou <evan@status.net>
|
* @author Evan Prodromou <evan@status.net>
|
||||||
* @copyright 2010 StatusNet, Inc.
|
* @copyright 2010 StatusNet, Inc.
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||||
|
@ -43,393 +42,17 @@ if (!defined('STATUSNET')) {
|
||||||
*
|
*
|
||||||
* @category NewMenu
|
* @category NewMenu
|
||||||
* @package StatusNet
|
* @package StatusNet
|
||||||
* @author Brion Vibber <brionv@status.net>
|
|
||||||
* @author Evan Prodromou <evan@status.net>
|
* @author Evan Prodromou <evan@status.net>
|
||||||
* @copyright 2010 StatusNet, Inc.
|
* @copyright 2010 StatusNet, Inc.
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class NewMenuPlugin extends Plugin
|
class NewMenuPlugin extends Plugin
|
||||||
{
|
{
|
||||||
public $loadCSS = false;
|
function __construct()
|
||||||
|
|
||||||
/**
|
|
||||||
* Load related modules when needed
|
|
||||||
*
|
|
||||||
* @param string $cls Name of the class to be loaded
|
|
||||||
*
|
|
||||||
* @return boolean hook value; true means continue processing, false means stop.
|
|
||||||
*/
|
|
||||||
|
|
||||||
function onAutoload($cls)
|
|
||||||
{
|
{
|
||||||
$dir = dirname(__FILE__);
|
// NOOP! No hooks, no nothin'.
|
||||||
|
return;
|
||||||
switch ($cls)
|
|
||||||
{
|
|
||||||
case 'HelloAction':
|
|
||||||
include_once $dir . '/' . strtolower(mb_substr($cls, 0, -6)) . '.php';
|
|
||||||
return false;
|
|
||||||
case 'User_greeting_count':
|
|
||||||
include_once $dir . '/'.$cls.'.php';
|
|
||||||
return false;
|
|
||||||
default:
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Modify the default menu
|
|
||||||
*
|
|
||||||
* @param Action $action The current action handler. Use this to
|
|
||||||
* do any output.
|
|
||||||
*
|
|
||||||
* @return boolean hook value; true means continue processing, false means stop.
|
|
||||||
*
|
|
||||||
* @see Action
|
|
||||||
*/
|
|
||||||
|
|
||||||
function onStartPrimaryNav($action)
|
|
||||||
{
|
|
||||||
$user = common_current_user();
|
|
||||||
|
|
||||||
if (!empty($user)) {
|
|
||||||
$action->menuItem(common_local_url('all',
|
|
||||||
array('nickname' => $user->nickname)),
|
|
||||||
_m('Home'),
|
|
||||||
_m('Friends timeline'),
|
|
||||||
false,
|
|
||||||
'nav_home');
|
|
||||||
$action->menuItem(common_local_url('showstream',
|
|
||||||
array('nickname' => $user->nickname)),
|
|
||||||
_m('Profile'),
|
|
||||||
_m('Your profile'),
|
|
||||||
false,
|
|
||||||
'nav_profile');
|
|
||||||
$action->menuItem(common_local_url('public'),
|
|
||||||
_m('Public'),
|
|
||||||
_m('Everyone on this site'),
|
|
||||||
false,
|
|
||||||
'nav_public');
|
|
||||||
$action->menuItem(common_local_url('profilesettings'),
|
|
||||||
_m('Settings'),
|
|
||||||
_m('Change your personal settings'),
|
|
||||||
false,
|
|
||||||
'nav_account');
|
|
||||||
if ($user->hasRight(Right::CONFIGURESITE)) {
|
|
||||||
$action->menuItem(common_local_url('siteadminpanel'),
|
|
||||||
_m('Admin'),
|
|
||||||
_m('Site configuration'),
|
|
||||||
false,
|
|
||||||
'nav_admin');
|
|
||||||
}
|
|
||||||
$action->menuItem(common_local_url('logout'),
|
|
||||||
_m('Logout'),
|
|
||||||
_m('Logout from the site'),
|
|
||||||
false,
|
|
||||||
'nav_logout');
|
|
||||||
} else {
|
|
||||||
$action->menuItem(common_local_url('public'),
|
|
||||||
_m('Public'),
|
|
||||||
_m('Everyone on this site'),
|
|
||||||
false,
|
|
||||||
'nav_public');
|
|
||||||
$action->menuItem(common_local_url('login'),
|
|
||||||
_m('Login'),
|
|
||||||
_m('Login to the site'),
|
|
||||||
false,
|
|
||||||
'nav_login');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($user) || !common_config('site', 'private')) {
|
|
||||||
$action->menuItem(common_local_url('noticesearch'),
|
|
||||||
_m('Search'),
|
|
||||||
_m('Search the site'),
|
|
||||||
false,
|
|
||||||
'nav_search');
|
|
||||||
}
|
|
||||||
|
|
||||||
Event::handle('EndPrimaryNav', array($action));
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function onStartPersonalGroupNav($menu)
|
|
||||||
{
|
|
||||||
$user = null;
|
|
||||||
|
|
||||||
// FIXME: we should probably pass this in
|
|
||||||
|
|
||||||
$action = $menu->action->trimmed('action');
|
|
||||||
$nickname = $menu->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;
|
|
||||||
}
|
|
||||||
|
|
||||||
$menu->out->menuItem(common_local_url('all', array('nickname' =>
|
|
||||||
$nickname)),
|
|
||||||
_('Home'),
|
|
||||||
sprintf(_('%s and friends'), $name),
|
|
||||||
$action == 'all', 'nav_timeline_personal');
|
|
||||||
$menu->out->menuItem(common_local_url('replies', array('nickname' =>
|
|
||||||
$nickname)),
|
|
||||||
_('Replies'),
|
|
||||||
sprintf(_('Replies to %s'), $name),
|
|
||||||
$action == 'replies', 'nav_timeline_replies');
|
|
||||||
$menu->out->menuItem(common_local_url('showfavorites', array('nickname' =>
|
|
||||||
$nickname)),
|
|
||||||
_('Favorites'),
|
|
||||||
sprintf(_('%s\'s favorite notices'), ($user_profile) ? $name : _('User')),
|
|
||||||
$action == 'showfavorites', 'nav_timeline_favorites');
|
|
||||||
|
|
||||||
$cur = common_current_user();
|
|
||||||
|
|
||||||
if ($cur && $cur->id == $user->id &&
|
|
||||||
!common_config('singleuser', 'enabled')) {
|
|
||||||
|
|
||||||
$menu->out->menuItem(common_local_url('inbox', array('nickname' =>
|
|
||||||
$nickname)),
|
|
||||||
_('Inbox'),
|
|
||||||
_('Your incoming messages'),
|
|
||||||
$action == 'inbox');
|
|
||||||
$menu->out->menuItem(common_local_url('outbox', array('nickname' =>
|
|
||||||
$nickname)),
|
|
||||||
_('Outbox'),
|
|
||||||
_('Your sent messages'),
|
|
||||||
$action == 'outbox');
|
|
||||||
}
|
|
||||||
Event::handle('EndPersonalGroupNav', array($menu));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function onStartSubGroupNav($menu)
|
|
||||||
{
|
|
||||||
$cur = common_current_user();
|
|
||||||
$action = $menu->action->trimmed('action');
|
|
||||||
|
|
||||||
$profile = $menu->user->getProfile();
|
|
||||||
|
|
||||||
$menu->out->menuItem(common_local_url('showstream', array('nickname' =>
|
|
||||||
$menu->user->nickname)),
|
|
||||||
_('Profile'),
|
|
||||||
(empty($profile)) ? $menu->user->nickname : $profile->getBestName(),
|
|
||||||
$action == 'showstream',
|
|
||||||
'nav_profile');
|
|
||||||
$menu->out->menuItem(common_local_url('subscriptions',
|
|
||||||
array('nickname' =>
|
|
||||||
$menu->user->nickname)),
|
|
||||||
_('Subscriptions'),
|
|
||||||
sprintf(_('People %s subscribes to'),
|
|
||||||
$menu->user->nickname),
|
|
||||||
$action == 'subscriptions',
|
|
||||||
'nav_subscriptions');
|
|
||||||
$menu->out->menuItem(common_local_url('subscribers',
|
|
||||||
array('nickname' =>
|
|
||||||
$menu->user->nickname)),
|
|
||||||
_('Subscribers'),
|
|
||||||
sprintf(_('People subscribed to %s'),
|
|
||||||
$menu->user->nickname),
|
|
||||||
$action == 'subscribers',
|
|
||||||
'nav_subscribers');
|
|
||||||
$menu->out->menuItem(common_local_url('usergroups',
|
|
||||||
array('nickname' =>
|
|
||||||
$menu->user->nickname)),
|
|
||||||
_('Groups'),
|
|
||||||
sprintf(_('Groups %s is a member of'),
|
|
||||||
$menu->user->nickname),
|
|
||||||
$action == 'usergroups',
|
|
||||||
'nav_usergroups');
|
|
||||||
if (common_config('invite', 'enabled') && !is_null($cur) && $menu->user->id === $cur->id) {
|
|
||||||
$menu->out->menuItem(common_local_url('invite'),
|
|
||||||
_('Invite'),
|
|
||||||
sprintf(_('Invite friends and colleagues to join you on %s'),
|
|
||||||
common_config('site', 'name')),
|
|
||||||
$action == 'invite',
|
|
||||||
'nav_invite');
|
|
||||||
}
|
|
||||||
|
|
||||||
Event::handle('EndSubGroupNav', array($menu));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function onStartShowLocalNavBlock($action)
|
|
||||||
{
|
|
||||||
$actionName = $action->trimmed('action');
|
|
||||||
|
|
||||||
if ($actionName == 'showstream') {
|
|
||||||
$action->elementStart('dl', array('id' => 'site_nav_local_views'));
|
|
||||||
// TRANS: DT element for local views block. String is hidden in default CSS.
|
|
||||||
$action->element('dt', null, _('Local views'));
|
|
||||||
$action->elementStart('dd');
|
|
||||||
$nav = new SubGroupNav($action, $action->user);
|
|
||||||
$nav->show();
|
|
||||||
$action->elementEnd('dd');
|
|
||||||
$action->elementEnd('dl');
|
|
||||||
Event::handle('EndShowLocalNavBlock', array($action));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function onStartAccountSettingsNav(&$action)
|
|
||||||
{
|
|
||||||
$this->_settingsMenu($action);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function onStartConnectSettingsNav(&$action)
|
|
||||||
{
|
|
||||||
$this->_settingsMenu($action);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private function _settingsMenu(&$action)
|
|
||||||
{
|
|
||||||
$actionName = $action->trimmed('action');
|
|
||||||
|
|
||||||
$action->menuItem(common_local_url('profilesettings'),
|
|
||||||
_('Profile'),
|
|
||||||
_('Change your profile settings'),
|
|
||||||
$actionName == 'profilesettings');
|
|
||||||
|
|
||||||
$action->menuItem(common_local_url('avatarsettings'),
|
|
||||||
_('Avatar'),
|
|
||||||
_('Upload an avatar'),
|
|
||||||
$actionName == 'avatarsettings');
|
|
||||||
|
|
||||||
$action->menuItem(common_local_url('passwordsettings'),
|
|
||||||
_('Password'),
|
|
||||||
_('Change your password'),
|
|
||||||
$actionName == 'passwordsettings');
|
|
||||||
|
|
||||||
$action->menuItem(common_local_url('emailsettings'),
|
|
||||||
_('Email'),
|
|
||||||
_('Change email handling'),
|
|
||||||
$actionName == 'emailsettings');
|
|
||||||
|
|
||||||
$action->menuItem(common_local_url('userdesignsettings'),
|
|
||||||
_('Design'),
|
|
||||||
_('Design your profile'),
|
|
||||||
$actionName == 'userdesignsettings');
|
|
||||||
|
|
||||||
$action->menuItem(common_local_url('othersettings'),
|
|
||||||
_('Other'),
|
|
||||||
_('Other options'),
|
|
||||||
$actionName == 'othersettings');
|
|
||||||
|
|
||||||
Event::handle('EndAccountSettingsNav', array(&$action));
|
|
||||||
|
|
||||||
if (common_config('xmpp', 'enabled')) {
|
|
||||||
$action->menuItem(common_local_url('imsettings'),
|
|
||||||
_m('IM'),
|
|
||||||
_('Updates by instant messenger (IM)'),
|
|
||||||
$actionName == 'imsettings');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (common_config('sms', 'enabled')) {
|
|
||||||
$action->menuItem(common_local_url('smssettings'),
|
|
||||||
_m('SMS'),
|
|
||||||
_('Updates by SMS'),
|
|
||||||
$actionName == 'smssettings');
|
|
||||||
}
|
|
||||||
|
|
||||||
$action->menuItem(common_local_url('oauthconnectionssettings'),
|
|
||||||
_('Connections'),
|
|
||||||
_('Authorized connected applications'),
|
|
||||||
$actionName == 'oauthconnectionsettings');
|
|
||||||
|
|
||||||
Event::handle('EndConnectSettingsNav', array(&$action));
|
|
||||||
}
|
|
||||||
|
|
||||||
function onEndShowStyles($action)
|
|
||||||
{
|
|
||||||
if (($this->showCSS ||
|
|
||||||
in_array(common_config('site', 'theme'),
|
|
||||||
array('default', 'identica', 'h4ck3r'))) &&
|
|
||||||
($action instanceof AccountSettingsAction ||
|
|
||||||
$action instanceof ConnectSettingsAction)) {
|
|
||||||
$action->cssLink(common_path('plugins/NewMenu/newmenu.css'));
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function onStartAddressData($action)
|
|
||||||
{
|
|
||||||
if (common_config('singleuser', 'enabled')) {
|
|
||||||
$user = User::singleUser();
|
|
||||||
$url = common_local_url('showstream',
|
|
||||||
array('nickname' => $user->nickname));
|
|
||||||
} else if (common_logged_in()) {
|
|
||||||
$cur = common_current_user();
|
|
||||||
$url = common_local_url('all', array('nickname' => $cur->nickname));
|
|
||||||
} else {
|
|
||||||
$url = common_local_url('public');
|
|
||||||
}
|
|
||||||
|
|
||||||
$action->elementStart('a', array('class' => 'url home bookmark',
|
|
||||||
'href' => $url));
|
|
||||||
|
|
||||||
if (StatusNet::isHTTPS()) {
|
|
||||||
$logoUrl = common_config('site', 'ssllogo');
|
|
||||||
if (empty($logoUrl)) {
|
|
||||||
// if logo is an uploaded file, try to fall back to HTTPS file URL
|
|
||||||
$httpUrl = common_config('site', 'logo');
|
|
||||||
if (!empty($httpUrl)) {
|
|
||||||
$f = File::staticGet('url', $httpUrl);
|
|
||||||
if (!empty($f) && !empty($f->filename)) {
|
|
||||||
// this will handle the HTTPS case
|
|
||||||
$logoUrl = File::url($f->filename);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$logoUrl = common_config('site', 'logo');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($logoUrl) && file_exists(Theme::file('logo.png'))) {
|
|
||||||
// This should handle the HTTPS case internally
|
|
||||||
$logoUrl = Theme::path('logo.png');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($logoUrl)) {
|
|
||||||
$action->element('img', array('class' => 'logo photo',
|
|
||||||
'src' => $logoUrl,
|
|
||||||
'alt' => common_config('site', 'name')));
|
|
||||||
}
|
|
||||||
|
|
||||||
$action->text(' ');
|
|
||||||
$action->element('span', array('class' => 'fn org'), common_config('site', 'name'));
|
|
||||||
$action->elementEnd('a');
|
|
||||||
|
|
||||||
Event::handle('EndAddressData', array($action));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return version information for this plugin
|
|
||||||
*
|
|
||||||
* @param array &$versions Version info; add to this array
|
|
||||||
*
|
|
||||||
* @return boolean hook value
|
|
||||||
*/
|
|
||||||
|
|
||||||
function onPluginVersion(&$versions)
|
|
||||||
{
|
|
||||||
$versions[] = array('name' => 'NewMenu',
|
|
||||||
'version' => STATUSNET_VERSION,
|
|
||||||
'author' => 'Evan Prodromou',
|
|
||||||
'homepage' => 'http://status.net/wiki/Plugin:NewMenu',
|
|
||||||
'description' =>
|
|
||||||
_m('A preview of the new menu '.
|
|
||||||
'layout in StatusNet 1.0.'));
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,47 +0,0 @@
|
||||||
body[id$=settings] #site_nav_local_views {
|
|
||||||
position:relative;
|
|
||||||
z-index:9;
|
|
||||||
float:right;
|
|
||||||
margin-right:10.65%;
|
|
||||||
width:22.25%;
|
|
||||||
}
|
|
||||||
body[id$=settings] #site_nav_local_views li {
|
|
||||||
width:100%;
|
|
||||||
margin-right:0;
|
|
||||||
margin-bottom:7px;
|
|
||||||
}
|
|
||||||
body[id$=settings] #site_nav_local_views a {
|
|
||||||
display:block;
|
|
||||||
width:80%;
|
|
||||||
padding-right:10%;
|
|
||||||
padding-left:10%;
|
|
||||||
border-radius-toprleft:0;
|
|
||||||
-moz-border-radius-topleft:0;
|
|
||||||
-webkit-border-top-left-radius:0;
|
|
||||||
border-radius-topright:4px;
|
|
||||||
-moz-border-radius-topright:4px;
|
|
||||||
-webkit-border-top-right-radius:4px;
|
|
||||||
border-radius-bottomright:4px;
|
|
||||||
-moz-border-radius-bottomright:4px;
|
|
||||||
-webkit-border-bottom-right-radius:4px;
|
|
||||||
}
|
|
||||||
body[id$=settings] #site_nav_local_views li.current {
|
|
||||||
box-shadow:none;
|
|
||||||
-moz-box-shadow:none;
|
|
||||||
-webkit-box-shadow:none;
|
|
||||||
}
|
|
||||||
|
|
||||||
body[id$=settings] #content {
|
|
||||||
border-radius-topleft:7px;
|
|
||||||
border-radius-topright:7px;
|
|
||||||
-moz-border-radius-topleft:7px;
|
|
||||||
-moz-border-radius-topright:7px;
|
|
||||||
-webkit-border-top-left-radius:7px;
|
|
||||||
-webkit-border-top-right-radius:7px;
|
|
||||||
border-radius-topright:0;
|
|
||||||
-moz-border-radius-topright:0;
|
|
||||||
-webkit-border-top-right-radius:0;
|
|
||||||
}
|
|
||||||
body[id$=settings] #aside_primary {
|
|
||||||
display:none;
|
|
||||||
}
|
|
|
@ -45,7 +45,7 @@ require_once INSTALLDIR.'/plugins/OpenID/openid.php';
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class OpenidsettingsAction extends AccountSettingsAction
|
class OpenidsettingsAction extends SettingsAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Title of the page
|
* Title of the page
|
||||||
|
|
|
@ -29,7 +29,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
class MirrorSettingsAction extends AccountSettingsAction
|
class MirrorSettingsAction extends SettingsAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Title of the page
|
* Title of the page
|
||||||
|
|
|
@ -45,7 +45,7 @@ require_once INSTALLDIR . '/plugins/TwitterBridge/twitter.php';
|
||||||
*
|
*
|
||||||
* @see SettingsAction
|
* @see SettingsAction
|
||||||
*/
|
*/
|
||||||
class TwittersettingsAction extends ConnectSettingsAction
|
class TwittersettingsAction extends SettingsAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Title of the page
|
* Title of the page
|
||||||
|
|
|
@ -94,6 +94,55 @@ list-style-type:none;
|
||||||
form label.submit {
|
form label.submit {
|
||||||
display:none;
|
display:none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
body[id$=settings] #site_nav_local_views {
|
||||||
|
position:relative;
|
||||||
|
z-index:9;
|
||||||
|
float:right;
|
||||||
|
margin-right:10.65%;
|
||||||
|
width:22.25%;
|
||||||
|
}
|
||||||
|
body[id$=settings] #site_nav_local_views li {
|
||||||
|
width:100%;
|
||||||
|
margin-right:0;
|
||||||
|
margin-bottom:7px;
|
||||||
|
}
|
||||||
|
body[id$=settings] #site_nav_local_views a {
|
||||||
|
display:block;
|
||||||
|
width:80%;
|
||||||
|
padding-right:10%;
|
||||||
|
padding-left:10%;
|
||||||
|
border-radius-toprleft:0;
|
||||||
|
-moz-border-radius-topleft:0;
|
||||||
|
-webkit-border-top-left-radius:0;
|
||||||
|
border-radius-topright:4px;
|
||||||
|
-moz-border-radius-topright:4px;
|
||||||
|
-webkit-border-top-right-radius:4px;
|
||||||
|
border-radius-bottomright:4px;
|
||||||
|
-moz-border-radius-bottomright:4px;
|
||||||
|
-webkit-border-bottom-right-radius:4px;
|
||||||
|
}
|
||||||
|
body[id$=settings] #site_nav_local_views li.current {
|
||||||
|
box-shadow:none;
|
||||||
|
-moz-box-shadow:none;
|
||||||
|
-webkit-box-shadow:none;
|
||||||
|
}
|
||||||
|
|
||||||
|
body[id$=settings] #content {
|
||||||
|
border-radius-topleft:7px;
|
||||||
|
border-radius-topright:7px;
|
||||||
|
-moz-border-radius-topleft:7px;
|
||||||
|
-moz-border-radius-topright:7px;
|
||||||
|
-webkit-border-top-left-radius:7px;
|
||||||
|
-webkit-border-top-right-radius:7px;
|
||||||
|
border-radius-topright:0;
|
||||||
|
-moz-border-radius-topright:0;
|
||||||
|
-webkit-border-top-right-radius:0;
|
||||||
|
}
|
||||||
|
body[id$=settings] #aside_primary {
|
||||||
|
display:none;
|
||||||
|
}
|
||||||
|
|
||||||
.form_settings {
|
.form_settings {
|
||||||
clear:both;
|
clear:both;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user