3 * StatusNet, the distributed open-source microblogging tool
9 * LICENCE: This program is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU Affero General Public License as published by
11 * the Free Software Foundation, either version 3 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU Affero General Public License for more details.
19 * You should have received a copy of the GNU Affero General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
24 * @author Evan Prodromou <evan@status.net>
25 * @author Sarven Capadisli <csarven@status.net>
26 * @copyright 2008-2011 StatusNet, Inc.
27 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
28 * @link http://status.net/
31 if (!defined('STATUSNET') && !defined('LACONICA')) {
35 require_once INSTALLDIR.'/lib/noticelist.php';
36 require_once INSTALLDIR.'/lib/feedlist.php';
43 * @author Evan Prodromou <evan@status.net>
44 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
45 * @link http://status.net/
47 class ShowgroupAction extends GroupAction
49 /** page we're viewing. */
51 var $userProfile = null;
55 * Is this page read-only?
57 * @return boolean true
59 function isReadOnly($args)
67 * @return string page title, with page number
71 $base = $this->group->getFancyName();
73 if ($this->page == 1) {
74 // TRANS: Page title for first group page. %s is a group name.
75 return sprintf(_('%s group'), $base);
77 // TRANS: Page title for any but first group page.
78 // TRANS: %1$s is a group name, $2$s is a page number.
79 return sprintf(_('%1$s group, page %2$d'),
88 * Reads and validates arguments and instantiates the attributes.
90 * @param array $args $_REQUEST args
92 * @return boolean success flag
94 function prepare($args)
96 parent::prepare($args);
98 $this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
101 $this->userProfile = Profile::current();
103 $stream = new ThreadingGroupNoticeStream($this->group, $this->userProfile);
105 $this->notice = $stream->getNotices(($this->page-1)*NOTICES_PER_PAGE,
106 NOTICES_PER_PAGE + 1);
108 common_set_returnto($this->selfUrl());
116 * Shows a profile for the group, some controls, and a list of
121 function handle($args)
127 * Show the page content
129 * Shows a group profile and a list of group notices
131 function showContent()
133 $this->showGroupNotices();
137 * Show the group notices
141 function showGroupNotices()
143 $nl = new ThreadedNoticeList($this->notice, $this, $this->userProfile);
146 $this->pagination($this->page > 1,
147 $cnt > NOTICES_PER_PAGE,
150 array('nickname' => $this->group->nickname));
154 * Get a list of the feeds for this page
161 common_local_url('grouprss',
162 array('nickname' => $this->group->nickname));
164 return array(new Feed(Feed::JSON,
165 common_local_url('ApiTimelineGroup',
166 array('format' => 'as',
167 'id' => $this->group->id)),
168 // TRANS: Tooltip for feed link. %s is a group nickname.
169 sprintf(_('Notice feed for %s group (Activity Streams JSON)'),
170 $this->group->nickname)),
172 common_local_url('grouprss',
173 array('nickname' => $this->group->nickname)),
174 // TRANS: Tooltip for feed link. %s is a group nickname.
175 sprintf(_('Notice feed for %s group (RSS 1.0)'),
176 $this->group->nickname)),
178 common_local_url('ApiTimelineGroup',
179 array('format' => 'rss',
180 'id' => $this->group->id)),
181 // TRANS: Tooltip for feed link. %s is a group nickname.
182 sprintf(_('Notice feed for %s group (RSS 2.0)'),
183 $this->group->nickname)),
185 common_local_url('ApiTimelineGroup',
186 array('format' => 'atom',
187 'id' => $this->group->id)),
188 // TRANS: Tooltip for feed link. %s is a group nickname.
189 sprintf(_('Notice feed for %s group (Atom)'),
190 $this->group->nickname)),
192 common_local_url('foafgroup',
193 array('nickname' => $this->group->nickname)),
194 // TRANS: Tooltip for feed link. %s is a group nickname.
195 sprintf(_('FOAF for %s group'),
196 $this->group->nickname)));
199 function showAnonymousMessage()
201 if (!(common_config('site','closed') || common_config('site','inviteonly'))) {
202 // @todo FIXME: use group full name here if available instead of (uglier) primary alias.
203 // TRANS: Notice on group pages for anonymous users for StatusNet sites that accept new registrations.
204 // TRANS: **%s** is the group alias, %%%%site.name%%%% is the site name,
205 // TRANS: %%%%action.register%%%% is the URL for registration, %%%%doc.help%%%% is a URL to help.
206 // TRANS: This message contains Markdown links. Ensure they are formatted correctly: [Description](link).
207 $m = sprintf(_('**%s** is a user group on %%%%site.name%%%%, a [micro-blogging](http://en.wikipedia.org/wiki/Micro-blogging) service ' .
208 'based on the Free Software [StatusNet](http://status.net/) tool. Its members share ' .
209 'short messages about their life and interests. '.
210 '[Join now](%%%%action.register%%%%) to become part of this group and many more! ([Read more](%%%%doc.help%%%%))'),
211 $this->group->nickname);
213 // @todo FIXME: use group full name here if available instead of (uglier) primary alias.
214 // TRANS: Notice on group pages for anonymous users for StatusNet sites that accept no new registrations.
215 // TRANS: **%s** is the group alias, %%%%site.name%%%% is the site name,
216 // TRANS: This message contains Markdown links. Ensure they are formatted correctly: [Description](link).
217 $m = sprintf(_('**%s** is a user group on %%%%site.name%%%%, a [micro-blogging](http://en.wikipedia.org/wiki/Micro-blogging) service ' .
218 'based on the Free Software [StatusNet](http://status.net/) tool. Its members share ' .
219 'short messages about their life and interests. '),
220 $this->group->nickname);
222 $this->elementStart('div', array('id' => 'anon_notice'));
223 $this->raw(common_markup_to_html($m));
224 $this->elementEnd('div');