mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-08-10 15:21:22 +02:00
- Fix createThesis SQL: extra ? placeholder in VALUES (27 values for 26 columns) - Add createThesis integration tests to catch column/value mismatches - Add CSV_COLUMNS as single source of truth in ExportController, deriving csvHeaders() and positional fallback from it - Add missing columns to export query + CSV: duration_pages, duration_minutes, has_annexes, license_custom, contact_visible, objet - Add missing columns to import INSERT: license_id, license_custom, cc2r, exemplaire_baiu, exemplaire_erg, objet, contact_visible, duration_pages, duration_minutes, has_annexes - Resolve license name → license_id during import - Fix XamxamInitFilePonds: add file-upload-filepond.js to admin-entry.js so FilePond initialization code is available on the admin list page - Add FilePond vendor CSS to admin.min.css bundle (import dialog styling) - Generate .admin-file-hint from csvHeaders() instead of hardcoded stale list - Use positional fallback from CSV_COLUMNS for import cell parsing
85 lines
3.6 KiB
PHP
85 lines
3.6 KiB
PHP
<?php
|
|
// Ensure ExportController is available for the CSV column hint
|
|
if (!class_exists('ExportController')) {
|
|
require_once APP_ROOT . '/src/Controllers/ExportController.php';
|
|
}
|
|
?>
|
|
<dialog id="import-dialog" class="admin-dialog" aria-labelledby="import-dialog-title">
|
|
<div class="admin-dialog__header">
|
|
<h3 id="import-dialog-title">Importer une liste de TFE</h3>
|
|
<button type="button" class="admin-dialog__close" aria-label="Fermer"
|
|
onclick="document.getElementById('import-dialog').close()">✕</button>
|
|
</div>
|
|
|
|
<?php if ($importMessage || !empty($importErrors)): ?>
|
|
<div class="admin-import-status-card">
|
|
<?php if (!empty($importErrors)): ?>
|
|
<div class="toast admin-import-status-card__errors" role="alert" data-type="error">
|
|
<strong>⚠ Erreurs :</strong>
|
|
<ul class="admin-error-list">
|
|
<?php foreach ($importErrors as $err): ?>
|
|
<li><?= htmlspecialchars($err) ?></li>
|
|
<?php endforeach; ?>
|
|
</ul>
|
|
</div>
|
|
<?php endif; ?>
|
|
<?php if ($importMessage): ?>
|
|
<p class="admin-import-status-card__success" role="status">✓ <?= htmlspecialchars($importMessage) ?></p>
|
|
<?php endif; ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<?php if ($importMessage): ?>
|
|
<?php if (!empty($importResults)): ?>
|
|
<details class="admin-import-log-details">
|
|
<summary>Logs d'importation (<?= count($importResults) ?> entrées)</summary>
|
|
<ul class="admin-import-log">
|
|
<?php foreach ($importResults as $r): ?>
|
|
<li class="admin-import-log__item admin-import-log__item--<?= $r['type'] ?>"><?= htmlspecialchars($r['msg']) ?></li>
|
|
<?php endforeach; ?>
|
|
</ul>
|
|
</details>
|
|
<?php endif; ?>
|
|
<div class="admin-form-footer">
|
|
<button type="button" class="btn btn--primary"
|
|
onclick="document.getElementById('import-dialog').close(); window.location.href = window.location.pathname">Terminé</button>
|
|
</div>
|
|
<?php else: ?>
|
|
<form method="post" enctype="multipart/form-data" class="admin-form">
|
|
<input type="hidden" name="csrf_token" value="<?= htmlspecialchars($_SESSION['csrf_token']) ?>">
|
|
|
|
<div>
|
|
<label for="csv_file">Fichier CSV</label>
|
|
<div class="admin-file-input">
|
|
<input type="file" id="csv_file"
|
|
name="csv_file"
|
|
class="tfe-file-picker"
|
|
data-queue-type="csv_import"
|
|
required>
|
|
<small class="admin-file-hint">
|
|
Colonnes : <?= htmlspecialchars(implode(', ', ExportController::csvHeaders())) ?><br>
|
|
Quatre premières lignes ignorées — Séparateur : virgule — UTF-8
|
|
</small>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="admin-form-footer">
|
|
<button type="submit" class="btn btn--primary">Importer</button>
|
|
<button type="button" class="btn btn--secondary"
|
|
onclick="document.getElementById('import-dialog').close()">Annuler</button>
|
|
</div>
|
|
</form>
|
|
|
|
<?php if (!empty($importResults)): ?>
|
|
<details class="admin-import-log-details">
|
|
<summary>Logs d'importation (<?= count($importResults) ?> entrées)</summary>
|
|
<ul class="admin-import-log">
|
|
<?php foreach ($importResults as $r): ?>
|
|
<li class="admin-import-log__item admin-import-log__item--<?= $r['type'] ?>"><?= htmlspecialchars($r['msg']) ?></li>
|
|
<?php endforeach; ?>
|
|
</ul>
|
|
</details>
|
|
<?php endif; ?>
|
|
<?php endif; ?>
|
|
</dialog>
|