Merge pull request #9 from LeOSW42/copilot/improve-view-readability-again

Improve readability of POI, blog, and wiki views
This commit is contained in:
2026-01-24 14:45:30 +01:00
committed by GitHub
3 changed files with 176 additions and 121 deletions

View File

@@ -7,23 +7,42 @@
<?php include('blocks/d.nav.html'); ?> <?php include('blocks/d.nav.html'); ?>
<section id="blog_article" <?=$blogArticle->is_archive=="t"||$blogArticle->is_public=="f"?'class="archive"':''?>> <?php
$isArchiveOrPrivate = $blogArticle->is_archive == "t" || $blogArticle->is_public == "f";
$canViewHistory = $user->rankIsHigher('premium');
$canModerate = $user->rankIsHigher('moderator');
$canWriteComment = $user->rankIsHigher("registered");
$canOpenCommentForm = $canWriteComment && !$isArchiveOrPrivate;
$hasHistory = isset($blogHistory);
$isVisitor = $user->rank == "visitor";
$isCommentable = $blogArticle->is_commentable == "t";
?>
<section id="blog_article" <?=$isArchiveOrPrivate ? 'class="archive"' : ''?>>
<h1><?=$blogArticle->name?></h1> <h1><?=$blogArticle->name?></h1>
<?php if($user->rankIsHigher('premium')) { ?> <?php if ($canViewHistory) { ?>
<span class="subtitle"> <span class="subtitle">
<?php if(isset($blogHistory)) { ?> <?php if ($hasHistory) { ?>
<select id="bloghistory"> <select id="bloghistory">
<?php $i = 0; <?php $historyIndex = 0; ?>
foreach ($blogHistory->objs as $row) { ?> <?php foreach ($blogHistory->objs as $row) { ?>
<option <?=$row->version_id==$blogArticle->version_id?'selected':''?> value="<?=$i?>"><?=$row->is_archive=="f"?'&bull; ':''?><?php echo datefmt_format($user->datetimeshort_format,date_create($row->update_date, new DateTimeZone("UTC"))) ?></option> <?php
<?php $i++; $isSelected = $row->version_id == $blogArticle->version_id ? 'selected' : '';
} ?> $isActive = $row->is_archive == "f" ? '&bull; ' : '';
$formattedDate = datefmt_format(
$user->datetimeshort_format,
date_create($row->update_date, new DateTimeZone("UTC"))
);
?>
<option <?=$isSelected?> value="<?=$historyIndex?>"><?=$isActive?><?=$formattedDate?></option>
<?php $historyIndex++; ?>
<?php } ?>
</select> </select>
<?php } <?php }
if ($user->rankIsHigher('moderator') && isset($blogHistory)) { ?> if ($canModerate && $hasHistory) { ?>
&mdash; &mdash;
<?php } <?php }
if ($user->rankIsHigher("moderator")) { ?> if ($canModerate) { ?>
<a href="<?=$config['rel_root_folder']?>blog/<?=$blogArticle->permalink?>/edit"><i class="fas fa-pencil-alt"></i> Éditer l'article</a> &mdash; <a href="<?=$config['rel_root_folder']?>blog/<?=$blogArticle->permalink?>/edit"><i class="fas fa-pencil-alt"></i> Éditer l'article</a> &mdash;
<?php if ($blogArticle->is_public == 't') { ?> <?php if ($blogArticle->is_public == 't') { ?>
<a href="<?=$config['rel_root_folder']?>blog/<?=$blogArticle->permalink?>/delete"><i class="fas fa-trash"></i> Effacer l'article</a> <a href="<?=$config['rel_root_folder']?>blog/<?=$blogArticle->permalink?>/delete"><i class="fas fa-trash"></i> Effacer l'article</a>
@@ -41,21 +60,20 @@
<p id="blogTimestamp">Article écrit par <p id="blogTimestamp">Article écrit par
<?php if ($user->rankIsHigher("blocked")) { ?> <?php if ($user->rankIsHigher("blocked")) { ?>
<a href="<?=$config['rel_root_folder']?>user/p/<?=$blogArticle->author?>"><?=$blogArticle->author_name?></a> <a href="<?=$config['rel_root_folder']?>user/p/<?=$blogArticle->author?>"><?=$blogArticle->author_name?></a>
<?php } <?php } else { ?>
else { ?>
<?=$blogArticle->author_name?> <?=$blogArticle->author_name?>
<?php } ?> <?php } ?>
le <?php echo datefmt_format($user->datetime_format,date_create($blogArticle->creation_date, new DateTimeZone("UTC"))) ?></p> le <?php echo datefmt_format($user->datetime_format,date_create($blogArticle->creation_date, new DateTimeZone("UTC"))) ?></p>
<!-- COMMENTS --> <!-- COMMENTS -->
<?php if ($blogArticle->is_commentable == "t") { ?> <?php if ($isCommentable) { ?>
<div id="new_comment"> <div id="new_comment">
<form class="form" action="<?=$config['rel_root_folder']?>blog/<?=$blogArticle->permalink?>/new_comment" method="post"> <form class="form" action="<?=$config['rel_root_folder']?>blog/<?=$blogArticle->permalink?>/new_comment" method="post">
<div id="new_comment_label" <?=$user->rank=="visitor"?"class='sent' ":""?>> <div id="new_comment_label" <?=$isVisitor ? "class='sent' " : ""?>>
<?php if ($blogArticle->is_archive == "t" || $blogArticle->is_public == "f") { ?> <?php if ($isArchiveOrPrivate) { ?>
<p>Impossible de commenter un article non publié</p> <p>Impossible de commenter un article non publié</p>
<?php } else if ($user->rankIsHigher("registered")) { ?> <?php } else if ($canWriteComment) { ?>
<input name="submit" type="submit" value="Envoyer"> <input name="submit" type="submit" value="Envoyer">
<p>Ajouter un nouveau commentaire</p> <p>Ajouter un nouveau commentaire</p>
<?php } else { ?> <?php } else { ?>
@@ -68,8 +86,8 @@
</form> </form>
</div> </div>
<?php if($blogArticle->is_commentable == 't') { <?php foreach ($blogArticles_comments->objs as $comment) { ?>
foreach ($blogArticles_comments->objs as $comment) { ?> <?php $canManageComment = $canModerate || $user->id == $comment->author; ?>
<article <?php if($comment->is_archive == 't' || $comment->is_public == 'f') echo 'class="comment_archive" '; ?>> <article <?php if($comment->is_archive == 't' || $comment->is_public == 'f') echo 'class="comment_archive" '; ?>>
<div class="comment_title"> <div class="comment_title">
@@ -84,10 +102,10 @@
<?=$comment->author_obj->name?> <?=$comment->author_obj->name?>
<?php } ?> <?php } ?>
le <?php echo datefmt_format($user->datetime_format,date_create($comment->update_date, new DateTimeZone("UTC"))) ?> le <?php echo datefmt_format($user->datetime_format,date_create($comment->update_date, new DateTimeZone("UTC"))) ?>
<?php if (($user->rankIsHigher("moderator") || $user->id == $comment->author) && $comment->is_public == 't') { ?> <?php if ($canManageComment && $comment->is_public == 't') { ?>
<span class="delete_link"><a href="<?=$config['rel_root_folder']?>blog/<?=$blogArticle->permalink?>/delete_comment/<?=$comment->id?>"><i class="fas fa-trash"></i> Effacer le commentaire</a></span> <span class="delete_link"><a href="<?=$config['rel_root_folder']?>blog/<?=$blogArticle->permalink?>/delete_comment/<?=$comment->id?>"><i class="fas fa-trash"></i> Effacer le commentaire</a></span>
<?php } ?> <?php } ?>
<?php if (($user->rankIsHigher("moderator") || $user->id == $comment->author) && $comment->is_public == 'f') { ?> <?php if ($canManageComment && $comment->is_public == 'f') { ?>
<span class="delete_link"><a href="<?=$config['rel_root_folder']?>blog/<?=$blogArticle->permalink?>/restore_comment/<?=$comment->id?>"><i class="fas fa-eye"></i> Restaurer le commentaire</a></span> <span class="delete_link"><a href="<?=$config['rel_root_folder']?>blog/<?=$blogArticle->permalink?>/restore_comment/<?=$comment->id?>"><i class="fas fa-eye"></i> Restaurer le commentaire</a></span>
<?php } ?> <?php } ?>
</div> </div>
@@ -97,7 +115,6 @@
</article> </article>
<?php } <?php }
}
} ?> } ?>
<br> <br>
@@ -105,14 +122,14 @@
<div style="clear: both;"> </div> <div style="clear: both;"> </div>
</section> </section>
<?php if($user->rankIsHigher("premium")) { ?> <?php if ($canViewHistory) { ?>
<script type="text/javascript"> <script type="text/javascript">
$( "#bloghistory" ).change(function() { $( "#bloghistory" ).change(function() {
window.location.href = "<?=$config['rel_root_folder']?>blog/<?=$blogArticle->permalink?>/"+$( this ).val(); window.location.href = "<?=$config['rel_root_folder']?>blog/<?=$blogArticle->permalink?>/"+$( this ).val();
}); });
</script> </script>
<?php } ?> <?php } ?>
<?php if($user->rankIsHigher("registered") && $blogArticle->is_archive == "f" && $blogArticle->is_public == "t") { ?> <?php if ($canOpenCommentForm) { ?>
<script type="text/javascript"> <script type="text/javascript">
$( "#new_comment_label" ).click(function() { $( "#new_comment_label" ).click(function() {
$( "#new_comment_form" ).show(400); $( "#new_comment_form" ).show(400);

View File

@@ -7,10 +7,21 @@
<?php include('blocks/d.nav.html'); ?> <?php include('blocks/d.nav.html'); ?>
<?php
$isArchiveOrPrivate = $poi->is_archive == "t" || $poi->is_public == "f";
$canViewHistory = $user->rankIsHigher('premium');
$canModerate = $user->rankIsHigher('moderator');
$canWriteComment = $user->rankIsHigher("registered");
$canOpenCommentForm = $canWriteComment && !$isArchiveOrPrivate;
$hasHistory = isset($PoiHistory);
$isVisitor = $user->rank == "visitor";
$isCommentable = $poi->is_commentable == 't';
?>
<div id="mapid"></div> <div id="mapid"></div>
<div id="sticky"> <div id="sticky">
<section <?=$poi->is_archive=="t"||$poi->is_public=="f"?'class="archive"':''?>> <section <?=$isArchiveOrPrivate ? 'class="archive"' : ''?>>
<i id="slide-icon" class="fas fa-chevron-up"></i> <i id="slide-icon" class="fas fa-chevron-up"></i>
<h1 class="flex_line"> <h1 class="flex_line">
@@ -50,21 +61,29 @@
</div> </div>
<?php if($user->rankIsHigher('premium')) { ?> <?php if ($canViewHistory) { ?>
<span class="subtitle"> <span class="subtitle">
<?php if(isset($PoiHistory)) { ?> <?php if ($hasHistory) { ?>
<select id="PoiHistory"> <select id="PoiHistory">
<?php $i = 0; <?php $historyIndex = 0; ?>
foreach ($PoiHistory->objs as $row) { ?> <?php foreach ($PoiHistory->objs as $row) { ?>
<option <?=$row->version_id==$poi->version_id?'selected':''?> value="<?=$i?>"><?=$row->is_archive=="f"?'&bull; ':''?><?php echo datefmt_format($user->datetimeshort_format,date_create($row->update_date, new DateTimeZone("UTC"))) ?></option> <?php
<?php $i++; $isSelected = $row->version_id == $poi->version_id ? 'selected' : '';
} ?> $isActive = $row->is_archive == "f" ? '&bull; ' : '';
$formattedDate = datefmt_format(
$user->datetimeshort_format,
date_create($row->update_date, new DateTimeZone("UTC"))
);
?>
<option <?=$isSelected?> value="<?=$historyIndex?>"><?=$isActive?><?=$formattedDate?></option>
<?php $historyIndex++; ?>
<?php } ?>
</select> </select>
<?php } <?php }
if ($user->rankIsHigher('moderator') && isset($PoiHistory)) { ?> if ($canModerate && $hasHistory) { ?>
&mdash; &mdash;
<?php } <?php }
if ($user->rankIsHigher("moderator")) { ?> if ($canModerate) { ?>
<a href="<?=$config['rel_root_folder']?>poi/<?=$poi->permalink?>/edit"><i class="fas fa-pencil-alt"></i> Éditer le point</a> &mdash; <a href="<?=$config['rel_root_folder']?>poi/<?=$poi->permalink?>/edit"><i class="fas fa-pencil-alt"></i> Éditer le point</a> &mdash;
<?php if ($poi->is_public == 't') { ?> <?php if ($poi->is_public == 't') { ?>
<a href="<?=$config['rel_root_folder']?>poi/<?=$poi->permalink?>/delete"><i class="fas fa-trash"></i> Effacer le point</a> <a href="<?=$config['rel_root_folder']?>poi/<?=$poi->permalink?>/delete"><i class="fas fa-trash"></i> Effacer le point</a>
@@ -79,18 +98,18 @@
<br> <br>
<?php <?php
$fields = $poi_types[$poi->poi_type][5]; $poiFields = $poi_types[$poi->poi_type][5];
$values = $poi->parameters ?? []; $poiValues = $poi->parameters ?? [];
// Séparer les booléens des autres champs // Séparer les booléens des autres champs
$bool_fields = []; $boolFields = [];
$other_fields = []; $otherFields = [];
foreach ($fields as $key => $label) { foreach ($poiFields as $key => $label) {
if ($key[0] === 'b') { if ($key[0] === 'b') {
$bool_fields[$key] = $label; $boolFields[$key] = $label;
} else { } else {
$other_fields[$key] = $label; $otherFields[$key] = $label;
} }
} }
?> ?>
@@ -98,9 +117,9 @@
<div id="specific_form" class="view-mode"> <div id="specific_form" class="view-mode">
<!-- AUTRES CHAMPS (texte, nombre, lien) --> <!-- AUTRES CHAMPS (texte, nombre, lien) -->
<?php foreach ($other_fields as $key => $label): ?> <?php foreach ($otherFields as $key => $label): ?>
<?php <?php
$value = $values[$key] ?? null; $value = $poiValues[$key] ?? null;
$type = $key[0]; $type = $key[0];
?> ?>
@@ -131,27 +150,30 @@
<?php endforeach; ?> <?php endforeach; ?>
<!-- TABLEAU DES BOOLÉENS --> <!-- TABLEAU DES BOOLÉENS -->
<?php if (!empty($bool_fields)): ?> <?php if (!empty($boolFields)): ?>
<?php
$boolIcons = [
0 => "<span class='boolean-pill boolean-no'>❌</span>",
1 => "<span class='boolean-pill boolean-maybe'>❓</span>",
2 => "<span class='boolean-pill boolean-yes'>✔️</span>",
-1 => "<span class='boolean-pill boolean-unknown'></span>"
];
?>
<div class="bool-grid"> <div class="bool-grid">
<!-- Ligne des labels --> <!-- Ligne des labels -->
<div class="bool-row labels"> <div class="bool-row labels">
<?php foreach ($bool_fields as $key => $label): ?> <?php foreach ($boolFields as $key => $label): ?>
<div class="bool-label"><?= $label ?></div> <div class="bool-label"><?= $label ?></div>
<?php endforeach; ?> <?php endforeach; ?>
</div> </div>
<!-- Ligne des valeurs --> <!-- Ligne des valeurs -->
<div class="bool-row values"> <div class="bool-row values">
<?php foreach ($bool_fields as $key => $label): ?> <?php foreach ($boolFields as $key => $label): ?>
<?php <?php
$value = $values[$key] ?? 2; $value = $poiValues[$key] ?? 2;
$icon = [ $icon = $boolIcons[$value];
0 => "<span class='boolean-pill boolean-no'>❌</span>",
1 => "<span class='boolean-pill boolean-maybe'>❓</span>",
2 => "<span class='boolean-pill boolean-yes'>✔️</span>",
-1 => "<span class='boolean-pill boolean-unknown'></span>"
][$value];
?> ?>
<div class="bool-cell"> <div class="bool-cell">
<?= $icon ?> <?= $icon ?>
@@ -165,13 +187,13 @@
</div> </div>
<?php if ($poi->is_commentable == 't') { ?> <?php if ($isCommentable) { ?>
<div id="new_comment"> <div id="new_comment">
<form class="form" action="<?=$config['rel_root_folder']?>poi/<?=$poi->permalink?>/new_comment" method="post"> <form class="form" action="<?=$config['rel_root_folder']?>poi/<?=$poi->permalink?>/new_comment" method="post">
<div id="new_comment_label" <?=$user->rank=="visitor"?"class='sent' ":""?>> <div id="new_comment_label" <?=$isVisitor ? "class='sent' " : ""?>>
<?php if ($poi->is_archive == "t" || $poi->is_public == "f") { ?> <?php if ($isArchiveOrPrivate) { ?>
<p>Impossible de commenter un point non publié</p> <p>Impossible de commenter un point non publié</p>
<?php } else if ($user->rankIsHigher("registered")) { ?> <?php } else if ($canWriteComment) { ?>
<input name="submit" type="submit" value="Envoyer"> <input name="submit" type="submit" value="Envoyer">
<p>Ajouter un nouveau commentaire</p> <p>Ajouter un nouveau commentaire</p>
<?php } else { ?> <?php } else { ?>
@@ -187,6 +209,7 @@
<?php if (isset($poi_comments) && $poi_comments->number > 0) { ?> <?php if (isset($poi_comments) && $poi_comments->number > 0) { ?>
<div id="comments"> <div id="comments">
<?php foreach ($poi_comments->objs as $comment) { ?> <?php foreach ($poi_comments->objs as $comment) { ?>
<?php $canManageComment = $canModerate || $user->id == $comment->author; ?>
<article <?php if($comment->is_archive == 't' || $comment->is_public == 'f') echo 'class="comment_archive" '; ?>> <article <?php if($comment->is_archive == 't' || $comment->is_public == 'f') echo 'class="comment_archive" '; ?>>
<div class="comment_title"> <div class="comment_title">
@@ -206,7 +229,7 @@
le <?php echo datefmt_format($user->datetime_format, date_create($comment->update_date, new DateTimeZone("UTC"))) ?> le <?php echo datefmt_format($user->datetime_format, date_create($comment->update_date, new DateTimeZone("UTC"))) ?>
<?php if (($user->rankIsHigher("moderator") || $user->id == $comment->author) && $comment->is_public == 't') { ?> <?php if ($canManageComment && $comment->is_public == 't') { ?>
<span class="delete_link"> <span class="delete_link">
<a href="<?=$config['rel_root_folder']?>poi/<?=$poi->permalink?>/delete_comment/<?=$comment->id?>"> <a href="<?=$config['rel_root_folder']?>poi/<?=$poi->permalink?>/delete_comment/<?=$comment->id?>">
<i class="fas fa-trash"></i> Effacer le commentaire <i class="fas fa-trash"></i> Effacer le commentaire
@@ -214,7 +237,7 @@
</span> </span>
<?php } ?> <?php } ?>
<?php if (($user->rankIsHigher("moderator") || $user->id == $comment->author) && $comment->is_public == 'f') { ?> <?php if ($canManageComment && $comment->is_public == 'f') { ?>
<span class="delete_link"> <span class="delete_link">
<a href="<?=$config['rel_root_folder']?>poi/<?=$poi->permalink?>/restore_comment/<?=$comment->id?>"> <a href="<?=$config['rel_root_folder']?>poi/<?=$poi->permalink?>/restore_comment/<?=$comment->id?>">
<i class="fas fa-eye"></i> Restaurer le commentaire <i class="fas fa-eye"></i> Restaurer le commentaire
@@ -249,7 +272,7 @@
var root = "<?=$config['rel_root_folder']?>"; var root = "<?=$config['rel_root_folder']?>";
</script> </script>
<?php if($user->rankIsHigher("premium")) { ?> <?php if ($canViewHistory) { ?>
<script type="text/javascript"> <script type="text/javascript">
$( "#PoiHistory" ).change(function() { $( "#PoiHistory" ).change(function() {
window.location.href = "<?=$config['rel_root_folder']?>poi/<?=$poi->permalink?>/"+$( this ).val(); window.location.href = "<?=$config['rel_root_folder']?>poi/<?=$poi->permalink?>/"+$( this ).val();
@@ -257,7 +280,7 @@ $( "#PoiHistory" ).change(function() {
</script> </script>
<?php } ?> <?php } ?>
<?php if($user->rankIsHigher("registered") && $poi->is_archive == "f" && $poi->is_public == "t") { ?> <?php if ($canOpenCommentForm) { ?>
<script type="text/javascript"> <script type="text/javascript">
$( "#new_comment_label" ).click(function() { $( "#new_comment_label" ).click(function() {
$( "#new_comment_form" ).show(400); $( "#new_comment_form" ).show(400);

View File

@@ -7,23 +7,38 @@
<?php include('blocks/d.nav.html'); ?> <?php include('blocks/d.nav.html'); ?>
<section id="wiki_page" <?=$wikiPage->is_archive=="t"||$wikiPage->is_public=="f"?'class="archive"':''?>> <?php
$isArchiveOrPrivate = $wikiPage->is_archive == "t" || $wikiPage->is_public == "f";
$canViewHistory = $user->rankIsHigher('premium');
$canModerate = $user->rankIsHigher('moderator');
$hasHistory = isset($wikiHistory);
?>
<section id="wiki_page" <?=$isArchiveOrPrivate ? 'class="archive"' : ''?>>
<h1><?=$wikiPage->name?></h1> <h1><?=$wikiPage->name?></h1>
<?php if($user->rankIsHigher('premium')) { ?> <?php if ($canViewHistory) { ?>
<span class="subtitle"> <span class="subtitle">
<?php if(isset($wikiHistory)) { ?> <?php if ($hasHistory) { ?>
<select id="wikihistory"> <select id="wikihistory">
<?php $i = 0; <?php $historyIndex = 0; ?>
foreach ($wikiHistory->objs as $row) { ?> <?php foreach ($wikiHistory->objs as $row) { ?>
<option <?=$row->version_id==$wikiPage->version_id?'selected':''?> value="<?=$i?>"><?=$row->is_archive=="f"?'&bull; ':''?><?php echo datefmt_format($user->datetimeshort_format,date_create($row->update_date, new DateTimeZone("UTC"))) ?></option> <?php
<?php $i++; $isSelected = $row->version_id == $wikiPage->version_id ? 'selected' : '';
} ?> $isActive = $row->is_archive == "f" ? '&bull; ' : '';
$formattedDate = datefmt_format(
$user->datetimeshort_format,
date_create($row->update_date, new DateTimeZone("UTC"))
);
?>
<option <?=$isSelected?> value="<?=$historyIndex?>"><?=$isActive?><?=$formattedDate?></option>
<?php $historyIndex++; ?>
<?php } ?>
</select> </select>
<?php } <?php }
if ($user->rankIsHigher('moderator') && isset($wikiHistory)) { ?> if ($canModerate && $hasHistory) { ?>
&mdash; &mdash;
<?php } <?php }
if ($user->rankIsHigher('moderator')) { ?> if ($canModerate) { ?>
<a href="<?=$config['rel_root_folder']?>wiki/<?=$wikiPage->permalink?>/edit"><i class="fas fa-pencil-alt"></i> Éditer la page</a> &mdash; <a href="<?=$config['rel_root_folder']?>wiki/<?=$wikiPage->permalink?>/edit"><i class="fas fa-pencil-alt"></i> Éditer la page</a> &mdash;
<?php if ($wikiPage->is_public=="t") { ?> <?php if ($wikiPage->is_public=="t") { ?>
<a href="<?=$config['rel_root_folder']?>wiki/<?=$wikiPage->permalink?>/delete"><i class="fas fa-trash"></i> Effacer la page</a> <a href="<?=$config['rel_root_folder']?>wiki/<?=$wikiPage->permalink?>/delete"><i class="fas fa-trash"></i> Effacer la page</a>
@@ -43,7 +58,7 @@
<div style="clear: both;"> </div> <div style="clear: both;"> </div>
</section> </section>
<?php if($user->rankIsHigher('premium')) { ?> <?php if ($canViewHistory) { ?>
<script type="text/javascript"> <script type="text/javascript">
$( "#wikihistory" ).change(function() { $( "#wikihistory" ).change(function() {
window.location.href = "<?=$config['rel_root_folder']?>wiki/<?=$wikiPage->permalink?>/"+$( this ).val(); window.location.href = "<?=$config['rel_root_folder']?>wiki/<?=$wikiPage->permalink?>/"+$( this ).val();