From 21759c31326ace83498466794d9b692f3f2ae077 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Tue, 28 Sep 2010 17:09:34 -0700 Subject: New eventsi: Start/EndShowNoticeOptions and Start/EndShowFaveForm --- lib/noticelist.php | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) (limited to 'lib') diff --git a/lib/noticelist.php b/lib/noticelist.php index 529d6a3f9..cc460005a 100644 --- a/lib/noticelist.php +++ b/lib/noticelist.php @@ -236,14 +236,17 @@ class NoticeListItem extends Widget function showNoticeOptions() { - $user = common_current_user(); - if ($user) { - $this->out->elementStart('div', 'notice-options'); - $this->showFaveForm(); - $this->showReplyLink(); - $this->showRepeatForm(); - $this->showDeleteLink(); - $this->out->elementEnd('div'); + if (Event::handle('StartShowNoticeOptions', array($this))) { + $user = common_current_user(); + if ($user) { + $this->out->elementStart('div', 'notice-options'); + $this->showFaveForm(); + $this->showReplyLink(); + $this->showRepeatForm(); + $this->showDeleteLink(); + $this->out->elementEnd('div'); + } + Event::handle('EndShowNoticeOptions', array($this)); } } @@ -270,15 +273,18 @@ class NoticeListItem extends Widget function showFaveForm() { - $user = common_current_user(); - if ($user) { - if ($user->hasFave($this->notice)) { - $disfavor = new DisfavorForm($this->out, $this->notice); - $disfavor->show(); - } else { - $favor = new FavorForm($this->out, $this->notice); - $favor->show(); + if (Event::handle('StartShowFaveForm', array($this))) { + $user = common_current_user(); + if ($user) { + if ($user->hasFave($this->notice)) { + $disfavor = new DisfavorForm($this->out, $this->notice); + $disfavor->show(); + } else { + $favor = new FavorForm($this->out, $this->notice); + $favor->show(); + } } + Event::handle('EndShowFaveForm', array($this)); } } -- cgit v1.2.3-54-g00ecf From 331502a9790806ca48e61eb94d9489ddf7baeb55 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Wed, 29 Sep 2010 12:49:26 -0700 Subject: Add Start/EndShowNoticeInfo events --- EVENTS.txt | 6 ++++++ lib/noticelist.php | 14 +++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/EVENTS.txt b/EVENTS.txt index d722bc4ac..7f6890ff0 100644 --- a/EVENTS.txt +++ b/EVENTS.txt @@ -263,6 +263,12 @@ StartShowNoticeItem: just before showing the notice item EndShowNoticeItem: just after showing the notice item - $item: the NoticeListItem object being shown +StartShowNoticeInfo: just before showing notice info +- $item: The NoticeListItem object being shown + +EndShowNoticeInfo: just after showing notice info +- $item: The NoticeListItem object being shown + StartShowNoticeOptions: just before showing notice options like fave, repeat, etc. - $item: the NoticeListItem object being shown diff --git a/lib/noticelist.php b/lib/noticelist.php index cc460005a..df1533980 100644 --- a/lib/noticelist.php +++ b/lib/noticelist.php @@ -226,11 +226,15 @@ class NoticeListItem extends Widget function showNoticeInfo() { $this->out->elementStart('div', 'entry-content'); - $this->showNoticeLink(); - $this->showNoticeSource(); - $this->showNoticeLocation(); - $this->showContext(); - $this->showRepeat(); + if (Event::handle('StartShowNoticeInfo', array($this))) { + $this->showNoticeLink(); + $this->showNoticeSource(); + $this->showNoticeLocation(); + $this->showContext(); + $this->showRepeat(); + Event::handle('EndShowNoticeInfo', array($this)); + } + $this->out->elementEnd('div'); } -- cgit v1.2.3-54-g00ecf From 0ac333ec801b8df68da69fa38a13d07960bd9649 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Wed, 29 Sep 2010 14:07:46 -0700 Subject: Add Start/EndFavorNoticeForm and Start/EndDisFavorNoticeForm hooks --- EVENTS.txt | 16 ++++++++++++++++ lib/disfavorform.php | 10 +++++++--- lib/favorform.php | 9 ++++++--- 3 files changed, 29 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/EVENTS.txt b/EVENTS.txt index 7f6890ff0..249641617 100644 --- a/EVENTS.txt +++ b/EVENTS.txt @@ -774,6 +774,22 @@ EndDisfavorNotice: After saving a notice as a favorite - $profile: profile of the person faving (can be remote!) - $notice: notice being faved +StartFavorNoticeForm: starting the data in the form for favoring a notice +- $FavorForm: the favor form being shown +- $notice: notice being favored + +EndFavorNoticeForm: Ending the data in the form for favoring a notice +- $FavorForm: the favor form being shown +- $notice: notice being favored + +StartDisFavorNoticeForm: starting the data in the form for disfavoring a notice +- $DisfavorForm: the disfavor form being shown +- $notice: notice being difavored + +EndDisFavorNoticeForm: Ending the data in the form for disfavoring a notice +- $DisfavorForm: the disfavor form being shown +- $notice: notice being disfavored + StartFindMentions: start finding mentions in a block of text - $sender: sender profile - $text: plain text version of the notice diff --git a/lib/disfavorform.php b/lib/disfavorform.php index 5b135b38a..6023766d7 100644 --- a/lib/disfavorform.php +++ b/lib/disfavorform.php @@ -123,9 +123,13 @@ class DisfavorForm extends Form function formData() { - $this->out->hidden('notice-n'.$this->notice->id, - $this->notice->id, - 'notice'); + if (Event::handle('StartDisFavorNoticeForm', array($this, $this->notice))) { + $this->out->hidden('notice-n'.$this->notice->id, + $this->notice->id, + 'notice'); + Event::handle('EndDisFavorNoticeForm', array($this, $this->notice)); + } + } /** diff --git a/lib/favorform.php b/lib/favorform.php index 625df7c8b..4e2891ffd 100644 --- a/lib/favorform.php +++ b/lib/favorform.php @@ -123,9 +123,12 @@ class FavorForm extends Form function formData() { - $this->out->hidden('notice-n'.$this->notice->id, - $this->notice->id, - 'notice'); + if (Event::handle('StartFavorNoticeForm', array($this, $this->notice))) { + $this->out->hidden('notice-n'.$this->notice->id, + $this->notice->id, + 'notice'); + Event::handle('EndFavorNoticeForm', array($this, $this->notice)); + } } /** -- cgit v1.2.3-54-g00ecf