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 Adrian Lang <mail@adrianlang.de>
22 * @author Brenda Wallace <shiny@cpan.org>
23 * @author Brion Vibber <brion@pobox.com>
24 * @author Craig Andrews <candrews@integralblue.com>
25 * @author Evan Prodromou <evan@status.net>
26 * @author Jeffery To <jeffery.to@gmail.com>
27 * @author Meitar Moscovitz <meitarm@gmail.com>
28 * @author Mike Cochrane <mikec@mikenz.geek.nz>
29 * @author Robin Millette <millette@status.net>
30 * @author Sarven Capadisli <csarven@status.net>
31 * @author Siebrand Mazeland <s.mazeland@xs4all.nl>
32 * @author Zach Copley <zach@status.net>
33 * @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
34 * @license GNU Affero General Public License http://www.gnu.org/licenses/
35 * @link http://status.net
38 if (!defined('STATUSNET') && !defined('LACONICA')) {
42 require_once INSTALLDIR.'/lib/personalgroupnav.php';
43 require_once INSTALLDIR.'/lib/noticelist.php';
44 require_once INSTALLDIR.'/lib/feedlist.php';
46 class AllAction extends ProfileAction
50 function isReadOnly($args)
55 function prepare($args)
57 parent::prepare($args);
58 $cur = common_current_user();
60 if (!empty($cur) && $cur->id == $this->user->id) {
61 $this->notice = $this->user->noticeInbox(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
63 $this->notice = $this->user->noticesWithFriends(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
66 if ($this->page > 1 && $this->notice->N == 0) {
67 // TRANS: Server error when page not found (404)
68 $this->serverError(_('No such page.'), $code = 404);
74 function handle($args)
76 parent::handle($args);
79 $this->clientError(_('No such user.'));
88 if ($this->page > 1) {
89 // TRANS: Page title. %1$s is user nickname, %2$d is page number
90 return sprintf(_('%1$s and friends, page %2$d'), $this->user->nickname, $this->page);
92 // TRANS: Page title. %1$s is user nickname
93 return sprintf(_("%s and friends"), $this->user->nickname);
104 $this->user->nickname)
106 // TRANS: %1$s is user nickname
107 sprintf(_('Feed for friends of %s (RSS 1.0)'), $this->user->nickname)),
110 'ApiTimelineFriends', array(
112 'id' => $this->user->nickname
115 // TRANS: %1$s is user nickname
116 sprintf(_('Feed for friends of %s (RSS 2.0)'), $this->user->nickname)),
119 'ApiTimelineFriends', array(
121 'id' => $this->user->nickname
124 // TRANS: %1$s is user nickname
125 sprintf(_('Feed for friends of %s (Atom)'), $this->user->nickname))
129 function showLocalNav()
131 $nav = new PersonalGroupNav($this);
135 function showEmptyListMessage()
137 // TRANS: %1$s is user nickname
138 $message = sprintf(_('This is the timeline for %s and friends but no one has posted anything yet.'), $this->user->nickname) . ' ';
140 if (common_logged_in()) {
141 $current_user = common_current_user();
142 if ($this->user->id === $current_user->id) {
143 $message .= _('Try subscribing to more people, [join a group](%%action.groups%%) or post something yourself.');
145 // TRANS: %1$s is user nickname, %2$s is user nickname, %2$s is user nickname prefixed with "@"
146 $message .= sprintf(_('You can try to [nudge %1$s](../%2$s) from their profile or [post something to their attention](%%%%action.newnotice%%%%?status_textarea=%3$s).'), $this->user->nickname, $this->user->nickname, '@' . $this->user->nickname);
149 $message .= sprintf(_('Why not [register an account](%%%%action.register%%%%) and then nudge %s or post a notice to their attention.'), $this->user->nickname);
152 $this->elementStart('div', 'guide');
153 $this->raw(common_markup_to_html($message));
154 $this->elementEnd('div');
157 function showContent()
159 if (Event::handle('StartShowAllContent', array($this))) {
160 $nl = new NoticeList($this->notice, $this);
165 $this->showEmptyListMessage();
169 $this->page > 1, $cnt > NOTICES_PER_PAGE,
170 $this->page, 'all', array('nickname' => $this->user->nickname)
173 Event::handle('EndShowAllContent', array($this));
177 function showPageTitle()
179 $user = common_current_user();
180 if ($user && ($user->id == $this->user->id)) {
182 $this->element('h1', null, _("You and friends"));
184 // TRANS: H1 text. %1$s is user nickname
185 $this->element('h1', null, sprintf(_('%s and friends'), $this->user->nickname));