From 565cbfbe7771f9491147bca13cec0d9cb5af7a64 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Thu, 15 Jan 2009 14:28:26 -0500 Subject: [PATCH 1/5] Hit dataobject.ini --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index fb5d478fe8..0c0fde8010 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ _darcs/* config.php .htaccess *.tmproj +dataobject.ini From 34d859c4a6708db0887983a7a9a2cf4c3e96f9cc Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Thu, 15 Jan 2009 14:31:03 -0500 Subject: [PATCH 2/5] Add a menuItem method to Action --- lib/action.php | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/lib/action.php b/lib/action.php index 30a3c8a031..7c919497ff 100644 --- a/lib/action.php +++ b/lib/action.php @@ -238,25 +238,25 @@ class Action extends HTMLOutputter // lawsuit $user = common_current_user(); $this->elementStart('ul', array('id' => 'nav')); if ($user) { - common_menu_item(common_local_url('all', array('nickname' => $user->nickname)), + $this->menuItem(common_local_url('all', array('nickname' => $user->nickname)), _('Home')); } - common_menu_item(common_local_url('peoplesearch'), _('Search')); + $this->menuItem(common_local_url('peoplesearch'), _('Search')); if ($user) { - common_menu_item(common_local_url('profilesettings'), + $this->menuItem(common_local_url('profilesettings'), _('Settings')); - common_menu_item(common_local_url('invite'), + $this->menuItem(common_local_url('invite'), _('Invite')); - common_menu_item(common_local_url('logout'), + $this->menuItem(common_local_url('logout'), _('Logout')); } else { - common_menu_item(common_local_url('login'), _('Login')); + $this->menuItem(common_local_url('login'), _('Login')); 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')); $this->elementEnd('ul'); $this->elementEnd('dl'); @@ -300,7 +300,7 @@ class Action extends HTMLOutputter // lawsuit $this->element('dt', null, _('Local views')); $this->elementStart('ul', array('id' => 'nav')); foreach ($menu as $menuaction => $menudesc) { - common_menu_item(common_local_url($menuaction, + $this->menuItem(common_local_url($menuaction, isset($menudesc[2]) ? $menudesc[2] : null), $menudesc[0], $menudesc[1], @@ -377,17 +377,17 @@ class Action extends HTMLOutputter // lawsuit function showSecondaryNav() { $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')); - common_menu_item(common_local_url('doc', array('title' => 'about')), + $this->menuItem(common_local_url('doc', array('title' => 'about')), _('About')); - common_menu_item(common_local_url('doc', array('title' => 'faq')), + $this->menuItem(common_local_url('doc', array('title' => 'faq')), _('FAQ')); - common_menu_item(common_local_url('doc', array('title' => 'privacy')), + $this->menuItem(common_local_url('doc', array('title' => 'privacy')), _('Privacy')); - common_menu_item(common_local_url('doc', array('title' => 'source')), + $this->menuItem(common_local_url('doc', array('title' => 'source')), _('Source')); - common_menu_item(common_local_url('doc', array('title' => 'contact')), + $this->menuItem(common_local_url('doc', array('title' => 'contact')), _('Contact')); $this->elementEnd('ul'); } @@ -546,7 +546,7 @@ class Action extends HTMLOutputter // lawsuit $action = $this->trimmed('action'); $this->elementStart('ul', array('id' => 'nav_views')); foreach ($menu as $menuaction => $menudesc) { - common_menu_item(common_local_url($menuaction, + $this->menuItem(common_local_url($menuaction, isset($menudesc[2]) ? $menudesc[2] : null), $menudesc[0], $menudesc[1], @@ -578,7 +578,8 @@ class Action extends HTMLOutputter // lawsuit } // Added @id to li for some control. We might want to move this to htmloutputter.php - function common_menu_item($id=null, $url, $text, $title=null, $is_selected=false) + + function menuItem($id=null, $url, $text, $title=null, $is_selected=false) { $lattrs = array(); if ($is_selected) { From 51730719acd183631ca8e335cb5fb8887fd5ac46 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Thu, 15 Jan 2009 14:31:18 -0500 Subject: [PATCH 3/5] Use menuItem(), extend Widget, and document --- lib/publicgroupnav.php | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/lib/publicgroupnav.php b/lib/publicgroupnav.php index c95d9acba6..c858824963 100644 --- a/lib/publicgroupnav.php +++ b/lib/publicgroupnav.php @@ -32,6 +32,8 @@ if (!defined('LACONICA')) { exit(1); } +require_once INSTALLDIR.'/lib/widget.php'; + /** * Base class for all actions * @@ -55,29 +57,42 @@ class PublicGroupNav { 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() { $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'); - common_menu_item(common_local_url('tag'), _('Recent tags'), + $this->menuItem(common_local_url('tag'), _('Recent tags'), _('Recent tags'), $this->action == 'tag'); 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'); } - common_menu_item(common_local_url('favorited'), _('Popular'), + $this->menuItem(common_local_url('favorited'), _('Popular'), _("Popular notices"), $this->action == 'favorited'); - common_element_end('ul'); + $this->action->elementEnd('ul'); } } From 7e316abe92d6cabfe626e0fbe747e783e9752085 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Thu, 15 Jan 2009 14:45:08 -0500 Subject: [PATCH 4/5] Move optional id param to end of function, where optional params actually go. --- lib/action.php | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/lib/action.php b/lib/action.php index 7c919497ff..634b3bfa36 100644 --- a/lib/action.php +++ b/lib/action.php @@ -290,25 +290,11 @@ class Action extends HTMLOutputter // lawsuit $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'); - - $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) { - $this->menuItem(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'); + // does nothing by default } function showContentBlock() @@ -577,9 +563,10 @@ class Action extends HTMLOutputter // lawsuit $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. + // XXX: We might want to move this to htmloutputter.php - function menuItem($id=null, $url, $text, $title=null, $is_selected=false) + function menuItem($url, $text, $id=null, $title=null, $is_selected=false) { $lattrs = array(); if ($is_selected) { From 73c1390eb1b14e829b33e60bd370622fce32bec0 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Thu, 15 Jan 2009 14:56:40 -0500 Subject: [PATCH 5/5] Fix notice form in action --- lib/action.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/action.php b/lib/action.php index 634b3bfa36..dd48cbc870 100644 --- a/lib/action.php +++ b/lib/action.php @@ -32,7 +32,7 @@ if (!defined('LACONICA')) { exit(1); } -require_once INSTALLDIR.'/lib/form.php'; +require_once INSTALLDIR.'/lib/noticeform.php'; require_once INSTALLDIR.'/lib/htmloutputter.php'; /**