From f802f0f5ae96511fb350d78d063bd8d3a5cb803b Mon Sep 17 00:00:00 2001 From: Ioannis Igoumenos Date: Sat, 27 Apr 2024 16:57:28 +0300 Subject: [PATCH] ExternalIdentities,ExternalIdentityRoles,ExternalIdentitySources --- app/src/Controller/ApiUsersController.php | 3 +- app/src/Controller/StandardController.php | 9 ++- app/templates/ExternalIdentities/fields.inc | 14 +++- .../ExternalIdentityRoles/fields-nav.inc | 2 +- .../ExternalIdentityRoles/fields.inc | 67 ++++++++++++++----- .../ExternalIdentitySources/fields.inc | 29 +++++--- 6 files changed, 88 insertions(+), 36 deletions(-) diff --git a/app/src/Controller/ApiUsersController.php b/app/src/Controller/ApiUsersController.php index 0cd2d139e..c00389945 100644 --- a/app/src/Controller/ApiUsersController.php +++ b/app/src/Controller/ApiUsersController.php @@ -67,7 +67,8 @@ public function generate(string $id) { if(in_array($this->name, [ 'Cous', 'ApiUsers', 'CoSettings', 'Cos', 'Addresses', 'EmailAddresses', 'Groups', 'Servers', 'Types', 'Urls', 'Identifiers', 'HistoryRecords', - 'TelephoneNumbers', 'Names', 'AdHocAttributes', 'PersonRoles' + 'TelephoneNumbers', 'Names', 'AdHocAttributes', 'PersonRoles', 'ExternalIdentities', + 'ExternalIdentityRoles', 'ExternalIdentitySources' ]) ) { $this->render('/Standard/add-edit-view-new'); diff --git a/app/src/Controller/StandardController.php b/app/src/Controller/StandardController.php index 0ff45ba24..87de46b0d 100644 --- a/app/src/Controller/StandardController.php +++ b/app/src/Controller/StandardController.php @@ -129,7 +129,8 @@ public function add() { if(in_array($this->name, [ 'Cous', 'ApiUsers', 'CoSettings', 'Cos', 'Addresses', 'EmailAddresses', 'Groups', 'Servers', 'Types', 'Urls', 'Identifiers', 'HistoryRecords', - 'TelephoneNumbers', 'Names', 'AdHocAttributes', 'PersonRoles' + 'TelephoneNumbers', 'Names', 'AdHocAttributes', 'PersonRoles', 'ExternalIdentities', + 'ExternalIdentityRoles', 'ExternalIdentitySources' ]) ) { $this->render('/Standard/add-edit-view-new'); @@ -433,7 +434,8 @@ public function edit(string $id) { if(in_array($this->name, [ 'Cous', 'CoSettings', 'ApiUsers', 'Cos', 'Addresses', 'EmailAddresses', 'Groups', 'Servers', 'Types', 'Urls', 'Identifiers', 'HistoryRecords', - 'TelephoneNumbers', 'Names', 'AdHocAttributes', 'PersonRoles' + 'TelephoneNumbers', 'Names', 'AdHocAttributes', 'PersonRoles', 'ExternalIdentities', + 'ExternalIdentityRoles', 'ExternalIdentitySources' ]) ) { $this->render('/Standard/add-edit-view-new'); @@ -890,7 +892,8 @@ public function view($id = null) { if(in_array($this->name, [ 'Cous', 'ApiUsers', 'CoSettings', 'Cos', 'Addresses', 'EmailAddresses', 'Groups', 'Servers', 'Types', 'Urls', 'Identifiers', 'HistoryRecords', - 'TelephoneNumbers', 'Names', 'AdHocAttributes', 'PersonRoles' + 'TelephoneNumbers', 'Names', 'AdHocAttributes', 'PersonRoles', 'ExternalIdentities', + 'ExternalIdentityRoles', 'ExternalIdentitySources' ]) ) { $this->render('/Standard/add-edit-view-new'); diff --git a/app/templates/ExternalIdentities/fields.inc b/app/templates/ExternalIdentities/fields.inc index 65d4411d9..8741f75ad 100644 --- a/app/templates/ExternalIdentities/fields.inc +++ b/app/templates/ExternalIdentities/fields.inc @@ -47,7 +47,15 @@ if($vv_action == 'add' || $vv_action == 'edit' || $vv_action == 'view') { print $this->Alert->alert($noticeText, 'information', false); } - print $this->Field->control('status', ['empty' => false]); - - print $this->Field->dateControl('date_of_birth', \App\Lib\Enum\DateTypeEnum::DateOnly); + print $this->element('form/listItem', [ + 'arguments' => [ + 'fieldName' => 'status' + ] + ]); + + print $this->element('form/listItem', [ + 'arguments' => [ + 'fieldName' => 'date_of_birth', // date + ] + ]); } diff --git a/app/templates/ExternalIdentityRoles/fields-nav.inc b/app/templates/ExternalIdentityRoles/fields-nav.inc index 653919ff4..ca3a42217 100644 --- a/app/templates/ExternalIdentityRoles/fields-nav.inc +++ b/app/templates/ExternalIdentityRoles/fields-nav.inc @@ -34,7 +34,7 @@ $mveas = [ ]; // Name the MVEAs Entity Type -$mveasEntityType = "external_identity_role"; +$mveasEntityType = 'external_identity_role'; // $addMenuLinks is also given slightly different treatment from the typical $topLinks found in most views: // it is a page-global menu used for adding MVEAs and is given special treatment in element/mveaCanvas.php. diff --git a/app/templates/ExternalIdentityRoles/fields.inc b/app/templates/ExternalIdentityRoles/fields.inc index abab0817b..3e1c11af2 100644 --- a/app/templates/ExternalIdentityRoles/fields.inc +++ b/app/templates/ExternalIdentityRoles/fields.inc @@ -26,24 +26,55 @@ */ if($vv_action == 'add' || $vv_action == 'edit' || $vv_action == 'view') { - print $this->Field->control('affiliation_type_id', labelText: __d('field', 'affiliation')); - - print $this->Field->control('status', ['empty' => false]); - - print $this->Field->control('ordr'); - - print $this->Field->control('title'); - - print $this->Field->control('organization'); - - print $this->Field->control('department'); + print $this->element('form/listItem', [ + 'arguments' => [ + 'fieldName' => 'affiliation_type_id', + 'labelText' => __d('field', 'affiliation') + ] + ]); + + print $this->element('form/listItem', [ + 'arguments' => [ + 'fieldName' => 'status' + ] + ]); + + foreach([ + 'ordr', + 'title', + 'organization'. + 'department' + ] as $field) { + print $this->element('form/listItem', [ + 'arguments' => [ + 'fieldName' => $field, + ] + ]); + } // XXX need to clarify this is an _identifier_ not an actual Person FK - print $this->Field->control('sponsor_identifier', labelText: __d('field', 'sponsor')); - - print $this->Field->control('manager_identifier', labelText: __d('field', 'manager')); - - print $this->Field->dateControl('valid_from'); - - print $this->Field->dateControl('valid_through'); + + print $this->element('form/listItem', [ + 'arguments' => [ + 'fieldName' => 'sponsor_identifier', + 'labelText' => __d('field', 'sponsor') + ] + ]); + print $this->element('form/listItem', [ + 'arguments' => [ + 'fieldName' => 'manager_identifier', + 'labelText' => __d('field', 'manager') + ] + ]); + + foreach([ + 'valid_from', + 'valid_through' + ] as $field) { + print $this->element('form/listItem', [ + 'arguments' => [ + 'fieldName' => $field, + ] + ]); + } } diff --git a/app/templates/ExternalIdentitySources/fields.inc b/app/templates/ExternalIdentitySources/fields.inc index cd1ef8fc5..85a746c38 100644 --- a/app/templates/ExternalIdentitySources/fields.inc +++ b/app/templates/ExternalIdentitySources/fields.inc @@ -28,14 +28,23 @@ Field->control('description'); - - print $this->Field->control('status', - ['default' => \App\Lib\Enum\SyncModeEnum::Disabled]); - - print $this->Field->control('plugin'); - - print $this->Field->control('pipeline_id'); - - print $this->Field->control('sor_label'); + foreach([ + 'description', + 'status', + 'plugin', + 'pipeline_id', + 'sor_label', + ] as $field) { + $params = [ + 'arguments' => [ + 'fieldName' => $field, + ] + ]; + if($field == 'status') { + $params['arguments']['options'] = [ + 'default' => \App\Lib\Enum\SyncModeEnum::Disabled + ]; + } + print $this->element('form/listItem', $params); + } }