123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237 |
- <?php
- if (!defined('STATUSNET') && !defined('LACONICA')) {
- exit(1);
- }
- require_once INSTALLDIR.'/lib/personalgroupnav.php';
- require_once INSTALLDIR.'/lib/noticelist.php';
- require_once INSTALLDIR.'/lib/feedlist.php';
- class RepliesAction extends Action
- {
- var $page = null;
- var $notice;
-
- function prepare($args)
- {
- parent::prepare($args);
- $nickname = common_canonical_nickname($this->arg('nickname'));
- $this->user = User::getKV('nickname', $nickname);
- if (!$this->user) {
-
- $this->clientError(_('No such user.'));
- }
- $profile = $this->user->getProfile();
- if (!$profile) {
-
- $this->serverError(_('User has no profile.'));
- }
- $this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
- common_set_returnto($this->selfUrl());
- $stream = new ReplyNoticeStream($this->user->id,
- Profile::current());
- $this->notice = $stream->getNotices(($this->page-1) * NOTICES_PER_PAGE,
- NOTICES_PER_PAGE + 1);
- if($this->page > 1 && $this->notice->N == 0){
-
- $this->clientError(_('No such page.'), 404);
- }
- return true;
- }
-
- function handle($args)
- {
- parent::handle($args);
- $this->showPage();
- }
-
- function title()
- {
- if ($this->page == 1) {
-
-
- return sprintf(_("Replies to %s"), $this->user->nickname);
- } else {
-
-
- return sprintf(_('Replies to %1$s, page %2$d'),
- $this->user->nickname,
- $this->page);
- }
- }
-
- function getFeeds()
- {
- return array(new Feed(Feed::JSON,
- common_local_url('ApiTimelineMentions',
- array(
- 'id' => $this->user->nickname,
- 'format' => 'as')),
-
-
- sprintf(_('Replies feed for %s (Activity Streams JSON)'),
- $this->user->nickname)),
- new Feed(Feed::RSS1,
- common_local_url('repliesrss',
- array('nickname' => $this->user->nickname)),
-
-
- sprintf(_('Replies feed for %s (RSS 1.0)'),
- $this->user->nickname)),
- new Feed(Feed::RSS2,
- common_local_url('ApiTimelineMentions',
- array(
- 'id' => $this->user->nickname,
- 'format' => 'rss')),
-
-
- sprintf(_('Replies feed for %s (RSS 2.0)'),
- $this->user->nickname)),
- new Feed(Feed::ATOM,
- common_local_url('ApiTimelineMentions',
- array(
- 'id' => $this->user->nickname,
- 'format' => 'atom')),
-
-
- sprintf(_('Replies feed for %s (Atom)'),
- $this->user->nickname)));
- }
-
- function showContent()
- {
- $nl = new PrimaryNoticeList($this->notice, $this, array('show_n'=>NOTICES_PER_PAGE));
- $cnt = $nl->show();
- if (0 === $cnt) {
- $this->showEmptyListMessage();
- }
- $this->pagination($this->page > 1, $cnt > NOTICES_PER_PAGE,
- $this->page, 'replies',
- array('nickname' => $this->user->nickname));
- }
- function showEmptyListMessage()
- {
-
-
- $message = sprintf(_('This is the timeline showing replies to %1$s but %2$s hasn\'t received a notice to them yet.'),
- $this->user->nickname,
- $this->user->nickname) . ' ';
- if (common_logged_in()) {
- $current_user = common_current_user();
- if ($this->user->id === $current_user->id) {
-
-
- $message .= _('You can engage other users in a conversation, subscribe to more people or [join groups](%%action.groups%%).');
- } else {
-
-
- $message .= sprintf(_('You can try to [nudge %1$s](../%2$s) or [post something to them](%%%%action.newnotice%%%%?status_textarea=%3$s).'), $this->user->nickname, $this->user->nickname, '@' . $this->user->nickname);
- }
- }
- else {
-
-
- $message .= sprintf(_('Why not [register an account](%%%%action.register%%%%) and then nudge %s or post a notice to them.'), $this->user->nickname);
- }
- $this->elementStart('div', 'guide');
- $this->raw(common_markup_to_html($message));
- $this->elementEnd('div');
- }
- function isReadOnly($args)
- {
- return true;
- }
- }
|