Files
xamxam/TODO.md
Pontoporeia e06a317499 fix: req annexes, add HTMX inline file validation (MIME/size)
- Annexes file input now required when 'has_annexes' checkbox is checked
- PHP-side validation: if has_annexes but no files, throw error
- HTMX inline file validation: POSTs to validate-file-fragment on file change
  - Validates MIME type against per-field whitelists (couverture, note_intention,
    tfe, annexes)
  - Validates file size with PDF-specific 100MB limit
  - Supports both single-file and multi-file inputs
  - Returns green ✓ or red ✕ inline validation messages
- Shared validation logic in src/Controllers/validate-file-fragment-shared.php
- Admin wrapper: admin/validate-file-fragment.php (with AdminAuth guard)
- Partage route: /partage/validate-file-fragment (dispatched via index.php)
- CSS: .file-validation-msg, .fv-ok (green), .fv-error (red)
- file-field.php: accepts $fieldName for per-input validation type,
  auto-detects admin/partage validate URL
2026-05-19 00:08:05 +02:00

3.6 KiB

TODO

  • Fix language-search-fragment: use searchLanguages() like tag fragment, remove broken predefined exclusion logic
  • Both fragments now follow identical patterns
  • Fix "Créer" button not appearing on language search: both language and tag inputs used name="q" in the same form, causing HTMX to submit the wrong (empty) value — renamed to unique names (language_search_q / tag_search_q)
  • Exclude Français, Anglais, Néerlandais from language-search suggestions (handled by the checkbox list)
  • Refactor file upload naming convention
    • Create shared ThesisFileHandler trait (src/Controllers/ThesisFileHandler.php)
    • New pattern: theses/{YYYY}/{YYYY}{AUTHORS}{TITLE_SLUG}/
    • COUVERTURE: single cover image in thesis folder (covers/ directory deprecated)
    • NOTE_INTENTION: single PDF in thesis folder
    • TFE_{XX}: main files, contiguous numbering 01+, hierarchy PDF > video > audio > subtitles > images > other
    • Subtitles (VTT) placed immediately after their associated video in TFE sequence
    • ANNEXE_{XX}: annex files, separate numbering 01+
    • Two-digit zero-padded numbering (sprintf('%02d', ...))
    • Update ThesisCreateController.php: use trait, new file handling
    • Update ThesisEditController.php: use trait, new file handling
    • Remove duplicate methods (generateAuthorSlug, sanitizeFilename, etc.) from both controllers
    • Update Database.php: deprecate handleCoverUpload, remove banner_path from queries
    • Update SystemController.php: remove banners/ stats
    • Update schema.sql: remove banner_path column and view field
    • Create migration 027_drop_banner_path.sql
    • Update PureLogicTest.php: adapt detectFileType call signature
    • All pure logic tests pass
  • Fix license validation: only require license for non-admin when access_type_id=1 (Libre), not for Interne (2) or Interdit (3) — fixes share link submissions failing with "Veuillez sélectionner une licence"
  • Add xamxam@erg.be mailto link at top of student (partage) form
  • On validation error, append "envoyez un e-mail à xamxam@erg.be" to flash error message
  • Preserve uploaded file names across validation redirects: store in session, display as warning on re-render so the student knows which files to re-select
  • Obfuscate all email addresses and mailto: links as HTML decimal entities site-wide (EmailObfuscator class, applied in templates + Parsedown post-processing)
  • Fix TFE and annexes files not saved in ThesisCreateController::submit(): call handleAnnexeFiles, fix file input name mapping
  • Apply ALLOWED_MIME_TYPES/ALLOWED_EXTENSIONS validation in handleAnnexeFiles (same as handleTfeFiles)
  • Fix handleAnnexeFiles to use correct $_FILES key ('annexes' not 'files')
  • Add annexe handling in ThesisEditController::save()
  • Relax 3-keyword minimum: admin mode (create) requires 1+, edit requires 1+, student (partage) requires 3
  • Add CSS for file preview items (.fp-item, .fp-thumb, .fp-icon, .fp-meta, .fp-name, .fp-size) so annexes/cover/note-intention previews wrap and display correctly
  • Fix TFE file input accept attribute to include video/audio/archive extensions
  • Make annexes file input required when "Ce TFE comporte des annexes" is checked
  • Add PHP-side validation: if has_annexes checked but no annexe files provided, throw error
  • Add HTMX inline file validation: MIME type + file size checked on change via validate-file-fragment endpoint
  • Create shared validation logic (validate-file-fragment-shared.php) used by both admin and partage
  • Add CSS for .file-validation-msg, .fv-ok, .fv-error inline validation messages