From bd13c2c7a54aa44672513283f69783d10ab3cc67 Mon Sep 17 00:00:00 2001 From: Ioannis Igoumenos Date: Fri, 26 Apr 2024 12:56:06 +0300 Subject: [PATCH] Urls, Types, Servers --- app/src/Controller/ApiUsersController.php | 14 ++++++-- app/src/Controller/StandardController.php | 9 ++++-- app/templates/Servers/fields.inc | 13 +++++--- app/templates/Types/fields.inc | 32 +++++++++++-------- app/templates/Urls/fields.inc | 31 +++++++++++++++--- app/templates/element/form/fieldDiv.php | 2 ++ app/templates/element/form/infoDiv/source.php | 1 - 7 files changed, 73 insertions(+), 29 deletions(-) diff --git a/app/src/Controller/ApiUsersController.php b/app/src/Controller/ApiUsersController.php index 25a690757..8e1337346 100644 --- a/app/src/Controller/ApiUsersController.php +++ b/app/src/Controller/ApiUsersController.php @@ -62,7 +62,17 @@ public function generate(string $id) { 'api.key', $this->request->getParam('action')); $this->set('vv_title', $title); - - $this->render('/Standard/add-edit-view'); + + // Let the view render + if(in_array($this->name, [ + 'Cous', 'ApiUsers', 'CoSettings', 'Cos', 'Addresses', 'EmailAddresses', + 'Groups', 'Servers', 'Types', 'Urls' + ]) + ) { + $this->render('/Standard/add-edit-view-new'); + } else { + // Let the view render + $this->render('/Standard/add-edit-view'); + } } } \ No newline at end of file diff --git a/app/src/Controller/StandardController.php b/app/src/Controller/StandardController.php index 9be5585e0..75e5c7128 100644 --- a/app/src/Controller/StandardController.php +++ b/app/src/Controller/StandardController.php @@ -127,7 +127,8 @@ public function add() { // Let the view render if(in_array($this->name, [ - 'Cous', 'ApiUsers' + 'Cous', 'ApiUsers', 'CoSettings', 'Cos', 'Addresses', 'EmailAddresses', + 'Groups', 'Servers', 'Types', 'Urls' ]) ) { $this->render('/Standard/add-edit-view-new'); @@ -429,7 +430,8 @@ public function edit(string $id) { $this->set('vv_subtitle', $subtitle); if(in_array($this->name, [ - 'Cous' + 'Cous', 'CoSettings', 'ApiUsers', 'Cos', 'Addresses', 'EmailAddresses', + 'Groups', 'Servers', 'Types', 'Urls' ]) ) { $this->render('/Standard/add-edit-view-new'); @@ -884,7 +886,8 @@ public function view($id = null) { // Let the view render if(in_array($this->name, [ - 'Cous', 'ApiUsers' + 'Cous', 'ApiUsers', 'CoSettings', 'Cos', 'Addresses', 'EmailAddresses', + 'Groups', 'Servers', 'Types', 'Urls' ]) ) { $this->render('/Standard/add-edit-view-new'); diff --git a/app/templates/Servers/fields.inc b/app/templates/Servers/fields.inc index ea9c1e85d..0e27460e0 100644 --- a/app/templates/Servers/fields.inc +++ b/app/templates/Servers/fields.inc @@ -28,9 +28,14 @@ Field->control('description'); + foreach (['description', + 'status', + 'plugin' + ] as $field) { + print $this->element('form/listItem', [ + 'arguments' => [ + 'fieldName' => $field + ]]); + } - print $this->Field->control('status'); - - print $this->Field->control('plugin'); } diff --git a/app/templates/Types/fields.inc b/app/templates/Types/fields.inc index 8e89035de..476167f6e 100644 --- a/app/templates/Types/fields.inc +++ b/app/templates/Types/fields.inc @@ -48,19 +48,23 @@ Field->control( - fieldName: 'attribute', - options: [ - 'onChange' => 'updateGadgets()', - 'readonly' => $vv_action == 'edit' - ] - ); - - print $this->Field->control('display_name'); - - print $this->Field->control('value'); + print $this->element('form/listItem', [ + 'arguments' => [ + 'fieldName' => 'attribute', + 'options' => [ + 'onChange' => 'updateGadgets()', + 'readonly' => $vv_action == 'edit' + ] + ]]); - print $this->Field->control('status'); - - print $this->Field->control('edupersonaffiliation'); + foreach (['display_name', + 'value', + 'status', + 'edupersonaffiliation' + ] as $field) { + print $this->element('form/listItem', [ + 'arguments' => [ + 'fieldName' => $field + ]]); + } } diff --git a/app/templates/Urls/fields.inc b/app/templates/Urls/fields.inc index 93ca41f36..4e45ab386 100644 --- a/app/templates/Urls/fields.inc +++ b/app/templates/Urls/fields.inc @@ -26,13 +26,34 @@ */ if($vv_action == 'add' || $vv_action == 'edit' || $vv_action == 'view') { - print $this->Field->control('url'); + print $this->element('form/listItem', [ + 'arguments' => [ + 'fieldName' => 'url' + ]]); - print $this->Field->control('type_id', ['default' => $vv_default_type]); + print $this->element('form/listItem', [ + 'arguments' => [ + 'fieldName' => 'type_id', + 'options' => [ + 'default' => $vv_default_type + ] + ]]); - print $this->Field->control('description'); + print $this->element('form/listItem', [ + 'arguments' => [ + 'fieldName' => 'description' + ]]); - print $this->Field->control('frozen'); + print $this->element('form/listItem', [ + 'arguments' => [ + 'fieldName' => 'frozen' + ]]); +} - print $this->Field->sourceControl($vv_obj); +if($vv_action == 'edit' || $vv_action == 'view') { + print $this->element('form/listItem', [ + 'arguments' => [ + 'fieldName' => 'source', + 'entity' => $vv_obj + ]]); } diff --git a/app/templates/element/form/fieldDiv.php b/app/templates/element/form/fieldDiv.php index c494c2fdc..e676faa28 100644 --- a/app/templates/element/form/fieldDiv.php +++ b/app/templates/element/form/fieldDiv.php @@ -41,6 +41,8 @@ print $this->element('form/infoDiv/status'); } elseif(isset($vv_field_arguments['groupedControls'])) { print $this->element('form/infoDiv/grouped'); + } elseif(isset($vv_field_arguments['entity'])) { + print $this->element('form/infoDiv/source'); } else { print $this->element('form/infoDiv/default'); } diff --git a/app/templates/element/form/infoDiv/source.php b/app/templates/element/form/infoDiv/source.php index 9eda537f0..1666f00c9 100644 --- a/app/templates/element/form/infoDiv/source.php +++ b/app/templates/element/form/infoDiv/source.php @@ -31,4 +31,3 @@
Fieeld->sourceLink($entity) ?>
-