3 * StatusNet, the distributed open-source microblogging tool
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-2011 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('GNUSOCIAL')) { exit(1); }
37 * @author Evan Prodromou <evan@status.net>
38 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
39 * @link http://status.net/
41 class RepliesAction extends ShowstreamAction
46 public function getStream()
48 return new ReplyNoticeStream($this->target->getID(), $this->scoped);
54 * Includes name of user and page number.
56 * @return string title of page
60 if ($this->page == 1) {
61 // TRANS: Title for first page of replies for a user.
62 // TRANS: %s is a user nickname.
63 return sprintf(_("Replies to %s"), $this->target->getNickname());
65 // TRANS: Title for all but the first page of replies for a user.
66 // TRANS: %1$s is a user nickname, %2$d is a page number.
67 return sprintf(_('Replies to %1$s, page %2$d'),
68 $this->target->getNickname(),
74 * Feeds for the <head> section
80 return array(new Feed(Feed::JSON,
81 common_local_url('ApiTimelineMentions',
83 'id' => $this->target->getNickname(),
85 // TRANS: Link for feed with replies for a user.
86 // TRANS: %s is a user nickname.
87 sprintf(_('Replies feed for %s (Activity Streams JSON)'),
88 $this->user->nickname)),
90 common_local_url('repliesrss',
91 array('nickname' => $this->target->getNickname())),
92 // TRANS: Link for feed with replies for a user.
93 // TRANS: %s is a user nickname.
94 sprintf(_('Replies feed for %s (RSS 1.0)'),
95 $this->target->getNickname())),
97 common_local_url('ApiTimelineMentions',
99 'id' => $this->target->getNickname(),
101 // TRANS: Link for feed with replies for a user.
102 // TRANS: %s is a user nickname.
103 sprintf(_('Replies feed for %s (RSS 2.0)'),
104 $this->target->getNickname())),
106 common_local_url('ApiTimelineMentions',
108 'id' => $this->target->getNickname(),
109 'format' => 'atom')),
110 // TRANS: Link for feed with replies for a user.
111 // TRANS: %s is a user nickname.
112 sprintf(_('Replies feed for %s (Atom)'),
113 $this->target->getNickname())));
116 function showContent()
118 $nl = new PrimaryNoticeList($this->notice, $this, array('show_n'=>NOTICES_PER_PAGE));
122 $this->showEmptyListMessage();
125 $this->pagination($this->page > 1, $cnt > NOTICES_PER_PAGE,
126 $this->page, 'replies',
127 array('nickname' => $this->target->getNickname()));
130 function showEmptyListMessage()
132 // TRANS: Empty list message for page with replies for a user.
133 // TRANS: %1$s is the user nickname.
134 $message = sprintf(_('This is the timeline showing replies to %1$s but no notices have arrived yet.'), $this->target->getNickname());
135 $message .= ' '; // Spacing between this sentence and the next.
137 if (common_logged_in()) {
138 if ($this->target->getID() === $this->scoped->getID()) {
139 // TRANS: Empty list message for page with replies for a user for the logged in user.
140 // TRANS: This message contains a Markdown link in the form [link text](link).
141 $message .= _('You can engage other users in a conversation, subscribe to more people or [join groups](%%action.groups%%).');
143 // TRANS: Empty list message for page with replies for a user for all logged in users but the user themselves.
144 // TRANS: %1$s is a user nickname and %2$s is the same but with a prepended '@' character. This message contains a Markdown link in the form [link text](link).
145 $message .= sprintf(_('You can try to [nudge %1$s](../%1$s) or [post something to them](%%%%action.newnotice%%%%?content=%2$s).'), $this->target->getNickname(), '@' . $this->target->getNickname());
148 // TRANS: Empty list message for page with replies for a user for not logged in users.
149 // TRANS: %1$s is a user nickname. This message contains a Markdown link in the form [link text](link).
150 $message .= sprintf(_('Why not [register an account](%%%%action.register%%%%) and then nudge %s or post a notice to them.'), $this->target->getNickname());
153 $this->elementStart('div', 'guide');
154 $this->raw(common_markup_to_html($message));
155 $this->elementEnd('div');
158 public function isReadOnly(array $args = array())