From da153fc60473d350930392818dfefd0f517f93ac Mon Sep 17 00:00:00 2001 From: Pontoporeia Date: Tue, 12 May 2026 15:01:17 +0200 Subject: [PATCH] Refactor HTMX fragment architecture: DRY split into auth endpoints + shared templates - Created templates/partials/form/_licence.php (shared HTML, no auth logic) - Created templates/partials/form/_format-website.php (shared HTML, no auth logic) - Created src/FragmentRenderer.php helper for clean fragment rendering - Created public/{admin,partage}/fragments/ subdirectories - Created thin fragment endpoint files: auth guard + data fetch + render template - Updated all hx-post references in templates to new fragments/ paths - Updated partage/index.php routing for new fragments subdirectory - Kept old fragment files as thin delegates for backward compat - Updated nginx config: added PHP handler in /partage/ location block --- TODO.md | 12 ++ app/public/admin/fichiers-fragment.php | 17 +-- app/public/admin/format-website-fragment.php | 57 +-------- app/public/admin/fragments/fichiers.php | 13 +++ app/public/admin/fragments/format-website.php | 29 +++++ app/public/admin/fragments/language-autre.php | 9 ++ .../admin/fragments/language-search.php | 10 ++ app/public/admin/fragments/licence.php | 23 ++++ app/public/admin/fragments/tag-search.php | 10 ++ app/public/admin/fragments/validate-file.php | 9 ++ app/public/admin/language-autre-fragment.php | 17 +-- app/public/admin/language-search-fragment.php | 14 +-- app/public/admin/licence-fragment.php | 109 +----------------- app/public/admin/tag-search-fragment.php | 14 +-- app/public/admin/validate-file-fragment.php | 12 +- .../partage/format-website-fragment.php | 66 +---------- app/public/partage/fragments/fichiers.php | 8 ++ .../partage/fragments/format-website.php | 26 +++++ .../partage/fragments/language-autre.php | 8 ++ .../partage/fragments/language-search.php | 8 ++ app/public/partage/fragments/licence.php | 22 ++++ app/public/partage/fragments/tag-search.php | 8 ++ .../partage/fragments/validate-file.php | 8 ++ app/public/partage/index.php | 71 ++++++------ .../partage/language-autre-fragment.php | 33 +----- app/public/partage/licence-fragment.php | 108 +---------------- app/public/partage/tag-search-fragment.php | 67 +---------- app/src/FragmentRenderer.php | 45 ++++++++ .../ad921d60486366258809553a3db49a4a.json | 2 +- app/templates/admin/acces.php | 13 +++ .../partials/form/_format-website.php | 48 ++++++++ app/templates/partials/form/_licence.php | 102 ++++++++++++++++ .../form/fieldset-licence-explanation.php | 10 +- app/templates/partials/form/file-field.php | 4 +- app/templates/partials/form/form.php | 6 +- .../partials/form/language-search.php | 2 +- app/templates/partials/form/tag-search.php | 2 +- nginx/xamxam.conf | 8 ++ 38 files changed, 503 insertions(+), 527 deletions(-) create mode 100644 app/public/admin/fragments/fichiers.php create mode 100644 app/public/admin/fragments/format-website.php create mode 100644 app/public/admin/fragments/language-autre.php create mode 100644 app/public/admin/fragments/language-search.php create mode 100644 app/public/admin/fragments/licence.php create mode 100644 app/public/admin/fragments/tag-search.php create mode 100644 app/public/admin/fragments/validate-file.php create mode 100644 app/public/partage/fragments/fichiers.php create mode 100644 app/public/partage/fragments/format-website.php create mode 100644 app/public/partage/fragments/language-autre.php create mode 100644 app/public/partage/fragments/language-search.php create mode 100644 app/public/partage/fragments/licence.php create mode 100644 app/public/partage/fragments/tag-search.php create mode 100644 app/public/partage/fragments/validate-file.php create mode 100644 app/src/FragmentRenderer.php create mode 100644 app/templates/partials/form/_format-website.php create mode 100644 app/templates/partials/form/_licence.php diff --git a/TODO.md b/TODO.md index fea61cd..d00e62b 100644 --- a/TODO.md +++ b/TODO.md @@ -21,6 +21,18 @@ - [x] F. `ThesisEditController.php` — Remove separate video/audio/peertube_* handleFilePondQueueFiles calls; also legacy $_FILES path - [x] G. `ThesisCreateController.php` — Same as F +# HTMX Fragment Architecture Reorganization + +- [x] Create shared templates `_licence.php` and `_format-website.php` in `templates/partials/form/` +- [x] Create `src/FragmentRenderer.php` helper +- [x] Create `public/admin/fragments/` and `public/partage/fragments/` subdirectories +- [x] Create thin fragment endpoint files (auth + data prep + render shared template) +- [x] Update all hx-post references in templates to point to new `fragments/` paths +- [x] Update `partage/index.php` routing for new fragments +- [x] Keep old fragment files as thin delegates to new `fragments/` for backward compat +- [x] Update nginx config for partage fragment PHP handling +- [ ] Deploy: `just deploy` + `just deploy-nginx` + ## Previous items - [x] Step 1 — Build 4 PHP endpoints (process.php, revert.php, load.php, remove.php) diff --git a/app/public/admin/fichiers-fragment.php b/app/public/admin/fichiers-fragment.php index 8df172c..fbd904d 100644 --- a/app/public/admin/fichiers-fragment.php +++ b/app/public/admin/fichiers-fragment.php @@ -1,17 +1,6 @@ getConnection(); - -$stmt = $db->prepare('SELECT id FROM format_types WHERE name = ? LIMIT 1'); -$stmt->execute(['Site web']); -$websiteFormatId = $stmt->fetchColumn(); - -if (!$websiteFormatId) { - echo ''; - exit; -} - -$selectedFormats = isset($_POST['formats']) && is_array($_POST['formats']) - ? array_map('intval', $_POST['formats']) - : []; - -if (!in_array((int)$websiteFormatId, $selectedFormats, true)) { - echo ''; - exit; -} - -$websiteUrl = htmlspecialchars($_POST['website_url'] ?? ''); -$websiteLabel = htmlspecialchars($_POST['website_label'] ?? ''); -?> -
- Site web -
- -
- - Si le TFE est un site web, entrez son URL ici. Il sera affiché comme un site embarqué sur la page du TFE. -
-
-
- - -
-
+require_once __DIR__ . '/fragments/format-website.php'; diff --git a/app/public/admin/fragments/fichiers.php b/app/public/admin/fragments/fichiers.php new file mode 100644 index 0000000..365ef74 --- /dev/null +++ b/app/public/admin/fragments/fichiers.php @@ -0,0 +1,13 @@ +getConnection(); + +$stmt = $db->prepare('SELECT id FROM format_types WHERE name = ? LIMIT 1'); +$stmt->execute(['Site web']); +$websiteFormatId = $stmt->fetchColumn(); + +$selectedFormats = isset($_POST['formats']) && is_array($_POST['formats']) + ? array_map('intval', $_POST['formats']) + : []; + +FragmentRenderer::render('form/_format-website', [ + 'fieldsetId' => 'edit-website-url-fieldset', + 'selectedFormats' => $selectedFormats, + 'websiteFormatId' => $websiteFormatId, + 'websiteUrl' => $_POST['website_url'] ?? '', + 'websiteLabel' => $_POST['website_label'] ?? '', +]); diff --git a/app/public/admin/fragments/language-autre.php b/app/public/admin/fragments/language-autre.php new file mode 100644 index 0000000..b689c67 --- /dev/null +++ b/app/public/admin/fragments/language-autre.php @@ -0,0 +1,9 @@ +getAllLicenseTypes(); + +FragmentRenderer::render('form/_licence', [ + 'adminMode' => true, + 'accessTypeId' => $_POST['access_type_id'] ?? '', + 'licenseId' => $_POST['license_id'] ?? '', + 'licenseCustom' => $_POST['license_custom'] ?? '', + 'cc2r' => !empty($_POST['cc2r']), + 'wantLicense' => !empty($_POST['want_license']), + 'hxPost' => '/admin/fragments/licence.php', + 'licenseTypes' => $licenseTypes, +]); diff --git a/app/public/admin/fragments/tag-search.php b/app/public/admin/fragments/tag-search.php new file mode 100644 index 0000000..4718c86 --- /dev/null +++ b/app/public/admin/fragments/tag-search.php @@ -0,0 +1,10 @@ +getAllLicenseTypes(); -?> - -
- -
- Options de licence -

