feat: clarification contact étudiant + déplacer Contact visible dans Informations du TFE

- Label : « Contact visible (optionnel) », placeholder : mail/site/insta/etc.
- Hint : demander l'URL complète, le système raccourcit à l'affichage
- Affichage public (tfe.php) : extraction d'identifiant depuis l'URL
- Déplacement de contact_visible du Backoffice vers le fieldset Informations du TFE
- Renommage « Identité » → « Informations du TFE » dans le récapitulatif admin
This commit is contained in:
Pontoporeia
2026-06-09 14:01:28 +02:00
parent 021c58925e
commit 655dd4c038
7 changed files with 27 additions and 20 deletions

View File

@@ -6,3 +6,4 @@
{"timestamp":"2026-06-09T10:34:45+00:00","ip":"127.0.0.1","user_agent":"Mozilla/5.0 (X11; Linux x86_64; rv:151.0) Gecko/20100101 Firefox/151.0","resource":"thesis","action":"edit","status":"success","context":{"thesis_id":26,"title":"DepNum"}}
{"timestamp":"2026-06-09T10:34:52+00:00","ip":"127.0.0.1","user_agent":"Mozilla/5.0 (X11; Linux x86_64; rv:151.0) Gecko/20100101 Firefox/151.0","resource":"thesis","action":"edit","status":"success","context":{"thesis_id":26,"title":"DepNum"}}
{"timestamp":"2026-06-09T10:42:57+00:00","ip":"127.0.0.1","user_agent":"Mozilla/5.0 (X11; Linux x86_64; rv:151.0) Gecko/20100101 Firefox/151.0","resource":"thesis","action":"edit","status":"success","context":{"thesis_id":26,"title":"DepNum"}}
{"timestamp":"2026-06-09T12:10:41+00:00","ip":"127.0.0.1","user_agent":"Mozilla/5.0 (X11; Linux x86_64; rv:151.0) Gecko/20100101 Firefox/151.0","resource":"thesis","action":"edit","status":"success","context":{"thesis_id":26,"title":"DepNum"}}

View File

