* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @author Sarven Capadisli <csarven@status.net>
- * @copyright 2008-2009 StatusNet, Inc.
+ * @copyright 2008-2011 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-class ShowgroupAction extends GroupDesignAction
+class ShowgroupAction extends Action
{
/** page we're viewing. */
var $page = null;
+ var $userProfile = null;
+ var $notice = null;
/**
* Is this page read-only?
return false;
}
+ $this->userProfile = Profile::current();
+
+ $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;
*
* @return void
*/
- function showLocalNav()
+ function showObjectNav()
{
$nav = new GroupNav($this, $this->group);
$nav->show();
*/
function showContent()
{
- $this->showGroupProfile();
- $this->showGroupActions();
$this->showGroupNotices();
}
*/
function showGroupNotices()
{
- $notice = $this->group->getNotices(($this->page-1)*NOTICES_PER_PAGE,
- NOTICES_PER_PAGE + 1);
-
- $nl = new ThreadedNoticeList($notice, $this);
+ $nl = new ThreadedNoticeList($this->notice, $this, $this->userProfile);
$cnt = $nl->show();
$this->pagination($this->page > 1,
array('nickname' => $this->group->nickname));
}
- /**
- * Show the group profile
- *
- * Information about the group
- *
- * @return void
- */
- function showGroupProfile()
- {
- $this->elementStart('div', array('id' => 'i',
- 'class' => 'entity_profile vcard author'));
-
- $logo = ($this->group->homepage_logo) ?
- $this->group->homepage_logo : User_group::defaultLogo(AVATAR_PROFILE_SIZE);
-
- $this->element('img', array('src' => $logo,
- 'class' => 'photo avatar entity_depiction',
- 'width' => AVATAR_PROFILE_SIZE,
- 'height' => AVATAR_PROFILE_SIZE,
- 'alt' => $this->group->nickname));
-
- $hasFN = ($this->group->fullname) ? 'entity_nickname nickname url uid' :
- 'entity_nickname fn org nickname url uid';
- $this->element('a', array('href' => $this->group->homeUrl(),
- 'rel' => 'me', 'class' => $hasFN),
- $this->group->nickname);
-
- if ($this->group->fullname) {
- $this->element('div', 'entity_fn fn org', $this->group->fullname);
- }
-
- if ($this->group->location) {
- $this->element('div', 'entity_location label', $this->group->location);
- }
-
- if ($this->group->homepage) {
- $this->element('a', array('href' => $this->group->homepage,
- 'rel' => 'me',
- 'class' => 'url entity_url'),
- $this->group->homepage);
- }
-
- if ($this->group->description) {
- $this->element('div', 'note entity_note', $this->group->description);
- }
-
- if (common_config('group', 'maxaliases') > 0) {
- $aliases = $this->group->getAliases();
-
- if (!empty($aliases)) {
- $this->element('div',
- 'aliases entity_aliases',
- implode(' ', $aliases));
- }
-
- if ($this->group->description) {
- $this->elementStart('dl', 'entity_note');
- // TRANS: Label for group description or group note (dt). Text hidden by default.
- $this->element('dt', null, _('Note'));
- $this->element('dd', 'note', $this->group->description);
- $this->elementEnd('dl');
- }
-
- if (common_config('group', 'maxaliases') > 0) {
- $aliases = $this->group->getAliases();
-
- if (!empty($aliases)) {
- $this->elementStart('dl', 'entity_aliases');
- // TRANS: Label for group aliases (dt). Text hidden by default.
- $this->element('dt', null, _('Aliases'));
- $this->element('dd', 'aliases', implode(' ', $aliases));
- $this->elementEnd('dl');
- }
- }
-
- Event::handle('EndGroupProfileElements', array($this, $this->group));
- }
-
- $this->elementEnd('div');
- }
-
- function showGroupActions()
- {
- $cur = common_current_user();
- $this->elementStart('div', 'entity_actions');
- // TRANS: Group actions header (h2). Text hidden by default.
- $this->element('h2', null, _('Group actions'));
- $this->elementStart('ul');
- if (Event::handle('StartGroupActionsList', array($this, $this->group))) {
- $this->elementStart('li', 'entity_subscribe');
- if (Event::handle('StartGroupSubscribe', array($this, $this->group))) {
- if ($cur) {
- if ($cur->isMember($this->group)) {
- $lf = new LeaveForm($this, $this->group);
- $lf->show();
- } else if (!Group_block::isBlocked($this->group, $cur->getProfile())) {
- $jf = new JoinForm($this, $this->group);
- $jf->show();
- }
- }
- Event::handle('EndGroupSubscribe', array($this, $this->group));
- }
- $this->elementEnd('li');
- if ($cur && $cur->hasRight(Right::DELETEGROUP)) {
- $this->elementStart('li', 'entity_delete');
- $df = new DeleteGroupForm($this, $this->group);
- $df->show();
- $this->elementEnd('li');
- }
- Event::handle('EndGroupActionsList', array($this, $this->group));
- }
- $this->elementEnd('ul');
- $this->elementEnd('div');
- }
-
/**
* Get a list of the feeds for this page
*
// TRANS: Header for group statistics on a group page (h2).
$this->element('h2', null, _('Statistics'));
- $this->elementEnd('dl');
+ $this->elementStart('dl');
+
+ // TRANS: Label for group creation date.
$this->element('dt', null, _m('LABEL','Created'));
$this->element('dd', 'entity_created', date('j M Y',
strtotime($this->group->created)));
$this->raw(common_markup_to_html($m));
$this->elementEnd('div');
}
+
+ function noticeFormOptions()
+ {
+ $options = parent::noticeFormOptions();
+ $cur = common_current_user();
+
+ if (!empty($cur) && $cur->isMember($this->group)) {
+ $options['to_group'] = $this->group;
+ }
+
+ return $options;
+ }
}
class GroupAdminSection extends ProfileSection
function title()
{
- // TRANS: Header for list of group administrators on a group page (h2).
- return _('Admins');
+ // TRANS: Title for list of group administrators on a group page.
+ return _m('TITLE','Admins');
}
function divId()
return $aAttrs;
}
}
+
+class ThreadingGroupNoticeStream extends ThreadingNoticeStream
+{
+ function __construct($group, $profile)
+ {
+ parent::__construct(new GroupNoticeStream($group, $profile));
+ }
+}
\ No newline at end of file