Skip to content

Commit

Permalink
Updated views with pagination and search box
Browse files Browse the repository at this point in the history
  • Loading branch information
rmathis committed May 16, 2023
1 parent 4656fe1 commit 84ac697
Show file tree
Hide file tree
Showing 18 changed files with 609 additions and 9,728 deletions.
70 changes: 55 additions & 15 deletions Controller/GrouperGroupsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,15 @@ public function beforeFilter()
{
parent::beforeFilter();

$this->Security->unlockedActions = array('removeSubscriber', 'addSubscriber', 'joinGroup', 'leaveGroup');
$this->Security->unlockedActions = array(
'removeSubscriber',
'addSubscriber',
'joinGroup',
'leaveGroup',
'groupMember',
'groupOptin',
'groupOwner'
);

//Need to find which plugin instance choosing, if more than one from cm_co_grouper_lites
// table being used in COmanage.
Expand Down Expand Up @@ -104,12 +112,7 @@ private function setConnection()
$this->Session->write('Plugin.Grouper.Api.defaultCollapse', $connectionInfo['CoGrouperLite']['default_collapse']);
}

/**
* No true Index page, so sent to default page of My Membership
*
* @return CakeResponse Redirect to MyMembership page
*/
public function index()
private function getConfig()
{
$this->set('title', _txt('pl.grouperlite.title.groupmember'));

Expand All @@ -121,9 +124,42 @@ public function index()
"defaultCollapse" => CakeSession::read('Plugin.Grouper.Api.defaultCollapse'),
"adHocHeading" => CakeSession::read('Plugin.Grouper.Api.adHocHeading'),
"wgHeading" => CakeSession::read('Plugin.Grouper.Api.wgHeading'),
'co' => CakeSession::read('Plugin.Grouper.Api.co')
'co' => CakeSession::read('Plugin.Grouper.Api.co'),
'glid' => isset($this->passedArgs['glid']),
];
$this->set('config', $config);

return $config;
}

/**
* No true Index page, so sent to default page of My Membership
*
* @return CakeResponse Redirect to MyMembership page
*/
public function index()
{
$this->set('config', $this->getConfig());
}

public function groupMember()
{
$this->set('config', $this->getConfig());
$this->set('page', 'groupmember');
$this->render('index');
}

public function groupOptin()
{
$this->set('config', $this->getConfig());
$this->set('page', 'groupoptin');
$this->render('index');
}

public function groupOwner()
{
$this->set('config', $this->getConfig());
$this->set('page', 'groupowner');
$this->render('index');
}

