From f42d4b18551eee1a8a8541047465d5beedb24bc2 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Tue, 28 Sep 2010 17:09:34 -0700 Subject: [PATCH] New eventsi: Start/EndShowNoticeOptions and Start/EndShowFaveForm --- EVENTS.txt | 16 ++++++++++++++-- lib/noticelist.php | 38 ++++++++++++++++++++++---------------- 2 files changed, 36 insertions(+), 18 deletions(-) diff --git a/EVENTS.txt b/EVENTS.txt index fd2bdb9d56..7b6ad40eb9 100644 --- a/EVENTS.txt +++ b/EVENTS.txt @@ -258,10 +258,22 @@ EndShowExportData: just after showing the
with export data (feeds) - $action: action object being shown StartShowNoticeItem: just before showing the notice item -- $action: action object being shown +- $item: The NoticeListItem object being shown EndShowNoticeItem: just after showing the notice item -- $action: action object being shown +- $item: the NoticeListItem object being shown + +StartShowNoticeOptions: just before showing notice options like fave, repeat, etc. +- $item: the NoticeListItem object being shown + +EndShowNoticeOptions: just after showing notice options like fave, repeat, etc. +- $item: the NoticeListItem object being shown + +StartShowFaveForm: just before showing the fave form +- $item: the NoticeListItem object being shown + +EndShowFaveForm: just after showing the fave form +- $item: the NoticeListItem object being shown StartShowPageNotice: just before showing the page notice (instructions or error) - $action: action object being shown diff --git a/lib/noticelist.php b/lib/noticelist.php index 529d6a3f90..cc460005ad 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)); } } -- 2.39.5