issue #2364 fix guest author name and language key

Added support for bulk comment validation and deletion with updated confirmation messages and translations. Improved modal dialog behavior, including keyboard accessibility and button visibility. Updated CSS for consistent button styling across themes. Fixed author name display for guest comments.
This commit is contained in:
Linty
2025-08-26 16:38:11 +02:00
parent 57042cc475
commit 613dd410e5
8 changed files with 67 additions and 11 deletions
+7 -1
View File
@@ -247,11 +247,17 @@ UL.thumbnails li.rank-of-image {background-color: #ddd;}
font-weight: bold;
}
#batchManagerGlobal #applyFilter,#batchManagerGlobal .addFilter-button {
#batchManagerGlobal #applyFilter,#batchManagerGlobal .addFilter-button,
.buttonSecondary {
color: #3C3C3C;
background-color: #ececec;
}
.buttonSecondary:hover {
color: #3C3C3C;
background-color: #aaa;
}
#batchManagerGlobal #applyFilter:hover, #batchManagerGlobal .addFilter-button:hover {
color: #111;
background-color: #ff9b32 ;
+32 -4
View File
@@ -110,6 +110,12 @@ $(function() {
commentsClearFilters();
});
$(window).on('keydown', function(e) {
if (e.key === 'Escape') {
closeModalViewComment();
}
});
// get comments and set display
commentsParams.per_page = window.localStorage.getItem('adminCommentsNB') ?? 5
updateNbComments(commentsParams.per_page);
@@ -320,8 +326,8 @@ function commentsDisplayFilters(filters) {
// reset here to let decide filterAuthor onChange
updateAuthorId = true;
const minDate = filters.started_at.split(' ')[0] ?? '';
const maxDate = filters.ended_at.split(' ')[0] ?? ''
const minDate = filters.started_at?.split(' ')[0] ?? '';
const maxDate = filters.ended_at?.split(' ')[0] ?? ''
filterDateStart.val(minDate).attr({ 'min': minDate, 'max': maxDate });
filterDateEnd.val(maxDate).attr({ 'max': maxDate, 'min': minDate });
@@ -404,14 +410,34 @@ function showModalViewComment(id) {
`);
modalViewComment.find('.comments-modal-body').html(comment.content)
const validBtn = modalViewComment.find('.comments-modal-validate');
if (comment.is_pending) {
validBtn.show();
$('#commentsModalValidate').off('click').on('click', function() {
validateComment([id]);
closeModalViewComment();
});
} else {
validBtn.hide();
}
$('#commentsModalDelete').off('click').on('click', function() {
deleteComment([id]);
closeModalViewComment();
});
modalViewComment.fadeIn();
}
function closeModalViewComment() {
modalViewComment.fadeOut();
$('#commentsModalValidate').off('click');
$('#commentsModalDelete').off('click')
}
function validateComment(id) {
const idLenght = id.length ?? 1;
$.ajax({
url: 'ws.php?format=json&method=pwg.userComments.validate',
type: 'POST',
@@ -424,7 +450,7 @@ function validateComment(id) {
if (res.stat === 'ok') {
$.alert({
...{
title: str_comment_validated,
title: idLenght > 1 ? str_comments_validated : str_comment_validated,
content: "",
},
...jConfirm_alert_options
@@ -454,8 +480,10 @@ function validateComment(id) {
}
function deleteComment(id) {
const idLenght = id.length ?? 1;
$.confirm({
title: str_delete.replace("%s", id),
title: idLenght > 1 ? str_deletes.replace("%d", idLenght) : str_delete.replace("%s", id),
draggable: false,
titleClass: "jconfirmDeleteConfirm",
theme: "modern",
+5 -2
View File
@@ -5,11 +5,13 @@
{footer_script}
const str_yes_delete_confirmation = "{'Yes, delete'|@translate|@escape:'javascript'}"
const str_no_delete_confirmation = "{"No, I have changed my mind"|@translate|@escape:'javascript'}"
const str_delete = "{'Are you sure you want to delete comment "%s"?'|@translate|@escape:'javascript'}"
const str_delete = "{'Are you sure you want to delete comment #%s?'|@translate|@escape:'javascript'}"
const str_deletes = "{'Are you sure you want to delete "%d" comments?'|@translate|@escape:'javascript'}"
const str_no_comments_selected = "{'No comments selected, no actions possible.'|@translate|@escape:'javascript'}"
const pwg_token = "{$PWG_TOKEN}"
const str_an_error_has = "{"An error has occured"|@translate|@escape:'javascript'}"
const str_comment_validated = "{"The comment has been validated."|@translate|@escape:'javascript'}"
const str_comments_validated = "{"The comments have been validated."|@translate|@escape:'javascript'}"
const str_and_others = "{"and %s others"|@translate}"
{/footer_script}
<style>
@@ -171,7 +173,8 @@ const str_and_others = "{"and %s others"|@translate}"
</div>
<div class="comments-modal-footer">
<button class="comments-modal-delete buttonLike buttonSecondary" type="button" id="commentsModalDelete"><i class="icon-trash-1"></i> {"Delete"|translate}</button>
<button class="comments-modal-validate buttonLike" type="button" id="commentsModalValidate"><i class="icon-ok"></i> {"Validate"|translate}</button>
</div>
</div>
+6 -1
View File
@@ -4855,7 +4855,8 @@ a#showPermissions:hover {text-decoration: none;}
.comments-selection,
.comment-validate,
.comments-selections,
.comment-template {
.comment-template,
.comments-modal-validate {
display: none;
}
@@ -5242,6 +5243,10 @@ a#showPermissions:hover {text-decoration: none;}
margin: 15px 0;
}
.comments-modal-footer {
justify-self: end;
}
.bottomButtons.syncBtn {
text-align:left;
margin-left: 25px;
+10
View File
@@ -2323,6 +2323,16 @@ ul.jqtree-tree li.jqtree-ghost span.jqtree-line {
background-color: #1B1B1B;
}
.buttonSecondary {
color: #3C3C3C;
background-color: #232323;
}
.buttonSecondary:hover {
color: #3C3C3C;
background-color: #111;
}
/* Cat modify description modal */
.modal-content,
.desc-modal-content,
+1 -1
View File
@@ -136,7 +136,7 @@ SELECT
)
)->get_url();
if (empty($row['author_id']))
if (empty($row['author_id']) or $row['author_id'] == $conf['guest_id'])
{
$author_name = $row['author'];
}
+3 -1
View File
@@ -1411,8 +1411,10 @@ $lang['Save all photos'] = 'Save all photos';
$lang['Use standard Piwigo template for common pages.'] = 'Use standard Piwigo template for common pages.';
$lang['When enabled, a common template is used for the login, registration and forgotten password pages, regardless of the theme. Some themes might use these templates even if you uncheck this option'] = 'When enabled, a common template is used for the login, registration and forgotten password pages, regardless of the theme. Some themes might use these templates even if you uncheck this option';
$lang['We have found %d duplicate paths. Details provided by plugin Check Uploads'] = 'We have found %d duplicate paths. Details provided by plugin Check Uploads';
$lang['Are you sure you want to delete comment "%s"?'] = 'Are you sure you want to delete comment "%s"?';
$lang['Are you sure you want to delete comment #%s?'] = 'Are you sure you want to delete comment #%s?';
$lang['No comments selected, no actions possible.'] = 'No comments selected, no actions possible.';
$lang['The comment has been validated.'] = 'The comment has been validated.';
$lang['The comments have been validated.'] = 'The comments have been validated.';
$lang['Are you sure you want to delete "%d" comments?'] = 'Are you sure you want to delete "%d" comments?';
// Leave this line empty
+3 -1
View File
@@ -1413,7 +1413,9 @@ $lang['Save all photos'] = 'Enregistrer toutes les photos';
$lang['Use standard Piwigo template for common pages.'] = 'Utiliser le modèle standard de Piwigo pour les pages courantes.';
$lang['When enabled, a common template is used for the login, registration and forgotten password pages, regardless of the theme. Some themes might use these templates even if you uncheck this option'] = 'Lorsque cette option est activée, un modèle commun est utilisé pour les pages de connexion, d\'inscription et de mot de passe oublié, quel que soit le thème. Certains thèmes peuvent utiliser ces modèles même si cette option est décochée.';
$lang['We have found %d duplicate paths. Details provided by plugin Check Uploads'] = 'Nous avons trouvé %d chemins anormalement dupliqués. À contrôler avec le plugin Check Uploads.';
$lang['Are you sure you want to delete comment "%s"?'] = 'Êtes-vous sûr de vouloir supprimer le commentaire "%s" ?';
$lang['Are you sure you want to delete comment #%s?'] = 'Êtes-vous sûr de vouloir supprimer le commentaire #%s ?';
$lang['No comments selected, no actions possible.'] = 'Aucun commentaire sélectionné, aucune action possible.';
$lang['The comment has been validated.'] = 'Le commentaire a été validé.';
$lang['The comments have been validated.'] = 'Les commentaires ont été validés.';
$lang['Are you sure you want to delete "%d" comments?'] = 'Êtes-vous sûr de vouloir supprimer "%d" commentaires ?';
// Leave this line empty