From 1bc7299e6104be8a0fd978f35c72bf1244332a4f Mon Sep 17 00:00:00 2001 From: Ioannis Igoumenos Date: Sat, 27 Apr 2024 20:58:03 +0300 Subject: [PATCH] GroupNestings --- app/src/Controller/ApiUsersController.php | 2 +- app/src/Controller/StandardController.php | 6 +-- app/templates/GroupNestings/fields.inc | 51 +++++++++++++++++------ 3 files changed, 42 insertions(+), 17 deletions(-) diff --git a/app/src/Controller/ApiUsersController.php b/app/src/Controller/ApiUsersController.php index 97fd1aff8..6b39a7b69 100644 --- a/app/src/Controller/ApiUsersController.php +++ b/app/src/Controller/ApiUsersController.php @@ -69,7 +69,7 @@ public function generate(string $id) { 'Groups', 'Servers', 'Types', 'Urls', 'Identifiers', 'HistoryRecords', 'TelephoneNumbers', 'Names', 'AdHocAttributes', 'PersonRoles', 'ExternalIdentities', 'ExternalIdentityRoles', 'ExternalIdentitySources', 'ExternalIdentitySourceRecords', - 'IdentifierAssignments', 'Jobs', 'JobHistoryRecords', 'People' + 'IdentifierAssignments', 'Jobs', 'JobHistoryRecords', 'People', 'GroupNestings' ]) ) { $this->render('/Standard/add-edit-view-new'); diff --git a/app/src/Controller/StandardController.php b/app/src/Controller/StandardController.php index cf83b48bd..6dea67ff3 100644 --- a/app/src/Controller/StandardController.php +++ b/app/src/Controller/StandardController.php @@ -131,7 +131,7 @@ public function add() { 'Groups', 'Servers', 'Types', 'Urls', 'Identifiers', 'HistoryRecords', 'TelephoneNumbers', 'Names', 'AdHocAttributes', 'PersonRoles', 'ExternalIdentities', 'ExternalIdentityRoles', 'ExternalIdentitySources', 'ExternalIdentitySourceRecords', - 'IdentifierAssignments', 'Jobs', 'JobHistoryRecords', 'People' + 'IdentifierAssignments', 'Jobs', 'JobHistoryRecords', 'People', 'GroupNestings' ]) ) { $this->render('/Standard/add-edit-view-new'); @@ -437,7 +437,7 @@ public function edit(string $id) { 'Groups', 'Servers', 'Types', 'Urls', 'Identifiers', 'HistoryRecords', 'TelephoneNumbers', 'Names', 'AdHocAttributes', 'PersonRoles', 'ExternalIdentities', 'ExternalIdentityRoles', 'ExternalIdentitySources', 'ExternalIdentitySourceRecords', - 'IdentifierAssignments', 'Jobs', 'JobHistoryRecords', 'People' + 'IdentifierAssignments', 'Jobs', 'JobHistoryRecords', 'People', 'GroupNestings' ]) ) { $this->render('/Standard/add-edit-view-new'); @@ -896,7 +896,7 @@ public function view($id = null) { 'Groups', 'Servers', 'Types', 'Urls', 'Identifiers', 'HistoryRecords', 'TelephoneNumbers', 'Names', 'AdHocAttributes', 'PersonRoles', 'ExternalIdentities', 'ExternalIdentityRoles', 'ExternalIdentitySources', 'ExternalIdentitySourceRecords', - 'IdentifierAssignments', 'Jobs', 'JobHistoryRecords', 'People' + 'IdentifierAssignments', 'Jobs', 'JobHistoryRecords', 'People', 'GroupNestings' ]) ) { $this->render('/Standard/add-edit-view-new'); diff --git a/app/templates/GroupNestings/fields.inc b/app/templates/GroupNestings/fields.inc index f913a1f21..673e5b005 100644 --- a/app/templates/GroupNestings/fields.inc +++ b/app/templates/GroupNestings/fields.inc @@ -26,22 +26,47 @@ */ if($vv_action == 'add') { - print $this->Field->control('target_group_id'); + print $this->element('form/listItem', [ + 'arguments' => [ + 'fieldName' => 'target_group_id', + ] + ]); } elseif($vv_action == 'edit') { + $link = [ + 'url' => [ + 'controller' => 'groups', + 'action' => 'edit', + $vv_obj->target_group_id] + ]; // The target group can't be changed after adding - print $this->Field->statusControl('target_group_id', - $vv_obj->target_group->name, - ['url' => ['controller' => 'groups', - 'action' => 'edit', - $vv_obj->target_group_id]]); + print $this->element('form/listItem', [ + 'arguments' => [ + 'fieldName' => 'target_group_id', + 'status' => $vv_obj->target_group->name, + 'link' => $link, + ] + ]); } if($vv_action == 'add' || $vv_action == 'edit') { - print $this->Field->statusControl('group_id', - $vv_bc_parent_obj->name, - ['url' => ['controller' => 'groups', - 'action' => 'edit', - $vv_bc_parent_obj->id]]); - - print $this->Field->control('negate'); + $link = [ + 'url' => [ + 'controller' => 'groups', + 'action' => 'edit', + $vv_bc_parent_obj->id] + ]; + // The target group can't be changed after adding + print $this->element('form/listItem', [ + 'arguments' => [ + 'fieldName' => 'group_id', + 'status' => $vv_bc_parent_obj->name, + 'link' => $link, + ] + ]); + + print $this->element('form/listItem', [ + 'arguments' => [ + 'fieldName' => 'negate', + ] + ]); } \ No newline at end of file