3 * StatusNet, the distributed open-source microblogging tool
5 * List of peopletag subscribers
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 peopletag subscribers
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/
46 class PeopletagsubscribersAction extends OwnerDesignAction
49 var $peopletag = null;
52 function isReadOnly($args)
57 function prepare($args)
59 parent::prepare($args);
60 $this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
62 $tagger_arg = $this->arg('tagger');
63 $tag_arg = $this->arg('tag');
64 $tagger = common_canonical_nickname($tagger_arg);
65 $tag = common_canonical_tag($tag_arg);
67 // Permanent redirect on non-canonical nickname
69 if ($tagger_arg != $tagger || $tag_arg != $tag) {
70 $args = array('tagger' => $nickname, 'tag' => $tag);
71 if ($this->page != 1) {
72 $args['page'] = $this->page;
74 common_redirect(common_local_url('peopletagged', $args), 301);
79 $this->clientError(_('No tagger.'), 404);
83 $user = User::staticGet('nickname', $tagger);
86 $this->clientError(_('No such user.'), 404);
90 $this->tagger = $user->getProfile();
91 $this->peopletag = Profile_list::pkeyGet(array('tagger' => $user->id, 'tag' => $tag));
93 if (!$this->peopletag) {
94 $this->clientError(_('No such peopletag.'), 404);
103 if ($this->page == 1) {
104 return sprintf(_('Subscribers of people tagged %s by %s'),
105 $this->peopletag->tag, $this->tagger->nickname);
107 return sprintf(_('Subscribers of people tagged %s by %s, page %d'),
108 $this->peopletag->tag, $this->tagger->nickname,
113 function handle($args)
115 parent::handle($args);
119 function showPageNotice()
123 function showLocalNav()
125 $nav = new PeopletagGroupNav($this);
129 function showContent()
131 $offset = ($this->page-1) * PROFILES_PER_PAGE;
132 $limit = PROFILES_PER_PAGE + 1;
136 $subs = $this->peopletag->getSubscribers($offset, $limit);
139 $subscriber_list = new PeopletagSubscriberList($subs, $this->peopletag, $this);
140 $cnt = $subscriber_list->show();
145 $this->pagination($this->page > 1, $cnt > PROFILES_PER_PAGE,
146 $this->page, 'peopletagsubscribers',
147 array('tagger' => $this->tagger->nickname,
148 'tag' => $this->peopletag->tag));
152 class PeopletagSubscriberList extends ProfileList
154 var $peopletag = null;
156 function __construct($profile, $peopletag, $action)
158 parent::__construct($profile, $action);
160 $this->peopletag = $peopletag;
163 function newListItem($profile)
165 return new PeopletagSubscriberListItem($profile, $this->peopletag, $this->action);
169 class PeopletagSubscriberListItem extends ProfileListItem
171 var $peopletag = null;
173 function __construct($profile, $peopletag, $action)
175 parent::__construct($profile, $action);
177 $this->peopletag = $peopletag;
180 function showFullName()
182 parent::showFullName();
183 if ($this->profile->id == $this->peopletag->tagger) {
184 $this->out->text(' ');
185 $this->out->element('span', 'role', _('Creator'));
189 function showActions()
191 $this->startActions();
192 if (Event::handle('StartProfileListItemActionElements', array($this))) {
193 $this->showSubscribeButton();
194 Event::handle('EndProfileListItemActionElements', array($this));
199 function linkAttributes()
201 $aAttrs = parent::linkAttributes();
203 if (common_config('nofollow', 'members')) {
204 $aAttrs['rel'] .= ' nofollow';
210 function homepageAttributes()
212 $aAttrs = parent::linkAttributes();
214 if (common_config('nofollow', 'members')) {
215 $aAttrs['rel'] = 'nofollow';
222 * Fetch necessary return-to arguments for the profile forms
223 * to return to this list when they're done.
227 protected function returnToArgs()
229 $args = array('action' => 'peopletagsubscribers',
230 'tag' => $this->peopletag->tag,
231 'tagger' => $this->profile->nickname);
232 $page = $this->out->arg('page');
234 $args['param-page'] = $page;