From 83dfe5ed3e8c2e9932a7386bd7976989785b3c42 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sat, 16 Apr 2011 15:30:50 -0400 Subject: [PATCH] show addressees in notice lists --- lib/noticelistitem.php | 77 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 72 insertions(+), 5 deletions(-) diff --git a/lib/noticelistitem.php b/lib/noticelistitem.php index f7b28534be..45e8e5d7d2 100644 --- a/lib/noticelistitem.php +++ b/lib/noticelistitem.php @@ -205,20 +205,87 @@ class NoticeListItem extends Widget function showAuthor() { - $this->out->elementStart('div', 'vcard author'); + $this->out->elementStart('div', 'author'); + + $this->out->elementStart('span', 'vcard author'); + $attrs = array('href' => $this->profile->profileurl, 'class' => 'url', 'title' => $this->profile->nickname); + $this->out->elementStart('a', $attrs); $this->showAvatar(); - $this->out->elementEnd('a'); - $this->out->element('a', array('href' => $this->profile->profileurl, - 'class' => 'url nickname fn', - 'title' => $this->profile->nickname), + $this->out->text(' '); + $this->out->element('span',array('class' => 'nickname fn'), $this->profile->getBestName()); + $this->out->elementEnd('a'); + + $this->out->elementEnd('span'); + + $this->showAddressees(); + $this->out->elementEnd('div'); } + function showAddressees() + { + $this->out->elementStart('span', 'addressees'); + + $cnt = $this->showGroupAddressees(true); + $cnt = $this->showProfileAddressees($cnt == 0); + + $this->out->elementEnd('span', 'addressees'); + } + + function showGroupAddressees($first) + { + $groups = $this->getGroups(); + + foreach ($groups as $group) { + if (!$first) { + $this->out->text(', '); + } else { + $this->out->text(' ▶ '); + $first = false; + } + $this->out->element('a', array('href' => $group->homeUrl(), + 'title' => $group->nickname, + 'class' => 'addressee group'), + $group->getBestName()); + } + + return count($groups); + } + + function getGroups() + { + return $this->notice->getGroups(); + } + + function showProfileAddressees($first) + { + $replies = $this->getReplyProfiles(); + + foreach ($replies as $reply) { + if (!$first) { + $this->out->text(', '); + } else { + $first = false; + } + $this->out->element('a', array('href' => $reply->profileurl, + 'title' => $reply->nickname, + 'class' => 'addressee account'), + $reply->getBestName()); + } + + return count($replies); + } + + function getReplyProfiles() + { + return $this->notice->getReplyProfiles(); + } + /** * show the avatar of the notice's author *