From 84ac69703f9a722c96cfcbc0345583b546f7c898 Mon Sep 17 00:00:00 2001 From: Ryan Mathis Date: Tue, 16 May 2023 14:42:56 -0700 Subject: [PATCH] Updated views with pagination and search box --- Controller/GrouperGroupsController.php | 70 +- View/GrouperGroups/base.ctp | 2 +- View/GrouperGroups/index.ctp | 116 +- webroot/css/co-grouper-plugin.css | 15 +- webroot/files/groupoptin.json | 31 +- webroot/files/groupowner.json | 55 +- webroot/js/bootstrap.bundle.js | 7031 ------------------------ webroot/js/grouper-groups-view.js | 133 +- webroot/js/groups-table.js | 119 + webroot/js/groups.js | 108 + webroot/js/jquery-3.5.1.min.js | 2 - webroot/js/loader.js | 19 + webroot/js/pagecount.js | 6 + webroot/js/pagination.js | 79 +- webroot/js/search-groups.js | 38 - webroot/js/tabs/tab.js | 18 + webroot/js/tabs/tabs.js | 44 + webroot/js/typeahead.bundle.js | 2451 --------- 18 files changed, 609 insertions(+), 9728 deletions(-) delete mode 100644 webroot/js/bootstrap.bundle.js create mode 100644 webroot/js/groups-table.js create mode 100644 webroot/js/groups.js delete mode 100644 webroot/js/jquery-3.5.1.min.js create mode 100644 webroot/js/loader.js delete mode 100644 webroot/js/search-groups.js create mode 100644 webroot/js/tabs/tab.js create mode 100644 webroot/js/tabs/tabs.js delete mode 100644 webroot/js/typeahead.bundle.js diff --git a/Controller/GrouperGroupsController.php b/Controller/GrouperGroupsController.php index e3832c6..1e6df11 100644 --- a/Controller/GrouperGroupsController.php +++ b/Controller/GrouperGroupsController.php @@ -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. @@ -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')); @@ -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'); } /** @@ -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(); @@ -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(); @@ -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(); @@ -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; diff --git a/View/GrouperGroups/base.ctp b/View/GrouperGroups/base.ctp index 56147b1..8038bc6 100644 --- a/View/GrouperGroups/base.ctp +++ b/View/GrouperGroups/base.ctp @@ -36,4 +36,4 @@ $this->Html->addCrumb(_txt('pl.grouperlite.crumb.root'), array('controller' => ' fetch('content'); ?> - + \ No newline at end of file diff --git a/View/GrouperGroups/index.ctp b/View/GrouperGroups/index.ctp index f521323..7e5553e 100644 --- a/View/GrouperGroups/index.ctp +++ b/View/GrouperGroups/index.ctp @@ -7,45 +7,42 @@ 0): ?> import GrouperGroupsView from 'webroot ?>grouper_lite/js/grouper-groups-view.js?time='; - import GrouperGroupsView from 'webroot ?>grouper_lite/js/grouper-groups-view.js'; + import GrouperGroupsView from 'webroot ?>grouper_lite/js/grouper-groups-view.js?time='; - - const columns = '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: "", - wgHeading: "", - collapsed: , - optAction: "", - members: , - add: - }, - owner: , - url: "", - } - }, provide: { + collapsed: , + optAction: "", + allowAddSubscribers: , + owner: , + url: "", + grouperUrl: "", + page: "", txt: { + adhocHeading: "", + wgHeading: "", search: "", searchForGroups: "", + display: "", + records: "", first: "", last: "", previous: "", next: "", groups: "", + grouper: "", leave: "", zero: { description: "", + records: "" }, members: "", email: "", @@ -56,10 +53,23 @@ noaccess: "", empty: "", join: "", + tabs: { + memberships: "", + optin: "", + owner: "", + }, + columns: _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: , + gl: , mode: "", base: "webroot ?>grouper_lite/grouper_groups", find: "Html->url( @@ -71,43 +81,18 @@ remove: "webroot ?>grouper_lite/grouper_groups/removeSubscriber", add: "webroot ?>grouper_lite/grouper_groups/addSubscriber", group: "webroot ?>grouper_lite/grouper_groups/groupSubscribers", + memberships: "webroot ?>grouper_lite/grouper_groups/groupmemberapi/co:/glid:", + optin: "webroot ?>grouper_lite/grouper_groups/groupoptinapi/co:/glid:", + owner: "webroot ?>grouper_lite/grouper_groups/groupownerapi/co:/glid:", }, - tabs: [ - { - order: 1, - label: "", - id: 'memberships', - api: "webroot ?>grouper_lite/files/groupmember.json?time=", - columns: ['name', 'role', 'description', 'action'], - members: true, - action: 'leavegroup', - addSubscribers: false - }, - { - order: 2, - label: "", - id: 'join', - api: "webroot ?>grouper_lite/files/groupoptin.json?time=", - columns: ['name', 'description', 'action'], - members: false, - action: 'joingroup', - addSubscribers: false - }, - { - order: 3, - label: "", - id: 'manage', - api: "webroot ?>grouper_lite/files/groupowner.json?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');