@@ -16,3 +16,5 @@
{"timestamp":"2026-06-09T10:34:52+00:00","ip":"127.0.0.1","user_agent":"Mozilla/5.0 (X11; Linux x86_64; rv:151.0) Gecko/20100101 Firefox/151.0","actor":"127.0.0.1","action":"DELETE","table":"thesis_files","record_id":7,"old_data":{"id":7,"thesis_id":26,"file_type":"website","file_path":"https://depnum.happyngreen.fr/","file_name":"depnum.happyngreen.fr","file_size":0,"mime_type":"text/html","description":null,"uploaded_at":"2026-06-09 10:34:45","sort_order":1,"display_label":null,"file_hash":null}}
{"timestamp":"2026-06-09T10:42:57+00:00","ip":"127.0.0.1","user_agent":"Mozilla/5.0 (X11; Linux x86_64; rv:151.0) Gecko/20100101 Firefox/151.0","actor":"127.0.0.1","action":"UPDATE","table":"theses","record_id":26,"old_data":{"id":26,"identifier":"2024-026","title":"DepNum","subtitle":null,"year":2024,"is_doctoral":0,"objet":"tfe","orientation_id":1,"ap_program_id":3,"finality_id":3,"synopsis":"Mon mémoire de Master à l'ERG est un blog autobiographique sur ma dépendance numérique. Chaque post mêle vécu personnel, questions et recherche. J'explore les dynamiques complexes de notre dépendance collective aux technologies numériques, en croisant expérience individuelle et réflexion systémique. JLKJLKJLKJ","context_note":"blposqujdfmlkqshjd mfglkqjhzmdslkf qsdmlkfj mlqskjdf mqskdjf mlqksdjf mlqksdjf mlqksjd fmlkjqsd","remarks":null,"access_type_id":2,"license_id":3,"jury_points":17.5,"jury_note_added":0,"submitted_at":"2026-06-08 08:33:14","defense_date":null,"published_at":null,"is_published":1,"baiu_link":"https://ils.bib.uclouvain.be/global/documents/3830452","created_at":"2026-06-08 08:33:14","updated_at":"2026-06-09 10:34:52","exemplaire_baiu":0,"exemplaire_erg":0,"cc2r":1,"license_custom":null,"deleted_at":null,"contact_visible":null}}
{"timestamp":"2026-06-09T10:42:57+00:00","ip":"127.0.0.1","user_agent":"Mozilla/5.0 (X11; Linux x86_64; rv:151.0) Gecko/20100101 Firefox/151.0","actor":"127.0.0.1","action":"DELETE","table":"thesis_files","record_id":8,"old_data":{"id":8,"thesis_id":26,"file_type":"website","file_path":"https://depnum.happyngreen.fr/","file_name":"depnum.happyngreen.fr","file_size":0,"mime_type":"text/html","description":null,"uploaded_at":"2026-06-09 10:34:52","sort_order":1,"display_label":null,"file_hash":null}}
{"timestamp":"2026-06-09T12:10:41+00:00","ip":"127.0.0.1","user_agent":"Mozilla/5.0 (X11; Linux x86_64; rv:151.0) Gecko/20100101 Firefox/151.0","actor":"127.0.0.1","action":"UPDATE","table":"theses","record_id":26,"old_data":{"id":26,"identifier":"2024-026","title":"DepNum","subtitle":null,"year":2024,"is_doctoral":0,"objet":"tfe","orientation_id":1,"ap_program_id":3,"finality_id":3,"synopsis":"Mon mémoire de Master à l'ERG est un blog autobiographique sur ma dépendance numérique. Chaque post mêle vécu personnel, questions et recherche. J'explore les dynamiques complexes de notre dépendance collective aux technologies numériques, en croisant expérience individuelle et réflexion systémique. JLKJLKJLKJ","context_note":"blposqujdfmlkqshjd mfglkqjhzmdslkf qsdmlkfj mlqskjdf mqskdjf mlqksdjf mlqksdjf mlqksjd fmlkjqsd","remarks":null,"access_type_id":2,"license_id":3,"jury_points":17.5,"jury_note_added":0,"submitted_at":"2026-06-08 08:33:14","defense_date":null,"published_at":null,"is_published":1,"baiu_link":"https://ils.bib.uclouvain.be/global/documents/3830452","created_at":"2026-06-08 08:33:14","updated_at":"2026-06-09 10:50:22","exemplaire_baiu":0,"exemplaire_erg":0,"cc2r":1,"license_custom":null,"deleted_at":null,"contact_visible":null}}
{"timestamp":"2026-06-09T12:10:41+00:00","ip":"127.0.0.1","user_agent":"Mozilla/5.0 (X11; Linux x86_64; rv:151.0) Gecko/20100101 Firefox/151.0","actor":"127.0.0.1","action":"DELETE","table":"thesis_files","record_id":11,"old_data":{"id":11,"thesis_id":26,"file_type":"website","file_path":"https://depnum.happyngreen.fr/","file_name":"depnum.happyngreen.fr","file_size":0,"mime_type":"text/html","description":null,"uploaded_at":"2026-06-09 10:50:22","sort_order":1,"display_label":null,"file_hash":null}}

View File

@@ -35,9 +35,9 @@
<p><a href="/admin/add.php" class="btn btn--secondary">Retour au formulaire</a></p>
<?php elseif ($thesis): ?>
<!-- ═══════════ Identité ═══════════ -->
<!-- ═══════════ Informations du TFE ═══════════ -->
<fieldset>
<legend>Identité</legend>
<legend>Informations du TFE</legend>
<dl class="recap-dl">
<dt>Identifiant</dt><dd><?= htmlspecialchars($thesis['identifier']) ?></dd>
<dt>Titre</dt><dd><?= htmlspecialchars($thesis['title']) ?></dd>

View File

