From ef5410689d0a2932f03e64738e654e9b644f0846 Mon Sep 17 00:00:00 2001 From: Wojtek Date: Fri, 16 Oct 2026 20:38:15 +0200 Subject: [PATCH] Resolve exam images relative to Joomla root --- README.md | 2 +- .../sql/updates/mysql/1.43.14.sql | 1 + com_testquestions.xml | 2 +- .../com_testquestions/tmpl/questions/default.php | 13 ++++++++++++- components/com_testquestions/tmpl/set/default.php | 15 +++++++++++++-- 5 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 administrator/components/com_testquestions/sql/updates/mysql/1.43.14.sql diff --git a/README.md b/README.md index 5a30495..c366ee5 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,6 @@ Szkielet komponentu Joomla 6 do gromadzenia pytań testowych. ## Instalacja -W Joomla wybierz **System → Install → Install from Folder** i wskaż ten katalog. Manifestem instalacyjnym jest `com_testquestions.xml` (wersja 1.43.13). +W Joomla wybierz **System → Install → Install from Folder** i wskaż ten katalog. Manifestem instalacyjnym jest `com_testquestions.xml` (wersja 1.43.14). Po instalacji komponent jest dostępny w panelu administratora jako **Pytania testowe**. diff --git a/administrator/components/com_testquestions/sql/updates/mysql/1.43.14.sql b/administrator/components/com_testquestions/sql/updates/mysql/1.43.14.sql new file mode 100644 index 0000000..7569eb8 --- /dev/null +++ b/administrator/components/com_testquestions/sql/updates/mysql/1.43.14.sql @@ -0,0 +1 @@ +-- No database changes required for version 1.43.14. diff --git a/com_testquestions.xml b/com_testquestions.xml index e8d80f5..60da07a 100644 --- a/com_testquestions.xml +++ b/com_testquestions.xml @@ -4,7 +4,7 @@ 2026-10-14 Komponent GNU General Public License version 2 or later - 1.43.13 + 1.43.14 COM_TESTQUESTIONS_DESCRIPTION com_testquestions Komponent\Component\Testquestions diff --git a/components/com_testquestions/tmpl/questions/default.php b/components/com_testquestions/tmpl/questions/default.php index fd3b2c9..4511498 100644 --- a/components/com_testquestions/tmpl/questions/default.php +++ b/components/com_testquestions/tmpl/questions/default.php @@ -3,6 +3,17 @@ defined('_JEXEC') or die; use Joomla\CMS\HTML\HTMLHelper; +use Joomla\CMS\Uri\Uri; + +$resolveImageUrl = static function ($path) { + $path = trim((string) $path); + + if ($path === '' || preg_match('#^https?://#i', $path)) { + return $path; + } + + return Uri::root() . ltrim($path, '/'); +}; ?>

@@ -43,7 +54,7 @@ use Joomla\CMS\HTML\HTMLHelper;
image) : ?> -
+
question_type === 'open') : ?>
diff --git a/components/com_testquestions/tmpl/set/default.php b/components/com_testquestions/tmpl/set/default.php index 25b77b9..c3d39c7 100644 --- a/components/com_testquestions/tmpl/set/default.php +++ b/components/com_testquestions/tmpl/set/default.php @@ -3,6 +3,17 @@ defined('_JEXEC') or die; use Joomla\CMS\Factory; +use Joomla\CMS\Uri\Uri; + +$resolveImageUrl = static function ($path) { + $path = trim((string) $path); + + if ($path === '' || preg_match('#^https?://#i', $path)) { + return $path; + } + + return Uri::root() . ltrim($path, '/'); +}; ?>
started) : ?> @@ -44,7 +55,7 @@ use Joomla\CMS\Factory;

set->title, ENT_QUOTES, 'UTF-8'); ?>

getInput()->post->getInt('extra_time', 0); ?> set->duration > 0) : ?>
: set->duration + $extraTime; ?> min
- set->image) : ?>
+ set->image) : ?>
set->test_content) : ?>
set->test_content; ?>
results && ((int) $this->set->duration + $extraTime) > 0) : ?> @@ -64,7 +75,7 @@ use Joomla\CMS\Factory; items as $number => $item) : ?>
question; ?>
- image) : ?>
+ image) : ?>
question_type === 'open') : ?>
results) : ?>