2011-03-06 19:13:31 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* StatusNet, the distributed open-source microblogging tool
|
|
|
|
*
|
|
|
|
* List of people tagged by the user with a tag
|
|
|
|
*
|
|
|
|
* PHP version 5
|
|
|
|
*
|
|
|
|
* LICENCE: This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
* @category Group
|
|
|
|
* @package StatusNet
|
|
|
|
* @author Shashi Gowda <connect2shashi@gmail.com>
|
2011-06-09 21:20:19 +01:00
|
|
|
* @copyright 2008-2011 StatusNet, Inc.
|
2011-03-06 19:13:31 +00:00
|
|
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
|
|
|
* @link http://status.net/
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (!defined('STATUSNET') && !defined('LACONICA')) {
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
2019-08-22 18:06:14 +01:00
|
|
|
require_once(INSTALLDIR . '/lib/profilelist.php');
|
2011-03-06 19:13:31 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* List of people tagged by the user with a tag
|
|
|
|
*
|
|
|
|
* @category Peopletag
|
|
|
|
* @package StatusNet
|
|
|
|
* @author Shashi Gowda <connect2shashi@gmail.com>
|
|
|
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
|
|
|
* @link http://status.net/
|
|
|
|
*/
|
2011-06-09 21:20:19 +01:00
|
|
|
class PeopletaggedAction extends Action
|
2011-03-06 19:13:31 +00:00
|
|
|
{
|
|
|
|
var $page = null;
|
|
|
|
var $peopletag = null;
|
|
|
|
var $tagger = null;
|
|
|
|
|
|
|
|
function isReadOnly($args)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-06-01 03:21:50 +01:00
|
|
|
function prepare(array $args = array())
|
2011-03-06 19:13:31 +00:00
|
|
|
{
|
|
|
|
parent::prepare($args);
|
|
|
|
$this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
|
|
|
|
|
2011-09-29 17:29:12 +01:00
|
|
|
if (common_config('singleuser', 'enabled')) {
|
|
|
|
$tagger_arg = User::singleUserNickname();
|
|
|
|
} else {
|
|
|
|
$tagger_arg = $this->arg('tagger');
|
|
|
|
}
|
|
|
|
|
2011-03-06 19:13:31 +00:00
|
|
|
$tag_arg = $this->arg('tag');
|
|
|
|
$tagger = common_canonical_nickname($tagger_arg);
|
|
|
|
$tag = common_canonical_tag($tag_arg);
|
|
|
|
|
|
|
|
// Permanent redirect on non-canonical nickname
|
|
|
|
|
|
|
|
if ($tagger_arg != $tagger || $tag_arg != $tag) {
|
|
|
|
$args = array('tagger' => $nickname, 'tag' => $tag);
|
|
|
|
if ($this->page != 1) {
|
|
|
|
$args['page'] = $this->page;
|
|
|
|
}
|
|
|
|
common_redirect(common_local_url('peopletagged', $args), 301);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!$tagger) {
|
2011-04-10 18:59:55 +01:00
|
|
|
// TRANS: Client error displayed when a tagger is expected but not provided.
|
2011-03-06 19:13:31 +00:00
|
|
|
$this->clientError(_('No tagger.'), 404);
|
|
|
|
}
|
|
|
|
|
2013-08-18 12:04:58 +01:00
|
|
|
$user = User::getKV('nickname', $tagger);
|
2011-03-06 19:13:31 +00:00
|
|
|
|
|
|
|
if (!$user) {
|
2011-04-10 18:59:55 +01:00
|
|
|
// TRANS: Client error displayed when referring to non-existing user.
|
2011-03-06 19:13:31 +00:00
|
|
|
$this->clientError(_('No such user.'), 404);
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->tagger = $user->getProfile();
|
|
|
|
$this->peopletag = Profile_list::pkeyGet(array('tagger' => $user->id, 'tag' => $tag));
|
|
|
|
|
|
|
|
if (!$this->peopletag) {
|
2011-04-15 09:20:34 +01:00
|
|
|
// TRANS: Client error displayed when referring to a non-existing list.
|
2011-04-13 09:15:25 +01:00
|
|
|
$this->clientError(_('No such list.'), 404);
|
2011-03-06 19:13:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
function title()
|
|
|
|
{
|
|
|
|
if ($this->page == 1) {
|
2011-04-15 09:20:34 +01:00
|
|
|
// TRANS: Title for list of people listed by the user.
|
|
|
|
// TRANS: %1$s is a list, %2$s is a username.
|
2011-04-13 09:15:25 +01:00
|
|
|
return sprintf(_('People listed in %1$s by %2$s'),
|
2011-03-06 19:13:31 +00:00
|
|
|
$this->peopletag->tag, $this->tagger->nickname);
|
|
|
|
} else {
|
2011-04-15 09:20:34 +01:00
|
|
|
// TRANS: Title for list of people listed by the user.
|
|
|
|
// TRANS: %1$s is a list, %2$s is a username, %2$s is a page number.
|
2011-04-13 09:15:25 +01:00
|
|
|
return sprintf(_('People listed in %1$s by %2$s, page %3$d'),
|
2011-03-06 19:13:31 +00:00
|
|
|
$this->peopletag->tag, $this->user->nickname,
|
|
|
|
$this->page);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-06-01 03:05:11 +01:00
|
|
|
function handle()
|
2011-03-06 19:13:31 +00:00
|
|
|
{
|
2016-06-01 03:05:11 +01:00
|
|
|
parent::handle();
|
2011-03-06 19:13:31 +00:00
|
|
|
$this->showPage();
|
|
|
|
}
|
|
|
|
|
|
|
|
function showPageNotice()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
function showLocalNav()
|
|
|
|
{
|
|
|
|
$nav = new PeopletagGroupNav($this, $this->peopletag);
|
|
|
|
$nav->show();
|
|
|
|
}
|
|
|
|
|
|
|
|
function showContent()
|
|
|
|
{
|
|
|
|
$offset = ($this->page-1) * PROFILES_PER_PAGE;
|
|
|
|
$limit = PROFILES_PER_PAGE + 1;
|
|
|
|
|
|
|
|
$cnt = 0;
|
|
|
|
|
|
|
|
$subs = $this->peopletag->getTagged($offset, $limit);
|
|
|
|
|
|
|
|
if ($subs) {
|
|
|
|
$subscriber_list = new PeopletagMemberList($subs, $this->peopletag, $this);
|
|
|
|
$cnt = $subscriber_list->show();
|
|
|
|
}
|
|
|
|
|
|
|
|
$subs->free();
|
|
|
|
|
|
|
|
$this->pagination($this->page > 1, $cnt > PROFILES_PER_PAGE,
|
|
|
|
$this->page, 'peopletagged',
|
|
|
|
array('tagger' => $this->tagger->nickname,
|
|
|
|
'tag' => $this->peopletag->tag));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class PeopletagMemberList extends ProfileList
|
|
|
|
{
|
|
|
|
var $peopletag = null;
|
|
|
|
|
|
|
|
function __construct($profile, $peopletag, $action)
|
|
|
|
{
|
|
|
|
parent::__construct($profile, $action);
|
|
|
|
|
|
|
|
$this->peopletag = $peopletag;
|
|
|
|
}
|
|
|
|
|
2017-03-17 02:57:16 +00:00
|
|
|
function newListItem(Profile $profile)
|
2011-03-06 19:13:31 +00:00
|
|
|
{
|
|
|
|
return new PeopletagMemberListItem($profile, $this->peopletag, $this->action);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class PeopletagMemberListItem extends ProfileListItem
|
|
|
|
{
|
|
|
|
var $peopletag = null;
|
|
|
|
|
|
|
|
function __construct($profile, $peopletag, $action)
|
|
|
|
{
|
|
|
|
parent::__construct($profile, $action);
|
|
|
|
|
|
|
|
$this->peopletag = $peopletag;
|
|
|
|
}
|
|
|
|
|
|
|
|
function showFullName()
|
|
|
|
{
|
|
|
|
parent::showFullName();
|
|
|
|
if ($this->profile->id == $this->peopletag->tagger) {
|
|
|
|
$this->out->text(' ');
|
2011-04-10 18:59:55 +01:00
|
|
|
// TRANS: Addition in tag membership list for creator of a tag.
|
2011-03-06 19:13:31 +00:00
|
|
|
$this->out->element('span', 'role', _('Creator'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function showActions()
|
|
|
|
{
|
|
|
|
$this->startActions();
|
|
|
|
if (Event::handle('StartProfileListItemActionElements', array($this))) {
|
|
|
|
$this->showSubscribeButton();
|
|
|
|
// TODO: Untag button
|
|
|
|
Event::handle('EndProfileListItemActionElements', array($this));
|
|
|
|
}
|
|
|
|
$this->endActions();
|
|
|
|
}
|
|
|
|
|
|
|
|
function linkAttributes()
|
|
|
|
{
|
|
|
|
// tagging people is healthy page-rank flow.
|
|
|
|
return parent::linkAttributes();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Fetch necessary return-to arguments for the profile forms
|
|
|
|
* to return to this list when they're done.
|
2011-04-10 18:59:55 +01:00
|
|
|
*
|
2011-03-06 19:13:31 +00:00
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
protected function returnToArgs()
|
|
|
|
{
|
|
|
|
$args = array('action' => 'peopletagged',
|
|
|
|
'tag' => $this->peopletag->tag,
|
|
|
|
'tagger' => $this->profile->nickname);
|
|
|
|
$page = $this->out->arg('page');
|
|
|
|
if ($page) {
|
|
|
|
$args['param-page'] = $page;
|
|
|
|
}
|
|
|
|
return $args;
|
|
|
|
}
|
|
|
|
}
|