]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
move pending queue to sidebar
authorEvan Prodromou <evan@status.net>
Sat, 27 Aug 2011 20:05:58 +0000 (16:05 -0400)
committerEvan Prodromou <evan@status.net>
Sat, 27 Aug 2011 20:05:58 +0000 (16:05 -0400)
classes/User_group.php
lib/groupaction.php
lib/groupnav.php

index 80a0d209b4791533c5f70990421fbb5bfa89d776..0f1cc40b28f38e42a50b4e93323144962a40a021 100644 (file)
@@ -219,6 +219,16 @@ class User_group extends Managed_DataObject
         return $block->count();
     }
 
+    function getQueueCount()
+    {
+        // XXX: WORM cache this
+
+        $queue = new Group_join_queue();
+        $queue->group_id = $this->id;
+
+        return $queue->count();
+    }
+
     function getAdmins($offset=0, $limit=null)
     {
         $qry =
index 50ecd107c0bee00c113dab2f38bdbff676e25687..54c8cbd8f591134b17ed95e9b26ce581fa46b3a8 100644 (file)
@@ -128,6 +128,7 @@ class GroupAction extends Action
         $this->showMembers();
         $cur = common_current_user();
         if ($cur && $cur->isAdmin($this->group)) {
+            $this->showPending();
             $this->showBlocked();
         }
         $this->showAdmins();
@@ -188,11 +189,56 @@ class GroupAction extends Action
         $this->elementEnd('div');
     }
 
+
+    function showPending()
+    {
+        if ($this->group->join_policy != User_group::JOIN_POLICY_MODERATE) {
+            return;
+        }
+
+        $pending = $this->group->getQueueCount();
+
+        if (!$pending) {
+            return;
+        }
+
+        $request = $this->group->getRequests(0, MEMBERS_PER_SECTION);
+
+        if (!$request) {
+            return;
+        }
+
+        $this->elementStart('div', array('id' => 'entity_pending',
+                                         'class' => 'section'));
+
+        if (Event::handle('StartShowGroupPendingMiniList', array($this))) {
+             
+            $this->elementStart('h2');
+
+            $this->element('a', array('href' => common_local_url('groupqueue', array('nickname' =>
+                                                                                     $this->group->nickname))),
+                           _('Pending'));
+
+            $this->text(' ');
+
+            $this->text($pending);
+            
+            $this->elementEnd('h2');
+
+            $gmml = new ProfileMiniList($request, $this);
+            $gmml->show();
+
+            Event::handle('EndShowGroupPendingMiniList', array($this));
+        }
+
+        $this->elementEnd('div');
+    }
+
     function showBlocked()
     {
-        $member = $this->group->getBlocked(0, MEMBERS_PER_SECTION);
+        $blocked = $this->group->getBlocked(0, MEMBERS_PER_SECTION);
 
-        if (!$member) {
+        if (!$blocked) {
             return;
         }
 
@@ -213,7 +259,7 @@ class GroupAction extends Action
             
             $this->elementEnd('h2');
 
-            $gmml = new GroupBlockedMiniList($member, $this);
+            $gmml = new GroupBlockedMiniList($blocked, $this);
             $cnt = $gmml->show();
             if ($cnt == 0) {
                 // TRANS: Description for mini list of group members on a group page when the group has no members.
index aadc8f80418b5d21ba8f970cd7abc48066daa097..dbf6c1e9063f2fe361ffcff78c80fcd2a6277718 100644 (file)
@@ -79,19 +79,6 @@ class GroupNav extends Menu
             $cur = common_current_user();
 
             if ($cur && $cur->isAdmin($this->group)) {
-                $pending = $this->countPendingMembers();
-                if ($pending || $this->group->join_policy == User_group::JOIN_POLICY_MODERATE) {
-                    $this->out->menuItem(common_local_url('groupqueue', array('nickname' =>
-                                                                              $nickname)),
-                                         // TRANS: Menu item in the group navigation page. Only shown for group administrators.
-                                         // TRANS: %d is the number of pending members.
-                                         sprintf(_m('MENU','Pending members (%d)','Pending members (%d)',$pending), $pending),
-                                         // TRANS: Tooltip for menu item in the group navigation page. Only shown for group administrators.
-                                         // TRANS: %s is the nickname of the group.
-                                         sprintf(_m('TOOLTIP','%s pending members'), $nickname),
-                                         $action_name == 'groupqueue',
-                                         'nav_group_pending');
-                }
             }
             Event::handle('EndGroupGroupNav', array($this));
         }