Skip to content

Commit

Permalink
changes for member list view
Browse files Browse the repository at this point in the history
  • Loading branch information
axel committed Sep 27, 2021
1 parent 82fffcd commit 7d03f55
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 18 deletions.
36 changes: 34 additions & 2 deletions Controller/GrouperGroupsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
class GrouperGroupsController extends GrouperLiteAppController
{
public $helpers = array('Html', 'Form', 'Flash');
public $components = array('Flash', 'Paginator');
public $components = array('Flash', 'Paginator', 'RequestHandler');

public $name = 'GrouperGroups';

Expand Down Expand Up @@ -168,6 +168,36 @@ public function membersInGroup() {

return $details;
}

/**
* Show all members of group in Grouper Group detail page
* Called from method GroupInfo
*
*/
public function groupSubscribers() {
$groupName = urldecode($this->request->query['groupname']);

if ($this->request->is('ajax')) {
$ajax = true;
}

//Set initial
$scope = [
'groupName' => 'ref:incommon-collab:' . $groupName . ':users'
];

try {
$subscribers = $this->GrouperGroup->membersInGroup($scope);

} catch (Exception $e) {
CakeLog::write('error', __METHOD__ . ': ' . var_export($e->getMessage(), true));

$this->Flash->set(_txt('pl.grouperlite.message.flash.group-detail-members-failed'), array('key' => 'error'));
}

$this->set(compact('subscribers'));
$this->set('_serialize', 'subscribers');
}


/**
Expand Down Expand Up @@ -294,6 +324,7 @@ public function groupMember() {
return;
}
}
$this->set('grouperbaseurl', $this->Session->read('Plugin.Grouper.Api.grouperUrl'));
$this->set('isuserowner', $this->GrouperGroup->isUserOwner($this->userId));
$this->set('isTemplateUser', $this->GrouperGroup->isTemplateUser($this->userId));
}
Expand Down Expand Up @@ -521,9 +552,10 @@ function isAuthorized() {

$p['index'] = true;
$p['groupinfo'] = true;
$p['membersInGroup'] = true;
$p['membersingroup'] = true;
$p['groupowner'] = true;
$p['groupmember'] = true;
$p['groupSubscribers'] = true;
$p['groupoptin'] = true;
$p['emaillistsoptin'] = true;
$p['emaillistsmember'] = true;
Expand Down
3 changes: 2 additions & 1 deletion View/Elements/Components/subscriberList.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<div class="modal-body subs">
<table class="table table-striped">
<tbody>
<?php var_dump($subscribers) ?>
<?php foreach ($subscribers as $sub) : ?>
<tr>
<td><?php echo $sub['name']; ?></td>
Expand All @@ -38,7 +39,7 @@
array(
'plugin' => "grouper_lite",
'controller' => 'grouper_groups',
'action' => 'groupSubscribers'
'action' => 'groupSubscribers.json'
)
); ?>';
$('.members-btn').click(function(ev) {
Expand Down
30 changes: 15 additions & 15 deletions View/GrouperGroups/groupmember.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -111,20 +111,20 @@ $numColumns = count($columns);
data-id="<?php echo $wggroup['WGName']; ?>">
<?php echo _txt('pl.grouperlite.action.members'); ?> <i class="fa fa-group"></i>
</button>
<?php if ($isuserowner === 'T') : ?>
<?php
$baseUrl = $grouperbaseurl;
$path = '/grouper/grouperUi/app/UiV2Main.index';
$groupOperation = '?operation=UiV2Group.viewGroup&groupId=';
$groupUrlBase = $baseUrl . $path . $groupOperation;
$attrOperation = '?operation=UiV2AttributeDefName.viewAttributeDefName&attributeDefNameId=';
$attrUrlBase = $baseUrl . $path . $attrOperation;
?>
<a href="<?php echo $groupUrlBase . $groupergroupsdetail['uuid']; ?>" class="btn btn-grouper btn-block btn-sm btn-success mt-0 text-nowrap" target="_blank" role="button">
<?php echo _txt('pl.grouperlite.action.grouper'); ?> &nbsp;
<i class="fa fa-external-link"></i>
</a>
<?php endif ?>
<!-- --><?php //if ($isuserowner === 'T') : ?>
<!-- --><?php
// $baseUrl = $grouperbaseurl;
// $path = '/grouper/grouperUi/app/UiV2Main.index';
// $groupOperation = '?operation=UiV2Group.viewGroup&groupId=';
// $groupUrlBase = $baseUrl . $path . $groupOperation;
// $attrOperation = '?operation=UiV2AttributeDefName.viewAttributeDefName&attributeDefNameId=';
// $attrUrlBase = $baseUrl . $path . $attrOperation;
// ?>
<!-- <a href="--><?php //echo $groupUrlBase . $groupergroupsdetail['uuid']; ?><!--" class="btn btn-grouper btn-block btn-sm btn-success mt-0 text-nowrap" target="_blank" role="button">-->
<!-- --><?php //echo _txt('pl.grouperlite.action.grouper'); ?><!-- &nbsp;-->
<!-- <i class="fa fa-external-link"></i>-->
<!-- </a>-->
<!-- --><?php //endif ?>
</span>
</td>
</tr>
Expand Down Expand Up @@ -169,4 +169,4 @@ $numColumns = count($columns);
<p class="lead mb-0 text-center"><?php echo _txt('pl.grouperlite.groups.zero-state'); ?></p>
</div>
<?php endif; ?>
<?php echo $this->element('Components/subscriberList', array('subscribers' => $groupergroupssubscribers)); ?>
<?php echo $this->element('Components/subscriberList', array('subscribers' => $subscribers)); ?>

0 comments on commit 7d03f55

Please sign in to comment.