J'autorise que mon TFE soit disponible en libre accès. Je suis conscient·e des responsabilités légales.

- -
- - En savoir plus sur la CC2r ↗ -
- -
et / ou
- - - - -
- - -
- Options de licence -

Mon TFE est accessible sur place et sur la plateforme xamxam par la communauté erg. J'autorise une (ré-)utilisation dans un contexte académique au sein de l'erg.

- -
- - Par défaut, aucune licence spécifique n'est appliquée. Cochez pour en choisir une. -
- - -
- - En savoir plus sur la CC2r ↗ -
- - - - - -

Je suis conscient·e des obligations légales venant avec la licence choisie et acquiesce avoir lu la documentation prévue à cet effet par l'erg, ainsi qu'avoir discuté des enjeux des licences avec l'équipe pédagogique.

- -
- - -
- Options de licence -

Mon TFE n'est pas disponible en physique ni sur le site. Une note descriptive est visible publiquement.

-

Aucune licence n'est applicable.

-
- -
+require_once __DIR__ . '/fragments/licence.php'; diff --git a/app/public/admin/tag-search-fragment.php b/app/public/admin/tag-search-fragment.php index 25c97c5..e6bc3d5 100644 --- a/app/public/admin/tag-search-fragment.php +++ b/app/public/admin/tag-search-fragment.php @@ -1,14 +1,6 @@ getConnection()->prepare( - 'SELECT id FROM format_types WHERE name = ? LIMIT 1' -); -$stmt->execute(['Site web']); -$websiteFormatId = $stmt->fetchColumn(); - -if (!$websiteFormatId) { - echo ''; - exit; -} - -$selectedFormats = isset($_POST['formats']) && is_array($_POST['formats']) - ? array_map('intval', $_POST['formats']) - : []; - -if (!in_array((int)$websiteFormatId, $selectedFormats, true)) { - echo ''; - exit; -} - -$websiteUrl = htmlspecialchars($_POST['website_url'] ?? ''); -$websiteLabel = htmlspecialchars($_POST['website_label'] ?? ''); -?> -
- Site web - -
- -
- - Si le TFE est un site web, entrez son URL ici. Il sera affiché comme un site embarqué sur la page du TFE. -
-
- -
- - -
-
+require_once __DIR__ . '/fragments/format-website.php'; diff --git a/app/public/partage/fragments/fichiers.php b/app/public/partage/fragments/fichiers.php new file mode 100644 index 0000000..de2020d --- /dev/null +++ b/app/public/partage/fragments/fichiers.php @@ -0,0 +1,8 @@ +getConnection(); + +$stmt = $db->prepare('SELECT id FROM format_types WHERE name = ? LIMIT 1'); +$stmt->execute(['Site web']); +$websiteFormatId = $stmt->fetchColumn(); + +$selectedFormats = isset($_POST['formats']) && is_array($_POST['formats']) + ? array_map('intval', $_POST['formats']) + : []; + +FragmentRenderer::render('form/_format-website', [ + 'fieldsetId' => 'website-url-fieldset', + 'selectedFormats' => $selectedFormats, + 'websiteFormatId' => $websiteFormatId, + 'websiteUrl' => $_POST['website_url'] ?? '', + 'websiteLabel' => $_POST['website_label'] ?? '', +]); diff --git a/app/public/partage/fragments/language-autre.php b/app/public/partage/fragments/language-autre.php new file mode 100644 index 0000000..4e7fae9 --- /dev/null +++ b/app/public/partage/fragments/language-autre.php @@ -0,0 +1,8 @@ +getAllLicenseTypes(); + +FragmentRenderer::render('form/_licence', [ + 'adminMode' => false, + 'accessTypeId' => $_POST['access_type_id'] ?? '', + 'licenseId' => $_POST['license_id'] ?? '', + 'licenseCustom' => $_POST['license_custom'] ?? '', + 'cc2r' => !empty($_POST['cc2r']), + 'wantLicense' => !empty($_POST['want_license']), + 'hxPost' => '/partage/fragments/licence.php', + 'licenseTypes' => $licenseTypes, +]); diff --git a/app/public/partage/fragments/tag-search.php b/app/public/partage/fragments/tag-search.php new file mode 100644 index 0000000..4fb66b4 --- /dev/null +++ b/app/public/partage/fragments/tag-search.php @@ -0,0 +1,8 @@ + is_string($l) && trim($l) !== '')) > 0; - -// The "Autre(s) langue(s)" label is required if no standard language is checked. -// The "Langue(s) du TFE" checkbox list is required if neither standard languages -// nor "autre" languages are set. -$langAutreRequired = !$anyChecked; -$checkboxesRequired = !$anyChecked && !$hasLangAutre; -?> -*' : '' ?> -*' : '' ?> +require_once __DIR__ . '/fragments/language-autre.php'; diff --git a/app/public/partage/licence-fragment.php b/app/public/partage/licence-fragment.php index 5ceb6c3..264ad38 100644 --- a/app/public/partage/licence-fragment.php +++ b/app/public/partage/licence-fragment.php @@ -1,108 +1,6 @@ getAllLicenseTypes(); -?> - -
- -
- Options de licence -

