Skip to content

Commit

Permalink
Implemented vue.js payout
Browse files Browse the repository at this point in the history
  • Loading branch information
rmathis committed May 15, 2023
1 parent 716989b commit 3c6ecf2
Show file tree
Hide file tree
Showing 14 changed files with 747 additions and 149 deletions.
24 changes: 16 additions & 8 deletions Controller/GrouperGroupsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,19 @@ private function setConnection()
*/
public function index()
{
return $this->redirect(
array('controller' => 'grouper_groups', 'action' => 'groupmember')
);
$this->set('title', _txt('pl.grouperlite.title.groupmember'));

$config = [
"grouperbaseurl" => $this->Session->read('Plugin.Grouper.Api.grouperUrl'),
"isuserowner" => $this->GrouperGroup->isUserOwner($this->userId),
"isTemplateUser" => $this->GrouperGroup->isTemplateUser($this->userId),
"isGrouperVisible" => $this->GrouperGroup->isGrouperVisible($this->userId),
"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')
];
$this->set('config', $config);
}


Expand Down Expand Up @@ -471,12 +481,12 @@ public function groupOwner()
$this->set('config', $config);
}


/**
* Returns all Groups that the User is a member of in Grouper
* This includes self-joined Optin Groups, as well as required Groups User cannot leave
*
*/

public function groupMember()
{
$this->set('title', _txt('pl.grouperlite.title.groupmember'));
Expand Down Expand Up @@ -789,18 +799,16 @@ function isAuthorized()

//TODO - This is needed for my dev enviro since I do not log in via I2 IdP
// BEGIN ===============================================
/*
if ($this->Session->check('Auth.User.username')) {
$this->userId = $this->Session->read('Auth.User.username');
}
*/
// END ===============================================

//TODO - Need to make the following code configurable in getting the user ID. In this case the code is
// specific to the needs of I2.
// BEGIN ===============================================


/*
$uid=$this->Session->read('Auth.User.co_person_id');
$username=$this->Session->read('Auth.User.username');
error_log("HUBING ================ " . $username);
Expand Down Expand Up @@ -841,7 +849,7 @@ function isAuthorized()
$this->Session->write('Plugin.Grouper.UserId', $this->userId);
}
// END ===============================================

*/

// Determine what operations this user can perform
// Construct the permission set for this user, which will also be passed to the view.
Expand Down
17 changes: 17 additions & 0 deletions View/Elements/Components/vue-table.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,23 @@
add: "<?php echo $this->webroot ?>grouper_lite/grouper_groups/addSubscriber",
group: "<?php echo $this->webroot ?>grouper_lite/grouper_groups/groupSubscribers",
},
tabs: [
{
order: 1,
label: "<?php echo _txt('pl.grouperlite.nav.memberships') ?>",
id: 'memberships'
},
{
order: 2,
label: "<?php echo _txt('pl.grouperlite.nav.groups-can-join') ?>",
id: 'join'
},
{
order: 3,
label: "<?php echo _txt('pl.grouperlite.nav.groups-presided') ?>",
id: 'manage'
},
]
},
mounted() {
if (!this.owner) {
Expand Down
2 changes: 0 additions & 2 deletions View/GrouperGroups/groupmember.ctp
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<!--nocache-->
<?php $this->extend('/GrouperGroups/base'); ?>
<?php $this->Html->addCrumb(_txt('pl.grouperlite.nav.memberships')); ?>
<?php echo $this->element('GrouperLite.Components/navigation-groups', array('active' => 'groupmember')); ?>
<?php echo $this->element('GrouperLite.Components/search', array('active' => 'groupmember')); ?>

<?php echo $this->element('GrouperLite.Components/vue-table', array(
'groupData' => json_encode(array(
Expand Down
149 changes: 149 additions & 0 deletions View/GrouperGroups/index.ctp
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
<!--nocache-->
<?php $this->extend('/GrouperGroups/base'); ?>
<?php $this->Html->addCrumb(_txt('pl.grouperlite.nav.memberships')); ?>
<!--/nocache-->

<script type="module">
<?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';
<?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')),
))) ?>


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: {
txt: {
search: "<?php echo _txt('pl.grouperlite.title.search'); ?>",
searchForGroups: "<?php echo _txt('pl.grouperlite.action.search'); ?>",
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'); ?>",
leave: "<?php echo _txt('pl.grouperlite.action.leave') ?>",
zero: {
description: "<?php echo _txt('pl.grouperlite.value.descr.zerostate') ?>",
},
members: "<?php echo _txt('pl.grouperlite.action.members') ?>",
email: "<?php echo _txt('pl.grouperlite.value.email') ?>",
close: "<?php echo _txt('pl.grouperlite.action.close') ?>",
remove: "<?php echo _txt('pl.grouperlite.action.remove-user') ?>",
addUser: "<?php echo _txt('pl.grouperlite.action.add-user') ?>",
search: "<?php echo _txt('pl.grouperlite.search.tags.text') ?>",
noaccess: "<?php echo _txt('pl.grouperlite.members.noaccess') ?>",
empty: "<?php echo _txt('pl.grouperlite.members.empty') ?>",
join: "<?php echo _txt('pl.grouperlite.action.join') ?>",
},
columns,
api: {
co: <?php echo $config['co'] ?>,
mode: "<?php echo PeoplePickerModeEnum::All ?>",
base: "<?php echo $this->webroot ?>grouper_lite/grouper_groups",
find: "<?php echo $this->Html->url(
array(
'controller' => 'grouper_groups',
'action' => 'findSubscriber'
)
); ?>",
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",
},
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');
</script>

<style>
.ui-autocomplete {
max-height: 240px;
overflow-y: auto;
overflow-x: hidden;
padding-right: 20px;
}
</style>

<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">
<?php echo $this->Form->create(false, array(
'url' => array('controller' => 'grouper_groups', 'action' => isset($optAction) ? $optAction : ''),
'class' => 'd-flex justify-content-center',
'id' => 'group-action'
)); ?>
<input type="hidden" name="data[GroupName]" :value="actionform.groupname" />
<input type="hidden" name="data[GroupDisplayName]" :value="actionform.groupdisplayname" />
<button
:class="actionform.actiontype"
class="btn btn-sm btn-block text-nowrap m-1 btn-success" type="submit">
{{ actionform.actionlabel }}
&nbsp;
<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>
43 changes: 25 additions & 18 deletions webroot/css/co-grouper-plugin.css
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,23 @@ a {
margin-right: 2px;
}

#grouper-plugin .nav.nav-tabs .nav-item a.nav-link {
#grouper-plugin .nav.nav-tabs .nav-item .nav-link {
padding: 0.75rem 2rem;
transition: background-color .2s cubic-bezier(.4, 0, .2, 1), color .2s cubic-bezier(.4, 0, .2, 1);
border-radius: 0;
}

#grouper-plugin .nav.nav-tabs .nav-item a.nav-link:not(.active) {
#grouper-plugin .nav.nav-tabs .nav-item .nav-link:not(.active) {
color: white;
background: var(--primary);
}

#grouper-plugin .nav.nav-tabs .nav-item a.nav-link:not(.active):hover {
#grouper-plugin .nav.nav-tabs .nav-item .nav-link:not(.active):hover {
border-color: black;
background: black;
}

