X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FDirectory%2Flib%2Fsortablegrouplist.php;h=ab00068f6d20a5f438794e1986dc3d07a98db8b8;hb=2b4a6c7dd723c404a48b629766279c24b45f54b4;hp=37642e9b9c19b58b5945b649d63c1361829865ff;hpb=220b51d8be61e9bd316567f3ad03fffdbc4b7526;p=quix0rs-gnu-social.git diff --git a/plugins/Directory/lib/sortablegrouplist.php b/plugins/Directory/lib/sortablegrouplist.php index 37642e9b9c..ab00068f6d 100644 --- a/plugins/Directory/lib/sortablegrouplist.php +++ b/plugins/Directory/lib/sortablegrouplist.php @@ -27,11 +27,7 @@ * @link http://status.net/ */ -if (!defined('STATUSNET')) { - exit(1); -} - -require_once INSTALLDIR . '/lib/subscriptionlist.php'; +if (!defined('GNUSOCIAL')) { exit(1); } /** * Widget to show a sortable list of subscriptions @@ -44,16 +40,6 @@ require_once INSTALLDIR . '/lib/subscriptionlist.php'; */ class SortableGroupList extends SortableSubscriptionList { - /** Owner of this list */ - var $owner = null; - - function __construct($profile, $owner=null, $action=null) - { - parent::__construct($profile, $owner, $action); - - $this->owner = $owner; - } - function startList() { $this->out->elementStart('table', array('class' => 'profile_list xoxo')); @@ -119,25 +105,14 @@ class SortableGroupList extends SortableSubscriptionList $this->out->elementStart('tbody'); } - function newListItem($profile, $odd) + function newListItem($profile) { - return new SortableGroupListItem($profile, $this->owner, $this->action, $odd); + return new SortableGroupListItem($profile, $this->owner, $this->action); } } class SortableGroupListItem extends SortableSubscriptionListItem { - /** Owner of this list */ - var $owner = null; - - function __construct($profile, $owner, $action, $alt) - { - parent::__construct($profile, $owner, $action, $alt); - - $this->alt = $alt; // is this row alternate? - $this->owner = $owner; - } - function showHomepage() { if (!empty($this->profile->homepage)) { @@ -167,37 +142,16 @@ class SortableGroupListItem extends SortableSubscriptionListItem } - function showAvatar() + // TODO: Make sure we can do ->getAvatar() for group profiles too! + function showAvatar(Profile $profile, $size=null) { - $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 - ) - ); + $logo = $profile->getGroup()->stream_logo ?: User_group::defaultLogo($size ?: $this->avatarSize()); - $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'); + $this->out->element('img', array('src' => $logo, + 'class' => 'avatar u-photo', + 'width' => AVATAR_STREAM_SIZE, + 'height' => AVATAR_STREAM_SIZE, + 'alt' => $profile->getBestName())); } function show() @@ -226,7 +180,13 @@ class SortableGroupListItem extends SortableSubscriptionListItem function showProfile() { $this->startProfile(); - $this->showAvatar(); + + $this->showAvatar($this->profile->getProfile()); + $this->out->element('a', array('href' => $this->profile->homeUrl(), + 'class' => 'p-org p-nickname', + 'rel' => 'contact group'), + $this->profile->getNickname()); + $this->showFullName(); $this->showLocation(); $this->showHomepage(); @@ -236,6 +196,23 @@ class SortableGroupListItem extends SortableSubscriptionListItem $this->endProfile(); } + function endActions() + { + // delete button + $cur = common_current_user(); + list($action, $r2args) = $this->out->returnToArgs(); + $r2args['action'] = $action; + if ($cur instanceof User && $cur->hasRight(Right::DELETEGROUP)) { + $this->out->elementStart('li', 'entity_delete'); + $df = new DeleteGroupForm($this->out, $this->profile, $r2args); + $df->show(); + $this->out->elementEnd('li'); + } + + $this->out->elementEnd('ul'); + $this->out->elementEnd('td'); + } + function showActions() { $this->startActions();