X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fgroupmembers.php;h=038d1db68a4af6f7fc46378be06385d704635c44;hb=b5cfcba4712809cb17eabba299ce5ff04f4d7d70;hp=14256526a059453bf887ab819fbedf00cf511b48;hpb=bafa1ab1c532118e2230df50ed18a1b4573692b7;p=quix0rs-gnu-social.git diff --git a/actions/groupmembers.php b/actions/groupmembers.php index 14256526a0..038d1db68a 100644 --- a/actions/groupmembers.php +++ b/actions/groupmembers.php @@ -1,6 +1,6 @@ . * * @category Group - * @package Laconica - * @author Evan Prodromou - * @copyright 2008-2009 Control Yourself, Inc. + * @package StatusNet + * @author Evan Prodromou + * @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); } @@ -38,10 +38,10 @@ require_once INSTALLDIR.'/lib/publicgroupnav.php'; * List of group members * * @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 GroupmembersAction extends GroupDesignAction @@ -73,14 +73,21 @@ class GroupmembersAction extends GroupDesignAction } if (!$nickname) { - $this->clientError(_('No nickname'), 404); + $this->clientError(_('No nickname.'), 404); return false; } - $this->group = User_group::staticGet('nickname', $nickname); + $local = Local_group::staticGet('nickname', $nickname); + + if (!$local) { + $this->clientError(_('No such group.'), 404); + return false; + } + + $this->group = User_group::staticGet('id', $local->group_id); if (!$this->group) { - $this->clientError(_('No such group'), 404); + $this->clientError(_('No such group.'), 404); return false; } @@ -90,10 +97,14 @@ class GroupmembersAction extends GroupDesignAction function title() { if ($this->page == 1) { + // TRANS: Title of the page showing group members. + // TRANS: %s is the name of the group. return sprintf(_('%s group members'), $this->group->nickname); } else { - return sprintf(_('%s group members, page %d'), + // TRANS: Title of the page showing group members. + // TRANS: %1$s is the name of the group, %2$d is the page number of the members list. + return sprintf(_('%1$s group members, page %2$d'), $this->group->nickname, $this->page); } @@ -179,9 +190,12 @@ class GroupMemberListItem extends ProfileListItem function showActions() { $this->startActions(); - $this->showSubscribeButton(); - $this->showMakeAdminForm(); - $this->showGroupBlockForm(); + if (Event::handle('StartProfileListItemActionElements', array($this))) { + $this->showSubscribeButton(); + $this->showMakeAdminForm(); + $this->showGroupBlockForm(); + Event::handle('EndProfileListItemActionElements', array($this)); + } $this->endActions(); } @@ -189,17 +203,19 @@ class GroupMemberListItem extends ProfileListItem { $user = common_current_user(); - if (!empty($user) && $user->id != $this->profile->id && $user->isAdmin($this->group) && + if (!empty($user) && + $user->id != $this->profile->id && + ($user->isAdmin($this->group) || $user->hasRight(Right::MAKEGROUPADMIN)) && !$this->profile->isAdmin($this->group)) { $this->out->elementStart('li', 'entity_make_admin'); $maf = new MakeAdminForm($this->out, $this->profile, $this->group, - array('action' => 'groupmembers', - 'nickname' => $this->group->nickname)); + $this->returnToArgs()); $maf->show(); $this->out->elementEnd('li'); } } + function showGroupBlockForm() { $user = common_current_user(); @@ -207,12 +223,49 @@ class GroupMemberListItem extends ProfileListItem if (!empty($user) && $user->id != $this->profile->id && $user->isAdmin($this->group)) { $this->out->elementStart('li', 'entity_block'); $bf = new GroupBlockForm($this->out, $this->profile, $this->group, - array('action' => 'groupmembers', - 'nickname' => $this->group->nickname)); + $this->returnToArgs()); $bf->show(); $this->out->elementEnd('li'); } + } + + function linkAttributes() + { + $aAttrs = parent::linkAttributes(); + if (common_config('nofollow', 'members')) { + $aAttrs['rel'] .= ' nofollow'; + } + + return $aAttrs; + } + + function homepageAttributes() + { + $aAttrs = parent::linkAttributes(); + + if (common_config('nofollow', 'members')) { + $aAttrs['rel'] = 'nofollow'; + } + + return $aAttrs; + } + + /** + * Fetch necessary return-to arguments for the profile forms + * to return to this list when they're done. + * + * @return array + */ + protected function returnToArgs() + { + $args = array('action' => 'groupmembers', + 'nickname' => $this->group->nickname); + $page = $this->out->arg('page'); + if ($page) { + $args['param-page'] = $page; + } + return $args; } } @@ -220,11 +273,11 @@ class GroupMemberListItem extends ProfileListItem * Form for blocking a user from a group * * @category Form - * @package Laconica - * @author Evan Prodromou - * @author Sarven Capadisli + * @package StatusNet + * @author Evan Prodromou + * @author Sarven Capadisli * @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/ * * @see BlockForm */ @@ -340,7 +393,14 @@ class GroupBlockForm extends Form function formActions() { - $this->out->submit('submit', _('Block'), 'submit', null, _('Block this user')); + $this->out->submit( + 'submit', + // TRANS: Button text for the form that will block a user from a group. + _m('BUTTON','Block'), + 'submit', + null, + // TRANS: Submit button title. + _m('TOOLTIP',_('Block this user')); } } @@ -348,11 +408,11 @@ class GroupBlockForm extends Form * Form for making a user an admin for a group * * @category Form - * @package Laconica - * @author Evan Prodromou - * @author Sarven Capadisli + * @package StatusNet + * @author Evan Prodromou + * @author Sarven Capadisli * @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 MakeAdminForm extends Form @@ -467,6 +527,13 @@ class MakeAdminForm extends Form function formActions() { - $this->out->submit('submit', _('Make Admin'), 'submit', null, _('Make this user an admin')); + $this->out->submit( + 'submit', + // TRANS: Button text for the form that will make a user administrator. + _m('BUTTON','Make Admin'), + 'submit', + null, + // TRANS: Submit button title. + _m('TOOLTIP','Make this user an admin')); } }