From 94c858d1e191a92ca36abd47cb5603a67a759963 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Thu, 5 May 2011 14:57:38 -0700 Subject: [PATCH] * Show group descriptions in group directory * Truncate descriptions and bios in directory list when > 140c --- plugins/Directory/lib/sortablegrouplist.php | 31 +++++++++++++++++++ .../lib/sortablesubscriptionlist.php | 21 +++++++++++++ 2 files changed, 52 insertions(+) diff --git a/plugins/Directory/lib/sortablegrouplist.php b/plugins/Directory/lib/sortablegrouplist.php index 4f34a8a897..709547ae0f 100644 --- a/plugins/Directory/lib/sortablegrouplist.php +++ b/plugins/Directory/lib/sortablegrouplist.php @@ -149,6 +149,24 @@ class SortableGroupListItem extends SortableSubscriptionListItem } } + function showDescription() + { + if (!empty($this->profile->description)) { + $cutoff = 140; // XXX Should this be configurable? + $description = htmlspecialchars($this->profile->description); + + if (mb_strlen($description) > $cutoff) { + $description = mb_substr($description, 0, $cutoff - 1) + .'…'; + } + + $this->out->elementStart('p', 'note'); + $this->out->raw($description); + $this->out->elementEnd('p'); + } + + } + function showAvatar() { $logo = ($this->profile->stream_logo) ? @@ -205,6 +223,19 @@ class SortableGroupListItem extends SortableSubscriptionListItem } } + function showProfile() + { + $this->startProfile(); + $this->showAvatar(); + $this->showFullName(); + $this->showLocation(); + $this->showHomepage(); + $this->showDescription(); // groups have this instead of bios + // Relevant portion! + $this->showTags(); + $this->endProfile(); + } + function showActions() { $this->startActions(); diff --git a/plugins/Directory/lib/sortablesubscriptionlist.php b/plugins/Directory/lib/sortablesubscriptionlist.php index 8f6e66d20a..7685c86a6a 100644 --- a/plugins/Directory/lib/sortablesubscriptionlist.php +++ b/plugins/Directory/lib/sortablesubscriptionlist.php @@ -249,6 +249,27 @@ class SortableSubscriptionListItem extends SubscriptionListItem $this->out->elementEnd('td'); } + /** + * Overrided to truncate the bio if it's real long, because it + * looks better that way in the SortableSubscriptionList's table + */ + function showBio() + { + if (!empty($this->profile->bio)) { + $cutoff = 140; // XXX Should this be configurable? + $bio = htmlspecialchars($this->profile->bio); + + if (mb_strlen($bio) > $cutoff) { + $bio = mb_substr($bio, 0, $cutoff - 1) + .'…'; + } + + $this->out->elementStart('p', 'note'); + $this->out->raw($bio); + $this->out->elementEnd('p'); + } + } + /** * Only show the tags if we're logged in */ -- 2.39.2