From 1a4652b1ade6ea4de842835a7d2a011845a1cd62 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Wed, 3 Mar 2010 10:32:54 -0500 Subject: [PATCH 1/5] Changed label text for remote subscription to something similar. Given that this button will be used within context of subscriptions, 'New' works along with the '+' icon. --- plugins/OStatus/OStatusPlugin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/OStatus/OStatusPlugin.php b/plugins/OStatus/OStatusPlugin.php index 7b6d22acf3..b5e6867c87 100644 --- a/plugins/OStatus/OStatusPlugin.php +++ b/plugins/OStatus/OStatusPlugin.php @@ -727,7 +727,7 @@ class OStatusPlugin extends Plugin 'class' => 'entity_subscribe')); $action->element('a', array('href' => common_local_url('ostatussub'), 'class' => 'entity_remote_subscribe') - , _m('Subscribe to remote user')); + , _m('New')); $action->elementEnd('p'); $action->elementEnd('div'); } From 06fb1124f5cd328bc0b3028a0cc0499b1c916653 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Wed, 3 Mar 2010 11:14:39 -0500 Subject: [PATCH 2/5] Added event hooks for start and end of subscriptions mini list --- EVENTS.txt | 6 ++++++ lib/profileaction.php | 35 +++++++++++++++++++---------------- 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/EVENTS.txt b/EVENTS.txt index bb4936b354..a40855134e 100644 --- a/EVENTS.txt +++ b/EVENTS.txt @@ -776,6 +776,12 @@ StartShowAllContent: before showing the all (you and friends) content EndShowAllContent: after showing the all (you and friends) content - $action: the current action +StartShowSubscriptionsMiniList: at the start of subscriptions mini list +- $action: the current action + +EndShowSubscriptionsMiniList: at the end of subscriptions mini list +- $action: the current action + StartDeleteUserForm: starting the data in the form for deleting a user - $action: action being shown - $user: user being deleted diff --git a/lib/profileaction.php b/lib/profileaction.php index 2d4d232655..2bda8b07c9 100644 --- a/lib/profileaction.php +++ b/lib/profileaction.php @@ -106,27 +106,30 @@ class ProfileAction extends OwnerDesignAction $this->elementStart('div', array('id' => 'entity_subscriptions', 'class' => 'section')); - $this->element('h2', null, _('Subscriptions')); + if (Event::handle('StartShowSubscriptionsMiniList', array($this))) { + $this->element('h2', null, _('Subscriptions')); - $cnt = 0; + $cnt = 0; - if (!empty($profile)) { - $pml = new ProfileMiniList($profile, $this); - $cnt = $pml->show(); - if ($cnt == 0) { - $this->element('p', null, _('(None)')); + if (!empty($profile)) { + $pml = new ProfileMiniList($profile, $this); + $cnt = $pml->show(); + if ($cnt == 0) { + $this->element('p', null, _('(None)')); + } } - } - if ($cnt > PROFILES_PER_MINILIST) { - $this->elementStart('p'); - $this->element('a', array('href' => common_local_url('subscriptions', - array('nickname' => $this->profile->nickname)), - 'class' => 'more'), - _('All subscriptions')); - $this->elementEnd('p'); - } + if ($cnt > PROFILES_PER_MINILIST) { + $this->elementStart('p'); + $this->element('a', array('href' => common_local_url('subscriptions', + array('nickname' => $this->profile->nickname)), + 'class' => 'more'), + _('All subscriptions')); + $this->elementEnd('p'); + } + Event::handle('EndShowSubscriptionsMiniList', array($this)); + } $this->elementEnd('div'); } From ea10805e3f68f5781321e7c93144242478081a1f Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Wed, 3 Mar 2010 11:22:21 -0500 Subject: [PATCH 3/5] Moved the remote subscription button to subscription mini list --- plugins/OStatus/OStatusPlugin.php | 2 +- plugins/OStatus/theme/base/css/ostatus.css | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/plugins/OStatus/OStatusPlugin.php b/plugins/OStatus/OStatusPlugin.php index b5e6867c87..eb777c6b2f 100644 --- a/plugins/OStatus/OStatusPlugin.php +++ b/plugins/OStatus/OStatusPlugin.php @@ -711,7 +711,7 @@ class OStatusPlugin extends Plugin return true; } - function onStartShowAllContent($action) + function onEndShowSubscriptionsMiniList($action) { $this->showEntityRemoteSubscribe($action); diff --git a/plugins/OStatus/theme/base/css/ostatus.css b/plugins/OStatus/theme/base/css/ostatus.css index 13e30ef5df..40cdfcef13 100644 --- a/plugins/OStatus/theme/base/css/ostatus.css +++ b/plugins/OStatus/theme/base/css/ostatus.css @@ -41,8 +41,22 @@ min-width:96px; #entity_remote_subscribe { padding:0; float:right; +position:relative; } -#all #entity_remote_subscribe { -margin-top:-52px; +.section .entity_actions { +margin-bottom:0; +} + +.section #entity_remote_subscribe .entity_remote_subscribe { +border-color:#AAAAAA; +} + +.section #entity_remote_subscribe .dialogbox { +width:405px; +} + + +.aside #entity_subscriptions .more { +float:left; } From b65ee23e8293c301f8b142320eabff6c4acdfcfe Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Wed, 3 Mar 2010 12:01:38 -0500 Subject: [PATCH 4/5] Added event hooks for group subscribe --- EVENTS.txt | 8 ++++++++ actions/showgroup.php | 24 +++++++++++++----------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/EVENTS.txt b/EVENTS.txt index a40855134e..2c3863f228 100644 --- a/EVENTS.txt +++ b/EVENTS.txt @@ -363,6 +363,14 @@ EndProfileRemoteSubscribe: After showing the link to remote subscription - $userprofile: UserProfile widget - &$profile: the profile being shown +StartGroupSubscribe: Before showing the link to remote subscription +- $action: the current action +- $group: the group being shown + +EndGroupSubscribe: After showing the link to remote subscription +- $action: the current action +- $group: the group being shown + StartProfilePageProfileSection: Starting to show the section of the profile page with the actual profile data; hook to prevent showing the profile (e.g.) diff --git a/actions/showgroup.php b/actions/showgroup.php index 4e1fcb6c7b..a1dc3865bd 100644 --- a/actions/showgroup.php +++ b/actions/showgroup.php @@ -300,20 +300,22 @@ class ShowgroupAction extends GroupDesignAction $this->elementStart('div', 'entity_actions'); $this->element('h2', null, _('Group actions')); $this->elementStart('ul'); - $this->elementStart('li', 'entity_subscribe'); - $cur = common_current_user(); - if ($cur) { - if ($cur->isMember($this->group)) { - $lf = new LeaveForm($this, $this->group); - $lf->show(); - } else if (!Group_block::isBlocked($this->group, $cur->getProfile())) { - $jf = new JoinForm($this, $this->group); - $jf->show(); + if (Event::handle('StartGroupSubscribe', array($this, $this->group))) { + $this->elementStart('li', 'entity_subscribe'); + $cur = common_current_user(); + if ($cur) { + if ($cur->isMember($this->group)) { + $lf = new LeaveForm($this, $this->group); + $lf->show(); + } else if (!Group_block::isBlocked($this->group, $cur->getProfile())) { + $jf = new JoinForm($this, $this->group); + $jf->show(); + } } + $this->elementEnd('li'); + Event::handle('EndGroupSubscribe', array($this, $this->group)); } - $this->elementEnd('li'); - $this->elementEnd('ul'); $this->elementEnd('div'); } From 11750e832f994013b2fbce860bd24d24f49a14db Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Wed, 3 Mar 2010 12:02:10 -0500 Subject: [PATCH 5/5] Added remote join action for group profile --- plugins/OStatus/OStatusPlugin.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/plugins/OStatus/OStatusPlugin.php b/plugins/OStatus/OStatusPlugin.php index eb777c6b2f..014fb0b380 100644 --- a/plugins/OStatus/OStatusPlugin.php +++ b/plugins/OStatus/OStatusPlugin.php @@ -210,6 +210,26 @@ class OStatusPlugin extends Plugin return false; } + function onStartGroupSubscribe($output, $group) + { + $cur = common_current_user(); + + if (empty($cur)) { + // Add an OStatus subscribe + $output->elementStart('li', 'entity_subscribe'); + $url = common_local_url('ostatusinit', + array('nickname' => $group->nickname)); + $output->element('a', array('href' => $url, + 'class' => 'entity_remote_subscribe'), + _m('Join')); + + $output->elementEnd('li'); + } + + return false; + } + + /** * Check if we've got remote replies to send via Salmon. *