mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-06-25 16:19:19 +02:00
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:
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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; ?>
|
||||
|
||||
Reference in New Issue
Block a user