]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
* Show group descriptions in group directory
authorZach Copley <zach@status.net>
Thu, 5 May 2011 21:57:38 +0000 (14:57 -0700)
committerZach Copley <zach@status.net>
Thu, 5 May 2011 21:57:38 +0000 (14:57 -0700)
* Truncate descriptions and bios in directory list when > 140c

plugins/Directory/lib/sortablegrouplist.php
plugins/Directory/lib/sortablesubscriptionlist.php

index 4f34a8a897722be45c7f8584ee197157ffe40a5d..709547ae0f4ee0c9629ed9e02b115d7c4df2e771 100644 (file)
@@ -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)
+                    .'<a href="' . $this->profile->homeUrl() .'">…</a>';
+            }
+
+            $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();
index 8f6e66d20a13cde5a959343214a1ae69f9e6e913..7685c86a6a160780068a1d3d4afe65fbccb517b9 100644 (file)
@@ -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)
+                    .'<a href="' . $this->profile->profileurl .'">…</a>';
+            }
+
+            $this->out->elementStart('p', 'note');
+            $this->out->raw($bio);
+            $this->out->elementEnd('p');
+        }
+    }
+
     /**
      * Only show the tags if we're logged in
      */