J'autorise que mon TFE soit disponible en libre accès. Je suis conscient·e des responsabilités légales.

- -
- - En savoir plus sur la CC2r ↗ -
- -
et / ou
- - - - -
- - -
- Options de licence -

Mon TFE est accessible sur place et sur la plateforme xamxam par la communauté erg. J'autorise une (ré-)utilisation dans un contexte académique au sein de l'erg.

- -
- - Par défaut, aucune licence spécifique n'est appliquée. Cochez pour en choisir une. -
- - -
- - En savoir plus sur la CC2r ↗ -
- - - - - -

Je suis conscient·e des obligations légales venant avec la licence choisie et acquiesce avoir lu la documentation prévue à cet effet par l'erg, ainsi qu'avoir discuté des enjeux des licences avec l'équipe pédagogique.

- -
- - -
- Options de licence -

Mon TFE n'est pas disponible en physique ni sur le site. Une note descriptive est visible publiquement.

-

Aucune licence n'est applicable.

-
- -
+require_once __DIR__ . '/fragments/licence.php'; diff --git a/app/public/partage/tag-search-fragment.php b/app/public/partage/tag-search-fragment.php index 4ef049d..dd9afa7 100644 --- a/app/public/partage/tag-search-fragment.php +++ b/app/public/partage/tag-search-fragment.php @@ -1,67 +1,6 @@ searchTags($query); - -// Deduplicate results by lowercase name -$seen = []; -$results = array_values(array_filter($results, function($tag) use (&$seen) { - $key = strtolower($tag['name']); - if (isset($seen[$key])) return false; - $seen[$key] = true; - return true; -})); - -// Filter out already-selected tags (case-insensitive) -$results = array_values(array_filter($results, function($tag) use ($currentTags) { - return !in_array(strtolower($tag['name']), $currentTags, true); -})); - -// Check if query exactly matches an existing tag (case-insensitive) -$exactExists = false; -foreach ($results as $tag) { - if (strcasecmp($tag['name'], $query) === 0) { - $exactExists = true; - break; - } -} - -// If no exact match and query non-empty, suggest creation -$canCreate = ($query !== '' && !$exactExists && !in_array($query, $currentTags, true)); -?> - -
Aucun mot-clé trouvé.
- - - - - - - - - +require_once __DIR__ . '/fragments/tag-search.php'; diff --git a/app/src/FragmentRenderer.php b/app/src/FragmentRenderer.php new file mode 100644 index 0000000..055a0b4 --- /dev/null +++ b/app/src/FragmentRenderer.php @@ -0,0 +1,45 @@ +, , , header, or footer). + * + * Usage: + * + * // public/admin/fragments/licence.php + * AdminAuth::requireLogin(); + * FragmentRenderer::render('form/_licence', [ + * 'accessTypeId' => $_POST['access_type_id'] ?? '', + * 'licenseId' => $_POST['license_id'] ?? '', + * 'licenseTypes' => Database::getInstance()->getAllLicenseTypes(), + * 'cc2r' => !empty($_POST['cc2r']), + * 'wantLicense' => !empty($_POST['want_license']), + * 'adminMode' => true, + * 'hxPost' => '/admin/fragments/licence.php', + * ]); + * + * The template receives all keys in $data as variables via extract(). + */ +class FragmentRenderer +{ + /** + * Render a template partial for an HTMX fragment response. + * + * @param string $template Path relative to APP_ROOT/templates/partials/ (without .php extension) + * @param array $data Variables to extract into template scope + */ + public static function render(string $template, array $data = []): void + { + // Prevent output buffering from any wrapping layout + if (ob_get_level() === 0) { + ob_start(); + } + + extract($data, EXTR_SKIP); + require APP_ROOT . '/templates/partials/' . $template . '.php'; + + ob_end_flush(); + } +} diff --git a/app/storage/cache/rate_limit/ad921d60486366258809553a3db49a4a.json b/app/storage/cache/rate_limit/ad921d60486366258809553a3db49a4a.json index 5e13009..8b9c9fa 100644 --- a/app/storage/cache/rate_limit/ad921d60486366258809553a3db49a4a.json +++ b/app/storage/cache/rate_limit/ad921d60486366258809553a3db49a4a.json @@ -1 +1 @@ -[1778455046] \ No newline at end of file +[1778590812] \ No newline at end of file diff --git a/app/templates/admin/acces.php b/app/templates/admin/acces.php index 7159ce2..6b32f9c 100644 --- a/app/templates/admin/acces.php +++ b/app/templates/admin/acces.php @@ -1728,6 +1728,19 @@ +%%%%%%% diff from: somsyvxz 249f7943 "Bulk bar anti-shift, tags icons, AP no-wrap, credits reorder" (rebased revision) +\\\\\\\ to: sqvvzxku e3b36997 ".gitignore ignore rate_limit and theses and logs." (rebased revision) ++ $linkName = $link['name'] ?? ''; +++ $linkExpiresVal = $link['expires_at'] ? date('Y-m-d\TH:i', strtotime($link['expires_at'])) : ''; +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff from: sqvvzxku e3b36997 ".gitignore ignore rate_limit and theses and logs." (rebased revision) +\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ to: somsyvxz 249f7943 "Bulk bar anti-shift, tags icons, AP no-wrap, credits reorder" (rebased revision) +- $linkName = $link['name'] ?? ''; +- $linkExpiresVal = $link['expires_at'] ? date('Y-m-d\TH:i', strtotime($link['expires_at'])) : ''; +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff from: somsyvxz 14a3cd10 "Bulk bar anti-shift, tags icons, AP no-wrap, credits reorder" (rebase destination) +\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ to: tkqwzqos dffabd97 "Refactor HTMX fragment architecture: DRY split into auth endpoints + shared templates" (rebased revision) + $linkName = $link['name'] ?? ''; + $linkExpiresVal = $link['expires_at'] ? date('Y-m-d\TH:i', strtotime($link['expires_at'])) : ''; + $linkLockedYear = $link['locked_year'] ?? null; ++%%%%%%% diff from: somsyvxz 249f7943 "Bulk bar anti-shift, tags icons, AP no-wrap, credits reorder" (rebased revision) ++\\\\\\\ to: tkqwzqos e51fc3eb "Refactor HTMX fragment architecture: DRY split into auth endpoints + shared templates" (rebased revision) +++ $linkName = $link['name'] ?? ''; ++ $linkExpiresVal = $link['expires_at'] ? date('Y-m-d\TH:i', strtotime($link['expires_at'])) : ''; ?> diff --git a/app/templates/partials/form/_format-website.php b/app/templates/partials/form/_format-website.php new file mode 100644 index 0000000..fe2f062 --- /dev/null +++ b/app/templates/partials/form/_format-website.php @@ -0,0 +1,48 @@ + ('website-url-fieldset' or 'edit-website-url-fieldset') + * array $selectedFormats — selected format_type IDs + * int $websiteFormatId — ID of the "Site web" format_type + * string $websiteUrl — current value (for repopulation) + * string $websiteLabel — current value (for repopulation) + */ + +if (!$websiteFormatId) { + echo ''; + return; +} + +if (!in_array((int)$websiteFormatId, array_map('intval', $selectedFormats), true)) { + echo ''; + return; +} + +$escUrl = htmlspecialchars($websiteUrl); +$escLabel = htmlspecialchars($websiteLabel); +?> +
+ Site web +
+ +
+ + Si le TFE est un site web, entrez son URL ici. Il sera affiché comme un site embarqué sur la page du TFE. +
+
+
+ + +
+
diff --git a/app/templates/partials/form/_licence.php b/app/templates/partials/form/_licence.php new file mode 100644 index 0000000..f4264c4 --- /dev/null +++ b/app/templates/partials/form/_licence.php @@ -0,0 +1,102 @@ + +
+ +
+ Options de licence +

