X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fshowgroup.php;h=d4f65a805983d01fa5361b4729080d06d97a7297;hb=25198a8d4cee5b2182f1ecb99192a4108a01afa4;hp=2806944452288c95c4f03a3780f54876b1574328;hpb=b09276635c6e20290f0955c4f86ff4a13c7774de;p=quix0rs-gnu-social.git diff --git a/actions/showgroup.php b/actions/showgroup.php index 2806944452..d4f65a8059 100644 --- a/actions/showgroup.php +++ b/actions/showgroup.php @@ -23,7 +23,7 @@ * @package StatusNet * @author Evan Prodromou * @author Sarven Capadisli - * @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/ */ @@ -46,10 +46,12 @@ define('MEMBERS_PER_SECTION', 27); * @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? @@ -144,6 +146,13 @@ class ShowgroupAction extends GroupDesignAction 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; @@ -167,7 +176,7 @@ class ShowgroupAction extends GroupDesignAction * * @return void */ - function showLocalNav() + function showObjectNav() { $nav = new GroupNav($this, $this->group); $nav->show(); @@ -180,8 +189,6 @@ class ShowgroupAction extends GroupDesignAction */ function showContent() { - $this->showGroupProfile(); - $this->showGroupActions(); $this->showGroupNotices(); } @@ -192,10 +199,7 @@ class ShowgroupAction extends GroupDesignAction */ function showGroupNotices() { - $notice = $this->group->getNotices(($this->page-1)*NOTICES_PER_PAGE, - NOTICES_PER_PAGE + 1); - - $nl = new NoticeList($notice, $this); + $nl = new ThreadedNoticeList($this->notice, $this, $this->userProfile); $cnt = $nl->show(); $this->pagination($this->page > 1, @@ -205,140 +209,6 @@ class ShowgroupAction extends GroupDesignAction 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')); - - if (Event::handle('StartGroupProfileElements', array($this, $this->group))) { - - // TRANS: Group profile header (h2). Text hidden by default. - $this->element('h2', null, _('Group profile')); - - $this->elementStart('dl', 'entity_depiction'); - // TRANS: Label for group avatar (dt). Text hidden by default. - $this->element('dt', null, _('Avatar')); - $this->elementStart('dd'); - - $logo = ($this->group->homepage_logo) ? - $this->group->homepage_logo : User_group::defaultLogo(AVATAR_PROFILE_SIZE); - - $this->element('img', array('src' => $logo, - 'class' => 'photo avatar', - 'width' => AVATAR_PROFILE_SIZE, - 'height' => AVATAR_PROFILE_SIZE, - 'alt' => $this->group->nickname)); - $this->elementEnd('dd'); - $this->elementEnd('dl'); - - $this->elementStart('dl', 'entity_nickname'); - // TRANS: Label for group nickname (dt). Text hidden by default. - $this->element('dt', null, _('Nickname')); - $this->elementStart('dd'); - $hasFN = ($this->group->fullname) ? 'nickname url uid' : 'fn org nickname url uid'; - $this->element('a', array('href' => $this->group->homeUrl(), - 'rel' => 'me', 'class' => $hasFN), - $this->group->nickname); - $this->elementEnd('dd'); - $this->elementEnd('dl'); - - if ($this->group->fullname) { - $this->elementStart('dl', 'entity_fn'); - // TRANS: Label for full group name (dt). Text hidden by default. - $this->element('dt', null, _('Full name')); - $this->elementStart('dd'); - $this->element('span', 'fn org', $this->group->fullname); - $this->elementEnd('dd'); - $this->elementEnd('dl'); - } - - if ($this->group->location) { - $this->elementStart('dl', 'entity_location'); - // TRANS: Label for group location (dt). Text hidden by default. - $this->element('dt', null, _('Location')); - $this->element('dd', 'label', $this->group->location); - $this->elementEnd('dl'); - } - - if ($this->group->homepage) { - $this->elementStart('dl', 'entity_url'); - // TRANS: Label for group URL (dt). Text hidden by default. - $this->element('dt', null, _('URL')); - $this->elementStart('dd'); - $this->element('a', array('href' => $this->group->homepage, - 'rel' => 'me', 'class' => 'url'), - $this->group->homepage); - $this->elementEnd('dd'); - $this->elementEnd('dl'); - } - - 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 * @@ -350,7 +220,14 @@ class ShowgroupAction extends GroupDesignAction common_local_url('grouprss', array('nickname' => $this->group->nickname)); - return array(new Feed(Feed::RSS1, + return array(new Feed(Feed::JSON, + common_local_url('ApiTimelineGroup', + array('format' => 'as', + 'id' => $this->group->id)), + // TRANS: Tooltip for feed link. %s is a group nickname. + 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)), // TRANS: Tooltip for feed link. %s is a group nickname. @@ -459,15 +336,12 @@ class ShowgroupAction extends GroupDesignAction // TRANS: Header for group statistics on a group page (h2). $this->element('h2', null, _('Statistics')); - $this->elementStart('dl', 'entity_created'); - // @todo FIXME: i18n issue. This label gets a colon added from somewhere. Should be part of the message. - // TRANS: Label for creation date in statistics on group page. + $this->elementStart('dl'); + + // TRANS: Label for group creation date. $this->element('dt', null, _m('LABEL','Created')); - $this->element('dd', null, date('j M Y', + $this->element('dd', 'entity_created', date('j M Y', strtotime($this->group->created))); - $this->elementEnd('dl'); - - $this->elementStart('dl', 'entity_members'); // @todo FIXME: i18n issue. This label gets a colon added from somewhere. Should be part of the message. // TRANS: Label for member count in statistics on group page. $this->element('dt', null, _m('LABEL','Members')); @@ -504,6 +378,18 @@ class ShowgroupAction extends GroupDesignAction $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 @@ -523,8 +409,8 @@ 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() @@ -559,3 +445,11 @@ class GroupMembersMiniListItem extends ProfileMiniListItem return $aAttrs; } } + +class ThreadingGroupNoticeStream extends ThreadingNoticeStream +{ + function __construct($group, $profile) + { + parent::__construct(new GroupNoticeStream($group, $profile)); + } +} \ No newline at end of file