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 * @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
31 * @license GNU Affero General Public License http://www.gnu.org/licenses/
32 * @link http://status.net
35 if (!defined('STATUSNET') && !defined('LACONICA')) {
39 require_once INSTALLDIR.'/lib/personalgroupnav.php';
40 require_once INSTALLDIR.'/lib/noticelist.php';
41 require_once INSTALLDIR.'/lib/feedlist.php';
43 class AllAction extends ProfileAction
47 function isReadOnly($args)
52 function prepare($args)
54 parent::prepare($args);
55 $cur = common_current_user();
57 if (!empty($cur) && $cur->id == $this->user->id) {
58 $this->notice = $this->user->noticeInbox(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
60 $this->notice = $this->user->noticesWithFriends(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
63 if ($this->page > 1 && $this->notice->N == 0) {
64 // TRANS: Server error when page not found (404)
65 $this->serverError(_('No such page.'), $code = 404);
71 function handle($args)
73 parent::handle($args);
76 $this->clientError(_('No such user.'));
85 if ($this->page > 1) {
86 // TRANS: Page title. %1$s is user nickname, %2$d is page number
87 return sprintf(_('%1$s and friends, page %2$d'), $this->user->nickname, $this->page);
89 // TRANS: Page title. %1$s is user nickname
90 return sprintf(_("%s and friends"), $this->user->nickname);
101 $this->user->nickname)
103 // TRANS: %1$s is user nickname
104 sprintf(_('Feed for friends of %s (RSS 1.0)'), $this->user->nickname)),
107 'ApiTimelineFriends', array(
109 'id' => $this->user->nickname
112 // TRANS: %1$s is user nickname
113 sprintf(_('Feed for friends of %s (RSS 2.0)'), $this->user->nickname)),
116 'ApiTimelineFriends', array(
118 'id' => $this->user->nickname
121 // TRANS: %1$s is user nickname
122 sprintf(_('Feed for friends of %s (Atom)'), $this->user->nickname))
126 function showLocalNav()
128 $nav = new PersonalGroupNav($this);
132 function showEmptyListMessage()
134 // TRANS: %1$s is user nickname
135 $message = sprintf(_('This is the timeline for %s and friends but no one has posted anything yet.'), $this->user->nickname) . ' ';
137 if (common_logged_in()) {
138 $current_user = common_current_user();
139 if ($this->user->id === $current_user->id) {
140 $message .= _('Try subscribing to more people, [join a group](%%action.groups%%) or post something yourself.');
142 // TRANS: %1$s is user nickname, %2$s is user nickname, %2$s is user nickname prefixed with "@"
143 $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);
146 $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);
149 $this->elementStart('div', 'guide');
150 $this->raw(common_markup_to_html($message));
151 $this->elementEnd('div');
154 function showContent()
156 if (Event::handle('StartShowAllContent', array($this))) {
157 $nl = new NoticeList($this->notice, $this);
162 $this->showEmptyListMessage();
166 $this->page > 1, $cnt > NOTICES_PER_PAGE,
167 $this->page, 'all', array('nickname' => $this->user->nickname)
170 Event::handle('EndShowAllContent', array($this));
174 function showPageTitle()
176 $user = common_current_user();
177 if ($user && ($user->id == $this->user->id)) {
179 $this->element('h1', null, _("You and friends"));
181 // TRANS: H1 text. %1$s is user nickname
182 $this->element('h1', null, sprintf(_('%s and friends'), $this->user->nickname));