From 7f81597a8146e0fa5f062cf42a30c86914877ec5 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 13 Apr 2009 15:49:26 -0400 Subject: isReadOnly() now takes arguments Add an array of arguments to isReadOnly() method of actions, to let them change their results depending on what actions are called. Primarily used by the 'api' action. Ideally in the future that will be multiple actions. But this might still be useful. --- lib/action.php | 5 ++++- lib/error.php | 2 +- lib/galleryaction.php | 2 +- lib/peoplesearchresults.php | 2 +- lib/personal.php | 2 +- lib/searchaction.php | 2 +- 6 files changed, 9 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/action.php b/lib/action.php index cc98d4445..673549246 100644 --- a/lib/action.php +++ b/lib/action.php @@ -791,9 +791,12 @@ class Action extends HTMLOutputter // lawsuit * * MAY override * + * @param array $args other arguments + * * @return boolean is read only action? */ - function isReadOnly() + + function isReadOnly($args)($args) { return false; } diff --git a/lib/error.php b/lib/error.php index 526d9f81b..282682133 100644 --- a/lib/error.php +++ b/lib/error.php @@ -93,7 +93,7 @@ class ErrorAction extends Action return $this->message; } - function isReadOnly() + function isReadOnly($args) { return true; } diff --git a/lib/galleryaction.php b/lib/galleryaction.php index 8e21d7393..0484918ce 100644 --- a/lib/galleryaction.php +++ b/lib/galleryaction.php @@ -76,7 +76,7 @@ class GalleryAction extends Action return true; } - function isReadOnly() + function isReadOnly($args) { return true; } diff --git a/lib/peoplesearchresults.php b/lib/peoplesearchresults.php index f8ab7cf3b..d3f840852 100644 --- a/lib/peoplesearchresults.php +++ b/lib/peoplesearchresults.php @@ -67,7 +67,7 @@ class PeopleSearchResults extends ProfileList return preg_replace($this->pattern, '\\1', htmlspecialchars($text)); } - function isReadOnly() + function isReadOnly($args) { return true; } diff --git a/lib/personal.php b/lib/personal.php index e46350c63..f92732375 100644 --- a/lib/personal.php +++ b/lib/personal.php @@ -47,7 +47,7 @@ class PersonalAction extends Action var $user = null; - function isReadOnly() + function isReadOnly($args) { return true; } diff --git a/lib/searchaction.php b/lib/searchaction.php index e7ad4affd..e74450e11 100644 --- a/lib/searchaction.php +++ b/lib/searchaction.php @@ -51,7 +51,7 @@ class SearchAction extends Action * * @return boolean true */ - function isReadOnly() + function isReadOnly($args) { return true; } -- cgit v1.2.3-54-g00ecf From 1bae34e24fe87ed1abcd5c27e183e8a826fbf775 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 13 Apr 2009 15:54:16 -0400 Subject: typo in lib action --- lib/action.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/action.php b/lib/action.php index 673549246..1ba062812 100644 --- a/lib/action.php +++ b/lib/action.php @@ -796,7 +796,7 @@ class Action extends HTMLOutputter // lawsuit * @return boolean is read only action? */ - function isReadOnly($args)($args) + function isReadOnly($args) { return false; } -- cgit v1.2.3-54-g00ecf From cd9a24798001cfa5e6ecfbfbccc5c0ce07726846 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Mon, 13 Apr 2009 15:03:34 -0700 Subject: Fix bad dates in API's JSON search results --- lib/jsonsearchresultslist.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/jsonsearchresultslist.php b/lib/jsonsearchresultslist.php index 0cdcf0c51..f786c20a8 100644 --- a/lib/jsonsearchresultslist.php +++ b/lib/jsonsearchresultslist.php @@ -232,7 +232,7 @@ class ResultItem $this->profile_image_url = ($avatar) ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_STREAM_SIZE); - $this->created_at = date('r', $this->notice->created); + $this->created_at = common_date_rfc2822($this->notice->created); } /** -- cgit v1.2.3-54-g00ecf From ff7d71181038ba1e97e9bbcaa7901638aa715574 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 15 Apr 2009 10:05:16 -0400 Subject: add user id to statistics --- lib/profileaction.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib') diff --git a/lib/profileaction.php b/lib/profileaction.php index c81924e31..1f2e30994 100644 --- a/lib/profileaction.php +++ b/lib/profileaction.php @@ -179,6 +179,11 @@ class ProfileAction extends Action $this->element('h2', null, _('Statistics')); // Other stats...? + $this->elementStart('dl', 'entity_user-id'); + $this->element('dt', null, _('User ID')); + $this->element('dd', null, $this->profile->id); + $this->elementEnd('dl'); + $this->elementStart('dl', 'entity_member-since'); $this->element('dt', null, _('Member since')); $this->element('dd', null, date('j M Y', -- cgit v1.2.3-54-g00ecf From c6816c163e813ac4bc8163cba7ab08c54d8320d5 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Fri, 15 May 2009 14:18:04 -0400 Subject: reformat action.php --- lib/action.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'lib') diff --git a/lib/action.php b/lib/action.php index 2ec9329e0..4bd41c226 100644 --- a/lib/action.php +++ b/lib/action.php @@ -98,15 +98,15 @@ class Action extends HTMLOutputter // lawsuit Event::handle('EndShowHTML', array($this)); } if (Event::handle('StartShowHead', array($this))) { - $this->showHead(); + $this->showHead(); Event::handle('EndShowHead', array($this)); } if (Event::handle('StartShowBody', array($this))) { - $this->showBody(); + $this->showBody(); Event::handle('EndShowBody', array($this)); } if (Event::handle('StartEndHTML', array($this))) { - $this->endHTML(); + $this->endHTML(); Event::handle('EndEndHTML', array($this)); } } @@ -347,7 +347,7 @@ class Action extends HTMLOutputter // lawsuit { $this->elementStart('body', (common_current_user()) ? array('id' => $this->trimmed('action'), 'class' => 'user_in') - : array('id' => $this->trimmed('action'))); + : array('id' => $this->trimmed('action'))); $this->elementStart('div', array('id' => 'wrap')); if (Event::handle('StartShowHeader', array($this))) { $this->showHeader(); @@ -431,10 +431,10 @@ class Action extends HTMLOutputter // lawsuit _('Connect'), _('Connect to SMS, Twitter'), false, 'nav_connect'); } $this->menuItem(common_local_url('invite'), - _('Invite'), - sprintf(_('Invite friends and colleagues to join you on %s'), - common_config('site', 'name')), - false, 'nav_invitecontact'); + _('Invite'), + sprintf(_('Invite friends and colleagues to join you on %s'), + common_config('site', 'name')), + false, 'nav_invitecontact'); $this->menuItem(common_local_url('logout'), _('Logout'), _('Logout from the site'), false, 'nav_logout'); } @@ -629,7 +629,7 @@ class Action extends HTMLOutputter // lawsuit $this->elementStart('div', array('id' => 'aside_primary', 'class' => 'aside')); if (Event::handle('StartShowExportData', array($this))) { - $this->showExportData(); + $this->showExportData(); Event::handle('EndShowExportData', array($this)); } if (Event::handle('StartShowSections', array($this))) { -- cgit v1.2.3-54-g00ecf From 14662354dc501e811dd714aa72fd8001842ee672 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Fri, 15 May 2009 14:22:49 -0400 Subject: add hooks for subgroupnav showing --- EVENTS.txt | 6 +++++ lib/subgroupnav.php | 68 +++++++++++++++++++++++++++++------------------------ 2 files changed, 43 insertions(+), 31 deletions(-) (limited to 'lib') diff --git a/EVENTS.txt b/EVENTS.txt index 5edf59245..07fc446c3 100644 --- a/EVENTS.txt +++ b/EVENTS.txt @@ -100,6 +100,12 @@ StartPublicGroupNav: Showing the public group nav menu EndPublicGroupNav: At the end of the public group nav menu - $action: the current action +StartSubGroupNav: Showing the subscriptions group nav menu +- $action: the current action + +EndSubGroupNav: At the end of the subscriptions group nav menu +- $action: the current action + RouterInitialized: After the router instance has been initialized - $m: the Net_URL_Mapper that has just been set up diff --git a/lib/subgroupnav.php b/lib/subgroupnav.php index 31c3ea0b5..4a9b36ae8 100644 --- a/lib/subgroupnav.php +++ b/lib/subgroupnav.php @@ -74,38 +74,44 @@ class SubGroupNav extends Widget $this->out->elementStart('ul', array('class' => 'nav')); - $this->out->menuItem(common_local_url('subscriptions', - array('nickname' => - $this->user->nickname)), - _('Subscriptions'), - sprintf(_('People %s subscribes to'), - $this->user->nickname), - $action == 'subscriptions', - 'nav_subscriptions'); - $this->out->menuItem(common_local_url('subscribers', - array('nickname' => - $this->user->nickname)), - _('Subscribers'), - sprintf(_('People subscribed to %s'), - $this->user->nickname), - $action == 'subscribers', - 'nav_subscribers'); - $this->out->menuItem(common_local_url('usergroups', - array('nickname' => - $this->user->nickname)), - _('Groups'), - sprintf(_('Groups %s is a member of'), - $this->user->nickname), - $action == 'usergroups', - 'nav_usergroups'); - if (!is_null($cur) && $this->user->id === $cur->id) { - $this->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'); + if (Event::handle('StartSubGroupNav', array($this))) { + + $this->out->menuItem(common_local_url('subscriptions', + array('nickname' => + $this->user->nickname)), + _('Subscriptions'), + sprintf(_('People %s subscribes to'), + $this->user->nickname), + $action == 'subscriptions', + 'nav_subscriptions'); + $this->out->menuItem(common_local_url('subscribers', + array('nickname' => + $this->user->nickname)), + _('Subscribers'), + sprintf(_('People subscribed to %s'), + $this->user->nickname), + $action == 'subscribers', + 'nav_subscribers'); + $this->out->menuItem(common_local_url('usergroups', + array('nickname' => + $this->user->nickname)), + _('Groups'), + sprintf(_('Groups %s is a member of'), + $this->user->nickname), + $action == 'usergroups', + 'nav_usergroups'); + if (!is_null($cur) && $this->user->id === $cur->id) { + $this->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($this)); } + $this->out->elementEnd('ul'); } } -- cgit v1.2.3-54-g00ecf From 9d13890a859eb657c1ee95b1b2a1144fdf46d6b4 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Fri, 15 May 2009 17:11:28 -0400 Subject: add a hook for the page notice --- lib/action.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/action.php b/lib/action.php index 4bd41c226..6b130b6d5 100644 --- a/lib/action.php +++ b/lib/action.php @@ -591,7 +591,10 @@ class Action extends HTMLOutputter // lawsuit 'class' => 'system_notice')); $this->element('dt', null, _('Page notice')); $this->elementStart('dd'); - $this->showPageNotice(); + if (Event::handle('StartShowPageNotice', array($this))) { + $this->showPageNotice(); + Event::handle('EndShowPageNotice', array($this)); + } $this->elementEnd('dd'); $this->elementEnd('dl'); } -- cgit v1.2.3-54-g00ecf