X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fpeopletagsbyuser.php;h=9a5f9106f41086885f271459874b0448632b3af8;hb=d6b28c64830f632bb2f4b6f3c9369b9e56ad217a;hp=3158b715bc2c22f76480d0ac7bf3528c37a4e705;hpb=31c1177970124cee31823cab3a11542c23b4126d;p=quix0rs-gnu-social.git diff --git a/actions/peopletagsbyuser.php b/actions/peopletagsbyuser.php index 3158b715bc..9a5f9106f4 100644 --- a/actions/peopletagsbyuser.php +++ b/actions/peopletagsbyuser.php @@ -2,7 +2,7 @@ /** * StatusNet, the distributed open-source microblogging tool * - * People tags by a user + * Lists by a user * * PHP version 5 * @@ -22,7 +22,7 @@ * @category Personal * @package StatusNet * @author Shashi Gowda - * @copyright 2008-2009 StatusNet, Inc. + * @copyright 2008-2011 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ @@ -33,13 +33,13 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { require_once INSTALLDIR.'/lib/peopletaglist.php'; -class PeopletagsbyuserAction extends OwnerDesignAction +class PeopletagsbyuserAction extends Action { var $page = null; var $tagger = null; var $tags = null; - function isReadOnly($args) + function isReadOnly(array $args=array()) { return true; } @@ -49,19 +49,26 @@ class PeopletagsbyuserAction extends OwnerDesignAction if ($this->page == 1) { if ($this->isOwner()) { if ($this->arg('private')) { - return _('Private people tags by you'); + // TRANS: Title for lists by a user page for a private tag. + return _('Private lists by you'); } else if ($this->arg('public')) { - return _('Public people tags by you'); + // TRANS: Title for lists by a user page for a public tag. + return _('Public lists by you'); } - return _('People tags by you'); + // TRANS: Title for lists by a user page. + return _('Lists by you'); } - return sprintf(_("People tags by %s"), $this->tagger->nickname); + // TRANS: Title for lists by a user page. + // TRANS: %s is a user nickname. + return sprintf(_('Lists by %s'), $this->tagger->nickname); } else { - return sprintf(_("People tags by %s, page %d"), $this->tagger->nickname, $this->page); + // TRANS: Title for lists by a user page. + // TRANS: %1$s is a user nickname, %2$d is a page number. + return sprintf(_('Lists by %1$s, page %2$d'), $this->tagger->nickname, $this->page); } } - function prepare($args) + function prepare(array $args=array()) { parent::prepare($args); @@ -69,7 +76,12 @@ class PeopletagsbyuserAction extends OwnerDesignAction $this->args['public'] = $this->args['private'] = false; } - $nickname_arg = $this->arg('nickname'); + if (common_config('singleuser', 'enabled')) { + $nickname_arg = User::singleUserNickname(); + } else { + $nickname_arg = $this->arg('nickname'); + } + $nickname = common_canonical_nickname($nickname_arg); // Permanent redirect on non-canonical nickname @@ -80,21 +92,20 @@ class PeopletagsbyuserAction extends OwnerDesignAction $args['page'] = $this->arg['page']; } common_redirect(common_local_url('peopletagsbyuser', $args), 301); - return false; } - $this->user = User::staticGet('nickname', $nickname); + $this->user = User::getKV('nickname', $nickname); if (!$this->user) { + // TRANS: Client error displayed trying to perform an action related to a non-existing user. $this->clientError(_('No such user.'), 404); - return false; } $this->tagger = $this->user->getProfile(); if (!$this->tagger) { + // TRANS: Error message displayed when referring to a user without a profile. $this->serverError(_('User has no profile.')); - return false; } $this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1; @@ -105,33 +116,34 @@ class PeopletagsbyuserAction extends OwnerDesignAction $user = common_current_user(); if ($this->arg('public')) { - $this->tags = $this->tagger->getOwnedTags(false, $offset, $limit); + $this->tags = $this->tagger->getLists(false, $offset, $limit); } else if ($this->arg('private')) { if (empty($user)) { - $this->clientError(_('Not logged in'), 403); + // TRANS: Error message displayed when trying to perform an action that requires a logged in user. + $this->clientError(_('Not logged in.'), 403); } if ($this->isOwner()) { $this->tags = $this->tagger->getPrivateTags($offset, $limit); } else { - $this->clientError(_('You cannot view others\' private people tags'), 403); + // TRANS: Client error displayed when trying view another user's private lists. + $this->clientError(_('You cannot view others\' private lists'), 403); } } else { - $this->tags = $this->tagger->getOwnedTags(common_current_user(), $offset, $limit); + $this->tags = $this->tagger->getLists(common_current_user(), $offset, $limit); } return true; } - function handle($args) + function handle(array $args=array()) { parent::handle($args); - # Post from the tag dropdown; redirect to a GET + // Post from the tag dropdown; redirect to a GET - if ($_SERVER['REQUEST_METHOD'] == 'POST') { - common_redirect(common_local_url('peopletagsbyuser', $this->getSelfUrlArgs()), 303); - return; - } + if ($_SERVER['REQUEST_METHOD'] == 'POST') { + common_redirect(common_local_url('peopletagsbyuser', $this->getSelfUrlArgs()), 303); + } $this->showPage(); } @@ -139,6 +151,7 @@ class PeopletagsbyuserAction extends OwnerDesignAction function showModeSelector() { $this->elementStart('dl', array('id'=>'filter_tags')); + // TRANS: Mode selector label. $this->element('dt', null, _('Mode')); $this->elementStart('dd'); $this->elementStart('ul'); @@ -148,7 +161,8 @@ class PeopletagsbyuserAction extends OwnerDesignAction array('href' => common_local_url('peopletagsforuser', array('nickname' => $this->user->nickname))), - sprintf(_('People tags for %s'), $this->tagger->nickname)); + // TRANS: Link text to show lists for user %s. + sprintf(_('Lists for %s'), $this->tagger->nickname)); $this->elementEnd('li'); if ($this->isOwner()) { @@ -159,6 +173,7 @@ class PeopletagsbyuserAction extends OwnerDesignAction array('nickname' => $this->tagger->nickname)), 'method' => 'post')); $this->elementStart('fieldset'); + // TRANS: Fieldset legend. $this->element('legend', null, _('Select tag to filter')); $priv = $this->arg('private'); @@ -167,12 +182,17 @@ class PeopletagsbyuserAction extends OwnerDesignAction if (!$priv && !$pub) { $priv = $pub = true; } - $this->checkbox('private', _m('Private'), $priv, - _m('Show private tags')); - $this->checkbox('public', _m('Public'), $pub, - _m('Show public tags')); + // TRANS: Checkbox label to show private tags. + $this->checkbox('private', _m('LABEL','Private'), $priv, + // TRANS: Checkbox title. + _('Show private tags.')); + // TRANS: Checkbox label to show public tags. + $this->checkbox('public', _m('LABEL','Public'), $pub, + // TRANS: Checkbox title. + _('Show public tags.')); $this->hidden('nickname', $this->user->nickname); - $this->submit('submit', _('Go')); + // TRANS: Submit button text for tag filter form. + $this->submit('submit', _m('BUTTON','Go')); $this->elementEnd('fieldset'); $this->elementEnd('form'); $this->elementEnd('li'); @@ -181,22 +201,20 @@ class PeopletagsbyuserAction extends OwnerDesignAction $this->elementEnd('dd'); $this->elementEnd('dl'); } - function showLocalNav() - { - $nav = new PersonalGroupNav($this); - $nav->show(); - } function showAnonymousMessage() { $notice = - sprintf(_('These are people tags created by **%s**. ' . - 'People tags are how you sort similar ' . + // TRANS: Message displayed for anonymous users on page that displays lists by a user. + // TRANS: This message contains Markdown links in the form [description](links). + // TRANS: %s is a tagger nickname. + sprintf(_('These are lists created by **%s**. ' . + 'Lists are how you sort similar ' . 'people on %%%%site.name%%%%, a [micro-blogging]' . '(http://en.wikipedia.org/wiki/Micro-blogging) service ' . 'based on the Free Software [StatusNet](http://status.net/) tool. ' . 'You can easily keep track of what they ' . - 'are doing by subscribing to the tag\'s timeline.' ), $this->tagger->nickname); + 'are doing by subscribing to the list\'s timeline.' ), $this->tagger->nickname); $this->elementStart('div', array('id' => 'anon_notice')); $this->raw(common_markup_to_html($notice)); $this->elementEnd('div'); @@ -242,14 +260,29 @@ class PeopletagsbyuserAction extends OwnerDesignAction return !empty($user) && $user->id == $this->tagger->id; } + function showObjectNav() + { + $nav = new PeopletagNav($this, $this->tagger); + $nav->show(); + } + function showEmptyListMessage() { - $message = sprintf(_('%s has not created any [people tags](%%%%doc.tags%%%%) yet.'), $this->tagger->nickname); + // TRANS: Message displayed on page that displays lists by a user when there are none. + // TRANS: This message contains Markdown links in the form [description](links). + // TRANS: %s is a tagger nickname. + $message = sprintf(_('%s has not created any [lists](%%%%doc.lists%%%%) yet.'), $this->tagger->nickname); $this->elementStart('div', 'guide'); $this->raw(common_markup_to_html($message)); $this->elementEnd('div'); } + function showProfileBlock() + { + $block = new AccountProfileBlock($this, $this->tagger); + $block->show(); + } + function showSections() { #TODO: tags with most subscribers