Merge branch 'uiredesign' of ../evan into uiredesign

This commit is contained in:
sarven 2009-01-15 20:05:09 +00:00
commit b3c171d317
3 changed files with 45 additions and 41 deletions

1
.gitignore vendored
View File

@ -4,3 +4,4 @@ _darcs/*
config.php config.php
.htaccess .htaccess
*.tmproj *.tmproj
dataobject.ini

View File

@ -32,7 +32,7 @@ if (!defined('LACONICA')) {
exit(1); exit(1);
} }
require_once INSTALLDIR.'/lib/form.php'; require_once INSTALLDIR.'/lib/noticeform.php';
require_once INSTALLDIR.'/lib/htmloutputter.php'; require_once INSTALLDIR.'/lib/htmloutputter.php';
/** /**
@ -238,25 +238,25 @@ class Action extends HTMLOutputter // lawsuit
$user = common_current_user(); $user = common_current_user();
$this->elementStart('ul', array('id' => 'nav')); $this->elementStart('ul', array('id' => 'nav'));
if ($user) { if ($user) {
common_menu_item(common_local_url('all', array('nickname' => $user->nickname)), $this->menuItem(common_local_url('all', array('nickname' => $user->nickname)),
_('Home')); _('Home'));
} }
common_menu_item(common_local_url('peoplesearch'), _('Search')); $this->menuItem(common_local_url('peoplesearch'), _('Search'));
if ($user) { if ($user) {
common_menu_item(common_local_url('profilesettings'), $this->menuItem(common_local_url('profilesettings'),
_('Settings')); _('Settings'));
common_menu_item(common_local_url('invite'), $this->menuItem(common_local_url('invite'),
_('Invite')); _('Invite'));
common_menu_item(common_local_url('logout'), $this->menuItem(common_local_url('logout'),
_('Logout')); _('Logout'));
} else { } else {
common_menu_item(common_local_url('login'), _('Login')); $this->menuItem(common_local_url('login'), _('Login'));
if (!common_config('site', 'closed')) { if (!common_config('site', 'closed')) {
common_menu_item(common_local_url('register'), _('Register')); $this->menuItem(common_local_url('register'), _('Register'));
} }
common_menu_item(common_local_url('openidlogin'), _('OpenID')); $this->menuItem(common_local_url('openidlogin'), _('OpenID'));
} }
common_menu_item(common_local_url('doc', array('title' => 'help')), $this->menuItem(common_local_url('doc', array('title' => 'help')),
_('Help')); _('Help'));
$this->elementEnd('ul'); $this->elementEnd('ul');
$this->elementEnd('dl'); $this->elementEnd('dl');
@ -290,25 +290,11 @@ class Action extends HTMLOutputter // lawsuit
$this->elementEnd('div'); $this->elementEnd('div');
} }
// SHOULD overload (perhaps this should be a MUST because sometimes it is not used) // SHOULD overload
function showLocalNav($menu) function showLocalNav()
{ {
$action = $this->trimmed('action'); // does nothing by default
$this->elementStart('dl', array('id' => 'site_nav_local_views'));
$this->element('dt', null, _('Local views'));
$this->elementStart('ul', array('id' => 'nav'));
foreach ($menu as $menuaction => $menudesc) {
common_menu_item(common_local_url($menuaction,
isset($menudesc[2]) ? $menudesc[2] : null),
$menudesc[0],
$menudesc[1],
$action == $menuaction);
}
$this->elementEnd('ul');
$this->elementEnd('dd');
$this->elementEnd('dl');
} }
function showContentBlock() function showContentBlock()
@ -377,17 +363,17 @@ class Action extends HTMLOutputter // lawsuit
function showSecondaryNav() function showSecondaryNav()
{ {
$this->elementStart('ul', array('id' => 'nav_sub')); $this->elementStart('ul', array('id' => 'nav_sub'));
common_menu_item(common_local_url('doc', array('title' => 'help')), $this->menuItem(common_local_url('doc', array('title' => 'help')),
_('Help')); _('Help'));
common_menu_item(common_local_url('doc', array('title' => 'about')), $this->menuItem(common_local_url('doc', array('title' => 'about')),
_('About')); _('About'));
common_menu_item(common_local_url('doc', array('title' => 'faq')), $this->menuItem(common_local_url('doc', array('title' => 'faq')),
_('FAQ')); _('FAQ'));
common_menu_item(common_local_url('doc', array('title' => 'privacy')), $this->menuItem(common_local_url('doc', array('title' => 'privacy')),
_('Privacy')); _('Privacy'));
common_menu_item(common_local_url('doc', array('title' => 'source')), $this->menuItem(common_local_url('doc', array('title' => 'source')),
_('Source')); _('Source'));
common_menu_item(common_local_url('doc', array('title' => 'contact')), $this->menuItem(common_local_url('doc', array('title' => 'contact')),
_('Contact')); _('Contact'));
$this->elementEnd('ul'); $this->elementEnd('ul');
} }
@ -546,7 +532,7 @@ class Action extends HTMLOutputter // lawsuit
$action = $this->trimmed('action'); $action = $this->trimmed('action');
$this->elementStart('ul', array('id' => 'nav_views')); $this->elementStart('ul', array('id' => 'nav_views'));
foreach ($menu as $menuaction => $menudesc) { foreach ($menu as $menuaction => $menudesc) {
common_menu_item(common_local_url($menuaction, $this->menuItem(common_local_url($menuaction,
isset($menudesc[2]) ? $menudesc[2] : null), isset($menudesc[2]) ? $menudesc[2] : null),
$menudesc[0], $menudesc[0],
$menudesc[1], $menudesc[1],
@ -577,8 +563,10 @@ class Action extends HTMLOutputter // lawsuit
$this->elementStart('div', array('id' => 'content')); $this->elementStart('div', array('id' => 'content'));
} }
// Added @id to li for some control. We might want to move this to htmloutputter.php // Added @id to li for some control.
function common_menu_item($id=null, $url, $text, $title=null, $is_selected=false) // XXX: We might want to move this to htmloutputter.php
function menuItem($url, $text, $id=null, $title=null, $is_selected=false)
{ {
$lattrs = array(); $lattrs = array();
if ($is_selected) { if ($is_selected) {

View File

@ -32,6 +32,8 @@ if (!defined('LACONICA')) {
exit(1); exit(1);
} }
require_once INSTALLDIR.'/lib/widget.php';
/** /**
* Base class for all actions * Base class for all actions
* *
@ -55,29 +57,42 @@ class PublicGroupNav
{ {
var $action = null; var $action = null;
/**
* Construction
*
* @param Action $action current action, used for output
*/
function __construct($action=null) function __construct($action=null)
{ {
parent::__construct($action);
$this->action = $action; $this->action = $action;
} }
/**
* Show the menu
*
* @return void
*/
function show() function show()
{ {
$this->action->elementStart('ul', array('class' => 'nav')); $this->action->elementStart('ul', array('class' => 'nav'));
common_menu_item(common_local_url('public'), _('Public'), $this->menuItem(common_local_url('public'), _('Public'),
_('Public timeline'), $this->action == 'public'); _('Public timeline'), $this->action == 'public');
common_menu_item(common_local_url('tag'), _('Recent tags'), $this->menuItem(common_local_url('tag'), _('Recent tags'),
_('Recent tags'), $this->action == 'tag'); _('Recent tags'), $this->action == 'tag');
if (count(common_config('nickname', 'featured')) > 0) { if (count(common_config('nickname', 'featured')) > 0) {
common_menu_item(common_local_url('featured'), _('Featured'), $this->menuItem(common_local_url('featured'), _('Featured'),
_('Featured users'), $this->action == 'featured'); _('Featured users'), $this->action == 'featured');
} }
common_menu_item(common_local_url('favorited'), _('Popular'), $this->menuItem(common_local_url('favorited'), _('Popular'),
_("Popular notices"), $this->action == 'favorited'); _("Popular notices"), $this->action == 'favorited');
common_element_end('ul'); $this->action->elementEnd('ul');
} }
} }