/**
Expand Down Expand Up @@ -403,7 +439,7 @@ public function removeSubscriber()
/**
* Listing of all Grouper Groups owned/admin by User Or search those Grouper Groups
*/
public function groupOwner()
public function groupOwnerApi()
{
if ($this->request->is('ajax')) {
$this->response->disableCache();
Expand Down Expand Up @@ -463,7 +499,7 @@ public function groupOwner()
* This includes self-joined Optin Groups, as well as required Groups User cannot leave
*
*/
public function groupMember()
public function groupMemberApi()
{
if ($this->request->is('ajax')) {
$this->response->disableCache();
Expand Down Expand Up @@ -538,7 +574,7 @@ public function groupMember()
/**
* Display all Groups a User can Join
*/
public function groupOptin()
public function groupOptinApi()
{
if ($this->request->is('ajax')) {
$this->response->disableCache();
Expand Down Expand Up @@ -781,14 +817,18 @@ function isAuthorized()
$p = array();

$p['index'] = true;
$p['groupOwner'] = true;
$p['groupMember'] = true;
$p['groupowner'] = true;
$p['groupownerapi'] = true;
$p['groupoptin'] = true;
$p['groupoptinapi'] = true;
$p['groupmember'] = true;
$p['groupmemberapi'] = true;
$p['getBaseConfig'] = true;
$p['groupSubscribers'] = true;
$p['addSubscriber'] = true;
$p['findSubscriber'] = true;
$p['removeSubscriber'] = true;
$p['groupOptin'] = true;

$p['groupCreate'] = true;
$p['joinGroup'] = true;
$p['leaveGroup'] = true;
Expand Down
2 changes: 1 addition & 1 deletion View/GrouperGroups/base.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ $this->Html->addCrumb(_txt('pl.grouperlite.crumb.root'), array('controller' => '
</div>

<?php echo $this->fetch('content'); ?>
</div>
</div>
116 changes: 48 additions & 68 deletions View/GrouperGroups/index.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -7,45 +7,42 @@
<?php if(Configure::read('debug') > 0): ?>
import GrouperGroupsView from '<?php print $this->webroot ?>grouper_lite/js/grouper-groups-view.js?time=<?php print time()?>';
<?php else: ?>
import GrouperGroupsView from '<?php print $this->webroot ?>grouper_lite/js/grouper-groups-view.js';
import GrouperGroupsView from '<?php print $this->webroot ?>grouper_lite/js/grouper-groups-view.js?time=<?php print time()?>';
<?php endif; ?>

const columns = <?php print_r(json_encode(array(
array('value' => 'name', 'label' => _txt('pl.grouperlite.table.name')),
array('value' => 'role', 'label' => _txt('pl.grouperlite.table.role')),
array('value' => 'description', 'label' => _txt('pl.grouperlite.table.description')),
array('value' => 'status', 'label' => _txt('pl.grouperlite.table.status')),
array('value' => 'action', 'label' => _txt('pl.grouperlite.table.action')),
))) ?>


<?php
$baseUrl = $config['grouperbaseurl'];
$path = '/grouper/grouperUi/app/UiV2Main.index';
$groupOperation = '?operation=UiV2Group.viewGroup&groupId=';
$grouperUrlBase = $baseUrl . $path . $groupOperation;
?>

const app = Vue.createApp({
data() {
return {
config: {
adhocHeading: "<?php echo $config['adHocHeading'] ? $config['adHocHeading'] : 'Ad-hoc groups' ; ?>",
wgHeading: "<?php echo $config['wgHeading'] ? $config['wgHeading'] : 'Working groups' ; ?>",
collapsed: <?php echo $config['defaultCollapse'] == 'collapsed' ? 'true' : 'false'; ?>,
optAction: "<?php echo isset($optAction) ? $optAction : 'none'; ?>",
members: <?php echo isset($members) && $members ? 'true' : 'false' ?>,
add: <?php echo isset($addSubscribers) && $addSubscribers ? 'true' : 'false' ?>
},
owner: <?php echo $treatAsOwner ? 'true' : 'false'; ?>,
url: "<?php echo isset($actionUrl) ? $actionUrl : 'null'; ?>",
}
},
provide: {
collapsed: <?php echo $config['defaultCollapse'] == 'collapsed' ? 'true' : 'false'; ?>,
optAction: "<?php echo isset($optAction) ? $optAction : 'none'; ?>",
allowAddSubscribers: <?php echo isset($addSubscribers) && $addSubscribers ? 'true' : 'false' ?>,
owner: <?php echo $treatAsOwner ? 'true' : 'false'; ?>,
url: "<?php echo isset($actionUrl) ? $actionUrl : 'null'; ?>",
grouperUrl: "<?php echo $grouperUrlBase ?>",
page: "<?php echo $page; ?>",
txt: {
adhocHeading: "<?php echo $config['adHocHeading'] ? $config['adHocHeading'] : 'Ad-hoc groups' ; ?>",
wgHeading: "<?php echo $config['wgHeading'] ? $config['wgHeading'] : 'Working groups' ; ?>",
search: "<?php echo _txt('pl.grouperlite.title.search'); ?>",
searchForGroups: "<?php echo _txt('pl.grouperlite.action.search'); ?>",
display: "<?php echo _txt('fd.page.limit.display'); ?>",
records: "<?php echo _txt('fd.page.limit.records'); ?>",
first: "<?php echo _txt('op.first'); ?>",
last: "<?php echo _txt('op.last'); ?>",
previous: "<?php echo _txt('op.previous'); ?>",
next: "<?php echo _txt('op.next'); ?>",
groups: "<?php echo _txt('pl.grouperlite.dashboard.heading.groups'); ?>",
grouper: "<?php echo _txt('pl.grouperlite.action.grouper'); ?>",
leave: "<?php echo _txt('pl.grouperlite.action.leave') ?>",
zero: {
description: "<?php echo _txt('pl.grouperlite.value.descr.zerostate') ?>",
records: "<?php echo _txt('pl.grouperlite.groups.zero-state'); ?>"
},
members: "<?php echo _txt('pl.grouperlite.action.members') ?>",
email: "<?php echo _txt('pl.grouperlite.value.email') ?>",
Expand All @@ -56,10 +53,23 @@
noaccess: "<?php echo _txt('pl.grouperlite.members.noaccess') ?>",
empty: "<?php echo _txt('pl.grouperlite.members.empty') ?>",
join: "<?php echo _txt('pl.grouperlite.action.join') ?>",
tabs: {
memberships: "<?php echo _txt('pl.grouperlite.nav.memberships') ?>",
optin: "<?php echo _txt('pl.grouperlite.nav.groups-can-join') ?>",
owner: "<?php echo _txt('pl.grouperlite.nav.groups-presided') ?>",
},
columns: <?php print_r(json_encode(array(
'name' => _txt('pl.grouperlite.table.name'),
'role' => _txt('pl.grouperlite.table.role'),
'description' => _txt('pl.grouperlite.table.description'),
'status' => _txt('pl.grouperlite.table.status'),
'action' => _txt('pl.grouperlite.table.action'),
))) ?>,
},
columns,

api: {
co: <?php echo $config['co'] ?>,
gl: <?php echo $config['glid'] ?>,
mode: "<?php echo PeoplePickerModeEnum::All ?>",
base: "<?php echo $this->webroot ?>grouper_lite/grouper_groups",
find: "<?php echo $this->Html->url(
Expand All @@ -71,43 +81,18 @@
remove: "<?php echo $this->webroot ?>grouper_lite/grouper_groups/removeSubscriber",
add: "<?php echo $this->webroot ?>grouper_lite/grouper_groups/addSubscriber",
group: "<?php echo $this->webroot ?>grouper_lite/grouper_groups/groupSubscribers",
memberships: "<?php echo $this->webroot ?>grouper_lite/grouper_groups/groupmemberapi/co:<?php echo $config['co']; ?>/glid:<?php echo $config['glid']; ?>",
optin: "<?php echo $this->webroot ?>grouper_lite/grouper_groups/groupoptinapi/co:<?php echo $config['co']; ?>/glid:<?php echo $config['glid']; ?>",
owner: "<?php echo $this->webroot ?>grouper_lite/grouper_groups/groupownerapi/co:<?php echo $config['co']; ?>/glid:<?php echo $config['glid']; ?>",
},
tabs: [
{
order: 1,
label: "<?php echo _txt('pl.grouperlite.nav.memberships') ?>",
id: 'memberships',
api: "<?php echo $this->webroot ?>grouper_lite/files/groupmember.json?time=<?php print time()?>",
columns: ['name', 'role', 'description', 'action'],
members: true,
action: 'leavegroup',
addSubscribers: false
},
{
order: 2,
label: "<?php echo _txt('pl.grouperlite.nav.groups-can-join') ?>",
id: 'join',
api: "<?php echo $this->webroot ?>grouper_lite/files/groupoptin.json?time=<?php print time()?>",
columns: ['name', 'description', 'action'],
members: false,
action: 'joingroup',
addSubscribers: false
},
{
order: 3,
label: "<?php echo _txt('pl.grouperlite.nav.groups-presided') ?>",
id: 'manage',
api: "<?php echo $this->webroot ?>grouper_lite/files/groupowner.json?time=<?php print time()?>",
columns: ['name', 'role', 'description', 'status', 'action'],
members: true,
addSubscribers: true
},
]
},
components: {
GrouperGroupsView
}
}).mount('#grouper-lite-widget');
});

app.config.unwrapInjectedRef = true;
app.mount('#grouper-lite-widget');
</script>

<style>
Expand All @@ -121,13 +106,11 @@

<div class="grouper-table">
<div id="grouper-lite-widget">
<grouper-groups-view
:config="config"
:owner="owner"
:action="config.optAction"
:url="url"
>
<template v-slot:actionform="actionform">
<grouper-groups-view></grouper-groups-view>
</div>
</div>
<?php /*
<template v-slot:actionform="actionform">
<?php echo $this->Form->create(false, array(
'url' => array('controller' => 'grouper_groups', 'action' => isset($optAction) ? $optAction : ''),
'class' => 'd-flex justify-content-center',
Expand All @@ -143,7 +126,4 @@
<em class="material-icons mt-0" aria-hidden="true">{{ actionform.actionicon }}</em>
</button>
<?php echo $this->Form->end(null); ?>
</template>
</grouper-groups-view>
</div>
</div>
</template>*/ ?>
15 changes: 12 additions & 3 deletions webroot/css/co-grouper-plugin.css
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ a.list-group-item-action:hover .fa {
font-size: 0.9rem;
}

.grouper .pagination .pagination-item:not(:last-child) {
.grouper .pagination .pagination-item {
border-right: 1px solid rgba(255, 255, 255, 0.5);
}

Expand Down Expand Up @@ -275,8 +275,17 @@ a.list-group-item-action:hover .fa {
padding: 0.5rem 1rem;
}

.grouper .pagination .pagination-element.pagination-form * {
margin: 0 0.5rem 0 0;
.grouper .pagination .pagination-element .pagination-form {
padding: 0rem 0.5rem;
display: flex;
align-items: center;
}
.grouper .pagination .pagination-element .pagination-form * {
margin-left: 0.25rem;
}

.grouper .pagination .pagination-element .pagination-form select {
padding: 0.5rem 0.5rem;
}

.grouper .pagination .btn {
Expand Down
31 changes: 14 additions & 17 deletions webroot/files/groupoptin.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
{
"adhoc": [
{
"extension": "users",
"displayName": "ref:InCommon-collab:UniconTestAxel123:UniconTestAxel123 users",
"description": "Users role means members of the working group with access to collaboration tools. UniconTestAxel123",
"uuid": "ac1641e827894283a8b7259a6549ce5c",
"enabled": "T",
"displayExtension": "UniconTestAxel123 users",
"name": "ref:incommon-collab:UniconTestAxel123:users",
"typeOfGroup": "group",
"idIndex": "19469",
"friendlyName": "UniconTestAxel123 users"
}
],
"working": []
}
[
{
"extension": "users",
"displayName": "ref:InCommon-collab:UniconTestAxel123:UniconTestAxel123 users",
"description": "Users role means members of the working group with access to collaboration tools. UniconTestAxel123",
"uuid": "ac1641e827894283a8b7259a6549ce5c",
"enabled": "T",
"displayExtension": "UniconTestAxel123 users",
"name": "ref:incommon-collab:UniconTestAxel123:users",
"typeOfGroup": "group",
"idIndex": "19469",
"friendlyName": "UniconTestAxel123 users"
}
]
Loading

0 comments on commit 84ac697

Please sign in to comment.