From ed166d6eb7c939ff02714219d0019cdda7a5cc9b Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Wed, 20 May 2015 16:17:37 +0200 Subject: [PATCH] GroupController: Add showAction refs #8826 --- application/controllers/GroupController.php | 25 ++++++++++++ application/views/scripts/group/list.phtml | 7 +++- application/views/scripts/group/show.phtml | 45 +++++++++++++++++++++ public/css/icinga/main-content.less | 15 +++++++ 4 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 application/views/scripts/group/show.phtml diff --git a/application/controllers/GroupController.php b/application/controllers/GroupController.php index 45d677e50..f0addcd51 100644 --- a/application/controllers/GroupController.php +++ b/application/controllers/GroupController.php @@ -96,6 +96,28 @@ class GroupController extends Controller ); } + /** + * Show a group + */ + public function showAction() + { + $groupName = $this->params->getRequired('group'); + $backend = $this->getUserGroupBackend($this->params->getRequired('backend')); + + $group = $backend->select(array( + 'group_name', + 'parent_name', + 'created_at', + 'last_modified' + ))->where('group_name', $groupName)->fetchRow(); + if ($group === false) { + $this->httpNotFound(sprintf($this->translate('Group "%s" not found'), $groupName)); + } + + $this->view->group = $group; + $this->view->backend = $backend; + } + /** * Add a group */ @@ -125,6 +147,9 @@ class GroupController extends Controller } $form = new UserGroupForm(); + $form->setRedirectUrl( + Url::fromPath('group/show', array('backend' => $backend->getName(), 'group' => $groupName)) + ); $form->setRepository($backend); $form->edit($groupName, get_object_vars($row))->handleRequest(); diff --git a/application/views/scripts/group/list.phtml b/application/views/scripts/group/list.phtml index 05b79d5f7..be2dfae1a 100644 --- a/application/views/scripts/group/list.phtml +++ b/application/views/scripts/group/list.phtml @@ -44,7 +44,12 @@ if (count($groups) > 0): ?> - escape($group->group_name); ?> + qlink($group->group_name, 'group/show', array( + 'backend' => $backend->getName(), + 'group' => $group->group_name + ), array( + 'title' => sprintf($this->translate('Show detailed information for group %s'), $group->group_name) + )); ?> qlink( diff --git a/application/views/scripts/group/show.phtml b/application/views/scripts/group/show.phtml new file mode 100644 index 000000000..302917b2a --- /dev/null +++ b/application/views/scripts/group/show.phtml @@ -0,0 +1,45 @@ +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' + ) + ); +} + +?> +
+ compact): ?> + showOnlyCloseButton(); ?> + +
+

escape($group->group_name); ?>

+

translate('Parent'); ?>: parent_name === null ? '-' : $this->qlink( + $group->parent_name, + 'group/show', + array( + 'backend' => $backend->getName(), + 'group' => $group->parent_name + ), + array( + 'title' => sprintf($this->translate('Show detailed information for group %s'), $group->parent_name) + ) + ); ?>

+

translate('Created at'); ?>: created_at === null ? '-' : $this->formatDateTime($group->created_at); ?>

+

translate('Last modified'); ?>: last_modified === null ? '-' : $this->formatDateTime($group->last_modified); ?>

+
+
+
+
\ No newline at end of file diff --git a/public/css/icinga/main-content.less b/public/css/icinga/main-content.less index bea9b4a0f..d7082d5fd 100644 --- a/public/css/icinga/main-content.less +++ b/public/css/icinga/main-content.less @@ -264,6 +264,21 @@ div.content.groups { } } +div.controls div.group-header { + border-bottom: 2px solid @colorPetrol; + + .group-name { + display: inline-block; + margin: 0 0 0.3em; + font-size: 2em; + } + + .group-parent, .group-created, .group-modified { + margin: 0 0 0.2em; + font-size: 0.8em; + } +} + form.backend-selection { float: right;