X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fshowprofiletag.php;h=4524e4aa8c23a8e71482bbf826b7977fe21e0336;hb=1776c90cb98d5ca738db143703fb998612ada31e;hp=d9f9e9c12e5ade8e5a5f7acbeeddfce9417331db;hpb=4d61760154a53e39d1e0499d5fe7a4a586e7a9f0;p=quix0rs-gnu-social.git diff --git a/actions/showprofiletag.php b/actions/showprofiletag.php index d9f9e9c12e..4524e4aa8c 100644 --- a/actions/showprofiletag.php +++ b/actions/showprofiletag.php @@ -33,7 +33,7 @@ require_once INSTALLDIR.'/lib/feedlist.php'; class ShowprofiletagAction extends Action { - var $notice, $tagger, $peopletag; + var $notice, $tagger, $peopletag, $userProfile; function isReadOnly($args) { @@ -44,7 +44,11 @@ class ShowprofiletagAction extends Action { parent::prepare($args); - $tagger_arg = $this->arg('tagger'); + if (common_config('singleuser', 'enabled')) { + $tagger_arg = User::singleUserNickname(); + } else { + $tagger_arg = $this->arg('tagger'); + } $tag_arg = $this->arg('tag'); $tagger = common_canonical_nickname($tagger_arg); $tag = common_canonical_tag($tag_arg); @@ -57,19 +61,18 @@ class ShowprofiletagAction extends Action $args['page'] = $this->page; } common_redirect(common_local_url('showprofiletag', $args), 301); - return false; } if (!$tagger) { + // TRANS: Client error displayed when a tagger is expected but not provided. $this->clientError(_('No tagger.'), 404); - return false; } - $user = User::staticGet('nickname', $tagger); + $user = User::getKV('nickname', $tagger); if (!$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 = $user->getProfile(); @@ -80,15 +83,20 @@ class ShowprofiletagAction extends Action ($this->peopletag->private && $this->peopletag->tagger === $current->id)); if (!$can_see) { - $this->clientError(_('No such peopletag.'), 404); - return false; + // TRANS: Client error displayed trying to reference a non-existing list. + $this->clientError(_('No such list.'), 404); } $this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1; - $this->notice = $this->peopletag->getNotices(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1); + $this->userProfile = Profile::current(); + + $stream = new PeopletagNoticeStream($this->peopletag, $this->userProfile); + + $this->notice = $stream->getNotices(($this->page-1)*NOTICES_PER_PAGE, + NOTICES_PER_PAGE + 1); if ($this->page > 1 && $this->notice->N == 0) { - // TRANS: Server error when page not found (404) + // TRANS: Server error when page not found (404). $this->serverError(_('No such page.'), $code = 404); } @@ -100,8 +108,8 @@ class ShowprofiletagAction extends Action parent::handle($args); if (!$this->peopletag) { + // TRANS: Client error displayed trying to perform an action related to a non-existing user. $this->clientError(_('No such user.')); - return; } $this->showPage(); @@ -110,42 +118,49 @@ class ShowprofiletagAction extends Action function title() { if ($this->page > 1) { - if($this->peopletag->private) { - return sprintf(_('Private timeline for people tagged %s by you, page %d'), + // TRANS: Title for private list timeline. + // TRANS: %1$s is a list, %2$s is a page number. + return sprintf(_('Private timeline for %1$s list by you, page %2$d'), $this->peopletag->tag, $this->page); } $current = common_current_user(); if (!empty($current) && $current->id == $this->peopletag->tagger) { - return sprintf(_('Timeline for people tagged %s by you, page %d'), + // TRANS: Title for public list timeline where the viewer is the tagger. + // TRANS: %1$s is a list, %2$s is a page number. + return sprintf(_('Timeline for %1$s list by you, page %2$d'), $this->peopletag->tag, $this->page); } - // TRANS: Page title. %1$s is user nickname, %2$d is page number - return sprintf(_('Timeline for people tagged %1$s by %2$s, page %3$d'), + // TRANS: Title for private list timeline. + // TRANS: %1$s is a list, %2$s is the tagger's nickname, %3$d is a page number. + return sprintf(_('Timeline for %1$s list by %2$s, page %3$d'), $this->peopletag->tag, $this->tagger->nickname, $this->page ); } else { - if($this->peopletag->private) { - return sprintf(_('Private timeline of people tagged %s by you'), - $this->peopletag->tag, $this->page); + // TRANS: Title for private list timeline. + // TRANS: %s is a list. + return sprintf(_('Private timeline of %s list by you'), + $this->peopletag->tag); } $current = common_current_user(); if (!empty($current) && $current->id == $this->peopletag->tagger) { - return sprintf(_('Timeline for people tagged %s by you'), - $this->peopletag->tag, $this->page); + // TRANS: Title for public list timeline where the viewer is the tagger. + // TRANS: %s is a list. + return sprintf(_('Timeline for %s list by you'), + $this->peopletag->tag); } - // TRANS: Page title. %1$s is user nickname, %2$d is page number - return sprintf(_('Timeline for people tagged %1$s by %2$s'), + // TRANS: Title for private list timeline. + // TRANS: %1$s is a list, %2$s is the tagger's nickname. + return sprintf(_('Timeline for %1$s list by %2$s'), $this->peopletag->tag, - $this->tagger->nickname, - $this->page + $this->tagger->nickname ); } } @@ -153,7 +168,18 @@ class ShowprofiletagAction extends Action function getFeeds() { #XXX: make these actually work - return array(new Feed(Feed::RSS2, + return array(new Feed(Feed::JSON, + common_local_url( + 'ApiTimelineList', array( + 'user' => $this->tagger->id, + 'id' => $this->peopletag->id, + 'format' => 'as' + ) + ), + // TRANS: Feed title. + // TRANS: %s is tagger's nickname. + sprintf(_('Feed for friends of %s (Activity Streams JSON)'), $this->tagger->nickname)), + new Feed(Feed::RSS2, common_local_url( 'ApiTimelineList', array( 'user' => $this->tagger->id, @@ -161,7 +187,8 @@ class ShowprofiletagAction extends Action 'format' => 'rss' ) ), - // TRANS: %1$s is user nickname + // TRANS: Feed title. + // TRANS: %s is tagger's nickname. sprintf(_('Feed for friends of %s (RSS 2.0)'), $this->tagger->nickname)), new Feed(Feed::ATOM, common_local_url( @@ -171,8 +198,9 @@ class ShowprofiletagAction extends Action 'format' => 'atom' ) ), - // TRANS: %1$s is user nickname - sprintf(_('Feed for people tagged %s by %s (Atom)'), + // TRANS: Feed title. + // TRANS: %1$s is a list, %2$s is tagger's nickname. + sprintf(_('Feed for %1$s list by %2$s (Atom)'), $this->peopletag->tag, $this->tagger->nickname ) ) @@ -187,16 +215,22 @@ class ShowprofiletagAction extends Action function showEmptyListMessage() { - // TRANS: %1$s is user nickname - $message = sprintf(_('This is the timeline for people tagged %s by %s but no one has posted anything yet.'), $this->peopletag->tag, $this->tagger->nickname) . ' '; + // TRANS: Empty list message for list timeline. + // TRANS: %1$s is a list, %2$s is a tagger's nickname. + $message = sprintf(_('This is the timeline for %1$s list by %2$s but no one has posted anything yet.'), + $this->peopletag->tag, + $this->tagger->nickname) . ' '; if (common_logged_in()) { $current_user = common_current_user(); if ($this->tagger->id == $current_user->id) { + // TRANS: Additional empty list message for list timeline for currently logged in user tagged tags. $message .= _('Try tagging more people.'); } } else { - $message .= _('Why not [register an account](%%%%action.register%%%%) and start following this timeline.'); + // TRANS: Additional empty list message for list timeline. + // TRANS: This message contains Markdown links in the form [description](link). + $message .= _('Why not [register an account](%%%%action.register%%%%) and start following this timeline!'); } $this->elementStart('div', 'guide'); @@ -228,10 +262,12 @@ class ShowprofiletagAction extends Action $this->showEmptyListMessage(); } - $this->pagination( - $this->page > 1, $cnt > NOTICES_PER_PAGE, - $this->page, 'showprofiletag', array('tag' => $this->peopletag->tag, - 'tagger' => $this->tagger->nickname) + $this->pagination($this->page > 1, + $cnt > NOTICES_PER_PAGE, + $this->page, + 'showprofiletag', + array('tag' => $this->peopletag->tag, + 'tagger' => $this->tagger->nickname) ); Event::handle('EndShowProfileTagContent', array($this)); @@ -259,19 +295,10 @@ class ShowprofiletagAction extends Action $this->elementStart('div', array('id' => 'entity_tagged', 'class' => 'section')); if (Event::handle('StartShowTaggedProfilesMiniList', array($this))) { - $title = ''; - $current = common_current_user(); - if(!empty($current) && $this->peopletag->tagger == $current->id) { - $title = sprintf(_('People tagged %s by you'), $this->peopletag->tag); - } else { - $title = sprintf(_('People tagged %1$s by %2$s'), - $this->peopletag->tag, - $this->tagger->nickname); - } - - $this->element('h2', null, $title); + // TRANS: Header on show list page. + $this->element('h2', null, _('Listed')); $cnt = 0; @@ -279,6 +306,7 @@ class ShowprofiletagAction extends Action $pml = new ProfileMiniList($profile, $this); $cnt = $pml->show(); if ($cnt == 0) { + // TRANS: Content of "Listed" page if there are no listed users. $this->element('p', null, _('(None)')); } } @@ -289,6 +317,8 @@ class ShowprofiletagAction extends Action array('nickname' => $this->tagger->nickname, 'profiletag' => $this->peopletag->tag)), 'class' => 'more'), + // TRANS: Link for more "People in list x by a user" + // TRANS: if there are more than the mini list's maximum. _('Show all')); $this->elementEnd('p'); } @@ -305,6 +335,7 @@ class ShowprofiletagAction extends Action $this->elementStart('div', array('id' => 'entity_subscribers', 'class' => 'section')); if (Event::handle('StartShowProfileTagSubscribersMiniList', array($this))) { + // TRANS: Header for tag subscribers. $this->element('h2', null, _('Subscribers')); $cnt = 0; @@ -313,19 +344,12 @@ class ShowprofiletagAction extends Action $pml = new ProfileMiniList($profile, $this); $cnt = $pml->show(); if ($cnt == 0) { + // TRANS: Content of "People following tag x" if there are no subscribed users. $this->element('p', null, _('(None)')); } } - if ($cnt > PROFILES_PER_MINILIST) { - $this->elementStart('p'); - $this->element('a', array('href' => common_local_url('profiletagsubscribers', - array('nickname' => $this->tagger->nickname, - 'profiletag' => $this->peopletag->tag)), - 'class' => 'more'), - _('All subscribers')); - $this->elementEnd('p'); - } + // FIXME: link to full list Event::handle('EndShowProfileTagSubscribersMiniList', array($this)); }