]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/showgroup.php
Merge branch '1.0.x' into testing
[quix0rs-gnu-social.git] / actions / showgroup.php
index aa1f620880e0c9ccf6594ef2d7d643b30dda1b1b..530deff622ff21a8b0cdf1668afb3245cbcb59a0 100644 (file)
@@ -23,7 +23,7 @@
  * @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/
  */
@@ -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;
@@ -190,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 ThreadedNoticeList($notice, $this);
+        $nl = new ThreadedNoticeList($this->notice, $this, $this->userProfile);
         $cnt = $nl->show();
 
         $this->pagination($this->page > 1,
@@ -324,6 +330,8 @@ class ShowgroupAction extends GroupDesignAction
         $this->element('h2', null, _('Statistics'));
 
         $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)));
@@ -363,6 +371,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
@@ -382,8 +402,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()
@@ -418,3 +438,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