3 * StatusNet - the distributed open-source microblogging tool
4 * Copyright (C) 2008, 2009, StatusNet, Inc.
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Affero General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Affero General Public License for more details.
16 * You should have received a copy of the GNU Affero General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 * @author Evan Prodromou <evan@status.net>
22 * @author Mike Cochrane <mikec@mikenz.geek.nz>
23 * @author Robin Millette <millette@controlyourself.ca>
24 * @author Adrian Lang <mail@adrianlang.de>
25 * @author Meitar Moscovitz <meitarm@gmail.com>
26 * @author Sarven Capadisli <csarven@status.net>
27 * @author Craig Andrews <candrews@integralblue.com>
28 * @author Jeffery To <jeffery.to@gmail.com>
29 * @author Zach Copley <zach@controlyourself.ca>
30 * @license GNU Affero General Public License http://www.gnu.org/licenses/
31 * @link http://status.net
34 if (!defined('STATUSNET') && !defined('LACONICA')) {
38 require_once INSTALLDIR.'/lib/personalgroupnav.php';
39 require_once INSTALLDIR.'/lib/noticelist.php';
40 require_once INSTALLDIR.'/lib/feedlist.php';
42 class AllAction extends ProfileAction
46 function isReadOnly($args)
51 function prepare($args)
53 parent::prepare($args);
54 $cur = common_current_user();
56 if (!empty($cur) && $cur->id == $this->user->id) {
57 $this->notice = $this->user->noticeInbox(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
59 $this->notice = $this->user->noticesWithFriends(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
62 if ($this->page > 1 && $this->notice->N == 0) {
63 // TRANS: Server error when page not found (404)
64 $this->serverError(_('No such page'), $code = 404);
70 function handle($args)
72 parent::handle($args);
75 $this->clientError(_('No such user.'));
84 if ($this->page > 1) {
85 // TRANS: Page title. %1$s is user nickname, %2$d is page number
86 return sprintf(_('%1$s and friends, page %2$d'), $this->user->nickname, $this->page);
88 // TRANS: Page title. %1$s is user nickname
89 return sprintf(_("%s and friends"), $this->user->nickname);
100 $this->user->nickname)
102 // TRANS: %1$s is user nickname
103 sprintf(_('Feed for friends of %s (RSS 1.0)'), $this->user->nickname)),
106 'ApiTimelineFriends', array(
108 'id' => $this->user->nickname
111 // TRANS: %1$s is user nickname
112 sprintf(_('Feed for friends of %s (RSS 2.0)'), $this->user->nickname)),
115 'ApiTimelineFriends', array(
117 'id' => $this->user->nickname
120 // TRANS: %1$s is user nickname
121 sprintf(_('Feed for friends of %s (Atom)'), $this->user->nickname))
125 function showLocalNav()
127 $nav = new PersonalGroupNav($this);
131 function showEmptyListMessage()
133 // TRANS: %1$s is user nickname
134 $message = sprintf(_('This is the timeline for %s and friends but no one has posted anything yet.'), $this->user->nickname) . ' ';
136 if (common_logged_in()) {
137 $current_user = common_current_user();
138 if ($this->user->id === $current_user->id) {
139 $message .= _('Try subscribing to more people, [join a group](%%action.groups%%) or post something yourself.');
141 // TRANS: %1$s is user nickname, %2$s is user nickname, %2$s is user nickname prefixed with "@"
142 $message .= sprintf(_('You can try to [nudge %1$s](../%2$s) from his profile or [post something to his or her attention](%%%%action.newnotice%%%%?status_textarea=%3$s).'), $this->user->nickname, $this->user->nickname, '@' . $this->user->nickname);
145 $message .= sprintf(_('Why not [register an account](%%%%action.register%%%%) and then nudge %s or post a notice to his or her attention.'), $this->user->nickname);
148 $this->elementStart('div', 'guide');
149 $this->raw(common_markup_to_html($message));
150 $this->elementEnd('div');
153 function showContent()
155 if (Event::handle('StartShowAllContent', array($this))) {
156 $nl = new NoticeList($this->notice, $this);
161 $this->showEmptyListMessage();
165 $this->page > 1, $cnt > NOTICES_PER_PAGE,
166 $this->page, 'all', array('nickname' => $this->user->nickname)
169 Event::handle('EndShowAllContent', array($this));
173 function showPageTitle()
175 $user = common_current_user();
176 if ($user && ($user->id == $this->user->id)) {
178 $this->element('h1', null, _("You and friends"));
180 // TRANS: H1 text. %1$s is user nickname
181 $this->element('h1', null, sprintf(_('%s and friends'), $this->user->nickname));