]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/showgroup.php
Minor markup fix
[quix0rs-gnu-social.git] / actions / showgroup.php
index 9fa86761566f0ecf0a0634bc4c49c02d789b63fe..8d8fbe6be57ac46da06312f8f50f3df402ff1df4 100644 (file)
@@ -19,7 +19,7 @@
  * You should have received a copy of the GNU Affero General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *
- * @category  Personal
+ * @category  Group
  * @package   Laconica
  * @author    Evan Prodromou <evan@controlyourself.ca>
  * @author    Sarven Capadisli <csarven@controlyourself.ca>
@@ -35,10 +35,12 @@ if (!defined('LACONICA')) {
 require_once INSTALLDIR.'/lib/noticelist.php';
 require_once INSTALLDIR.'/lib/feedlist.php';
 
+define('MEMBERS_PER_SECTION', 81);
+
 /**
  * Group main page
  *
- * @category Personal
+ * @category Group
  * @package  Laconica
  * @author   Evan Prodromou <evan@controlyourself.ca>
  * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
@@ -52,6 +54,17 @@ class ShowgroupAction extends Action
     /** page we're viewing. */
     var $page = null;
 
+    /**
+     * Is this page read-only?
+     *
+     * @return boolean true
+     */
+
+    function isReadOnly()
+    {
+        return true;
+    }
+
     /**
      * Title of the page
      *
@@ -133,6 +146,18 @@ class ShowgroupAction extends Action
         $this->showPage();
     }
 
+    /**
+     * Local menu
+     *
+     * @return void
+     */
+
+    function showLocalNav()
+    {
+        $nav = new GroupNav($this, $this->group);
+        $nav->show();
+    }
+
     /**
      * Show the page content
      *
@@ -176,13 +201,12 @@ class ShowgroupAction extends Action
 
     function showGroupProfile()
     {
-        $this->elementStart('div', array('id' => 'group_profile',
-                                         'class' => 'vcard author'));
+        $this->elementStart('div', 'entity_profile vcard author');
 
         $this->element('h2', null, _('Group profile'));
 
-        $this->elementStart('dl', 'group_depiction');
-        $this->element('dt', null, _('Photo'));
+        $this->elementStart('dl', 'entity_depiction');
+        $this->element('dt', null, _('Avatar'));
         $this->elementStart('dd');
 
         $logo = ($this->group->homepage_logo) ?
@@ -196,10 +220,10 @@ class ShowgroupAction extends Action
         $this->elementEnd('dd');
         $this->elementEnd('dl');
 
-        $this->elementStart('dl', 'group_nickname');
+        $this->elementStart('dl', 'entity_nickname');
         $this->element('dt', null, _('Nickname'));
         $this->elementStart('dd');
-        $hasFN = ($this->group->fullname) ? 'nickname url uid' : 'fn nickname url uid';
+        $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);
@@ -207,23 +231,23 @@ class ShowgroupAction extends Action
         $this->elementEnd('dl');
 
         if ($this->group->fullname) {
-            $this->elementStart('dl', 'group_fn');
+            $this->elementStart('dl', 'entity_fn');
             $this->element('dt', null, _('Full name'));
             $this->elementStart('dd');
-            $this->element('span', 'fn', $this->group->fullname);
+            $this->element('span', 'fn org', $this->group->fullname);
             $this->elementEnd('dd');
             $this->elementEnd('dl');
         }
 
         if ($this->group->location) {
-            $this->elementStart('dl', 'group_location');
+            $this->elementStart('dl', 'entity_location');
             $this->element('dt', null, _('Location'));
             $this->element('dd', 'location', $this->group->location);
             $this->elementEnd('dl');
         }
 
         if ($this->group->homepage) {
-            $this->elementStart('dl', 'group_url');
+            $this->elementStart('dl', 'entity_url');
             $this->element('dt', null, _('URL'));
             $this->elementStart('dd');
             $this->element('a', array('href' => $this->group->homepage,
@@ -234,7 +258,7 @@ class ShowgroupAction extends Action
         }
 
         if ($this->group->description) {
-            $this->elementStart('dl', 'group_note');
+            $this->elementStart('dl', 'entity_note');
             $this->element('dt', null, _('Note'));
             $this->element('dd', 'note', $this->group->description);
             $this->elementEnd('dl');
@@ -242,22 +266,16 @@ class ShowgroupAction extends Action
 
         $this->elementEnd('div');
 
-        $this->elementStart('div', array('id' => 'group_actions'));
+        $this->elementStart('div', 'entity_actions');
         $this->element('h2', null, _('Group actions'));
         $this->elementStart('ul');
-        $this->elementStart('li', array('id' => 'group_subscribe'));
+        $this->elementStart('li', array('id' => 'entity_subscribe'));
         $cur = common_current_user();
         if ($cur) {
             if ($cur->isMember($this->group)) {
-                $lf = new LeaveForm($this, $this->group);
-                $lf->show();
-                if ($cur->isAdmin($this->group)) {
-                    $edit = common_local_url('editgroup',
-                                             array('nickname' => $this->group->nickname));
-                    $this->element('a',
-                                   array('href' => $edit,
-                                         'id' => 'group_admin'),
-                                   _('Admin'));
+                if (!$cur->isAdmin($this->group)) {
+                    $lf = new LeaveForm($this, $this->group);
+                    $lf->show();
                 }
             } else {
                 $jf = new JoinForm($this, $this->group);
@@ -305,4 +323,53 @@ class ShowgroupAction extends Action
                                      'title' => sprintf(_('Notice feed for %s group'),
                                                         $this->group->nickname)));
     }
-}
\ No newline at end of file
+
+    /**
+     * Fill in the sidebar.
+     *
+     * @return void
+     */
+
+    function showSections()
+    {
+        $this->showMembers();
+        $cloud = new GroupTagCloudSection($this, $this->group);
+        $cloud->show();
+    }
+
+    /**
+     * Show mini-list of members
+     *
+     * @return void
+     */
+
+    function showMembers()
+    {
+        $member = $this->group->getMembers(0, MEMBERS_PER_SECTION);
+
+        if (!$member) {
+            return;
+        }
+
+        $this->elementStart('div', array('id' => 'entity_members',
+                                         'class' => 'section'));
+
+        $this->element('h2', null, _('Members'));
+
+        if ($member) {
+            $pml = new ProfileMiniList($member, null, $this);
+            $cnt = $pml->show();
+            if ($cnt == 0) {
+                $this->element('p', null, _('(None)'));
+            }
+        }
+
+        if ($cnt == MEMBERS_PER_SECTION) {
+            $this->element('a', array('href' => common_local_url('groupmembers',
+                                                                 array('nickname' => $this->group->nickname))),
+                           _('All members'));
+        }
+
+        $this->elementEnd('div');
+    }
+}