X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fshowgroup.php;h=2806944452288c95c4f03a3780f54876b1574328;hb=65bf58be806d19bc7fe962c0824160deab07d5c3;hp=c8728284420a73e571030b72305f2a8442ac4df6;hpb=23f69c80b5c6a8730fc6ff3b9f3cec71840de03b;p=quix0rs-gnu-social.git diff --git a/actions/showgroup.php b/actions/showgroup.php index c872828442..2806944452 100644 --- a/actions/showgroup.php +++ b/actions/showgroup.php @@ -68,12 +68,7 @@ class ShowgroupAction extends GroupDesignAction */ function title() { - if (!empty($this->group->fullname)) { - // @todo FIXME: Needs proper i18n. Maybe use a generic method for this? - $base = $this->group->fullname . ' (' . $this->group->nickname . ')'; - } else { - $base = $this->group->nickname; - } + $base = $this->group->getFancyName(); if ($this->page == 1) { // TRANS: Page title for first group page. %s is a group name. @@ -186,6 +181,7 @@ class ShowgroupAction extends GroupDesignAction function showContent() { $this->showGroupProfile(); + $this->showGroupActions(); $this->showGroupNotices(); } @@ -221,112 +217,123 @@ class ShowgroupAction extends GroupDesignAction $this->elementStart('div', array('id' => 'i', 'class' => 'entity_profile vcard author')); - // TRANS: Group profile header (h2). Text hidden by default. - $this->element('h2', null, _('Group profile')); + if (Event::handle('StartGroupProfileElements', array($this, $this->group))) { - $this->elementStart('dl', 'entity_depiction'); - // TRANS: Label for group avatar (dt). Text hidden by default. - $this->element('dt', null, _('Avatar')); - $this->elementStart('dd'); + // TRANS: Group profile header (h2). Text hidden by default. + $this->element('h2', null, _('Group profile')); - $logo = ($this->group->homepage_logo) ? - $this->group->homepage_logo : User_group::defaultLogo(AVATAR_PROFILE_SIZE); - - $this->element('img', array('src' => $logo, - 'class' => 'photo avatar', - 'width' => AVATAR_PROFILE_SIZE, - 'height' => AVATAR_PROFILE_SIZE, - 'alt' => $this->group->nickname)); - $this->elementEnd('dd'); - $this->elementEnd('dl'); + $this->elementStart('dl', 'entity_depiction'); + // TRANS: Label for group avatar (dt). Text hidden by default. + $this->element('dt', null, _('Avatar')); + $this->elementStart('dd'); - $this->elementStart('dl', 'entity_nickname'); - // TRANS: Label for group nickname (dt). Text hidden by default. - $this->element('dt', null, _('Nickname')); - $this->elementStart('dd'); - $hasFN = ($this->group->fullname) ? 'nickname url uid' : 'fn org nickname url uid'; - $this->element('a', array('href' => $this->group->homeUrl(), - 'rel' => 'me', 'class' => $hasFN), - $this->group->nickname); - $this->elementEnd('dd'); - $this->elementEnd('dl'); + $logo = ($this->group->homepage_logo) ? + $this->group->homepage_logo : User_group::defaultLogo(AVATAR_PROFILE_SIZE); - if ($this->group->fullname) { - $this->elementStart('dl', 'entity_fn'); - // TRANS: Label for full group name (dt). Text hidden by default. - $this->element('dt', null, _('Full name')); - $this->elementStart('dd'); - $this->element('span', 'fn org', $this->group->fullname); + $this->element('img', array('src' => $logo, + 'class' => 'photo avatar', + 'width' => AVATAR_PROFILE_SIZE, + 'height' => AVATAR_PROFILE_SIZE, + 'alt' => $this->group->nickname)); $this->elementEnd('dd'); $this->elementEnd('dl'); - } - if ($this->group->location) { - $this->elementStart('dl', 'entity_location'); - // TRANS: Label for group location (dt). Text hidden by default. - $this->element('dt', null, _('Location')); - $this->element('dd', 'label', $this->group->location); - $this->elementEnd('dl'); - } - - if ($this->group->homepage) { - $this->elementStart('dl', 'entity_url'); - // TRANS: Label for group URL (dt). Text hidden by default. - $this->element('dt', null, _('URL')); + $this->elementStart('dl', 'entity_nickname'); + // TRANS: Label for group nickname (dt). Text hidden by default. + $this->element('dt', null, _('Nickname')); $this->elementStart('dd'); - $this->element('a', array('href' => $this->group->homepage, - 'rel' => 'me', 'class' => 'url'), - $this->group->homepage); + $hasFN = ($this->group->fullname) ? 'nickname url uid' : 'fn org nickname url uid'; + $this->element('a', array('href' => $this->group->homeUrl(), + 'rel' => 'me', 'class' => $hasFN), + $this->group->nickname); $this->elementEnd('dd'); $this->elementEnd('dl'); - } - if ($this->group->description) { - $this->elementStart('dl', 'entity_note'); - // TRANS: Label for group description or group note (dt). Text hidden by default. - $this->element('dt', null, _('Note')); - $this->element('dd', 'note', $this->group->description); - $this->elementEnd('dl'); - } + if ($this->group->fullname) { + $this->elementStart('dl', 'entity_fn'); + // TRANS: Label for full group name (dt). Text hidden by default. + $this->element('dt', null, _('Full name')); + $this->elementStart('dd'); + $this->element('span', 'fn org', $this->group->fullname); + $this->elementEnd('dd'); + $this->elementEnd('dl'); + } + + if ($this->group->location) { + $this->elementStart('dl', 'entity_location'); + // TRANS: Label for group location (dt). Text hidden by default. + $this->element('dt', null, _('Location')); + $this->element('dd', 'label', $this->group->location); + $this->elementEnd('dl'); + } - if (common_config('group', 'maxaliases') > 0) { - $aliases = $this->group->getAliases(); + if ($this->group->homepage) { + $this->elementStart('dl', 'entity_url'); + // TRANS: Label for group URL (dt). Text hidden by default. + $this->element('dt', null, _('URL')); + $this->elementStart('dd'); + $this->element('a', array('href' => $this->group->homepage, + 'rel' => 'me', 'class' => 'url'), + $this->group->homepage); + $this->elementEnd('dd'); + $this->elementEnd('dl'); + } - if (!empty($aliases)) { - $this->elementStart('dl', 'entity_aliases'); - // TRANS: Label for group aliases (dt). Text hidden by default. - $this->element('dt', null, _('Aliases')); - $this->element('dd', 'aliases', implode(' ', $aliases)); + if ($this->group->description) { + $this->elementStart('dl', 'entity_note'); + // TRANS: Label for group description or group note (dt). Text hidden by default. + $this->element('dt', null, _('Note')); + $this->element('dd', 'note', $this->group->description); $this->elementEnd('dl'); } + + if (common_config('group', 'maxaliases') > 0) { + $aliases = $this->group->getAliases(); + + if (!empty($aliases)) { + $this->elementStart('dl', 'entity_aliases'); + // TRANS: Label for group aliases (dt). Text hidden by default. + $this->element('dt', null, _('Aliases')); + $this->element('dd', 'aliases', implode(' ', $aliases)); + $this->elementEnd('dl'); + } + } + + Event::handle('EndGroupProfileElements', array($this, $this->group)); } $this->elementEnd('div'); + } + function showGroupActions() + { $cur = common_current_user(); $this->elementStart('div', 'entity_actions'); // TRANS: Group actions header (h2). Text hidden by default. $this->element('h2', null, _('Group actions')); $this->elementStart('ul'); - $this->elementStart('li', 'entity_subscribe'); - if (Event::handle('StartGroupSubscribe', array($this, $this->group))) { - if ($cur) { - if ($cur->isMember($this->group)) { - $lf = new LeaveForm($this, $this->group); - $lf->show(); - } else if (!Group_block::isBlocked($this->group, $cur->getProfile())) { - $jf = new JoinForm($this, $this->group); - $jf->show(); + if (Event::handle('StartGroupActionsList', array($this, $this->group))) { + $this->elementStart('li', 'entity_subscribe'); + if (Event::handle('StartGroupSubscribe', array($this, $this->group))) { + if ($cur) { + if ($cur->isMember($this->group)) { + $lf = new LeaveForm($this, $this->group); + $lf->show(); + } else if (!Group_block::isBlocked($this->group, $cur->getProfile())) { + $jf = new JoinForm($this, $this->group); + $jf->show(); + } } + Event::handle('EndGroupSubscribe', array($this, $this->group)); } - Event::handle('EndGroupSubscribe', array($this, $this->group)); - } - $this->elementEnd('li'); - if ($cur && $cur->hasRight(Right::DELETEGROUP)) { - $this->elementStart('li', 'entity_delete'); - $df = new DeleteGroupForm($this, $this->group); - $df->show(); $this->elementEnd('li'); + if ($cur && $cur->hasRight(Right::DELETEGROUP)) { + $this->elementStart('li', 'entity_delete'); + $df = new DeleteGroupForm($this, $this->group); + $df->show(); + $this->elementEnd('li'); + } + Event::handle('EndGroupActionsList', array($this, $this->group)); } $this->elementEnd('ul'); $this->elementEnd('div');