diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 11:46:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 11:46:43 +0000 |
commit | 3e02d5aff85babc3ffbfcf52313f2108e313aa23 (patch) | |
tree | b01f3923360c20a6a504aff42d45670c58af3ec5 /application/views/scripts/group | |
parent | Initial commit. (diff) | |
download | icingaweb2-3e02d5aff85babc3ffbfcf52313f2108e313aa23.tar.xz icingaweb2-3e02d5aff85babc3ffbfcf52313f2108e313aa23.zip |
Adding upstream version 2.12.1.upstream/2.12.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'application/views/scripts/group')
-rw-r--r-- | application/views/scripts/group/form.phtml | 6 | ||||
-rw-r--r-- | application/views/scripts/group/list.phtml | 96 | ||||
-rw-r--r-- | application/views/scripts/group/show.phtml | 108 |
3 files changed, 210 insertions, 0 deletions
diff --git a/application/views/scripts/group/form.phtml b/application/views/scripts/group/form.phtml new file mode 100644 index 0000000..cbf0659 --- /dev/null +++ b/application/views/scripts/group/form.phtml @@ -0,0 +1,6 @@ +<div class="controls"> + <?= $tabs->showOnlyCloseButton(); ?> +</div> +<div class="content"> + <?= $form; ?> +</div>
\ No newline at end of file diff --git a/application/views/scripts/group/list.phtml b/application/views/scripts/group/list.phtml new file mode 100644 index 0000000..d362db4 --- /dev/null +++ b/application/views/scripts/group/list.phtml @@ -0,0 +1,96 @@ +<?php + +use Icinga\Data\Extensible; +use Icinga\Data\Reducible; + +if (! $this->compact): ?> +<div class="controls separated"> + <?= $this->tabs ?> + <?= $this->paginator ?> + <div class="sort-controls-container"> + <?= $this->limiter ?> + <?= $this->sortBox ?> + </div> + <?= $this->backendSelection ?> + <?= $this->filterEditor ?> +</div> +<?php endif ?> +<div class="content"> +<?php + +if (! isset($backend)) { + echo $this->translate('No backend found which is able to list user groups') . '</div>'; + return; +} else { + $extensible = $this->hasPermission('config/access-control/groups') && $backend instanceof Extensible; + $reducible = $this->hasPermission('config/access-control/groups') && $backend instanceof Reducible; +} +?> + +<?php if ($extensible): ?> + <?= $this->qlink( + $this->translate('Add a New User Group'), + 'group/add', + array('backend' => $backend->getName()), + array( + 'class' => 'button-link', + 'data-base-target' => '_next', + 'icon' => 'plus' + ) + ) ?> +<?php endif ?> + +<?php if (! $groups->hasResult()): ?> + <p><?= $this->translate('No user groups found matching the filter'); ?></p> +</div> +<?php return; endif ?> + <table data-base-target="_next" class="table-row-selectable common-table"> + <thead> + <tr> + <th><?= $this->translate('User Group'); ?></th> + <?php if ($reducible): ?> + <th><?= $this->translate('Remove'); ?></th> + <?php endif ?> + </tr> + </thead> + <tbody> + <?php foreach ($groups as $group): ?> + <tr> + <td> + <?= $this->qlink( + $group->group_name, + 'group/show', + array( + 'backend' => $backend->getName(), + 'group' => $group->group_name + ), + array( + 'title' => sprintf( + $this->translate('Show detailed information for user group %s'), + $group->group_name + ) + ) + ); ?> + </td> + <?php if ($reducible): ?> + <td class="icon-col"> + <?= $this->qlink( + null, + 'group/remove', + array( + 'backend' => $backend->getName(), + 'group' => $group->group_name + ), + array( + 'class' => 'action-link', + 'title' => sprintf($this->translate('Remove user group %s'), $group->group_name), + 'icon' => 'cancel' + ) + ); ?> + </td> + <?php endif ?> + </tr> + <?php endforeach ?> + </tbody> + </table> +</div> diff --git a/application/views/scripts/group/show.phtml b/application/views/scripts/group/show.phtml new file mode 100644 index 0000000..75f0b75 --- /dev/null +++ b/application/views/scripts/group/show.phtml @@ -0,0 +1,108 @@ +<?php + +use Icinga\Data\Extensible; +use Icinga\Data\Updatable; + +$extensible = $this->hasPermission('config/access-control/groups') && $backend instanceof Extensible; + +$editLink = null; +if ($this->hasPermission('config/access-control/groups') && $backend instanceof Updatable) { + $editLink = $this->qlink( + null, + 'group/edit', + array( + 'backend' => $backend->getName(), + 'group' => $group->group_name + ), + array( + 'title' => sprintf($this->translate('Edit group %s'), $group->group_name), + 'class' => 'group-edit', + 'icon' => 'edit' + ) + ); +} + +?> +<div class="controls separated"> +<?php if (! $this->compact): ?> + <?= $tabs; ?> +<?php endif ?> + <h2 class="clearfix"><?= $this->escape($group->group_name) ?><span class="pull-right"><?= $editLink ?></span></h2> + <table class="name-value-table"> + <tr> + <th><?= $this->translate('Created at'); ?></th> + <td><?= $group->created_at === null ? '-' : $this->formatDateTime($group->created_at); ?></td> + </tr> + <tr> + <th><?= $this->translate('Last modified'); ?></th> + <td><?= $group->last_modified === null ? '-' : $this->formatDateTime($group->last_modified); ?></td> + </tr> + </table> +<?php if (! $this->compact): ?> + <h2><?= $this->translate('Members'); ?></h2> + <div class="sort-controls-container"> + <?= $this->limiter; ?> + <?= $this->paginator; ?> + <?= $this->sortBox; ?> + </div> + <?= $this->filterEditor; ?> +<?php endif ?> +</div> +<div class="content"> +<?php if ($extensible): ?> + <?= $this->qlink( + $this->translate('Add New Member'), + 'group/addmember', + array( + 'backend' => $backend->getName(), + 'group' => $group->group_name + ), + array( + 'icon' => 'plus', + 'class' => 'button-link' + ) + ) ?> +<?php endif ?> + +<?php if (! $members->hasResult()): ?> + <p><?= $this->translate('No group member found matching the filter'); ?></p> +</div> +<?php return; endif ?> + + <table data-base-target="_next" class="table-row-selectable common-table"> + <thead> + <tr> + <th><?= $this->translate('Username'); ?></th> + <?php if (isset($removeForm)): ?> + <th><?= $this->translate('Remove'); ?></th> + <?php endif ?> + </tr> + </thead> + <tbody> + <?php foreach ($members as $member): ?> + <tr> + <td> + <?php if ( + $this->hasPermission('config/access-control/users') + && ($userBackend = $backend->getUserBackendName($member->user_name)) !== null + ): ?> + <?= $this->qlink($member->user_name, 'user/show', array( + 'backend' => $userBackend, + 'user' => $member->user_name + ), array( + 'title' => sprintf($this->translate('Show detailed information about %s'), $member->user_name) + )); ?> + <?php else: ?> + <?= $this->escape($member->user_name); ?> + <?php endif ?> + </td> + <?php if (isset($removeForm)): ?> + <td class="icon-col" data-base-target="_self"> + <?php $removeForm->getElement('user_name')->setValue($member->user_name); echo $removeForm; ?> + </td> + <?php endif ?> + </tr> + <?php endforeach ?> + </tbody> + </table> +</div> |