From 5dbaaed4e68ecae1c78b9493add89df3557c8e98 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Thu, 8 Apr 2010 19:06:55 -0700 Subject: Maintain 'page' parameter for block from subscribers list, block & make-admin from group members list. Refactored some of the returnto handling code. It looks like we have several different ways of handling this in the software, icky! Marked the session-based functions with fixmes (they'll stomp on other forms when multiple tabs/windows are used) and combined some commonish bits of code between ProfileFormAction and the group block & makeadmin actions where they're using hidden form parameters. Extended that to allow passing dynamic parameters (eg 'page') as well as static ones (action, target user/group). --- actions/groupmembers.php | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'actions/groupmembers.php') diff --git a/actions/groupmembers.php b/actions/groupmembers.php index fb4e46dbc..6d0701239 100644 --- a/actions/groupmembers.php +++ b/actions/groupmembers.php @@ -205,8 +205,7 @@ class GroupMemberListItem extends ProfileListItem !$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'); } @@ -220,8 +219,7 @@ 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'); } @@ -244,6 +242,23 @@ class GroupMemberListItem extends ProfileListItem $aAttrs['rel'] = 'nofollow'; } } + + /** + * 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; + } } /** -- cgit v1.2.3-54-g00ecf