]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/profilelist.php
people tag UI elements
[quix0rs-gnu-social.git] / lib / profilelist.php
index 5f536e0f4d24cc94868fecabed3d4b289d2b65d4..af38fa71d9bc62f1fcf0ea3593579f4771a5ffe3 100644 (file)
@@ -33,6 +33,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
 }
 
 require_once INSTALLDIR.'/lib/widget.php';
+require_once INSTALLDIR.'/lib/peopletags.php';
 
 /**
  * Widget to show a list of profiles
@@ -76,7 +77,7 @@ class ProfileList extends Widget
 
     function startList()
     {
-        $this->out->elementStart('ul', 'profiles');
+        $this->out->elementStart('ul', 'profiles xoxo');
     }
 
     function endList()
@@ -140,7 +141,7 @@ class ProfileListItem extends Widget
 
     function startItem()
     {
-        $this->out->elementStart('li', array('class' => 'profile',
+        $this->out->elementStart('li', array('class' => 'profile hentry',
                                              'id' => 'profile-' . $this->profile->id));
     }
 
@@ -168,6 +169,10 @@ class ProfileListItem extends Widget
                 $this->showBio();
                 Event::handle('EndProfileListItemBio', array($this));
             }
+            if (Event::handle('StartProfileListItemTags', array($this))) {
+                $this->showTags();
+                Event::handle('EndProfileListItemTags', array($this));
+            }
             Event::handle('EndProfileListItemProfileElements', array($this));
         }
         $this->endProfile();
@@ -175,14 +180,14 @@ class ProfileListItem extends Widget
 
     function startProfile()
     {
-        $this->out->elementStart('div', 'entity_profile vcard');
+        $this->out->elementStart('div', 'entity_profile vcard entry-content');
     }
 
     function showAvatar()
     {
         $avatar = $this->profile->getAvatar(AVATAR_STREAM_SIZE);
-        $this->out->elementStart('a', array('href' => $this->profile->profileurl,
-                                            'class' => 'url'));
+        $aAttrs = $this->linkAttributes();
+        $this->out->elementStart('a', $aAttrs);
         $this->out->element('img', array('src' => ($avatar) ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_STREAM_SIZE),
                                          'class' => 'photo avatar',
                                          'width' => AVATAR_STREAM_SIZE,
@@ -190,7 +195,8 @@ class ProfileListItem extends Widget
                                          'alt' =>
                                          ($this->profile->fullname) ? $this->profile->fullname :
                                          $this->profile->nickname));
-        $hasFN = ($this->profile->fullname !== '') ? 'nickname' : 'fn nickname';
+        $this->out->text(' ');
+        $hasFN = (!empty($this->profile->fullname)) ? 'nickname' : 'fn nickname';
         $this->out->elementStart('span', $hasFN);
         $this->out->raw($this->highlight($this->profile->nickname));
         $this->out->elementEnd('span');
@@ -200,6 +206,7 @@ class ProfileListItem extends Widget
     function showFullName()
     {
         if (!empty($this->profile->fullname)) {
+            $this->out->text(' ');
             $this->out->elementStart('span', 'fn');
             $this->out->raw($this->highlight($this->profile->fullname));
             $this->out->elementEnd('span');
@@ -209,7 +216,8 @@ class ProfileListItem extends Widget
     function showLocation()
     {
         if (!empty($this->profile->location)) {
-            $this->out->elementStart('span', 'location');
+            $this->out->text(' ');
+            $this->out->elementStart('span', 'label');
             $this->out->raw($this->highlight($this->profile->location));
             $this->out->elementEnd('span');
         }
@@ -218,8 +226,9 @@ class ProfileListItem extends Widget
     function showHomepage()
     {
         if (!empty($this->profile->homepage)) {
-            $this->out->elementStart('a', array('href' => $this->profile->homepage,
-                                                'class' => 'url'));
+            $this->out->text(' ');
+            $aAttrs = $this->homepageAttributes();
+            $this->out->elementStart('a', $aAttrs);
             $this->out->raw($this->highlight($this->profile->homepage));
             $this->out->elementEnd('a');
         }
@@ -234,6 +243,20 @@ class ProfileListItem extends Widget
         }
     }
 
+    function showTags()
+    {
+        $user = common_current_user();
+        if (!empty($user)) {
+            if ($user->id == $this->profile->id) {
+                $tags = new SelftagsWidget($this->out, $user, $this->profile);
+                $tags->show();
+            } else if ($user->getProfile()->canTag($this->profile)) {
+                $tags = new PeopletagsWidget($this->out, $user, $this->profile);
+                $tags->show();
+            }
+        }
+    }
+
     function endProfile()
     {
         $this->out->elementEnd('div');
@@ -268,10 +291,9 @@ class ProfileListItem extends Widget
                 $usf = new UnsubscribeForm($this->out, $this->profile);
                 $usf->show();
             } else {
-                // Is it a local user? can't remote sub from a list
-                // XXX: make that possible!
-                $other = User::staticGet('id', $this->profile->id);
-                if (!empty($other)) {
+                // We can't initiate sub for a remote OMB profile.
+                $remote = Remote_profile::staticGet('id', $this->profile->id);
+                if (empty($remote)) {
                     $sf = new SubscribeForm($this->out, $this->profile);
                     $sf->show();
                 }
@@ -295,4 +317,17 @@ class ProfileListItem extends Widget
     {
         return htmlspecialchars($text);
     }
+
+    function linkAttributes()
+    {
+        return array('href' => $this->profile->profileurl,
+                     'class' => 'url entry-title',
+                     'rel' => 'contact');
+    }
+
+    function homepageAttributes()
+    {
+        return array('href' => $this->profile->homepage,
+                     'class' => 'url');
+    }
 }