]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/Directory/lib/sortablegrouplist.php
Localisation updates from http://translatewiki.net.
[quix0rs-gnu-social.git] / plugins / Directory / lib / sortablegrouplist.php
index 4f875ce2c3d152589c1f6f1fd2dce6dbe54574d2..709547ae0f4ee0c9629ed9e02b115d7c4df2e771 100644 (file)
@@ -1,5 +1,4 @@
 <?php
-
 /**
  * StatusNet, the distributed open-source microblogging tool
  *
@@ -43,7 +42,6 @@ require_once INSTALLDIR . '/lib/subscriptionlist.php';
  * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  * @link     http://status.net/
  */
-
 class SortableGroupList extends SortableSubscriptionList
 {
     /** Owner of this list */
@@ -58,17 +56,18 @@ class SortableGroupList extends SortableSubscriptionList
 
     function startList()
     {
-        $this->out->elementStart('table', array('class' => 'profile_list xoxo', 'border' => '1'));
+        $this->out->elementStart('table', array('class' => 'profile_list xoxo'));
         $this->out->elementStart('thead');
         $this->out->elementStart('tr');
 
         $tableHeaders = array(
+            // TRANS: Column header in table for user nickname.
             'nickname'    => _m('Nickname'),
+            // TRANS: Column header in table for timestamp when user was created.
             'created'     => _m('Created')
         );
 
         foreach ($tableHeaders as $id => $label) {
-
             $attrs   = array('id' => $id);
             $current = (!empty($this->action->sort) && $this->action->sort == $id);
 
@@ -110,8 +109,8 @@ class SortableGroupList extends SortableSubscriptionList
             $this->out->elementEnd('th');
         }
 
+        // TRANS: Column header in table for members of a group.
         $this->out->element('th', array('id' => 'Members'), _m('Members'));
-        $this->out->element('th', array('id' => 'Admins'), _m('Admins'));
         $this->out->element('th', array('id' => 'controls'), null);
 
         $this->out->elementEnd('tr');
@@ -120,25 +119,6 @@ class SortableGroupList extends SortableSubscriptionList
         $this->out->elementStart('tbody');
     }
 
-    function showProfiles()
-    {
-        $cnt = 0;
-
-        while ($this->profile->fetch()) {
-            $cnt++;
-            if($cnt > PROFILES_PER_PAGE) {
-                break;
-            }
-
-            $odd = ($cnt % 2 == 0); // for zebra striping
-
-            $pli = $this->newListItem($this->profile, $odd);
-            $pli->show();
-        }
-
-        return $cnt;
-    }
-
     function newListItem($profile, $odd)
     {
         return new SortableGroupListItem($profile, $this->owner, $this->action, $odd);
@@ -158,20 +138,6 @@ class SortableGroupListItem extends SortableSubscriptionListItem
         $this->owner = $owner;
     }
 
-    function startItem()
-    {
-        $attr = array(
-            'class' => 'profile',
-            'id'    => 'profile-' . $this->profile->id
-        );
-
-        if ($this->alt) {
-            $attr['class'] .= ' alt';
-        }
-
-        $this->out->elementStart('tr', $attr);
-    }
-
     function showHomepage()
     {
         if (!empty($this->profile->homepage)) {
@@ -183,52 +149,55 @@ class SortableGroupListItem extends SortableSubscriptionListItem
         }
     }
 
-    function showAvatar()
+    function showDescription()
     {
-        $avatar = $this->profile->stream_logo;
-        $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,
-                                         'height' => AVATAR_STREAM_SIZE,
-                                         'alt' =>
-                                         ($this->profile->fullname) ? $this->profile->fullname :
-                                         $this->profile->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');
-        $this->out->elementEnd('a');
-    }
+        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>';
+            }
 
