adad
This commit is contained in:
@@ -75,6 +75,12 @@ $refreshSchedulerState();
|
||||
$setupActions = modules()->hasFunction($moduleName, 'setup_actions')
|
||||
? (array) module_fn($moduleName, 'setup_actions')
|
||||
: [];
|
||||
$databaseSectionActions = array_values(array_filter($setupActions, static function (mixed $action): bool {
|
||||
return is_array($action) && trim((string) ($action['section'] ?? '')) === 'database';
|
||||
}));
|
||||
$customSectionActions = array_values(array_filter($setupActions, static function (mixed $action): bool {
|
||||
return !is_array($action) || trim((string) ($action['section'] ?? '')) !== 'database';
|
||||
}));
|
||||
$defaults = $module['db_defaults'] ?? [];
|
||||
if (empty($current['db']) && is_array($defaults)) {
|
||||
$current['db'] = $defaults;
|
||||
@@ -137,6 +143,9 @@ foreach ($fields as $field) {
|
||||
|
||||
$label = (string)($field['label'] ?? $group);
|
||||
$label = trim(preg_replace('/\s+DB\s+Driver$/i', ' DB', $label) ?? $label);
|
||||
if ($group === 'db') {
|
||||
$label = 'Custom Datenbank';
|
||||
}
|
||||
$label = $label !== '' ? $label : $group;
|
||||
$dbGroups[$group] = $label;
|
||||
}
|
||||
@@ -155,6 +164,7 @@ foreach ($fields as $field) {
|
||||
}
|
||||
|
||||
$generalSetupFields = [];
|
||||
$databaseSetupFields = [];
|
||||
$cronSetupFields = [];
|
||||
$customSetupFields = [];
|
||||
foreach ($generalFields as $field) {
|
||||
@@ -163,6 +173,10 @@ foreach ($generalFields as $field) {
|
||||
$generalSetupFields[] = $field;
|
||||
continue;
|
||||
}
|
||||
if ($fieldName === 'use_separate_db') {
|
||||
$databaseSetupFields[] = $field;
|
||||
continue;
|
||||
}
|
||||
if ($fieldName === 'schedule_timezone') {
|
||||
$cronSetupFields[] = $field;
|
||||
continue;
|
||||
@@ -740,7 +754,7 @@ $manualGroups = array_values(array_filter($allowedGroups, fn (string $value): bo
|
||||
$hasDatabaseSection = array_key_exists('database', $setupSectionConfig)
|
||||
? !empty($setupSectionConfig['database'])
|
||||
: $dbGroups !== [];
|
||||
$hasCustomSection = $customSetupFields !== [] || $setupActions !== [] || $isFxRatesSetup;
|
||||
$hasCustomSection = $customSetupFields !== [] || $customSectionActions !== [] || $isFxRatesSetup;
|
||||
$showCustomDbConfig = !empty($current['use_separate_db']) && !in_array(strtolower(trim((string) ($current['use_separate_db'] ?? ''))), ['0', 'false', 'off', 'standard'], true);
|
||||
$allowedSetupSections = ['general', 'access', 'cron'];
|
||||
if ($hasDatabaseSection) {
|
||||
@@ -1614,7 +1628,42 @@ $GLOBALS['layout_header_context'] = 'Setup / ' . ($sectionTitles[$currentSection
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($currentSection === 'custom' && $setupActions !== []): ?>
|
||||
<?php if ($currentSection === 'database' && $databaseSectionActions !== []): ?>
|
||||
<section class="setup-panel">
|
||||
<div class="setup-panel__head">
|
||||
<div>
|
||||
<span class="pill">Aktionen</span>
|
||||
<h2>Datenbankaktionen</h2>
|
||||
<p class="muted">Tabellenbezogene Wartungsaktionen koennen direkt hier ausgefuehrt werden.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="setup-grid">
|
||||
<?php foreach ($databaseSectionActions as $action): ?>
|
||||
<?php
|
||||
$actionName = trim((string)($action['name'] ?? ''));
|
||||
$actionLabel = trim((string)($action['label'] ?? $actionName));
|
||||
$actionHelp = trim((string)($action['help'] ?? ''));
|
||||
if ($actionName === '' || $actionLabel === '') {
|
||||
continue;
|
||||
}
|
||||
?>
|
||||
<div class="setup-field muted">
|
||||
<span><?= e($actionLabel) ?></span>
|
||||
<?php if ($actionHelp !== ''): ?>
|
||||
<small class="muted"><?= e($actionHelp) ?></small>
|
||||
<?php endif; ?>
|
||||
<div class="setup-actions" style="justify-content:flex-start; margin-top:12px;">
|
||||
<button class="nav-link" type="submit" name="module_setup_action" value="<?= e($actionName) ?>" formnovalidate>
|
||||
<?= e($actionLabel) ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($currentSection === 'custom' && $customSectionActions !== []): ?>
|
||||
<section class="setup-panel"<?= $customSetupFields === [] ? ' id="setup-custom"' : '' ?>>
|
||||
<div class="setup-panel__head">
|
||||
<div>
|
||||
@@ -1624,7 +1673,7 @@ $GLOBALS['layout_header_context'] = 'Setup / ' . ($sectionTitles[$currentSection
|
||||
</div>
|
||||
</div>
|
||||
<div class="setup-grid">
|
||||
<?php foreach ($setupActions as $action): ?>
|
||||
<?php foreach ($customSectionActions as $action): ?>
|
||||
<?php
|
||||
$actionName = trim((string)($action['name'] ?? ''));
|
||||
$actionLabel = trim((string)($action['label'] ?? $actionName));
|
||||
@@ -1675,7 +1724,7 @@ $GLOBALS['layout_header_context'] = 'Setup / ' . ($sectionTitles[$currentSection
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($currentSection === 'database' && $dbGroups !== []): ?>
|
||||
<section class="setup-panel"<?= $generalSetupFields === [] ? ' id="setup-general"' : '' ?>>
|
||||
<section class="setup-panel"<?= $databaseSetupFields === [] ? ' id="setup-general"' : '' ?>>
|
||||
<div class="setup-panel__head">
|
||||
<div>
|
||||
<span class="pill">Datenbanken</span>
|
||||
@@ -1683,19 +1732,28 @@ $GLOBALS['layout_header_context'] = 'Setup / ' . ($sectionTitles[$currentSection
|
||||
<p class="muted">Standard nutzt die Nexus-Datenbank. Custom blendet eigene Verbindungsdaten und den DB-Test ein.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="setup-tabs" aria-label="Datenbankbereiche" data-setup-db-root <?= $showCustomDbConfig ? '' : 'hidden' ?>>
|
||||
<?php foreach ($dbGroups as $group => $label): ?>
|
||||
<button
|
||||
class="nav-link setup-tab<?= $group === $activeDbGroup ? ' is-active' : '' ?>"
|
||||
type="button"
|
||||
data-setup-tab-target="setup-db-<?= e($group) ?>"
|
||||
aria-controls="setup-db-<?= e($group) ?>"
|
||||
aria-selected="<?= $group === $activeDbGroup ? 'true' : 'false' ?>"
|
||||
>
|
||||
<?= e($label) ?>
|
||||
</button>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php if ($databaseSetupFields !== []): ?>
|
||||
<div class="setup-grid" style="margin-bottom:16px;">
|
||||
<?php foreach ($databaseSetupFields as $field): ?>
|
||||
<?php $renderField($field); ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if (count($dbGroups) > 1): ?>
|
||||
<div class="setup-tabs" aria-label="Datenbankbereiche" data-setup-db-root <?= $showCustomDbConfig ? '' : 'hidden' ?>>
|
||||
<?php foreach ($dbGroups as $group => $label): ?>
|
||||
<button
|
||||
class="nav-link setup-tab<?= $group === $activeDbGroup ? ' is-active' : '' ?>"
|
||||
type="button"
|
||||
data-setup-tab-target="setup-db-<?= e($group) ?>"
|
||||
aria-controls="setup-db-<?= e($group) ?>"
|
||||
aria-selected="<?= $group === $activeDbGroup ? 'true' : 'false' ?>"
|
||||
>
|
||||
<?= e($label) ?>
|
||||
</button>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="setup-db-panels" data-setup-db-panels <?= $showCustomDbConfig ? '' : 'hidden' ?>>
|
||||
<?php foreach ($dbGroups as $group => $label): ?>
|
||||
<?php
|
||||
@@ -1706,7 +1764,7 @@ $GLOBALS['layout_header_context'] = 'Setup / ' . ($sectionTitles[$currentSection
|
||||
$panelHint = $dbConfigHint($group, $panelConfig, $panelDefaults);
|
||||
$defaultDescription = $describeDbDefaults($panelDefaults);
|
||||
?>
|
||||
<section class="setup-db-panel" id="setup-db-<?= e($group) ?>" <?= $group === $activeDbGroup ? '' : 'hidden' ?>>
|
||||
<section class="setup-db-panel" id="setup-db-<?= e($group) ?>" <?= (count($dbGroups) === 1 || $group === $activeDbGroup) ? '' : 'hidden' ?>>
|
||||
<div class="setup-panel__head">
|
||||
<div>
|
||||
<span class="pill"><?= e($label) ?></span>
|
||||
|
||||
Reference in New Issue
Block a user