mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-06-25 16:19:19 +02:00
Replace `storeAsFile:true` with a full async FilePond round-trip pipeline using opaque server-side file IDs.
* Added 4 new PHP endpoints under `/admin/actions/filepond/`:
* `process.php` — upload/process single file and return opaque `file_id`
* `revert.php` — delete pending tmp uploads before form submit
* `load.php` — stream existing files by DB ID for FilePond preload
* `remove.php` — soft-delete `thesis_files` rows
* `process.php` improvements:
* accept arbitrary FilePond field names instead of hardcoded `file`
* support PHP-nested multi-file queue inputs (`queue_file[tfe][]`)
* explicit unwrapping of nested `$_FILES` structures
* add `audio/mp3` to audio + `peertube_audio` MIME whitelists
* immediate upload of `peertube_*` files to PeerTube, returning `peertube:{uuid}` IDs
* extensive `error_log()` instrumentation for request, CSRF, MIME, upload, and save stages
* `revert.php` now accepts `peertube:` IDs without local cleanup
* `ThesisFileHandler`:
* add `handleFilePondQueueFiles()` + `handleFilePondSingleFile()`
* process async uploads from `storage/tmp/filepond/` via opaque `file_id`
* inline handling of `peertube:{uuid}` IDs with direct `thesis_files` insertion
* remove obsolete deferred PeerTube queue-processing flow
* `ThesisCreateController` + `ThesisEditController`:
* gate async path behind `filepond_mode=1`
* preserve legacy multipart flow as fallback
* `file-upload-filepond.js`:
* remove `storeAsFile:true`
* add `buildServerConfig()` for async endpoint wiring
* fix `syncOrderInput()` to use `serverId`
* add `onprocessfile` hook
* add `fileValidateSizeFilterItem` for per-extension size caps
* preload existing uploads via `data-existing-files` + `server.load`
* replace static `INPUT_ID_TO_TYPE` map with `data-queue-type`
* add extensive `console.log()` debugging across upload pipeline stages
* `upload-progress.js`:
* block form submission while uploads are pending
* update `collectFileNames()` to read processed FilePond items
* Templates/layout:
* add `data-queue-type`
* add `data-existing-files`
* add global CSRF meta tag outside admin-only context
* add `filepond_mode` hidden input
* add CSRF token/meta support for partage pages
* move website URL field below file upload block
* `.gitignore`: exclude `storage/tmp/` from version control
61 lines
2.1 KiB
PHP
61 lines
2.1 KiB
PHP
<?php
|
|
/**
|
|
* Shared partial — "Fichiers" fieldset (add / student submission mode).
|
|
*
|
|
* Order per spec:
|
|
* 1. Image de couverture (optionnel)
|
|
* 2. Note d'intention (obligatoire)
|
|
* 3. TFE (obligatoire)
|
|
* 4. Annexes éventuelles (optionnel)
|
|
*
|
|
* Variables consumed:
|
|
* bool $adminMode — when true, no field is required (admin add/edit mode).
|
|
*/
|
|
$adminMode = $adminMode ?? false;
|
|
?>
|
|
<fieldset>
|
|
<legend>Fichiers</legend>
|
|
|
|
<?php
|
|
$name = 'couverture';
|
|
$label = 'Image de couverture (optionnel) :';
|
|
$accept = 'image/jpeg,image/png,image/webp';
|
|
$hint = 'JPG, PNG ou WEBP. Format 4:3 recommandé. Max 20 MB.';
|
|
include APP_ROOT . '/templates/partials/form/file-field.php';
|
|
?>
|
|
|
|
<?php
|
|
$name = 'note_intention';
|
|
$label = 'Note d\'intention :';
|
|
$accept ='.pdf';
|
|
$hint = 'Format PDF uniquement.';
|
|
$required = !$adminMode;
|
|
include APP_ROOT . '/templates/partials/form/file-field.php';
|
|
?>
|
|
|
|
<!-- TFE files — multi-file, FilePond-powered -->
|
|
<div class="admin-form-group admin-files-fieldgroup">
|
|
<label>TFE (obligatoire) :</label>
|
|
<div class="admin-file-input">
|
|
<input type="file" id="tfe-files-input"
|
|
name="queue_file[tfe][]" multiple
|
|
accept=".pdf,.jpg,.jpeg,.png,.gif,.webp,.mp4,.webm,.mov,.ogv,.mp3,.ogg,.oga,.wav,.flac,.aac,.m4a,.vtt"
|
|
class="tfe-file-picker"
|
|
data-queue-type="tfe">
|
|
<small class="admin-file-hint">
|
|
Types acceptés : PDF · JPG/PNG/GIF/WEBP · MP4/WebM/MOV (vidéo) · MP3/OGG/WAV/FLAC (audio) · ZIP/TAR (archives). Max 500 MB par fichier.
|
|
Les fichiers <code>.vtt</code> sont des sous-titres et seront associés automatiquement à la vidéo précédente.
|
|
</small>
|
|
</div>
|
|
</div>
|
|
|
|
<?php
|
|
$name = 'annexes';
|
|
$label = 'Annexes éventuelles (optionnel) :';
|
|
$accept = '.pdf,.zip,.tar,.gz';
|
|
$hint = 'PDF ou archives ZIP/TAR.';
|
|
$multiple = true;
|
|
include APP_ROOT . '/templates/partials/form/file-field.php';
|
|
?>
|
|
</fieldset>
|