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 $this->serverError(_('No such page'), $code = 404);
69 function handle($args)
71 parent::handle($args);
74 $this->clientError(_('No such user.'));
83 if ($this->page > 1) {
84 return sprintf(_("%s and friends, page %d"), $this->user->nickname, $this->page);
86 return sprintf(_("%s and friends"), $this->user->nickname);
97 $this->user->nickname)
99 sprintf(_('Feed for friends of %s (RSS 1.0)'), $this->user->nickname)),
102 'ApiTimelineFriends', array(
104 'id' => $this->user->nickname
107 sprintf(_('Feed for friends of %s (RSS 2.0)'), $this->user->nickname)),
110 'ApiTimelineFriends', array(
112 'id' => $this->user->nickname
115 sprintf(_('Feed for friends of %s (Atom)'), $this->user->nickname))
119 function showLocalNav()
121 $nav = new PersonalGroupNav($this);
125 function showEmptyListMessage()
127 $message = sprintf(_('This is the timeline for %s and friends but no one has posted anything yet.'), $this->user->nickname) . ' ';
129 if (common_logged_in()) {
130 $current_user = common_current_user();
131 if ($this->user->id === $current_user->id) {
132 $message .= _('Try subscribing to more people, [join a group](%%action.groups%%) or post something yourself.');
134 $message .= sprintf(_('You can try to [nudge %s](../%s) from his profile or [post something to his or her attention](%%%%action.newnotice%%%%?status_textarea=%s).'), $this->user->nickname, $this->user->nickname, '@' . $this->user->nickname);
137 $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);
140 $this->elementStart('div', 'guide');
141 $this->raw(common_markup_to_html($message));
142 $this->elementEnd('div');
145 function showContent()
147 $nl = new NoticeList($this->notice, $this);
152 $this->showEmptyListMessage();
156 $this->page > 1, $cnt > NOTICES_PER_PAGE,
157 $this->page, 'all', array('nickname' => $this->user->nickname)
161 function showPageTitle()
163 $user =& common_current_user();
164 if ($user && ($user->id == $this->user->id)) {
165 $this->element('h1', null, _("You and friends"));
167 $this->element('h1', null, sprintf(_('%s and friends'), $this->user->nickname));