-    function endItem()
-    {
-        $this->out->elementEnd('tr');
-    }
-
-    function startProfile()
-    {
-        $this->out->elementStart('td', 'entity_profile vcard entry-content');
-    }
+            $this->out->elementStart('p', 'note');
+            $this->out->raw($description);
+            $this->out->elementEnd('p');
+        }
 
-    function endProfile()
-    {
-        $this->out->elementEnd('td');
     }
 
-    function startActions()
+    function showAvatar()
     {
-        $this->out->elementStart('td', 'entity_actions');
-        $this->out->elementStart('ul');
-    }
+        $logo = ($this->profile->stream_logo) ?
+        $this->profile->stream_logo : User_group::defaultLogo(AVATAR_STREAM_SIZE);
+
+        $this->out->elementStart(
+            'a',
+            array(
+                'href'  => $this->profile->homeUrl(),
+                'class' => 'url entry-title',
+                'rel'   => 'contact group'
+            )
+        );
+        $this->out->element(
+            'img',
+            array(
+                'src'    => $logo,
+                'class'  => 'photo avatar',
+                'width'  => AVATAR_STREAM_SIZE,
+                'height' => AVATAR_STREAM_SIZE,
+                'alt'    => ($this->profile->fullname)
+                    ? $this->profile->fullname : $this->profile->nickname
+            )
+        );
 
-    function endActions()
-    {
-        $this->out->elementEnd('ul');
-        $this->out->elementEnd('td');
+        $this->out->text(' ');
+        $hasFN = ($this->profile->fullname) ? 'nickname' : 'fn org nickname';
+        $this->out->elementStart('span', $hasFN);
+        $this->out->raw($this->highlight($this->profile->nickname));
+        $this->out->elementEnd('span');
+        $this->out->elementEnd('a');
     }
 
     function show()
@@ -243,17 +212,30 @@ class SortableGroupListItem extends SortableSubscriptionListItem
             // XXX Add events?
             $this->showCreatedDate();
             $this->showMemberCount();
-            $this->showAdmins();
 
             if (Event::handle('StartProfileListItemActions', array($this))) {
                 $this->showActions();
                 Event::handle('EndProfileListItemActions', array($this));
             }
             $this->endItem();
+
             Event::handle('EndProfileListItem', array($this));
         }
     }
 
+    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();
@@ -266,11 +248,9 @@ class SortableGroupListItem extends SortableSubscriptionListItem
 
     function showJoinButton()
     {
-        $this->out->elementStart('td', 'entry_controls');
-
         $user = $this->owner;
         if ($user) {
-  
+
             $this->out->elementStart('li', 'entity_subscribe');
             // XXX: special-case for user looking at own
             // subscriptions page
@@ -281,14 +261,14 @@ class SortableGroupListItem extends SortableSubscriptionListItem
                 $jf = new JoinForm($this->out, $this->profile);
                 $jf->show();
             }
-        }
-        $this->out->elementEnd('td');
 
+            $this->out->elementEnd('li');
+        }
     }
 
     function showMemberCount()
     {
-        $this->out->elementStart('td', 'entry_subscriber_count');
+        $this->out->elementStart('td', 'entry_member_count');
         $this->out->raw($this->profile->getMemberCount());
         $this->out->elementEnd('td');
     }
@@ -296,13 +276,14 @@ class SortableGroupListItem extends SortableSubscriptionListItem
     function showCreatedDate()
     {
         $this->out->elementStart('td', 'entry_created');
+        // @todo FIXME: Should we provide i18n for timestamps in core?
         $this->out->raw(date('j M Y', strtotime($this->profile->created)));
         $this->out->elementEnd('td');
     }
 
     function showAdmins()
     {
-        $this->out->elementStart('td', 'entry_notice_count');
+        $this->out->elementStart('td', 'entry_admins');
         // @todo
         $this->out->raw('gargargar');
         $this->out->elementEnd('td');
@@ -318,5 +299,4 @@ class SortableGroupListItem extends SortableSubscriptionListItem
         }
 
     }
-
 }