From: Evan Prodromou Date: Sat, 27 Aug 2011 20:05:58 +0000 (-0400) Subject: move pending queue to sidebar X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=804c343a9f485c8a688c6083263b2316a2a48014;p=quix0rs-gnu-social.git move pending queue to sidebar --- diff --git a/classes/User_group.php b/classes/User_group.php index 80a0d209b4..0f1cc40b28 100644 --- a/classes/User_group.php +++ b/classes/User_group.php @@ -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 = diff --git a/lib/groupaction.php b/lib/groupaction.php index 50ecd107c0..54c8cbd8f5 100644 --- a/lib/groupaction.php +++ b/lib/groupaction.php @@ -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. diff --git a/lib/groupnav.php b/lib/groupnav.php index aadc8f8041..dbf6c1e906 100644 --- a/lib/groupnav.php +++ b/lib/groupnav.php @@ -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)); }