asdasd
All checks were successful
Deploy / deploy-staging (push) Successful in 5s
Deploy / deploy-production (push) Has been skipped

This commit is contained in:
2026-05-04 02:07:58 +02:00
parent 206bede930
commit 9acf70d7ce
7 changed files with 217 additions and 147 deletions

View File

@@ -1,6 +1,12 @@
<?php
require_admin();
$GLOBALS['layout_header_base_title'] = 'Modulverwaltung';
$GLOBALS['layout_header_title'] = 'Modulverwaltung';
$GLOBALS['layout_header_context'] = 'SQL-Import';
$GLOBALS['layout_header_text'] = '';
$GLOBALS['layout_header_actions'] = [];
$service = new \App\ModuleSqlImportService(modules());
$availableModules = $service->importableModules();
$selectedModule = (string) ($_POST['module'] ?? ($_GET['module'] ?? ''));
@@ -11,7 +17,7 @@ $result = null;
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
try {
if (!isset($_FILES['sql_file']) || !is_array($_FILES['sql_file'])) {
throw new RuntimeException('Bitte eine SQL-Datei auswaehlen.');
throw new RuntimeException('Bitte eine SQL-Datei auswählen.');
}
$result = $service->importUploadedFile($selectedModule, $_FILES['sql_file']);
@@ -27,68 +33,98 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
}
}
?>
<div class="card">
<div class="pill">SQL Import</div>
<h1 style="margin-top:.75rem;">Zentraler SQL-Import fuer Module</h1>
<p class="muted">
Diese Seite ist eine gemeinsame Standard-Loesung. Module koennen sie direkt nutzen oder weiterhin einen eigenen spezialisierten Uploader bereitstellen.
</p>
<div class="module-flow">
<?php if ($error): ?>
<div class="bg-red-900 border-l-4 border-red-500 text-red-100 p-4 mb-6" role="alert">
<div class="module-box-soft bg-red-900 border-l-4 border-red-500 text-red-100" role="alert">
<?= e($error) ?>
</div>
<?php elseif ($notice): ?>
<div class="card" style="margin-top:1rem; border-color:var(--accent-2);">
<div class="module-box-soft" style="border-color:var(--accent-2);">
<?= e($notice) ?>
</div>
<?php endif; ?>
<?php if ($availableModules === []): ?>
<div class="card" style="margin-top:1rem; background:var(--panel-2);">
Aktuell ist kein Modul fuer den generischen SQL-Import vorbereitet.
</div>
<?php else: ?>
<form method="post" enctype="multipart/form-data" class="card" style="margin-top:1rem; background:var(--panel-2);">
<div style="display:grid; gap:1rem;">
<label style="display:grid; gap:.35rem;">
<span>Modul</span>
<select name="module" required>
<option value="">Bitte waehlen</option>
<?php foreach ($availableModules as $module): ?>
<option value="<?= e($module['name']) ?>" <?= $selectedModule === $module['name'] ? 'selected' : '' ?>>
<?= e($module['title']) ?>
</option>
<?php endforeach; ?>
</select>
</label>
<label style="display:grid; gap:.35rem;">
<span>SQL-Datei</span>
<input type="file" name="sql_file" accept=".sql,text/sql,application/sql" required>
</label>
<div class="muted" style="font-size:.95rem;">
Der generische Import nutzt die Standard-Datenbankverbindung des Moduls oder einen optionalen Modul-Callback fuer Spezialfaelle.
</div>
<div style="display:flex; gap:10px; flex-wrap:wrap;">
<button class="cta-button" type="submit">SQL importieren</button>
<a class="nav-link" href="/modules/install">Zur Modulverwaltung</a>
</div>
<div class="submenu-box">
<div class="module-hero-top module-hero-top--compact">
<nav class="module-tabs" aria-label="Modulverwaltung">
<a class="module-button module-button--tab" href="/modules">Aktive Module</a>
<a class="module-button module-button--tab" href="/modules/install">Module installieren/aktivieren</a>
<a class="module-button module-button--tab-active" href="/modules/sql-import">SQL-Import</a>
</nav>
<div class="module-submenu-actions">
<a class="module-button module-button--secondary module-button--small" href="/">Nexus Übersicht</a>
</div>
</form>
</div>
</div>
<div style="margin-top:1.25rem;" class="grid">
<?php foreach ($availableModules as $module): ?>
<div class="card" style="background:var(--panel-2);">
<strong><?= e($module['title']) ?></strong>
<div class="muted" style="font-size:.85rem;"><?= e($module['description']) ?></div>
<div style="margin-top:.75rem;">
<a class="nav-link" href="/modules/sql-import?module=<?= e($module['name']) ?>">Fuer dieses Modul importieren</a>
<section class="section-box">
<div class="module-box-head">
<div>
<h2 class="module-box-title">Zentraler SQL-Import</h2>
<p>Gemeinsame Standard-Lösung für Module mit SQL-Upload in die konfigurierte Ziel-Datenbank.</p>
</div>
</div>
<?php if ($availableModules === []): ?>
<div class="card-box">
Aktuell ist kein Modul für den generischen SQL-Import vorbereitet.
</div>
<?php else: ?>
<form method="post" enctype="multipart/form-data" class="section-box" style="padding:0; border:0; box-shadow:none; background:transparent;">
<div style="display:grid; gap:1rem;">
<label style="display:grid; gap:.35rem;">
<span>Modul</span>
<select name="module" required>
<option value="">Bitte wählen</option>
<?php foreach ($availableModules as $module): ?>
<option value="<?= e($module['name']) ?>" <?= $selectedModule === $module['name'] ? 'selected' : '' ?>>
<?= e($module['title']) ?>
</option>
<?php endforeach; ?>
</select>
</label>
<label style="display:grid; gap:.35rem;">
<span>SQL-Datei</span>
<input type="file" name="sql_file" accept=".sql,text/sql,application/sql" required>
</label>
<div class="muted" style="font-size:.95rem;">
Der generische Import nutzt die Standard-Datenbankverbindung des Moduls oder einen optionalen Modul-Callback für Spezialfälle.
</div>
<div style="display:flex; gap:10px; flex-wrap:wrap;">
<button class="cta-button" type="submit">SQL importieren</button>
<a class="nav-link" href="/modules">Aktive Module öffnen</a>
</div>
</div>
<?php endforeach; ?>
</div>
</form>
<?php endif; ?>
</section>
<?php if ($availableModules !== []): ?>
<section class="section-box">
<div class="module-box-head">
<div>
<h2 class="module-box-title">Importierbare Module</h2>
<p>Schnelleinstieg für den Import mit bereits vorausgewähltem Modul.</p>
</div>
</div>
<div class="module-admin-grid module-admin-grid--compact">
<?php foreach ($availableModules as $module): ?>
<article class="card-box module-admin-card">
<div class="module-admin-card__head">
<div class="module-admin-card__title">
<h2><?= e($module['title']) ?></h2>
<p><?= e($module['description']) ?></p>
</div>
</div>
<div class="module-admin-actions">
<a class="nav-link" href="/modules/sql-import?module=<?= e($module['name']) ?>">Für dieses Modul importieren</a>
</div>
</article>
<?php endforeach; ?>
</div>
</section>
<?php endif; ?>
</div>