adasd
This commit is contained in:
@@ -15,12 +15,8 @@ if (!$module) {
|
||||
return;
|
||||
}
|
||||
|
||||
$allowedSetupSections = ['general', 'access', 'cron', 'custom'];
|
||||
if (!in_array($currentSection, $allowedSetupSections, true)) {
|
||||
$currentSection = 'general';
|
||||
}
|
||||
|
||||
$fields = (array)($module['setup']['fields'] ?? []);
|
||||
$setupSectionConfig = is_array($module['setup']['sections'] ?? null) ? $module['setup']['sections'] : [];
|
||||
$hasGlobalDebugField = false;
|
||||
foreach ($fields as $field) {
|
||||
if ((string)($field['name'] ?? '') === 'debug_enabled') {
|
||||
@@ -692,6 +688,21 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
}
|
||||
|
||||
$moduleStatusPanel = null;
|
||||
if (modules()->hasFunction($moduleName, 'setup_status')) {
|
||||
try {
|
||||
$statusPanelPayload = module_fn($moduleName, 'setup_status');
|
||||
if (is_array($statusPanelPayload)) {
|
||||
$moduleStatusPanel = $statusPanelPayload;
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
$moduleStatusPanel = [
|
||||
'title' => 'Status',
|
||||
'type' => 'error',
|
||||
'text' => $e->getMessage(),
|
||||
'stats' => [],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
$activeDbGroup = $testGroup !== null && array_key_exists($testGroup, $dbGroups)
|
||||
? $testGroup
|
||||
@@ -726,15 +737,31 @@ sort($knownGroups, SORT_NATURAL | SORT_FLAG_CASE);
|
||||
$knownUserValues = array_column($knownUsers, 'sub');
|
||||
$manualUsers = array_values(array_filter($allowedUsers, fn (string $value): bool => !in_array($value, $knownUserValues, true)));
|
||||
$manualGroups = array_values(array_filter($allowedGroups, fn (string $value): bool => !in_array($value, $knownGroups, true)));
|
||||
$hasDatabaseSection = array_key_exists('database', $setupSectionConfig)
|
||||
? !empty($setupSectionConfig['database'])
|
||||
: $dbGroups !== [];
|
||||
$hasCustomSection = $customSetupFields !== [] || $setupActions !== [] || $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) {
|
||||
$allowedSetupSections[] = 'database';
|
||||
}
|
||||
if ($hasCustomSection) {
|
||||
$allowedSetupSections[] = 'custom';
|
||||
}
|
||||
if (!in_array($currentSection, $allowedSetupSections, true)) {
|
||||
$currentSection = 'general';
|
||||
}
|
||||
$sectionUrls = [
|
||||
'general' => '/modules/setup/' . rawurlencode($moduleName) . '/general',
|
||||
'database' => '/modules/setup/' . rawurlencode($moduleName) . '/database',
|
||||
'access' => '/modules/setup/' . rawurlencode($moduleName) . '/access',
|
||||
'cron' => '/modules/setup/' . rawurlencode($moduleName) . '/cron',
|
||||
'custom' => '/modules/setup/' . rawurlencode($moduleName) . '/custom',
|
||||
];
|
||||
$sectionTitles = [
|
||||
'general' => 'Allgemein',
|
||||
'database' => 'Datenbank',
|
||||
'access' => 'Zugriffsrechte',
|
||||
'cron' => 'Cron Einstellungen',
|
||||
'custom' => 'Custom Settings',
|
||||
@@ -749,6 +776,9 @@ $GLOBALS['layout_header_context'] = 'Setup / ' . ($sectionTitles[$currentSection
|
||||
<div class="module-hero-top module-hero-top--compact">
|
||||
<nav class="module-tabs" aria-label="Setup-Navigation">
|
||||
<a class="module-button <?= $currentSection === 'general' ? 'module-button--tab-active' : 'module-button--tab' ?>" href="<?= e($sectionUrls['general']) ?>">Allgemein</a>
|
||||
<?php if ($hasDatabaseSection): ?>
|
||||
<a class="module-button <?= $currentSection === 'database' ? 'module-button--tab-active' : 'module-button--tab' ?>" href="<?= e($sectionUrls['database']) ?>">Datenbank</a>
|
||||
<?php endif; ?>
|
||||
<a class="module-button <?= $currentSection === 'access' ? 'module-button--tab-active' : 'module-button--tab' ?>" href="<?= e($sectionUrls['access']) ?>">Zugriffsrechte</a>
|
||||
<a class="module-button <?= $currentSection === 'cron' ? 'module-button--tab-active' : 'module-button--tab' ?>" href="<?= e($sectionUrls['cron']) ?>">Cron Einstellungen</a>
|
||||
<?php if ($hasCustomSection): ?>
|
||||
@@ -1619,7 +1649,7 @@ $GLOBALS['layout_header_context'] = 'Setup / ' . ($sectionTitles[$currentSection
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($currentSection === 'general' && is_array($moduleStatusPanel)): ?>
|
||||
<?php if (($currentSection === 'general' || $currentSection === 'custom' || $currentSection === 'database') && is_array($moduleStatusPanel)): ?>
|
||||
<section class="setup-panel setup-panel--flat">
|
||||
<div class="setup-panel__head">
|
||||
<div>
|
||||
@@ -1644,16 +1674,16 @@ $GLOBALS['layout_header_context'] = 'Setup / ' . ($sectionTitles[$currentSection
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($currentSection === 'general' && $dbGroups !== []): ?>
|
||||
<?php if ($currentSection === 'database' && $dbGroups !== []): ?>
|
||||
<section class="setup-panel"<?= $generalSetupFields === [] ? ' id="setup-general"' : '' ?>>
|
||||
<div class="setup-panel__head">
|
||||
<div>
|
||||
<span class="pill">Datenbanken</span>
|
||||
<h2>Verbindungen</h2>
|
||||
<p class="muted">Jede Verbindung kann getrennt konfiguriert und getestet werden.</p>
|
||||
<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">
|
||||
<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' : '' ?>"
|
||||
@@ -1666,7 +1696,7 @@ $GLOBALS['layout_header_context'] = 'Setup / ' . ($sectionTitles[$currentSection
|
||||
</button>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<div class="setup-db-panels">
|
||||
<div class="setup-db-panels" data-setup-db-panels <?= $showCustomDbConfig ? '' : 'hidden' ?>>
|
||||
<?php foreach ($dbGroups as $group => $label): ?>
|
||||
<?php
|
||||
$panelConfig = $getNested($current, $group);
|
||||
@@ -1843,6 +1873,21 @@ $GLOBALS['layout_header_context'] = 'Setup / ' . ($sectionTitles[$currentSection
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
(() => {
|
||||
const modeField = document.querySelector('[name="use_separate_db"]');
|
||||
const tabsRoot = document.querySelector('[data-setup-db-root]');
|
||||
const panelsRoot = document.querySelector('[data-setup-db-panels]');
|
||||
if (!modeField || !tabsRoot || !panelsRoot) return;
|
||||
const sync = () => {
|
||||
const value = String(modeField.value || '').trim().toLowerCase();
|
||||
const isCustom = !['', '0', 'false', 'off', 'standard'].includes(value);
|
||||
tabsRoot.hidden = !isCustom;
|
||||
panelsRoot.hidden = !isCustom;
|
||||
};
|
||||
modeField.addEventListener('change', sync);
|
||||
sync();
|
||||
})();
|
||||
|
||||
(() => {
|
||||
const jobs = document.querySelectorAll('[data-scheduler-job]');
|
||||
const modal = document.querySelector('[data-scheduler-modal]');
|
||||
|
||||
Reference in New Issue
Block a user