Use rendered AI feedback in PDF comments

This commit is contained in:
Wojtek
2026-10-17 13:12:11 +02:00
parent 4ceb5fd01c
commit bcd9335a47
4 changed files with 6 additions and 4 deletions
+1 -1
View File
@@ -30,6 +30,6 @@ Szkielet komponentu Joomla 6 do gromadzenia pytań testowych.
## Instalacja ## Instalacja
W Joomla wybierz **System → Install → Install from Folder** i wskaż ten katalog. Manifestem instalacyjnym jest `com_testquestions.xml` (wersja 1.43.37). W Joomla wybierz **System → Install → Install from Folder** i wskaż ten katalog. Manifestem instalacyjnym jest `com_testquestions.xml` (wersja 1.43.38).
Po instalacji komponent jest dostępny w panelu administratora jako **Pytania testowe**. Po instalacji komponent jest dostępny w panelu administratora jako **Pytania testowe**.
@@ -0,0 +1 @@
-- Brak zmian w schemacie bazy danych w wersji 1.43.38.
@@ -47,7 +47,8 @@ $resolveImageUrl = static function ($path) {
document.querySelectorAll('.result-pdf-comment').forEach(function (commentBlock) { document.querySelectorAll('.result-pdf-comment').forEach(function (commentBlock) {
const questionId = commentBlock.dataset.questionId; const questionId = commentBlock.dataset.questionId;
const manualComment = document.getElementById('result-comment-' + questionId)?.value.trim() || ''; const manualComment = document.getElementById('result-comment-' + questionId)?.value.trim() || '';
const aiComment = commentBlock.dataset.aiComment || ''; const visibleAiFeedback = document.querySelector('.ai-feedback-screen[data-question-id="' + questionId + '"] .ai-feedback-text')?.textContent.trim() || '';
const aiComment = visibleAiFeedback || commentBlock.dataset.aiComment || '';
const output = commentBlock.querySelector('.result-pdf-comment-text'); const output = commentBlock.querySelector('.result-pdf-comment-text');
if (output) { if (output) {
@@ -172,7 +173,7 @@ $resolveImageUrl = static function ($path) {
$maxPoints = (int) ($question->points ?? 0); $maxPoints = (int) ($question->points ?? 0);
$aiAlertClass = $aiPoints <= 0 ? 'alert-danger' : ($aiPoints >= $maxPoints ? 'alert-success' : 'alert-info'); $aiAlertClass = $aiPoints <= 0 ? 'alert-danger' : ($aiPoints >= $maxPoints ? 'alert-success' : 'alert-info');
?> ?>
<div class="alert <?php echo $aiAlertClass; ?> mt-3 ai-feedback-screen"><strong><?php echo \Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS_AI_RESULT'); ?>:</strong><br><?php echo nl2br(htmlspecialchars((string) $answer['ai_feedback'], ENT_QUOTES, 'UTF-8')); ?></div> <div class="alert <?php echo $aiAlertClass; ?> mt-3 ai-feedback-screen" data-question-id="<?php echo (int) $questionId; ?>"><strong><?php echo \Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS_AI_RESULT'); ?>:</strong><br><span class="ai-feedback-text"><?php echo nl2br(htmlspecialchars((string) $answer['ai_feedback'], ENT_QUOTES, 'UTF-8')); ?></span></div>
<?php endif; ?> <?php endif; ?>
<?php endif; ?> <?php endif; ?>
<?php if ($question->question_type === 'open' && $hasResponse) : ?> <?php if ($question->question_type === 'open' && $hasResponse) : ?>
+1 -1
View File
@@ -4,7 +4,7 @@
<creationDate>2026-10-14</creationDate> <creationDate>2026-10-14</creationDate>
<author>Komponent</author> <author>Komponent</author>
<license>GNU General Public License version 2 or later</license> <license>GNU General Public License version 2 or later</license>
<version>1.43.37</version> <version>1.43.38</version>
<description>COM_TESTQUESTIONS_DESCRIPTION</description> <description>COM_TESTQUESTIONS_DESCRIPTION</description>
<element>com_testquestions</element> <element>com_testquestions</element>
<namespace path="src">Komponent\Component\Testquestions</namespace> <namespace path="src">Komponent\Component\Testquestions</namespace>