3 * StatusNet, the distributed open-source microblogging tool
5 * List of group members
9 * LICENCE: This program is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU Affero General Public License as published by
11 * the Free Software Foundation, either version 3 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU Affero General Public License for more details.
19 * You should have received a copy of the GNU Affero General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
24 * @author Evan Prodromou <evan@status.net>
25 * @copyright 2008-2009 StatusNet, Inc.
26 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
27 * @link http://status.net/
30 if (!defined('STATUSNET') && !defined('LACONICA')) {
34 require_once(INSTALLDIR.'/lib/profilelist.php');
37 * List of group members
41 * @author Evan Prodromou <evan@status.net>
42 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
43 * @link http://status.net/
45 class SubqueueAction extends GalleryAction
49 function isReadOnly($args)
54 // @todo FIXME: most of this belongs in a base class, sounds common to most group actions?
55 function prepare($args)
57 parent::prepare($args);
59 $cur = common_current_user();
60 if (!$cur || $cur->id != $this->profile->id) {
61 // TRANS: Client error displayed when trying to approve group applicants without being a group administrator.
62 $this->clientError(_('You may only approve your own pending subscriptions.'));
70 if ($this->page == 1) {
71 // TRANS: Title of the first page showing pending subscribers still awaiting approval.
72 // TRANS: %s is the name of the user.
73 return sprintf(_('%s subscribers awaiting approval'),
74 $this->profile->nickname);
76 // TRANS: Title of all but the first page showing pending subscribersmembers still awaiting approval.
77 // TRANS: %1$s is the name of the user, %2$d is the page number of the members list.
78 return sprintf(_('%1$s subscribers awaiting approval, page %2$d'),
79 $this->profile->nickname,
84 function showPageNotice()
86 $this->element('p', 'instructions',
87 // TRANS: Page notice for group members page.
88 _('A list of users awaiting approval to subscribe to you.'));
92 function showContent()
94 $offset = ($this->page-1) * PROFILES_PER_PAGE;
95 $limit = PROFILES_PER_PAGE + 1;
99 $members = $this->profile->getRequests($offset, $limit);
103 $member_list = new SubQueueList($members, $this);
104 $cnt = $member_list->show();
109 $this->pagination($this->page > 1, $cnt > PROFILES_PER_PAGE,
110 $this->page, 'subqueue',
111 array('nickname' => $this->profile->nickname)); // urgh
115 class SubQueueList extends ProfileList
117 function newListItem($profile)
119 return new SubQueueListItem($profile, $this->action);
123 class SubQueueListItem extends ProfileListItem
125 function showActions()
127 $this->startActions();
128 if (Event::handle('StartProfileListItemActionElements', array($this))) {
129 $this->showApproveButtons();
130 Event::handle('EndProfileListItemActionElements', array($this));
135 function showApproveButtons()
137 $this->out->elementStart('li', 'entity_approval');
138 $form = new ApproveSubForm($this->out, $this->profile);
140 $this->out->elementEnd('li');