From 771ce470f91ff8cbe23a48ae493e0ae193908200 Mon Sep 17 00:00:00 2001 From: Astrid van Eerd Date: Wed, 25 Dec 2024 13:43:28 +0100 Subject: [PATCH 1/3] Fix for set all private button --- src/media/kunena/core/js/upload.main.js | 68 +++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/src/media/kunena/core/js/upload.main.js b/src/media/kunena/core/js/upload.main.js index fb3882b35c..cc8cdc158d 100644 --- a/src/media/kunena/core/js/upload.main.js +++ b/src/media/kunena/core/js/upload.main.js @@ -117,6 +117,74 @@ jQuery(function ($) { // Remove any alert messages $('#alert_max_file').remove(); +}); + $('#set-secure-all').on('click', function (e) { + e.preventDefault(); + + const child = $('#kattach-list').find('input'); + const filesidtosetprivate = []; + const $this = $(this); + + child.each(function (i, el) { + const elem = $(el); + + if (!elem.attr('id').match("[a-z]{8}")) { + const fileid = elem.attr('id').match("[0-9]{1,8}"); + filesidtosetprivate.push(fileid); + } + }); + + if (filesidtosetprivate.length !== 0) { + $.ajax({ + url: Joomla.getOptions('com_kunena.kunena_upload_files_set_private') + '&files_id=' + JSON.stringify(filesidtosetprivate), + type: 'POST' + }) + .done(function (data) { + // Update all individual private buttons + $('#files button').each(function() { + const $btn = $(this); + if ($btn.html().includes(Joomla.Text._('COM_KUNENA_EDITOR_INSERT_PRIVATE_ATTACHMENT'))) { + $btn.removeClass('btn-primary') + .addClass('btn-success') + .prop('disabled', true) + .html(Joomla.getOptions('com_kunena.icons.secure') + ' ' + + Joomla.Text._('COM_KUNENA_EDITOR_ATTACHMENT_IS_SECURED')); + + // Hide the corresponding insert button in the same container + $btn.siblings('button').each(function() { + const $siblingBtn = $(this); + if ($siblingBtn.html().includes(Joomla.Text._('COM_KUNENA_EDITOR_INSERT')) || + $siblingBtn.html().includes(Joomla.Text._('COM_KUNENA_EDITOR_IN_MESSAGE'))) { + $siblingBtn.hide(); + } + }); + } + }); + + // Update the set-secure-all button + $this.removeClass('btn-primary') + .addClass('btn-success') + .prop('disabled', true) + .html(Joomla.getOptions('com_kunena.icons.secure') + ' ' + + Joomla.Text._('COM_KUNENA_EDITOR_ATTACHMENTS_ARE_SECURED')); + + // Hide both insert and insert-all buttons + $('button').each(function() { + const $btn = $(this); + if ($btn.html().includes(Joomla.Text._('COM_KUNENA_EDITOR_INSERT')) || + $btn.html().includes(Joomla.Text._('COM_KUNENA_EDITOR_IN_MESSAGE')) || + $btn.attr('id') === 'insert-all') { + $btn.hide(); + } + }); + + // Explicitly hide the insert-all button + $('#insert-all').hide(); + }) + .fail(function () { + //TODO: handle the error of ajax request + }); + } }); $('#insert-all').on('click', function (e) { e.preventDefault(); From 7775191a288e79af78427fedb7db7fe8c7e8aa8d Mon Sep 17 00:00:00 2001 From: Astrid van Eerd Date: Fri, 3 Jan 2025 10:56:15 +0100 Subject: [PATCH 2/3] =?UTF-8?q?Show=20topic=20icons=20for=20moderators=20e?= =?UTF-8?q?ven=20when=20=E2=80=98Selectable=20Topic=20Icons=E2=80=99=20is?= =?UTF-8?q?=20disabled,?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../layouts/topic/moderate/default.php | 137 +++++++++--------- 1 file changed, 65 insertions(+), 72 deletions(-) diff --git a/src/site/template/aurelia/layouts/topic/moderate/default.php b/src/site/template/aurelia/layouts/topic/moderate/default.php index 42ad833d7f..88ecd5da75 100644 --- a/src/site/template/aurelia/layouts/topic/moderate/default.php +++ b/src/site/template/aurelia/layouts/topic/moderate/default.php @@ -6,7 +6,7 @@ * @package Kunena.Template.Aurelia * @subpackage Layout.Topic * - * @copyright Copyright (C) 2008 - @currentyear@ Kunena Team. All rights reserved. + * @copyright Copyright (C) 2008 - 2024 Kunena Team. All rights reserved. * @license https://www.gnu.org/copyleft/gpl.html GNU/GPL * @link https://www.kunena.org **/ @@ -21,6 +21,7 @@ use Kunena\Forum\Libraries\Icons\KunenaIcons; use Kunena\Forum\Libraries\Icons\KunenaSvgIcons; use Kunena\Forum\Libraries\Route\KunenaRoute; +use Kunena\Forum\Libraries\User\KunenaUserHelper; HTMLHelper::_('bootstrap.framework'); @@ -90,82 +91,74 @@
userLink; ?>
- config->topicIcons) : - ?> -
:
-
-
- topicIcons as $icon) : ?> - checked) ? ' checked="checked" ' : ''; ?> - /> - - category->iconset) { - $this->category->iconset = 'default'; - } - - // Determine icon type and render accordingly - $topicicontype = $this->config->topicIcons ? $topicicontype : null; - ?> - - - -
+ isModerator($this->category);?> + config->topicIcons || $canModerate || $this->me->authorise('core.admin')): ?> +
:
+
+
+ topicIcons as $icon): ?> + checked) ? ' checked="checked" ' : ''; ?> + /> + + category->iconset) { + $this->category->iconset = 'default'; + } + + $topicicontype = $this->ktemplate->params->get('topicicontype'); + ?> + + + +
+ -config->topicIcons): ?> +config->topicIcons && !$canModerate && !$this->me->authorise('core.admin')): ?>
:

-
- topicIcons as $icon) : - ?> - checked) ? ' checked="checked" ' : '' ?> /> - -
-
- -
- +
+ topicIcons as $icon): ?> + checked) ? ' checked="checked" ' : '' ?> + /> + + +
+
+ message)) : ?>
From b82f99ac8b37b4e7711bb8539f6f712959e2e7dd Mon Sep 17 00:00:00 2001 From: Astrid van Eerd Date: Fri, 10 Jan 2025 10:20:08 +0100 Subject: [PATCH 3/3] =?UTF-8?q?Fix=20No=20symbols=20for=20=E2=80=98Moderat?= =?UTF-8?q?e=20Topic=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/site/template/aurelia/layouts/topic/moderate/default.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/site/template/aurelia/layouts/topic/moderate/default.php b/src/site/template/aurelia/layouts/topic/moderate/default.php index 88ecd5da75..d272104e30 100644 --- a/src/site/template/aurelia/layouts/topic/moderate/default.php +++ b/src/site/template/aurelia/layouts/topic/moderate/default.php @@ -6,7 +6,7 @@ * @package Kunena.Template.Aurelia * @subpackage Layout.Topic * - * @copyright Copyright (C) 2008 - 2024 Kunena Team. All rights reserved. + * @copyright Copyright (C) 2008 - @currentyear@ Kunena Team. All rights reserved. * @license https://www.gnu.org/copyleft/gpl.html GNU/GPL * @link https://www.kunena.org **/