123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246 |
- <?php
- if (!defined('STATUSNET') && !defined('LACONICA')) {
- exit(1);
- }
- require_once INSTALLDIR.'/lib/noticelist.php';
- require_once INSTALLDIR.'/lib/feedlist.php';
- class ShowgroupAction extends GroupAction
- {
-
- var $page = null;
- var $userProfile = null;
- var $notice = null;
-
- function isReadOnly($args)
- {
- return true;
- }
-
- function title()
- {
- $base = $this->group->getFancyName();
- if ($this->page == 1) {
-
- return sprintf(_('%s group'), $base);
- } else {
-
-
- return sprintf(_('%1$s group, page %2$d'),
- $base,
- $this->page);
- }
- }
-
- protected function prepare(array $args=array())
- {
- parent::prepare($args);
- $this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
- $this->userProfile = Profile::current();
- $user = common_current_user();
- if (!empty($user) && $user->streamModeOnly()) {
- $stream = new GroupNoticeStream($this->group, $this->userProfile);
- } else {
- $stream = new ThreadingGroupNoticeStream($this->group, $this->userProfile);
- }
- $this->notice = $stream->getNotices(($this->page-1)*NOTICES_PER_PAGE,
- NOTICES_PER_PAGE + 1);
- common_set_returnto($this->selfUrl());
- return true;
- }
-
- protected function handle()
- {
- parent::handle();
- $this->showPage();
- }
-
- function showContent()
- {
- $this->showGroupNotices();
- }
-
- function showGroupNotices()
- {
- $user = common_current_user();
- if (!empty($user) && $user->streamModeOnly()) {
- $nl = new PrimaryNoticeList($this->notice, $this, array('show_n'=>NOTICES_PER_PAGE));
- } else {
- $nl = new ThreadedNoticeList($this->notice, $this, $this->userProfile);
- }
- $cnt = $nl->show();
- $this->pagination($this->page > 1,
- $cnt > NOTICES_PER_PAGE,
- $this->page,
- 'showgroup',
- array('nickname' => $this->group->nickname));
- }
-
- function getFeeds()
- {
- $url =
- common_local_url('grouprss',
- array('nickname' => $this->group->nickname));
- return array(new Feed(Feed::JSON,
- common_local_url('ApiTimelineGroup',
- array('format' => 'as',
- 'id' => $this->group->id)),
-
- sprintf(_('Notice feed for %s group (Activity Streams JSON)'),
- $this->group->nickname)),
- new Feed(Feed::RSS1,
- common_local_url('grouprss',
- array('nickname' => $this->group->nickname)),
-
- sprintf(_('Notice feed for %s group (RSS 1.0)'),
- $this->group->nickname)),
- new Feed(Feed::RSS2,
- common_local_url('ApiTimelineGroup',
- array('format' => 'rss',
- 'id' => $this->group->id)),
-
- sprintf(_('Notice feed for %s group (RSS 2.0)'),
- $this->group->nickname)),
- new Feed(Feed::ATOM,
- common_local_url('ApiTimelineGroup',
- array('format' => 'atom',
- 'id' => $this->group->id)),
-
- sprintf(_('Notice feed for %s group (Atom)'),
- $this->group->nickname)),
- new Feed(Feed::FOAF,
- common_local_url('foafgroup',
- array('nickname' => $this->group->nickname)),
-
- sprintf(_('FOAF for %s group'),
- $this->group->nickname)));
- }
- function showAnonymousMessage()
- {
- if (!(common_config('site','closed') || common_config('site','inviteonly'))) {
-
-
-
-
- $m = sprintf(_('**%s** is a user group on %%%%site.name%%%%, a [micro-blogging](http://en.wikipedia.org/wiki/Micro-blogging) service ' .
- 'based on the Free Software [StatusNet](http://status.net/) tool. Its members share ' .
- 'short messages about their life and interests. '.
- '[Join now](%%%%action.register%%%%) to become part of this group and many more! ([Read more](%%%%doc.help%%%%))'),
- $this->group->getBestName());
- } else {
-
-
-
- $m = sprintf(_('**%s** is a user group on %%%%site.name%%%%, a [micro-blogging](http://en.wikipedia.org/wiki/Micro-blogging) service ' .
- 'based on the Free Software [StatusNet](http://status.net/) tool. Its members share ' .
- 'short messages about their life and interests.'),
- $this->group->getBestName());
- }
- $this->elementStart('div', array('id' => 'anon_notice'));
- $this->raw(common_markup_to_html($m));
- $this->elementEnd('div');
- }
- function extraHead()
- {
- if ($this->page != 1) {
- $this->element('link', array('rel' => 'canonical',
- 'href' => $this->group->homeUrl()));
- }
- }
- }
|