Skip to content

Refactor fields.inc to be configuration only (CFM-218) #342

Merged
merged 14 commits into from
Nov 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class ApiSourcesTable extends Table {
use \App\Lib\Traits\PrimaryLinkTrait;
use \App\Lib\Traits\TableMetaTrait;
use \App\Lib\Traits\ValidationTrait;
use \App\Lib\Traits\TabTrait;

/**
* Perform Cake Model initialization.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,16 @@
* @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
*/

// This view does currently not support read-only
if($vv_action == 'edit') {
if(!empty($vv_push_endpoint)) {
print $this->element('notify/banner', [
'info' => __d('api_connector', 'information.endpoint.push', [$vv_push_endpoint])
]);
}

print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'external_identity_source_id',
if(!empty($vv_push_endpoint)) {
$alerts = [
[
'type' => 'information',
'message' => __d('api_connector', 'information.endpoint.push', [$vv_push_endpoint])
]
]);
];
}

$fields = [
'external_identity_source_id'
];

This file was deleted.

19 changes: 12 additions & 7 deletions app/availableplugins/ApiConnector/templates/ApiSources/fields.inc
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,16 @@
* @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
*/

// This view does currently not support read-only
if($vv_action == 'edit') {
print '<li class="info-title"><h3>' . __d('api_connector', 'field.ApiSources.push_mode') . '</h3></li>';
$alerts = [
[
'type' => 'information',
'message' => __d('information', 'plugin.config.none')
]
];

print $this->element('notify/banner', [
'info' => __d('information', 'plugin.config.none',)
]);
}
// XXX Revisit this - what's the "Push Mode" text attempting to convey here (with no other information)?
$fields = [
'SUBTITLE' => [
'subtitle' => __d('api_connector', 'field.ApiSources.push_mode')
]
];
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@
* @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
*/

// This view does currently not support read-only
if($vv_action == 'add' || $vv_action == 'edit') {
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'filename',
]
]);
}
$fields = [
'filename'
];
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,10 @@
* @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
*/

// This view does currently not support read-only
if($vv_action == 'add' || $vv_action == 'edit') {
foreach([
'filename',
'format',
'archivedir',
'threshold_check',
'threshold_override',
] as $field) {
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => $field,
]
]);
}
}
$fields = [
'filename',
'format',
'archivedir',
'threshold_check',
'threshold_override',
];
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,20 @@
* @since COmanage Registry v5.2.0
* @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
*/

$fields = [
'source_mode',
'min_length',
'max_length',
'format_crypt_php',
'format_sha1_ldap',
'format_plaintext'
];

?>
<script type="text/javascript">

<script>
// JS specific to these fields

function updateGadgets(isPageLoad) {
// Hide or show gadgets according to current state
var source = document.getElementById('source-mode').value;
Expand All @@ -49,51 +59,14 @@
}
}

function jsLocalOnLoad() {
$(function() {
// run on first load
updateGadgets(true);
}
</script>

<?php
// This view does currently not support read-only, and add is not used
if($vv_action == 'edit') {
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'source_mode',
'fieldOptions' => [
'onChange' => 'updateGadgets(false)'
]
]
]);

foreach(['min_length',
'max_length'
] as $field) {
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => $field,
]
]);
}

print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'format_crypt_php',
'fieldOptions' => [
// When source is Self Select we want crypt to remain checked
// (though this will also be enforced in the backend)
'onChange' => 'updateGadgets(false)'
]
]
]);

foreach(['format_sha1_ldap',
'format_plaintext'
] as $field) {
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => $field,
]
]);
}
}
// register onchange events
// note that underscores in field names above must be represented with hyphens here.
$('#source-mode, #format_crypt_php').change(function() {
updateGadgets();
});
});
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,37 @@

// We provide the current password status in a banner message since that's all the
// information we really want to display about a password.
$alerts = [
[
'type' => 'information',
'message' => $vv_status->comment
]
];

print $this->element('notify/banner', ['info' => $vv_status->comment]);
$fields = [];

if(!$vv_status->locked) {
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'password',
$fields = [
'password',
'password2' => [
'type' => 'password'
]
]);
];
// Inject the parent keys
$hidden = [
'password_authenticator_id' => $vv_authenticator->password_authenticator->id,
'person_id' => $vv_status->person_id
];
} else {
$suppress_submit = true;
}

print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'password2',
'fieldOptions' => [
'type' => 'password'
]
]
]);
}
$topLinks[] = [
'icon' => 'history',
'order' => 'Default',
'label' => __d('operation', 'reset'),
'link' => [
'controller' => 'authenticators',
'action' => 'reset',
]
];

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,18 @@

// There are currently no directly configurable fields for this model.)
$suppress_submit = true;
?>

// Top Links
$topLinks[] = [
'icon' => 'transform',
'order' => 'Default',
'label' => __d('pipeline_toolkit', 'controller.LoginIdentifierTypes', [99]),
'link' => [
'plugin' => 'PipelineToolkit',
'controller' => 'LoginIdentifierTypes',
'action' => 'index',
'identifier_mapper_id' => $vv_obj->id
],
'class' => ''
];
?>
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,7 @@
* @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
*/

// This view does not support read-only
if($vv_action == 'add' || $vv_action == 'edit') {
foreach (['type_id',
'login'
] as $field) {
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => $field
]]);
}
}
$fields = [
'type_id',
'login'
];
Loading