diff --git a/Controller/GrouperGroupsController.php b/Controller/GrouperGroupsController.php
index fd621c5..09458bc 100644
--- a/Controller/GrouperGroupsController.php
+++ b/Controller/GrouperGroupsController.php
@@ -112,7 +112,7 @@ private function setConnection()
$this->Session->write('Plugin.Grouper.Api.defaultCollapse', $connectionInfo['CoGrouperLite']['default_collapse']);
}
- private function getConfig()
+ private function getConfig($page = 'groupmember')
{
$this->set('title', _txt('pl.grouperlite.title.groupmember'));
@@ -125,7 +125,8 @@ private function getConfig()
"adHocHeading" => CakeSession::read('Plugin.Grouper.Api.adHocHeading'),
"wgHeading" => CakeSession::read('Plugin.Grouper.Api.wgHeading'),
'co' => CakeSession::read('Plugin.Grouper.Api.co'),
- 'glid' => isset($this->passedArgs['glid']),
+ 'glid' => $this->Session->read('Plugin.Grouper.Api.id'),
+ 'view' => $page
];
return $config;
@@ -138,27 +139,24 @@ private function getConfig()
*/
public function index()
{
- $this->set('config', $this->getConfig());
+ $this->set('config', $this->getConfig('groupmember'));
}
public function groupMember()
{
- $this->set('config', $this->getConfig());
- $this->set('page', 'groupmember');
+ $this->set('config', $this->getConfig('groupmember'));
$this->render('index');
}
public function groupOptin()
{
- $this->set('config', $this->getConfig());
- $this->set('page', 'groupoptin');
+ $this->set('config', $this->getConfig('groupoptin'));
$this->render('index');
}
public function groupOwner()
{
- $this->set('config', $this->getConfig());
- $this->set('page', 'groupowner');
+ $this->set('config', $this->getConfig('groupowner'));
$this->render('index');
}
@@ -248,7 +246,7 @@ public function addSubscriber()
CakeLog::write('error', __METHOD__ . ': ' . var_export($e->getMessage(), true));
$subscribers = 'ERROR';
- $this->Flash->set(_txt('pl.grouperlite.message.flash.group-detail-members-failed'), array('key' => 'error'));
+ // $this->Flash->set(_txt('pl.grouperlite.message.flash.group-detail-members-failed'), array('key' => 'error'));
}
if ($resultAdd == 'SUCCESS') {
@@ -420,7 +418,7 @@ public function removeSubscriber()
} 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->Flash->set(_txt('pl.grouperlite.message.flash.group-detail-members-failed'), array('key' => 'error'));
}
if ($resultRemove == 'SUCCESS') {
@@ -669,10 +667,10 @@ public function joinGroup()
try {
if ($this->GrouperGroup->joinGroup($this->userId, $name)) {
- $this->Flash->set(
+ /*$this->Flash->set(
_txt('pl.grouperlite.message.flash.join-group-success', array(filter_var($display, FILTER_SANITIZE_SPECIAL_CHARS))),
array('key' => 'success')
- );
+ );*/
$resultAdd = "Success";
} else {
$this->response->type('json');
diff --git a/Lib/lang.php b/Lib/lang.php
index cc33a8d..7e581b3 100644
--- a/Lib/lang.php
+++ b/Lib/lang.php
@@ -44,13 +44,13 @@
'pl.grouperlite.title.groupcreate' => 'Create a group',
'pl.grouperlite.title.templatecreate' => 'Create a working group',
- 'pl.grouperlite.message.flash.join-group-success' => 'You have been added to the group: %1$s',
- 'pl.grouperlite.message.flash.join-group-failed' => 'You are unable to join the group: %1$s',
+ 'pl.grouperlite.message.flash.join-group-success' => 'You have been added to the group:',
+ 'pl.grouperlite.message.flash.join-group-failed' => 'You are unable to join the group:',
'pl.grouperlite.message.flash.join-group-error' => 'An error occurred in joining the group, please try again later.',
'pl.grouperlite.message.flash.info-group-failed' => 'Error in viewing group info, please try again later.',
- 'pl.grouperlite.message.flash.leave-group-success' => 'You have been deleted from the group: %1$s',
- 'pl.grouperlite.message.flash.leave-group-failed' => 'You are unable to be removed from the group: %1$s',
+ 'pl.grouperlite.message.flash.leave-group-success' => 'You have been deleted from the group:',
+ 'pl.grouperlite.message.flash.leave-group-failed' => 'You are unable to be removed from the group:',
'pl.grouperlite.message.flash.leave-group-error' => 'An error occurred in leaving the group, please try again later.',
'pl.grouperlite.message.flash.owner-group-failed' => 'Error occurred in viewing groups you manage, please try again later.',
'pl.grouperlite.message.flash.member-group-failed' => 'Error occurred in viewing groups you are a member, please try again later.',
@@ -58,6 +58,11 @@
'pl.grouperlite.message.flash.group-detail-members-failed' => 'Error in viewing the members of this group, please try again later.',
+ 'pl.grouperlite.message.flash.add-subscriber-success' => 'Added subscriber.',
+ 'pl.grouperlite.message.flash.add-subscriber-failed' => 'Error in adding subscriber.',
+ 'pl.grouperlite.message.flash.remove-subscriber-success' => 'Removed subscriber.',
+ 'pl.grouperlite.message.flash.remove-subscriber-failed' => 'Error in removing subscriber.',
+
'pl.grouperlite.table.name' => 'Name',
'pl.grouperlite.table.description' => 'Description',
'pl.grouperlite.table.role' => 'Role',
diff --git a/View/CoGrouperLites/display.ctp b/View/CoGrouperLites/display.ctp
index 53dd633..480ee25 100644
--- a/View/CoGrouperLites/display.ctp
+++ b/View/CoGrouperLites/display.ctp
@@ -33,11 +33,78 @@
$divid = $vv_config['CoGrouperLite']['co_dashboard_widget_id'];
+// $coid = $config['co'];
+// $glid = $config['glid'];
+
+$this->extend('/GrouperGroups/base');
echo $this->element('GrouperLite.base-styles');
+$idsuffix = rand();
+
?>
+
+
+
diff --git a/View/GrouperGroups/base.ctp b/View/GrouperGroups/base.ctp
index 8038bc6..d1b2780 100644
--- a/View/GrouperGroups/base.ctp
+++ b/View/GrouperGroups/base.ctp
@@ -18,7 +18,7 @@ echo $this->Html->meta(
print $this->element('GrouperLite.base-styles');
print $this->Html->css('GrouperLite.co-grouper-plugin') . "\n ";
-print $this->Html->script('vue/vue-3.2.31.global.prod.js');
+
?>
@@ -29,11 +29,5 @@ $this->Html->addCrumb(_txt('pl.grouperlite.crumb.root'), array('controller' => '
-
- Html->image('GrouperLite.Grouper.jpg', array('class' => 'img-fluid mr-2', 'style' => 'height: 50px')); ?>
-
-
-
-
fetch('content'); ?>
\ No newline at end of file
diff --git a/View/GrouperGroups/index.ctp b/View/GrouperGroups/index.ctp
index 7e5553e..f696efe 100644
--- a/View/GrouperGroups/index.ctp
+++ b/View/GrouperGroups/index.ctp
@@ -1,15 +1,28 @@
extend('/GrouperGroups/base'); ?>
+Html->script('GrouperLite.vue-router.js'); ?>
Html->addCrumb(_txt('pl.grouperlite.nav.memberships')); ?>
+
+
+ Html->image('GrouperLite.Grouper.jpg', array('class' => 'img-fluid mr-2', 'style' => 'height: 50px')); ?>
+
+
+
@@ -106,7 +172,7 @@
+
+ {{ page.label }}
+
+
+ `
+}
\ No newline at end of file
diff --git a/webroot/js/grouper-groups-view.js b/webroot/js/grouper-groups-view.js
index 855b736..2975c20 100644
--- a/webroot/js/grouper-groups-view.js
+++ b/webroot/js/grouper-groups-view.js
@@ -1,40 +1,36 @@
import Collapse from './collapse.js';
-import Popover from './popover.js';
-import Members from './members.js';
-import Groups from './groups.js';
-import PageCount from './pagecount.js';
-import Pagination from './pagination.js';
-import Tab from './tabs/tab.js';
-import Tabs from './tabs/tabs.js';
-import GroupsTable from './groups-table.js';
export default {
- directives: {
- Popover
- },
props: {},
- inject: ['api', 'txt', 'tabs', 'columns', 'allowAddSubscribers', 'page'],
+ inject: ['api', 'txt', 'tabs', 'columns', 'allowAddSubscribers'],
data() {
return {
- active: 'groupmember',
keyword: '',
loading: false,
error: null,
groups: {
adhoc: [],
working: []
- }
+ },
+ newText: '',
+ tabs: [
+ {
+ path: `/groupmember/co:${this.api.co}/glid:${this.api.glid}`,
+ label: this.txt.tabs.memberships
+ },
+ {
+ path: `/groupoptin/co:${this.api.co}/glid:${this.api.glid}`,
+ label: this.txt.tabs.optin
+ },
+ {
+ path: `/groupowner/co:${this.api.co}/glid:${this.api.glid}`,
+ label: this.txt.tabs.owner
+ }
+ ]
}
},
components: {
- Collapse,
- Members,
- Groups,
- PageCount,
- Pagination,
- Tabs,
- Tab,
- GroupsTable
+ Collapse
},
computed: {
cols() {
@@ -54,45 +50,34 @@ export default {
return this.columns.some(c => c.value === 'status');
},
tab() {
- return this.tabs.find(t => t.id === this.active);
+ return this.tabs.find(t => t.id === this.controller);
}
},
methods: {
- search(query) {
- this.keyword = query;
- },
- showSubscribers(group) {
- this.$refs.members.show(group);
- },
- updateHistory(controller) {
- // const history = window.history;
- history.replaceState(null, null, `../../${controller}/co:${this.api.co}/glid:${this.api.gl}`);
+ setPage(controller) {
+ this.controller = controller;
}
},
- mounted() {
- // this.loadGroups(this.tab.api);
- },
template: /*html*/`
-
+
+
+ `
+}
+
+/*
+
+
-
-
-
-
-
-
-
-
-
-
+
-
+
@@ -107,7 +92,7 @@ export default {
-
+
@@ -123,11 +108,7 @@ export default {
-
- `
- }
-/*
diff --git a/webroot/js/groups-table.js b/webroot/js/groups-table.js
index 537a7fb..8efea6d 100644
--- a/webroot/js/groups-table.js
+++ b/webroot/js/groups-table.js
@@ -1,39 +1,13 @@
-import Popover from './popover.js';
+
+import Table from './table.js';
export default {
- props: {
- columns: {
- type: Array,
- default: ['name', 'role', 'description', 'status', 'action']
- },
- groups: {
- type: Array,
- default: []
- },
- members: {
- type: Boolean,
- default: false,
- },
- grouper: {
- type: Boolean,
- default: false,
- }
- },
- inject: ['txt', 'owner', 'grouperUrl'],
- directives: {
- Popover
- },
+ mixins: [
+ Table
+ ],
+
data() {
- },
- methods: {
- showOptAction(group) {
- if (this.$attrs.onLeaveGroup){
- return group.optOut;
- } else {
- return this.$attrs.onJoinGroup !== null;
- }
- },
},
computed: {
},
@@ -45,7 +19,7 @@ export default {
| {{ txt.columns[column] }} |
-
+
|
@@ -56,18 +30,22 @@ export default {
| {{ group.description || txt.descrZeroState }} |
{{ group.enabled && group.enabled === 'T' ? 'Enabled' : 'Disabled' }} |
-
+
+
+
+
|
+
+
+ |
+
+ |
+
+
+ | None |
+
+
+
+
+ |
+
+ |
+
+ {{ wggroup.workingDesc || '' }}
+ |
+
+
+
+ |
+
+ {{ group.WGApp || "No Name" }}
+
+ |
+ {{ group.WGRole || txt.descrZeroState }} |
+ {{ txt.email }} |
+ {{ group.description || txt.descrZeroState }} |
+
+
+
+
+
`
}
diff --git a/webroot/js/groups.js b/webroot/js/groups.js
index 8a39c9d..132af93 100644
--- a/webroot/js/groups.js
+++ b/webroot/js/groups.js
@@ -1,35 +1,45 @@
import Loader from './loader.js';
+import { getQueryParam, hasQueryParam, setQueryParam } from './params.js';
export default {
components: {
Loader
},
props: {
- api: {
+ apiPath: {
type: String,
default: ''
}
},
- inject: ['txt'],
+ inject: ['txt', 'api'],
data() {
return {
- query: '',
+ query: getQueryParam('search'),
loading: false,
- result: []
+ result: [],
+ searched: hasQueryParam('search'),
}
},
methods: {
+ clear(event) {
+ event && event.preventDefault();
+ this.query = '';
+ this.searched = false;
+ this.loadGroups(this.apiPath, '');
+ },
search(event, q) {
event && event.preventDefault();
- this.loadGroups(this.api, q)
+ this.query = q;
+ this.searched = q && q !== '';
+ this.loadGroups(this.apiPath, q);
},
- async loadGroups(api, keyword) {
- this.loading = true;
+ async loadGroups(apiPath, keyword, loading = true) {
+ this.loading = loading;
this.error = null;
if (keyword) {
- api = `${api}?search=${keyword}`
+ apiPath = `${apiPath}?search=${keyword}`
}
- const resp = await fetch(`${api}`, {
+ const resp = await fetch(`${apiPath}`, {
headers: {
"Accept": "application/json",
// 'Content-Type': 'application/x-www-form-urlencoded',
@@ -45,10 +55,8 @@ export default {
},
async leaveGroup(group) {
this.error = null;
- if (keyword) {
- api = `${api}?search=${keyword}`
- }
- const resp = await fetch(`${api}`, {
+ group.loading = true;
+ const resp = await fetch(`${this.api.leave}?GroupName=${group.name}&GroupDisplayName=${group.displayName}`, {
headers: {
"Accept": "application/json",
// 'Content-Type': 'application/x-www-form-urlencoded',
@@ -56,17 +64,17 @@ export default {
method: "DELETE"
});
if (resp.ok) {
- this.result = await resp.json();
+ this.loadGroups(this.apiPath, this.query, false);
+ generateFlash(`${this.txt.leaveSuccess}: ${group.displayName}`, 'success');
} else {
this.error = resp;
+ generateFlash(`${this.txt.leaveError}: ${group.displayName}`, 'error');
}
},
async joinGroup(group) {
this.error = null;
- if (keyword) {
- api = `${api}?search=${keyword}`
- }
- const resp = await fetch(`${api}`, {
+ group.loading = true;
+ const resp = await fetch(`${this.api.join}?GroupName=${group.name}&GroupDisplayName=${group.displayName}`, {
headers: {
"Accept": "application/json",
// 'Content-Type': 'application/x-www-form-urlencoded',
@@ -74,30 +82,48 @@ export default {
method: "DELETE"
});
if (resp.ok) {
- this.result = await resp.json();
+ this.loadGroups(this.apiPath, this.query, false);
+ generateFlash(`${this.txt.joinSuccess}: ${group.displayName}`, 'success');
} else {
this.error = resp;
+ generateFlash(`${this.txt.joinError}: ${group.displayName}`, 'error');
}
}
},
+ watch: {
+ searched(newValue) {
+ if (newValue) {
+ setQueryParam('search', this.query);
+ } else {
+ setQueryParam('search', null, true);
+ }
+ }
+ },
+ computed: {
+ keyword: () => getQueryParam('search'),
+ page: () => getQueryParam('page'),
+ limit: () => getQueryParam('limit')
+ },
mounted() {
this.search(null, this.query);
},
template: /*html*/`
-