#grouper-plugin .nav.nav-tabs .nav-item a.nav-link:not(.active):focus {
#grouper-plugin .nav.nav-tabs .nav-item .nav-link:not(.active):focus {
border-color: transparent;
}

Expand Down Expand Up @@ -225,32 +225,44 @@ a.list-group-item-action:hover .fa {
background-color: var(--primary);
color: white;
padding: 2px;
border-radius: 0;
}

.grouper .counter {
margin: 0.5rem 0;
font-size: 0.9rem;
}

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

.grouper .pagination .pagination-element:not(.pagination-numbers):not(.pagination-limit) {
padding: 0.5rem;
margin-right: 0.5rem;
}

.grouper .pagination .pagination-element.pagination-limit {
padding: 0 1rem;
.grouper .pagination .pagination-item-list {
display: flex;
}

.grouper .pagination .pagination-element.pagination-numbers {
margin-right: 1rem;
.grouper .pagination .pagination-item .pagination-item-btn {
padding: 0.5rem 1rem;
color: white;
border: none;
background: none;
}

.grouper .pagination .pagination-element.pagination-numbers-link:not(:first-child) {
border-left: 1px solid rgba(255, 255, 255, 0.5);
.grouper .pagination .pagination-item .pagination-item-btn:hover {
background: rgba(255, 255, 255, 0.1);
}

.grouper .pagination .pagination-item.pagination-item-list .pagination-item-btn.current {
background: white;
color: var(--primary);
}

.grouper .pagination .pagination-element.pagination-numbers {
margin-right: 1rem;
}

.grouper .pagination .pagination-element.pagination-numbers .pagination-numbers-list>span {
Expand All @@ -263,11 +275,6 @@ a.list-group-item-action:hover .fa {
padding: 0.5rem 1rem;
}

.grouper .pagination .pagination-element.pagination-numbers .pagination-numbers-list .current.pagination-numbers-item {
background: white;
color: var(--primary);
}

.grouper .pagination .pagination-element.pagination-form * {
margin: 0 0.5rem 0 0;
}
Expand Down
Empty file removed webroot/css/empty
Empty file.
Loading

0 comments on commit 3c6ecf2

Please sign in to comment.