asdasd
This commit is contained in:
@@ -67,7 +67,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
<a class="module-button module-button--tab-active" href="/modules">Aktive Module</a>
|
||||
<a class="module-button module-button--tab" href="/modules/install">Module installieren/aktivieren</a>
|
||||
</nav>
|
||||
<div class="module-hero-actions">
|
||||
<div class="module-submenu-actions">
|
||||
<a class="module-button module-button--secondary module-button--small" href="/">Nexus Übersicht</a>
|
||||
<a class="module-button module-button--secondary module-button--small" href="/modules/sql-import">Zentralen SQL-Import öffnen</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2,6 +2,11 @@
|
||||
$modules = modules()->all();
|
||||
$error = null;
|
||||
$notice = null;
|
||||
$GLOBALS['layout_header_base_title'] = 'Modulverwaltung';
|
||||
$GLOBALS['layout_header_title'] = 'Modulverwaltung';
|
||||
$GLOBALS['layout_header_context'] = 'Module installieren/aktivieren';
|
||||
$GLOBALS['layout_header_text'] = '';
|
||||
$GLOBALS['layout_header_actions'] = [];
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
require_admin();
|
||||
@@ -31,109 +36,129 @@ foreach ($modules as $m) {
|
||||
}
|
||||
?>
|
||||
<?php require_auth(); ?>
|
||||
<div class="card">
|
||||
<div class="pill">Module</div>
|
||||
<h1 style="margin-top:.75rem;">Module installieren/aktivieren</h1>
|
||||
<p class="muted">Erkannte Module basieren auf Ordnern in <code>modules/</code>.</p>
|
||||
<p style="margin-top:.75rem;">
|
||||
<a class="nav-link" href="/modules/sql-import">Zentralen SQL-Import öffnen</a>
|
||||
</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; ?>
|
||||
|
||||
<h3 style="margin-top:1.25rem;">Aktive Module</h3>
|
||||
<div class="module-admin-grid module-admin-grid--compact">
|
||||
<?php foreach ($active as $module): ?>
|
||||
<?php
|
||||
$migrationStatus = modules()->migrationStatus($module['name']);
|
||||
$pendingMigrations = $migrationStatus['pending'] ?? [];
|
||||
$migrationLabel = $pendingMigrations !== []
|
||||
? count($pendingMigrations) . ' ausstehend'
|
||||
: (($migrationStatus['available'] ?? 0) > 0 ? 'Schema aktuell' : 'Keine Migrationen');
|
||||
?>
|
||||
<article class="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-meta">
|
||||
<div class="module-admin-meta__item">
|
||||
<span class="module-admin-meta__label">Status</span>
|
||||
<strong class="module-admin-badge module-admin-badge--success">Aktiv</strong>
|
||||
</div>
|
||||
<div class="module-admin-meta__item">
|
||||
<span class="module-admin-meta__label">Migrationen</span>
|
||||
<strong class="module-admin-badge<?= $pendingMigrations !== [] ? ' module-admin-badge--accent' : (($migrationStatus['available'] ?? 0) > 0 ? ' module-admin-badge--success' : '') ?>"><?= e($migrationLabel) ?></strong>
|
||||
</div>
|
||||
</div>
|
||||
<div class="module-admin-actions">
|
||||
<a class="nav-link" href="/module/<?= e($module['name']) ?>">Öffnen</a>
|
||||
<?php if ($pendingMigrations !== []): ?>
|
||||
<form method="post" style="margin:0;">
|
||||
<input type="hidden" name="module" value="<?= e($module['name']) ?>">
|
||||
<button class="cta-button" name="action" value="migrate">Migrationen anwenden</button>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
<form method="post" style="margin:0;">
|
||||
<input type="hidden" name="module" value="<?= e($module['name']) ?>">
|
||||
<button class="cta-button" name="action" value="disable" style="background:var(--panel); color:var(--text);">Deaktivieren</button>
|
||||
</form>
|
||||
</div>
|
||||
</article>
|
||||
<?php endforeach; ?>
|
||||
<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-active" href="/modules/install">Module installieren/aktivieren</a>
|
||||
</nav>
|
||||
<div class="module-submenu-actions">
|
||||
<a class="module-button module-button--secondary module-button--small" href="/">Nexus Übersicht</a>
|
||||
<a class="module-button module-button--secondary module-button--small" href="/modules/sql-import">Zentralen SQL-Import öffnen</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3 style="margin-top:1.5rem;">Deaktivierte Module</h3>
|
||||
<div class="module-admin-grid module-admin-grid--compact">
|
||||
<?php foreach ($inactive as $module): ?>
|
||||
<?php
|
||||
$migrationStatus = modules()->migrationStatus($module['name']);
|
||||
$pendingMigrations = $migrationStatus['pending'] ?? [];
|
||||
$migrationLabel = $pendingMigrations !== []
|
||||
? count($pendingMigrations) . ' ausstehend'
|
||||
: (($migrationStatus['available'] ?? 0) > 0 ? 'Schema aktuell' : 'Keine Migrationen');
|
||||
?>
|
||||
<article class="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>
|
||||
<section class="section-box">
|
||||
<div class="module-box-head">
|
||||
<div>
|
||||
<h2 class="module-box-title">Aktive Module</h2>
|
||||
<p>Bereits aktivierte Module mit optionalen Migrationsschritten.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="module-admin-grid module-admin-grid--compact">
|
||||
<?php foreach ($active as $module): ?>
|
||||
<?php
|
||||
$migrationStatus = modules()->migrationStatus($module['name']);
|
||||
$pendingMigrations = $migrationStatus['pending'] ?? [];
|
||||
$migrationLabel = $pendingMigrations !== []
|
||||
? count($pendingMigrations) . ' ausstehend'
|
||||
: (($migrationStatus['available'] ?? 0) > 0 ? 'Schema aktuell' : 'Keine Migrationen');
|
||||
?>
|
||||
<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>
|
||||
<div class="module-admin-meta">
|
||||
<div class="module-admin-meta__item">
|
||||
<span class="module-admin-meta__label">Status</span>
|
||||
<strong class="module-admin-badge">Deaktiviert</strong>
|
||||
<div class="module-admin-meta">
|
||||
<div class="module-admin-meta__item">
|
||||
<span class="module-admin-meta__label">Status</span>
|
||||
<strong class="module-admin-badge module-admin-badge--success">Aktiv</strong>
|
||||
</div>
|
||||
<div class="module-admin-meta__item">
|
||||
<span class="module-admin-meta__label">Migrationen</span>
|
||||
<strong class="module-admin-badge<?= $pendingMigrations !== [] ? ' module-admin-badge--accent' : (($migrationStatus['available'] ?? 0) > 0 ? ' module-admin-badge--success' : '') ?>"><?= e($migrationLabel) ?></strong>
|
||||
</div>
|
||||
</div>
|
||||
<div class="module-admin-meta__item">
|
||||
<span class="module-admin-meta__label">Migrationen</span>
|
||||
<strong class="module-admin-badge<?= $pendingMigrations !== [] ? ' module-admin-badge--accent' : (($migrationStatus['available'] ?? 0) > 0 ? ' module-admin-badge--success' : '') ?>"><?= e($migrationLabel) ?></strong>
|
||||
</div>
|
||||
</div>
|
||||
<div class="module-admin-actions">
|
||||
<a class="nav-link" href="/modules/setup/<?= e($module['name']) ?>">Setup</a>
|
||||
<?php if ($pendingMigrations !== []): ?>
|
||||
<div class="module-admin-actions">
|
||||
<a class="nav-link" href="/module/<?= e($module['name']) ?>">Öffnen</a>
|
||||
<?php if ($pendingMigrations !== []): ?>
|
||||
<form method="post" style="margin:0;">
|
||||
<input type="hidden" name="module" value="<?= e($module['name']) ?>">
|
||||
<button class="cta-button" name="action" value="migrate">Migrationen anwenden</button>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
<form method="post" style="margin:0;">
|
||||
<input type="hidden" name="module" value="<?= e($module['name']) ?>">
|
||||
<button class="cta-button" name="action" value="migrate">Migrationen anwenden</button>
|
||||
<button class="cta-button" name="action" value="disable" style="background:var(--panel); color:var(--text);">Deaktivieren</button>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
<form method="post" style="margin:0;">
|
||||
<input type="hidden" name="module" value="<?= e($module['name']) ?>">
|
||||
<button class="cta-button" name="action" value="enable">Aktivieren</button>
|
||||
</form>
|
||||
</div>
|
||||
</article>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="section-box">
|
||||
<div class="module-box-head">
|
||||
<div>
|
||||
<h2 class="module-box-title">Deaktivierte Module</h2>
|
||||
<p>Erkannte Module basieren auf Ordnern in <code>modules/</code>.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="module-admin-grid module-admin-grid--compact">
|
||||
<?php foreach ($inactive as $module): ?>
|
||||
<?php
|
||||
$migrationStatus = modules()->migrationStatus($module['name']);
|
||||
$pendingMigrations = $migrationStatus['pending'] ?? [];
|
||||
$migrationLabel = $pendingMigrations !== []
|
||||
? count($pendingMigrations) . ' ausstehend'
|
||||
: (($migrationStatus['available'] ?? 0) > 0 ? 'Schema aktuell' : 'Keine Migrationen');
|
||||
?>
|
||||
<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-meta">
|
||||
<div class="module-admin-meta__item">
|
||||
<span class="module-admin-meta__label">Status</span>
|
||||
<strong class="module-admin-badge">Deaktiviert</strong>
|
||||
</div>
|
||||
<div class="module-admin-meta__item">
|
||||
<span class="module-admin-meta__label">Migrationen</span>
|
||||
<strong class="module-admin-badge<?= $pendingMigrations !== [] ? ' module-admin-badge--accent' : (($migrationStatus['available'] ?? 0) > 0 ? ' module-admin-badge--success' : '') ?>"><?= e($migrationLabel) ?></strong>
|
||||
</div>
|
||||
</div>
|
||||
<div class="module-admin-actions">
|
||||
<a class="nav-link" href="/modules/setup/<?= e($module['name']) ?>">Setup</a>
|
||||
<?php if ($pendingMigrations !== []): ?>
|
||||
<form method="post" style="margin:0;">
|
||||
<input type="hidden" name="module" value="<?= e($module['name']) ?>">
|
||||
<button class="cta-button" name="action" value="migrate">Migrationen anwenden</button>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
<form method="post" style="margin:0;">
|
||||
<input type="hidden" name="module" value="<?= e($module['name']) ?>">
|
||||
<button class="cta-button" name="action" value="enable">Aktivieren</button>
|
||||
</form>
|
||||
</div>
|
||||
</article>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user