@@ -58,14 +58,15 @@ $adminMode = $adminMode ?? false;
$hint = 'Séparez les auteur·ices par des virgules.';
include APP_ROOT . '/templates/partials/form/text-field.php';
?>
<?php if (!$adminMode): ?>
<?php
$name = 'mail'; $label = 'Contact visible (optionnel) [mail/site/insta/etc.] :'; $value = $oldFn('mail');
$name = $adminMode ? 'contact_visible' : 'mail';
$label = 'Contact visible (optionnel) :';
$value = $oldFn($adminMode ? 'contact_visible' : 'mail');
$attrs = ['autocomplete' => 'email'];
$hint = 'Un seul contact. Indiquez l\'URL complète pour un site (https://…), l\'adresse mail, le nom d\'utilisateur avec @ pour Instagram (@pseudo), ou l\'adresse complète pour Mastodon (@pseudo@instance). Ce contact sera visible publiquement sur la fiche du TFE.';
$placeholder = 'mail/site/insta/etc.';
$hint = 'Un seul contact. Collez l\'URL complète du site ou du profil (Instagram, Mastodon, site perso…) ou l\'adresse mail. Le lien sera automatiquement raccourci à l\'affichage (ex: https://instagram.com/pseudo → @pseudo, https://www.erg.be → erg.be).';
include APP_ROOT . '/templates/partials/form/text-field.php';
?>
<?php endif; ?>
<div>
<label for="synopsis">Synopsis :<?= $adminMode ? '' : ' <span class="asterisk">*</span>' ?></label>

View File

@@ -479,16 +479,7 @@ if ($filesMode === 'add'): ?>
<small>Case logistique : cocher si un exemplaire physique est disponible à l'ERG.</small>
</div>
<!-- 7. Contact visible (public) -->
<div class="admin-form-group">
<label for="contact_visible">Contact visible :</label>
<input type="text" id="contact_visible" name="contact_visible"
value="<?= htmlspecialchars($currentContactVisible ?? $formData['contact_visible'] ?? '') ?>"
placeholder="email, URL, @pseudo...">
<small>Contact affiché publiquement sur la page du TFE (email, site web, réseau social…). Laisser vide pour ne rien afficher.</small>
</div>
<!-- 8. Contact interne (privé) -->
<!-- 7. Contact interne (privé) -->
<div class="admin-form-group">
<label for="contact_interne">Contact interne (privé) :</label>
<input type="email" id="contact_interne" name="contact_interne"

View File

@@ -195,13 +195,13 @@
<span class="tfe-meta-label">Contact :</span>
<?php
$_contact = $data["contact_visible"];
$_isUrl = filter_var($_contact, FILTER_VALIDATE_URL) !== false;
$_isEmail = !$_isUrl && str_contains($_contact, "@");
$_isUrl = filter_var($_contact, FILTER_VALIDATE_URL) !== false;
$_isEmail = !$_isUrl && str_contains($_contact, '@') && !str_starts_with($_contact, '@');
if ($_isUrl):
$_host = parse_url($_contact, PHP_URL_HOST);
$_path = parse_url($_contact, PHP_URL_PATH) ?? '';
$_isInstagram = $_host && str_contains($_host, 'instagram.com');
$_isMastodon = $_path && str_contains($_path, '/@');
$_isMastodon = $_path && str_contains($_path, '/@');
if ($_isInstagram):
$_username = trim($_path, '/');
$_display = $_username ? '@' . $_username : preg_replace("#^https?://(www\.)?#i", "", rtrim($_contact, "/"));
@@ -217,8 +217,17 @@
</a>
<?php elseif ($_isEmail): ?>
<a href="<?= EmailObfuscator::mailto($_contact) ?>"><?= htmlspecialchars($_contact) ?></a>
<?php else: ?>
<?php else:
// Bare domain (ex: erg.be) or unrecognised → try to link it
$_looksLikeDomain = !str_contains($_contact, ' ') && preg_match('#\.[a-z]{2,}$#i', $_contact);
if ($_looksLikeDomain): ?>
<a href="https://<?= htmlspecialchars($_contact) ?>" target="_blank" rel="noopener">
<?= htmlspecialchars($_contact) ?>
<span class="sr-only">(ouvre dans un nouvel onglet)</span>
</a>
<?php else: ?>
<?= htmlspecialchars($_contact) ?>
<?php endif; ?>
<?php endif; ?>
</p>
<?php endif; ?>