J'autorise que mon TFE soit disponible en libre accès. Je suis conscient·e des responsabilités légales.

+ +
+ + En savoir plus sur la CC2r ↗ +
+ +
et / ou
+ + + + +
+ + +
+ Options de licence +

Mon TFE est accessible sur place et sur la plateforme xamxam par la communauté erg. J'autorise une (ré-)utilisation dans un contexte académique au sein de l'erg.

+ +
+ + Par défaut, aucune licence spécifique n'est appliquée. Cochez pour en choisir une. +
+ + +
+ + En savoir plus sur la CC2r ↗ +
+ + + + + +

Je suis conscient·e des obligations légales venant avec la licence choisie et acquiesce avoir lu la documentation prévue à cet effet par l'erg, ainsi qu'avoir discuté des enjeux des licences avec l'équipe pédagogique.

+ +
+ + +
+ Options de licence +

Mon TFE n'est pas disponible en physique ni sur le site. Une note descriptive est visible publiquement.

+

Aucune licence n'est applicable.

+
+ +
diff --git a/app/templates/partials/form/fieldset-licence-explanation.php b/app/templates/partials/form/fieldset-licence-explanation.php index 473b708..5397f1e 100644 --- a/app/templates/partials/form/fieldset-licence-explanation.php +++ b/app/templates/partials/form/fieldset-licence-explanation.php @@ -42,7 +42,7 @@ $adminMode = $adminMode ?? false;