Skip to content

Commit

Permalink
Implemented tabs, pagination, search
Browse files Browse the repository at this point in the history
  • Loading branch information
rmathis committed Jun 5, 2023
1 parent 1b76908 commit dc1eabf
Show file tree
Hide file tree
Showing 19 changed files with 4,448 additions and 234 deletions.
24 changes: 11 additions & 13 deletions Controller/GrouperGroupsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));

Expand All @@ -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;
Expand All @@ -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');
}

Expand Down Expand Up @@ -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') {
Expand Down Expand Up @@ -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') {
Expand Down Expand Up @@ -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');
Expand Down
13 changes: 9 additions & 4 deletions Lib/lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,25 @@
'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.',
'pl.grouperlite.message.flash.optin-group-failed' => 'Error occurred in viewing Optin groups, please try again later.',

'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',
Expand Down
148 changes: 70 additions & 78 deletions View/CoGrouperLites/display.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -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();

?>
<script type="module">
<?php if(Configure::read('debug') > 0): ?>
import Dashboard from '<?php print $this->webroot ?>grouper_lite/js/dashboard.js?time=<?php print time()?>';
<?php else: ?>
import Dashboard from '<?php print $this->webroot ?>grouper_lite/js/dashboard.js';
<?php endif; ?>

const app = Vue.createApp({
data() {
return {
co: "<?php echo $coid ?>",
glid: "<?php echo $glid ?>",
pages: [
{
label: "<?php echo _txt('pl.grouperlite.nav.memberships'); ?>",
url: "<?php print $this->Html->url(
array(
'plugin' => "grouper_lite",
'controller' => 'grouper_groups',
'action' => 'groupmember',
'co' => $coid,
'glid' => $glid
)
); ?>"
},
{
label: "<?php echo _txt('pl.grouperlite.nav.groups-can-join'); ?>",
url: "<?php print $this->Html->url(
array(
'plugin' => "grouper_lite",
'controller' => 'grouper_groups',
'action' => 'groupoptin',
'co' => $coid,
'glid' => $glid
)
); ?>"
},
{
label: "<?php echo _txt('pl.grouperlite.nav.groups-presided'); ?>",
url: "<?php print $this->Html->url(
array(
'plugin' => "grouper_lite",
'controller' => 'grouper_groups',
'action' => 'groupowner',
'co' => $coid,
'glid' => $glid
)
); ?>"
}
]
}
},
components: {
Dashboard
}
});

<div class="container-fluid p-0 grouper">
$(document).ready(function () {
app.mount('#grouper-lite-widget-<?php echo $idsuffix; ?>');
});
</script>

<div class="container-fluid p-0 grouper" id="grouper-lite-widget-<?php echo $idsuffix; ?>">
<div class="row no-gutters">
<div class="col-xl-6 col-lg-8 col-xs-12">
<div class="border rounded container ml-0 mr-auto">
Expand All @@ -49,85 +116,10 @@ echo $this->element('GrouperLite.base-styles');
</div>
<div class="col-xs-12 col-md-6">
<h3 class="text-center mb-2 mt-2 h6"><em class="material-icons text-grouper" aria-hidden="true">group</em>&nbsp; <?php echo _txt('pl.grouperlite.dashboard.heading.groups'); ?></h3>
<div class="px-4 d-flex flex-column justify-content-center align-items-center">
<a class="btn btn-primary btn-block text-nowrap" href="<?php print $this->Html->url(
array(
'plugin' => "grouper_lite",
'controller' => 'grouper_groups',
'action' => 'groupmember',
'co' => $coid,
'glid' => $glid
)
); ?>">
<?php echo _txt('pl.grouperlite.nav.memberships'); ?>

</a>
<a class="btn btn-primary mt-1 btn-block text-nowrap" href="<?php print $this->Html->url(
array(
'plugin' => "grouper_lite",
'controller' => 'grouper_groups',
'action' => 'groupoptin',
'co' => $coid,
'glid' => $glid
)
); ?>">
<?php echo _txt('pl.grouperlite.nav.groups-can-join'); ?>
</a>
<a class="btn btn-primary mt-1 btn-block text-nowrap" href="<?php print $this->Html->url(
array(
'plugin' => "grouper_lite",
'controller' => 'grouper_groups',
'action' => 'groupowner',
'co' => $coid,
'glid' => $glid
)
); ?>">
<?php echo _txt('pl.grouperlite.nav.groups-presided'); ?>

</a>
<div>
<dashboard :pages="pages"></dashboard>
</div>
</div>
<?php /*
<div class="col-xs-12 col-md-6 col-lg-4 border-left">
<h3 class="text-center mb-2 mt-2 h6"><i class="fa fa-envelope"></i>&nbsp; <?php echo _txt('pl.grouperlite.dashboard.heading.email-lists'); ?></h3>
<div class="px-4 d-flex flex-column justify-content-center align-items-center">
<a class="btn btn-secondary btn-block text-nowrap" href="<?php print $this->Html->url(
array(
'plugin' => "grouper_lite",
'controller' => 'grouper_groups',
'action' => 'emaillistsmember',
'co' => $coid,
'glid' => $glid
)
); ?>">
<?php echo _txt('pl.grouperlite.nav.emaillists-member'); ?>
</a>
<a class="btn btn-secondary mt-1 btn-block text-nowrap" href="<?php print $this->Html->url(
array(
'plugin' => "grouper_lite",
'controller' => 'grouper_groups',
'action' => 'emaillistsoptin',
'co' => $coid,
'glid' => $glid
)
); ?>">
<?php echo _txt('pl.grouperlite.nav.emaillists-join'); ?>
</a>
<a class="btn btn-secondary mt-1 btn-block text-nowrap" href="<?php print $this->Html->url(
array(
'plugin' => "grouper_lite",
'controller' => 'grouper_groups',
'action' => 'emaillistsmanage',
'co' => $coid,
'glid' => $glid
)
); ?>">
<?php echo _txt('pl.grouperlite.nav.emaillists-manage'); ?>
</a>
</div>
</div> */ ?>
</div>
</div>
</div>
Expand Down
8 changes: 1 addition & 7 deletions View/GrouperGroups/base.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -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');


?>

Expand All @@ -29,11 +29,5 @@ $this->Html->addCrumb(_txt('pl.grouperlite.crumb.root'), array('controller' => '
<!-- Load JavaScript -->

<div id="grouper-plugin" class="grouper pt-2">
<div class="d-flex align-items-center mb-4">
<?php print $this->Html->image('GrouperLite.Grouper.jpg', array('class' => 'img-fluid mr-2', 'style' => 'height: 50px')); ?>
<h1 class="h2"><?php echo $title; ?></h1>
<!--<div class="ml-auto"><a href="#">Why Grouper?</a></div>-->
</div>

<?php echo $this->fetch('content'); ?>
</div>
Loading

0 comments on commit dc1eabf

Please sign in to comment.