]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
show addressees in notice lists
authorEvan Prodromou <evan@status.net>
Sat, 16 Apr 2011 19:30:50 +0000 (15:30 -0400)
committerEvan Prodromou <evan@status.net>
Sat, 16 Apr 2011 19:30:50 +0000 (15:30 -0400)
lib/noticelistitem.php

index f7b28534bef6d5efd8def301e32c8b517d4cd184..45e8e5d7d251c4004705b5e1a2163ad84d7e3611 100644 (file)
@@ -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
      *