diff --git a/manifest.php b/manifest.php index 38e26a429a..578644eb4a 100755 --- a/manifest.php +++ b/manifest.php @@ -29,7 +29,7 @@ 'label' => 'QTI test model', 'description' => 'TAO QTI test implementation', 'license' => 'GPL-2.0', - 'version' => '17.21.4', + 'version' => '17.21.5', 'author' => 'Open Assessment Technologies', 'requires' => array( 'taoTests' => '>=6.7.0', diff --git a/models/classes/export/class.QtiTestExporter.php b/models/classes/export/class.QtiTestExporter.php index d5d29ae7e3..57e3ef4969 100644 --- a/models/classes/export/class.QtiTestExporter.php +++ b/models/classes/export/class.QtiTestExporter.php @@ -223,8 +223,7 @@ protected function exportItems() $file = $this->getTestService()->getQtiTestFile($this->getItem()); $extraPath = str_replace('\\', '/', dirname($rootDir->getRelPath($file))); $extraPath = trim($extraPath, '/'); - - $extraReversePath = ''; + $extraReversePath = '../../'; if (empty($extraPath) === false) { $n = count(explode('/', $extraPath)); $parts = array(); @@ -244,7 +243,7 @@ protected function exportItems() } // Modify the reference to the item in the test definition. - $newQtiItemXmlPath = $extraReversePath . '../../items/' . tao_helpers_Uri::getUniqueId($item->getUri()) . '/qti.xml'; + $newQtiItemXmlPath = $extraReversePath . 'items/' . tao_helpers_Uri::getUniqueId($item->getUri()) . '/qti.xml'; $itemRef = $this->getTestDocument()->getDocumentComponent()->getComponentByIdentifier($refIdentifier); $itemRef->setHref($newQtiItemXmlPath); @@ -274,10 +273,8 @@ protected function exportTest(array $itemIdentifiers) $newTestDir = 'tests/' . tao_helpers_Uri::getUniqueId($this->getItem()->getUri()).'/'; $testRootDir = $this->getTestService()->getQtiTestDir($this->getItem()); - $file = $this->getTestService()->getQtiTestFile($this->getItem()); - // revert backslashes introduced by dirname on windows - $relPath = trim(str_replace('\\', '/',dirname($testRootDir->getRelPath($file))), '/'); - $testHref = $newTestDir . (empty($relPath) ? '' : $relPath.'/') . 'test.xml'; + + $testHref = $newTestDir . 'test.xml'; common_Logger::t('TEST DEFINITION AT: ' . $testHref); $this->getZip()->addFromString($testHref, $testXmlDocument); @@ -285,12 +282,22 @@ protected function exportTest(array $itemIdentifiers) $iterator = $testRootDir->getFlyIterator(Directory::ITERATOR_RECURSIVE|Directory::ITERATOR_FILE); $indexFile = pathinfo(taoQtiTest_models_classes_QtiTestService::QTI_TEST_DEFINITION_INDEX , PATHINFO_BASENAME); + /** + * @var oat\oatbox\filesystem\File $f + */ + $file = $this->getTestService()->getQtiTestFile($this->getItem()); + // revert backslashes introduced by dirname on windows + $relPath = trim(str_replace('\\', '/',dirname($testRootDir->getRelPath($file))), '/'); + $basePath = $testRootDir->getPrefix(); + foreach ($iterator as $f) { + // Only add dependency files... if ($f->getBasename() !== taoQtiTest_models_classes_QtiTestService::TAOQTITEST_FILENAME && $f->getBasename() !== $indexFile) { + $data = $f->getMetadata(); // Add the file to the archive. - $fileHref = $newTestDir . ltrim($testRootDir->getRelPath($f), '/'); + $fileHref = $newTestDir . ltrim(str_replace($basePath , '' , $data['path']), '/'); common_Logger::t('AUXILIARY FILE AT: ' . $fileHref); $this->getZip()->addFromString($fileHref, $f->read()); $this->referenceAuxiliaryFile($fileHref); diff --git a/scripts/update/Updater.php b/scripts/update/Updater.php index f675dfe2c1..6224cbb8d9 100644 --- a/scripts/update/Updater.php +++ b/scripts/update/Updater.php @@ -1730,6 +1730,7 @@ public function update($initialVersion) { $this->setVersion('17.19.0'); } - $this->skip('17.19.0', '17.21.4'); + $this->skip('17.19.0', '17.21.5'); + } }