X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fshowgroup.php;h=ce11d574e94c7be3577902b15d5ef51590fa94f7;hb=ecb3abf84c8b6e868a523b8e721484cb7a4e0f63;hp=79445851f923b1b6f41352a546ca6b3bb0cf47f2;hpb=92f9ec1580178e2a2bcc6409f1cd9fba327bce03;p=quix0rs-gnu-social.git diff --git a/actions/showgroup.php b/actions/showgroup.php index 79445851f9..06ae572e81 100644 --- a/actions/showgroup.php +++ b/actions/showgroup.php @@ -1,6 +1,6 @@ . * * @category Group - * @package Laconica - * @author Evan Prodromou - * @author Sarven Capadisli - * @copyright 2008-2009 Control Yourself, Inc. + * @package StatusNet + * @author Evan Prodromou + * @author Sarven Capadisli + * @copyright 2008-2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } require_once INSTALLDIR.'/lib/noticelist.php'; require_once INSTALLDIR.'/lib/feedlist.php'; -define('MEMBERS_PER_SECTION', 81); +define('MEMBERS_PER_SECTION', 27); /** * Group main page * * @category Group - * @package Laconica - * @author Evan Prodromou + * @package StatusNet + * @author Evan Prodromou * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -class ShowgroupAction extends Action +class ShowgroupAction extends GroupDesignAction { - /** group we're viewing. */ - var $group = null; + /** page we're viewing. */ var $page = null; @@ -60,7 +59,7 @@ class ShowgroupAction extends Action * @return boolean true */ - function isReadOnly() + function isReadOnly($args) { return true; } @@ -82,7 +81,7 @@ class ShowgroupAction extends Action if ($this->page == 1) { return sprintf(_("%s group"), $base); } else { - return sprintf(_("%s group, page %d"), + return sprintf(_("%1$s group, page %2$d"), $base, $this->page); } @@ -102,11 +101,6 @@ class ShowgroupAction extends Action { parent::prepare($args); - if (!common_config('inboxes','enabled')) { - $this->serverError(_('Inboxes must be enabled for groups to work')); - return false; - } - $this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1; $nickname_arg = $this->arg('nickname'); @@ -124,15 +118,25 @@ class ShowgroupAction extends Action } if (!$nickname) { - $this->clientError(_('No nickname'), 404); + $this->clientError(_('No nickname.'), 404); return false; } $this->group = User_group::staticGet('nickname', $nickname); if (!$this->group) { - $this->clientError(_('No such group'), 404); - return false; + $alias = Group_alias::staticGet('alias', $nickname); + if ($alias) { + $args = array('id' => $alias->group_id); + if ($this->page != 1) { + $args['page'] = $this->page; + } + common_redirect(common_local_url('groupbyid', $args), 301); + return false; + } else { + $this->clientError(_('No such group.'), 404); + return false; + } } common_set_returnto($this->selfUrl()); @@ -272,6 +276,17 @@ class ShowgroupAction extends Action $this->elementEnd('dl'); } + if (common_config('group', 'maxaliases') > 0) { + $aliases = $this->group->getAliases(); + + if (!empty($aliases)) { + $this->elementStart('dl', 'entity_aliases'); + $this->element('dt', null, _('Aliases')); + $this->element('dd', 'aliases', implode(' ', $aliases)); + $this->elementEnd('dl'); + } + } + $this->elementEnd('div'); $this->elementStart('div', 'entity_actions'); @@ -283,7 +298,7 @@ class ShowgroupAction extends Action if ($cur->isMember($this->group)) { $lf = new LeaveForm($this, $this->group); $lf->show(); - } else { + } else if (!Group_block::isBlocked($this->group, $cur->getProfile())) { $jf = new JoinForm($this, $this->group); $jf->show(); } @@ -307,8 +322,28 @@ class ShowgroupAction extends Action common_local_url('grouprss', array('nickname' => $this->group->nickname)); - return array(new Feed(Feed::RSS1, $url, sprintf(_('Notice feed for %s group'), - $this->group->nickname))); + return array(new Feed(Feed::RSS1, + common_local_url('grouprss', + array('nickname' => $this->group->nickname)), + sprintf(_('Notice feed for %s group (RSS 1.0)'), + $this->group->nickname)), + new Feed(Feed::RSS2, + common_local_url('ApiTimelineGroup', + array('format' => 'rss', + 'id' => $this->group->nickname)), + sprintf(_('Notice feed for %s group (RSS 2.0)'), + $this->group->nickname)), + new Feed(Feed::ATOM, + common_local_url('ApiTimelineGroup', + array('format' => 'atom', + 'id' => $this->group->nickname)), + sprintf(_('Notice feed for %s group (Atom)'), + $this->group->nickname)), + new Feed(Feed::FOAF, + common_local_url('foafgroup', + array('nickname' => $this->group->nickname)), + sprintf(_('FOAF for %s group'), + $this->group->nickname))); } /** @@ -321,6 +356,7 @@ class ShowgroupAction extends Action { $this->showMembers(); $this->showStatistics(); + $this->showAdmins(); $cloud = new GroupTagCloudSection($this, $this->group); $cloud->show(); } @@ -344,13 +380,13 @@ class ShowgroupAction extends Action $this->element('h2', null, _('Members')); - $pml = new ProfileMiniList($member, null, $this); + $pml = new ProfileMiniList($member, $this); $cnt = $pml->show(); if ($cnt == 0) { $this->element('p', null, _('(None)')); } - if ($cnt == MEMBERS_PER_SECTION) { + if ($cnt > MEMBERS_PER_SECTION) { $this->element('a', array('href' => common_local_url('groupmembers', array('nickname' => $this->group->nickname))), _('All members')); @@ -359,6 +395,18 @@ class ShowgroupAction extends Action $this->elementEnd('div'); } + /** + * Show list of admins + * + * @return void + */ + + function showAdmins() + { + $adminSection = new GroupAdminSection($this, $this->group); + $adminSection->show(); + } + /** * Show some statistics * @@ -398,13 +446,13 @@ class ShowgroupAction extends Action { if (!(common_config('site','closed') || common_config('site','inviteonly'))) { $m = sprintf(_('**%s** is a user group on %%%%site.name%%%%, a [micro-blogging](http://en.wikipedia.org/wiki/Micro-blogging) service ' . - 'based on the Free Software [Laconica](http://laconi.ca/) tool. Its members share ' . + 'based on the Free Software [StatusNet](http://status.net/) tool. Its members share ' . 'short messages about their life and interests. '. '[Join now](%%%%action.register%%%%) to become part of this group and many more! ([Read more](%%%%doc.help%%%%))'), $this->group->nickname); } else { $m = sprintf(_('**%s** is a user group on %%%%site.name%%%%, a [micro-blogging](http://en.wikipedia.org/wiki/Micro-blogging) service ' . - 'based on the Free Software [Laconica](http://laconi.ca/) tool. Its members share ' . + 'based on the Free Software [StatusNet](http://status.net/) tool. Its members share ' . 'short messages about their life and interests. '), $this->group->nickname); } @@ -413,3 +461,34 @@ class ShowgroupAction extends Action $this->elementEnd('div'); } } + +class GroupAdminSection extends ProfileSection +{ + var $group; + + function __construct($out, $group) + { + parent::__construct($out); + $this->group = $group; + } + + function getProfiles() + { + return $this->group->getAdmins(); + } + + function title() + { + return _('Admins'); + } + + function divId() + { + return 'group_admins'; + } + + function moreUrl() + { + return null; + } +}