public function testDeepCloneTriplesFile() { /** @var \core_kernel_versioning_Repository $repository */ $repository = \tao_models_classes_FileSourceService::singleton()->addLocalSource("repository test", \tao_helpers_File::createTempDir()); //see if clone item content works /** @var \core_kernel_versioning_File $file */ $file = $repository->spawnFile(__DIR__ . '/sample/test.xml', "test", function ($originalName) { return md5($originalName); }); //see if clone file works $rdfsTriple = new \core_kernel_classes_Triple(); $rdfsTriple->predicate = "http://www.w3.org/1999/02/22-rdf-syntax-ns#value"; $rdfsTriple->object = $file->getUri(); $return = CloneHelper::deepCloneTriples(array($rdfsTriple)); $this->assertCount(1, $return); $this->assertEquals($rdfsTriple->predicate, $return[0]->predicate); $this->assertNotEquals($rdfsTriple->object, $return[0]->object); $fileCopy = new \core_kernel_file_File($return[0]->object); $this->assertFileExists($fileCopy->getAbsolutePath()); $this->assertEquals($file->getLabel(), $fileCopy->getLabel()); $this->assertNotEquals($file->getAbsolutePath(), $fileCopy->getAbsolutePath()); $file->delete(true); $fileCopy->delete(true); $repository->delete(true); }
/** * * @return array */ public function fileAccessProviders() { $ext = common_ext_ExtensionsManager::singleton()->getExtensionById('tao'); if (is_null(self::$fileSystem)) { self::$fileSystem = tao_models_classes_FileSourceService::singleton()->addLocalSource('test FS', $ext->getConstant('DIR_VIEWS')); } return array(array(DirectWebSource::spawnWebsource(self::$fileSystem, $ext->getConstant('BASE_WWW'))), array(TokenWebSource::spawnWebsource(self::$fileSystem)), array(ActionWebSource::spawnWebsource(self::$fileSystem))); }
public function run() { $extension = common_ext_ExtensionsManager::singleton()->getExtensionById('taoDelivery'); $runPath = $extension->getConstant('BASE_PATH') . 'data' . DIRECTORY_SEPARATOR . 'compiled' . DIRECTORY_SEPARATOR; helpers_File::emptyDirectory($runPath); $runSource = tao_models_classes_FileSourceService::singleton()->addLocalSource('runtimeDirectory', $runPath); $provider = new tao_models_classes_fsAccess_TokenAccessProvider($runSource); taoDelivery_models_classes_RuntimeAccess::setAccessProvider($provider); }
public function testDeepDeleteTriples() { //create resources $repository = \tao_models_classes_FileSourceService::singleton()->addLocalSource("Label Test", \tao_helpers_File::createTempDir()); $file = $repository->createFile("test.xml", "sample"); //delete resource DeleteHelper::deepDeleteTriples($file->getRdfTriples()); DeleteHelper::deepDeleteTriples($repository->getRdfTriples()); //see if all is deleted //try to get the resource $resourceTest = new \core_kernel_classes_Resource($repository->getUri()); $fileTest = new \core_kernel_classes_Resource($file->getUri()); $this->assertCount(0, $resourceTest->getRdfTriples()); $this->assertCount(0, $fileTest->getRdfTriples()); }
public function run() { $publicDataPath = FILES_PATH . 'tao' . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR; $privateDataPath = FILES_PATH . 'tao' . DIRECTORY_SEPARATOR . 'private' . DIRECTORY_SEPARATOR; if (file_exists($publicDataPath)) { helpers_File::emptyDirectory($publicDataPath); } if (file_exists($privateDataPath)) { helpers_File::emptyDirectory($privateDataPath); } $publicFs = tao_models_classes_FileSourceService::singleton()->addLocalSource('public service storage', $publicDataPath); $privateFs = tao_models_classes_FileSourceService::singleton()->addLocalSource('private service storage', $privateDataPath); $provider = tao_models_classes_fsAccess_TokenAccessProvider::spawnProvider($publicFs); tao_models_classes_service_FileStorage::configure($privateFs, $publicFs, $provider); }
<?php /** * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; under version 2 * of the License (non-upgradable). * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * Copyright (c) 2014 (original work) Open Assessment Technologies SA; * * */ use oat\taoBooklet\model\StorageService; $bookletDataPath = FILES_PATH . 'taoBooklet' . DIRECTORY_SEPARATOR; if (file_exists($bookletDataPath)) { helpers_File::emptyDirectory($bookletDataPath); } $bookletFs = tao_models_classes_FileSourceService::singleton()->addLocalSource('booklet storage', $bookletDataPath); StorageService::setFileSystem($bookletFs);
/** * * @return \oat\tao\model\search\zend\ZendSearch */ public static function createSearch() { $privateDataPath = FILES_PATH . 'tao' . DIRECTORY_SEPARATOR . 'ZendSearch' . DIRECTORY_SEPARATOR; if (file_exists($privateDataPath)) { \helpers_File::emptyDirectory($privateDataPath); } $privateFs = \tao_models_classes_FileSourceService::singleton()->addLocalSource('Zend Search index folder', $privateDataPath); $search = new ZendSearch(array('fileSystem' => $privateFs->getUri())); $search->flushIndex(); return $search; }
<?php /** * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; under version 2 * of the License (non-upgradable). * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * Copyright (c) 2013 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT); * * */ $extension = common_ext_ExtensionsManager::singleton()->getExtensionById('filemanager'); $dataPath = $extension->getDir() . 'views' . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR; $dataUrl = $extension->getConstant('BASE_WWW') . 'data/'; tao_helpers_File::emptyDirectory($dataPath); $fileSystem = tao_models_classes_FileSourceService::singleton()->addLocalSource('Filemanager Directory', $dataPath); $provider = tao_models_classes_fsAccess_DirectAccessProvider::spawnProvider($fileSystem, $dataUrl); filemanager_helpers_FileUtils::setAccessProvider($provider);
/** * @depends testInstantiateClass * @param \core_kernel_classes_Resource $instance */ public function testItemContent($instance) { $this->assertFalse($this->itemsService->hasItemModel($instance, array(OwiItemModel::ITEMMODEL_URI))); $this->assertFalse($this->itemsService->hasItemContent($instance)); $this->itemsService->setDefaultItemContent($instance); $this->assertFileExists($this->itemsService->getDefaultItemFolder($instance)); $instance->setPropertyValue(new \core_kernel_classes_Property(TAO_ITEM_MODEL_PROPERTY), OwiItemModel::ITEMMODEL_URI); //is really empty $this->assertFalse($this->itemsService->hasItemContent($instance)); //we can set $this->assertNotNull($this->itemsService->setItemContent($instance, 'test')); $this->assertEquals('test', $this->itemsService->getItemContent($instance)); // and overwrite $this->assertNotNull($this->itemsService->setItemContent($instance, 'test2')); $this->assertEquals('test2', $this->itemsService->getItemContent($instance)); //if no itemContent is set get the default one and copy it into a new repository $this->assertEquals('test2', $this->itemsService->getItemContent($instance, 'BY')); $this->assertTrue($this->itemsService->hasItemContent($instance)); $this->assertStringStartsWith(LOCAL_NAMESPACE, $instance->getUri()); $this->assertTrue($this->itemsService->hasItemModel($instance, array(OwiItemModel::ITEMMODEL_URI))); $this->assertStringStartsWith(ROOT_URL, $this->itemsService->getPreviewUrl($instance)); $this->assertEquals('taoItems_models_classes_ItemCompiler', $this->itemsService->getCompilerClass($instance)); $this->assertEquals(count($this->itemsService->getAllByModel($instance)), 0); $this->assertEquals(count($this->itemsService->getAllByModel(null)), 0); $this->assertContains('test2', $this->itemsService->render($instance, $this->itemsService->getSessionLg())); $this->assertFalse($this->itemsService->hasModelStatus($instance, array(TAO_ITEM_MODEL_STATUS_DEPRECATED))); $dataPath = FILES_PATH . 'taoItems' . DIRECTORY_SEPARATOR . 'itemData' . DIRECTORY_SEPARATOR; $source = \tao_models_classes_FileSourceService::singleton()->addLocalSource('itemDirectory', $dataPath); $this->assertNotFalse($this->itemsService->setDefaultFilesource($source)); }
/* * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; under version 2 * of the License (non-upgradable). * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); * */ /* * This post-installation script creates a fodler for the QTI Tests */ $dataPath = FILES_PATH . 'taoQtiTest' . DIRECTORY_SEPARATOR; if (file_exists($dataPath)) { helpers_File::emptyDirectory($dataPath); } $source = tao_models_classes_FileSourceService::singleton()->addLocalSource('QTI test datasource', $dataPath); mkdir($dataPath . 'testData'); $directory = new core_kernel_file_File($source->createFile('', 'testData')); taoQtiTest_models_classes_QtiTestService::singleton()->setQtiTestDirectory($directory);
<?php /** * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; under version 2 * of the License (non-upgradable). * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * Copyright (c) 2015 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT); * * @author lionel * @license GPLv2 * @package package_name * @subpackage * */ use oat\tao\model\ThemeRegistry; use oat\tao\model\websource\TokenWebSource; $itemThemesDataPath = FILES_PATH . 'tao' . DIRECTORY_SEPARATOR . 'themes' . DIRECTORY_SEPARATOR; $itemThemesDataPathFs = \tao_models_classes_FileSourceService::singleton()->addLocalSource('Theme FileSource', $itemThemesDataPath); $websource = TokenWebSource::spawnWebsource($itemThemesDataPathFs); ThemeRegistry::getRegistry()->setWebSource($websource->getId());
* but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); * */ /* * This post-installation script creates a new local file source for file uploaded * by end-users through the TAO GUI. */ $dataPath = FILES_PATH . 'tao' . DIRECTORY_SEPARATOR . 'upload' . DIRECTORY_SEPARATOR; if (file_exists($dataPath)) { helpers_File::emptyDirectory($dataPath); } $source = tao_models_classes_FileSourceService::singleton()->addLocalSource('fileUploadDirectory', $dataPath); tao_models_classes_TaoService::singleton()->setUploadFileSource($source); // add .htaccess to prevent php code execution if (file_exists($dataPath) && is_dir($dataPath)) { $accessFile = $dataPath . '.htaccess'; if (!is_writable($dataPath) || file_exists($accessFile && !is_writable($accessFile))) { throw new tao_install_utils_Exception("Unable to write .htaccess file into : {$accessFile}."); } file_put_contents($accessFile, "php_flag engine off\n"); }
* as published by the Free Software Foundation; under version 2 * of the License (non-upgradable). * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * Copyright (c) 2015 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT); * */ use oat\taoThemingPlatform\model\PlatformThemingService; /* * This post-installation script creates a data storage directory * for the taoThemingPlatform extension. */ $dataPath = FILES_PATH . 'taoThemingPlatform' . DIRECTORY_SEPARATOR; if (file_exists($dataPath)) { helpers_File::emptyDirectory($dataPath); } // Create extension datasource. $source = tao_models_classes_FileSourceService::singleton()->addLocalSource('Platform Theming datasource', $dataPath); // Create the assets directory which will contain theming assets. mkdir($dataPath . 'assets'); $directory = new core_kernel_file_File($source->createFile('', 'assets')); // Assets storage is now set to '/data/taoThemingPlatform/assets'. PlatformThemingService::singleton()->setDataDirectory($directory);
/** * * @param string $initialVersion * @return string */ public function update($initialVersion) { $currentVersion = $initialVersion; //add portable shared libraries: $libBasePath = ROOT_PATH . 'taoQtiItem/views/js/portableSharedLibraries'; $libRootUrl = ROOT_URL . 'taoQtiItem/views/js/portableSharedLibraries'; $installBasePath = ROOT_PATH . 'taoQtiItem/install/scripts/portableSharedLibraries'; $sharedLibRegistry = new SharedLibrariesRegistry($libBasePath, $libRootUrl); //migrate from 2.6 to 2.7.0 if ($currentVersion == '2.6') { $sharedLibRegistry->registerFromFile('IMSGlobal/jquery_2_1_1', $installBasePath . '/IMSGlobal/jquery_2_1_1.js'); $sharedLibRegistry->registerFromFile('OAT/lodash', $installBasePath . '/OAT/lodash.js'); $sharedLibRegistry->registerFromFile('OAT/async', $installBasePath . '/OAT/async.js'); $sharedLibRegistry->registerFromFile('OAT/raphael', $installBasePath . '/OAT/raphael.js'); $sharedLibRegistry->registerFromFile('OAT/scale.raphael', $installBasePath . '/OAT/scale.raphael.js'); $sharedLibRegistry->registerFromFile('OAT/util/xml', $installBasePath . '/OAT/util/xml.js'); $sharedLibRegistry->registerFromFile('OAT/util/math', $installBasePath . '/OAT/util/math.js'); $sharedLibRegistry->registerFromFile('OAT/util/html', $installBasePath . '/OAT/util/html.js'); $sharedLibRegistry->registerFromFile('OAT/util/EventMgr', $installBasePath . '/OAT/util/EventMgr.js'); $sharedLibRegistry->registerFromFile('OAT/util/event', $installBasePath . '/OAT/util/event.js'); $currentVersion = '2.7.0'; } //migrate from 2.7.0 to 2.7.1 if ($currentVersion == '2.7.0') { $sharedLibRegistry->registerFromFile('OAT/sts/common', $installBasePath . '/OAT/sts/common.js'); $sharedLibRegistry->registerFromFile('OAT/interact', $installBasePath . '/OAT/interact.js'); $sharedLibRegistry->registerFromFile('OAT/interact-rotate', $installBasePath . '/OAT/interact-rotate.js'); $currentVersion = '2.7.1'; } //migrate from 2.7.0 to 2.7.1 if ($currentVersion == '2.7.1') { $sharedLibRegistry->registerFromFile('OAT/sts/transform-helper', $installBasePath . '/OAT/sts/transform-helper.js'); $currentVersion = '2.7.2'; } //migrate from 2.7.2 to 2.7.3 if ($currentVersion == '2.7.2') { $sharedLibRegistry->registerFromFile('IMSGlobal/jquery_2_1_1', $installBasePath . '/IMSGlobal/jquery_2_1_1.js'); $sharedLibRegistry->registerFromFile('OAT/lodash', $installBasePath . '/OAT/lodash.js'); $sharedLibRegistry->registerFromFile('OAT/async', $installBasePath . '/OAT/async.js'); $sharedLibRegistry->registerFromFile('OAT/raphael', $installBasePath . '/OAT/raphael.js'); $sharedLibRegistry->registerFromFile('OAT/scale.raphael', $installBasePath . '/OAT/scale.raphael.js'); $sharedLibRegistry->registerFromFile('OAT/util/xml', $installBasePath . '/OAT/util/xml.js'); $sharedLibRegistry->registerFromFile('OAT/util/math', $installBasePath . '/OAT/util/math.js'); $sharedLibRegistry->registerFromFile('OAT/util/html', $installBasePath . '/OAT/util/html.js'); $sharedLibRegistry->registerFromFile('OAT/util/EventMgr', $installBasePath . '/OAT/util/EventMgr.js'); $sharedLibRegistry->registerFromFile('OAT/util/event', $installBasePath . '/OAT/util/event.js'); $sharedLibRegistry->registerFromFile('OAT/sts/common', $installBasePath . '/OAT/sts/common.js'); $sharedLibRegistry->registerFromFile('OAT/interact', $installBasePath . '/OAT/interact.js'); $sharedLibRegistry->registerFromFile('OAT/interact-rotate', $installBasePath . '/OAT/interact-rotate.js'); $sharedLibRegistry->registerFromFile('OAT/sts/transform-helper', $installBasePath . '/OAT/sts/transform-helper.js'); $currentVersion = '2.7.3'; } //migrate from 2.7.3 to 2.7.4 if ($currentVersion == '2.7.3') { $sharedLibRegistry->registerFromFile('OAT/handlebars', $installBasePath . '/OAT/handlebars.js'); $currentVersion = '2.7.4'; } if ($currentVersion == '2.7.4') { $ext = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiItem'); $ext->setConfig('qtiCreator', array('multi-column' => false)); $currentVersion = '2.7.5'; } if ($currentVersion == '2.7.5') { $sharedLibRegistry->registerFromFile('OAT/sts/stsEventManager', $installBasePath . '/OAT/sts/stsEventManager.js'); $currentVersion = '2.7.6'; } if ($currentVersion == '2.7.6') { $sharedLibRegistry->registerFromFile('OAT/sts/common', $installBasePath . '/OAT/sts/common.js'); $currentVersion = '2.7.7'; } if ($currentVersion == '2.7.7') { $itemThemesDataPath = FILES_PATH . 'tao' . DIRECTORY_SEPARATOR . 'themes' . DIRECTORY_SEPARATOR; $itemThemesDataPathFs = \tao_models_classes_FileSourceService::singleton()->addLocalSource('Theme FileSource', $itemThemesDataPath); $websource = TokenWebSource::spawnWebsource($itemThemesDataPathFs); ThemeRegistry::getRegistry()->setWebSource($websource->getId()); ThemeRegistry::getRegistry()->createTarget('items', 'taoQtiItem/views/css/qti-runner.css'); ThemeRegistry::getRegistry()->registerTheme('tao', 'TAO', 'taoQtiItem/views/css/themes/default.css', array('items')); ThemeRegistry::getRegistry()->setDefaultTheme('items', 'tao'); $currentVersion = '2.7.8'; } if ($currentVersion == '2.7.8') { $clientLibRegistry = ClientLibRegistry::getRegistry(); $clientLibRegistry->register('qtiCustomInteractionContext', '../../../taoQtiItem/views/js/runtime/qtiCustomInteractionContext'); $clientLibRegistry->register('qtiInfoControlContext', '../../../taoQtiItem/views/js/runtime/qtiInfoControlContext'); $currentVersion = '2.7.9'; } if ($currentVersion == '2.7.9') { $currentVersion = '2.8.0'; } if ($currentVersion == '2.8.0') { $currentVersion = '2.8.1'; $sharedLibRegistry->registerFromFile('OAT/sts/common', $installBasePath . '/OAT/sts/common.js'); } if ($currentVersion == '2.8.1') { $qtiItem = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiItem'); $qtiItem->setConfig('userScripts', array()); $currentVersion = '2.9.0'; } if ($currentVersion === '2.9.0') { $sharedLibRegistry->registerFromFile('OAT/waitForMedia', $installBasePath . '/OAT/waitForMedia.js'); $currentVersion = '2.9.1'; } if ($currentVersion === '2.9.1') { $currentVersion = '2.10.0'; } if ($currentVersion === '2.10.0') { $currentVersion = '2.11.0'; } if ($currentVersion === '2.11.0') { $sharedLibRegistry->registerFromFile('OAT/util/asset', $installBasePath . '/OAT/util/asset.js'); $sharedLibRegistry->registerFromFile('OAT/util/tpl', $installBasePath . '/OAT/util/tpl.js'); $currentVersion = '2.12.0'; } $this->setVersion($currentVersion); if ($this->isBetween('2.12.0', '2.13.0')) { $itemQtiExt = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiItem'); $compilerClassConfig = 'oat\\taoQtiItem\\model\\QtiItemCompiler'; $itemQtiExt->setConfig('compilerClass', $compilerClassConfig); $this->setVersion('2.13.0'); } if ($this->isVersion('2.13.0')) { \oat\tao\model\ClientLibConfigRegistry::getRegistry()->register('taoQtiItem/qtiRunner/core/QtiRunner', array('inlineModalFeedback' => false)); $fs = \taoItems_models_classes_ItemsService::singleton()->getDefaultFileSource(); $itemUpdater = new ItemUpdateInlineFeedback($fs->getPath()); $itemUpdater->update(true); $this->setVersion('2.14.0'); } $this->skip('2.14.0', '2.15.1'); if ($this->isVersion('2.15.1')) { $ext = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiItem'); $validation = array('default' => array(__DIR__ . '/../../model/qti/data/imscp_v1p1.xsd', __DIR__ . '/../../model/qti/data/apipv1p0/Core_Level/Package/apipv1p0_imscpv1p2_v1p0.xsd')); $ext->setConfig('manifestValidation', $validation); $this->setVersion('2.16.0'); } if ($this->isVersion('2.16.0')) { $ext = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiItem'); $validation = array('http://www.imsglobal.org/xsd/imsqti_v2p0' => array(__DIR__ . '/../../model/qti/data/qtiv2p0/imsqti_v2p0.xsd'), 'http://www.imsglobal.org/xsd/apip/apipv1p0/qtiitem/imsqti_v2p1' => array(__DIR__ . '/../../model/qti/data/apipv1p0/Core_Level/Package/apipv1p0_qtiitemv2p1_v1p0.xsd'), 'default' => array(__DIR__ . '/../../model/qti/data/qtiv2p1/imsqti_v2p1.xsd')); $ext->setConfig('contentValidation', $validation); $this->setVersion('2.17.0'); } if ($this->isVersion('2.17.0')) { $this->setVersion('2.17.1'); } if ($this->isVersion('2.17.1')) { $service = new addValidationSettings(); $service([]); $this->setVersion('2.17.2'); } $this->skip('2.17.2', '2.19.0'); if ($this->isVersion('2.19.0')) { if (!$this->getServiceManager()->has(SimpleExporter::SERVICE_ID)) { $service = new ItemExporter(array('fileSystem' => 'taoQtiItem', 'fileLocation' => 'export' . DIRECTORY_SEPARATOR . 'export.csv', 'extractors' => array('OntologyExtractor' => new OntologyExtractor(), 'QtiExtractor' => new QtiExtractor()), 'columns' => array('label' => array('extractor' => 'OntologyExtractor', 'parameters' => array('property' => RDFS_LABEL)), 'type' => array('extractor' => 'QtiExtractor', 'parameters' => array('callback' => 'getInteractionType')), 'nb choice' => array('extractor' => 'QtiExtractor', 'parameters' => array('callback' => 'getNumberOfChoices')), 'BR' => array('extractor' => 'QtiExtractor', 'parameters' => array('callback' => 'getRightAnswer', 'callbackParameters' => array('delimiter' => '|'))), 'choiceInteraction' => array('extractor' => 'QtiExtractor', 'parameters' => array('callback' => 'getChoices', 'valuesAsColumns' => true))))); $service->setServiceManager($this->getServiceManager()); $this->getServiceManager()->register(SimpleExporter::SERVICE_ID, $service); $createExportDirectoryScript = new createExportDirectory(); $createExportDirectoryScript([]); } $this->setVersion('2.20.0'); } $this->skip('2.20.0', '2.22.0'); if ($this->isVersion('2.22.0')) { $simpleExporter = $this->getServiceManager()->get(SimpleExporter::SERVICE_ID); $columns = $simpleExporter->getOption('columns'); $responseIdentifier['responseIdentifier'] = array('extractor' => 'QtiExtractor', 'parameters' => array('callback' => 'getResponseIdentifier')); $offset = array_search('BR', array_keys($columns)); $columns = array_slice($columns, 0, $offset, true) + $responseIdentifier + array_slice($columns, $offset, NULL, true); $simpleExporter->setOption('columns', $columns); $simpleExporter->setServiceManager($this->getServiceManager()); $this->getServiceManager()->register(SimpleExporter::SERVICE_ID, $simpleExporter); $this->setVersion('2.23.0'); } if ($this->isVersion('2.23.0')) { $simpleExporter = $this->getServiceManager()->get(SimpleExporter::SERVICE_ID); $columns = $simpleExporter->getOption('columns'); $columns['BR'] = array('extractor' => 'QtiExtractor', 'parameters' => array('callback' => 'getRightAnswer', 'callbackParameters' => array('delimiter' => '|'), 'valuesAsColumns' => true)); $simpleExporter->setOption('columns', $columns); $simpleExporter->setServiceManager($this->getServiceManager()); $this->getServiceManager()->register(SimpleExporter::SERVICE_ID, $simpleExporter); $this->setVersion('2.24.0'); } $this->skip('2.24.0', '2.25.0'); if ($this->isVersion('2.25.0')) { QtiCreatorClientConfigRegistry::getRegistry()->registerPlugin('back', 'taoQtiItem/qtiCreator/plugins/navigation/back', 'navigation'); $this->setVersion('2.26.0'); } if ($this->isVersion('2.26.0')) { AclProxy::applyRule(new AccessRule('grant', 'http://www.tao.lu/Ontologies/TAOItem.rdf#AbstractItemAuthor', QtiPreview::class)); AclProxy::applyRule(new AccessRule('grant', 'http://www.tao.lu/Ontologies/TAOItem.rdf#AbstractItemAuthor', QtiCreator::class)); AclProxy::applyRule(new AccessRule('grant', 'http://www.tao.lu/Ontologies/TAOItem.rdf#AbstractItemAuthor', QtiCssAuthoring::class)); $this->setVersion('2.27.0'); } $this->skip('2.27.0', '2.28.2'); if ($this->isVersion('2.28.2')) { $setDragAndDropConfig = new SetDragAndDropConfig(); $setDragAndDropConfig([]); $this->setVersion('2.29.0'); } $this->skip('2.29.0', '2.30.1'); if ($this->isVersion('2.30.1')) { $setDragAndDropConfig = new SetDragAndDropConfig(); $setDragAndDropConfig([]); $this->setVersion('2.31.0'); } $this->skip('2.31.0', '5.1.2'); if ($this->isVersion('5.1.2')) { $sharedLibRegistry->registerFromFile('OAT/jquery.qtip', $installBasePath . '/OAT/jquery.qtip.js'); $this->setVersion('5.2.0'); } $this->skip('5.2.0', '5.3.0'); if ($this->isVersion('5.3.0')) { $sharedLibRegistry->registerFromFile('OAT/customEvent', $installBasePath . '/OAT/customEvent.js'); $this->setVersion('5.4.0'); } $this->skip('5.4.0', '5.7.0'); if ($this->isVersion('5.7.0')) { $eventManager = $this->getServiceManager()->get(\oat\oatbox\event\EventManager::CONFIG_ID); $eventManager->attach(\oat\taoItems\model\event\ItemRdfUpdatedEvent::class, array(\oat\taoQtiItem\model\Listener\ItemUpdater::class, 'catchItemRdfUpdatedEvent')); $this->getServiceManager()->register(\oat\oatbox\event\EventManager::CONFIG_ID, $eventManager); $this->setVersion('5.7.1'); } $this->skip('5.7.1', '5.7.3'); if ($this->isVersion('5.7.3')) { $categoriesService = new ItemCategoriesService(array('properties' => array())); $categoriesService->setServiceManager($this->getServiceManager()); $this->getServiceManager()->register(ItemCategoriesService::SERVICE_ID, $categoriesService); $this->setVersion('5.8.0'); } $this->skip('5.8.0', '6.3.0'); }
* * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2); * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER); * 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV); * */ /* * This post-installation script creates a new local file source for file uploaded * by end-users through the TAO GUI. */ $publicDataPath = FILES_PATH . 'tao' . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR; $privateDataPath = FILES_PATH . 'tao' . DIRECTORY_SEPARATOR . 'private' . DIRECTORY_SEPARATOR; if (file_exists($publicDataPath)) { helpers_File::emptyDirectory($publicDataPath); } if (file_exists($privateDataPath)) { helpers_File::emptyDirectory($privateDataPath); } $publicFs = tao_models_classes_FileSourceService::singleton()->addLocalSource('public service storage', $publicDataPath); $privateFs = tao_models_classes_FileSourceService::singleton()->addLocalSource('private service storage', $privateDataPath); $websource = TokenWebSource::spawnWebsource($publicFs); tao_models_classes_service_FileStorage::configure($privateFs, $publicFs, $websource);
* This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; under version 2 * of the License (non-upgradable). * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * Copyright (c) 2014 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT); * * */ use oat\tao\model\media\MediaService; use oat\taoMediaManager\model\fileManagement\FileManager; use oat\taoMediaManager\model\fileManagement\TaoFileManagement; use oat\taoMediaManager\model\MediaSource; $dataPath = FILES_PATH . 'taoMediaManager' . DIRECTORY_SEPARATOR . 'media' . DIRECTORY_SEPARATOR; if (file_exists($dataPath)) { helpers_File::emptyDirectory($dataPath); } $source = tao_models_classes_FileSourceService::singleton()->addLocalSource('MediaManager', $dataPath); $config = array('uri' => $source->getUri()); FileManager::setFileManagementModel(new TaoFileManagement($config)); $mediaManager = new MediaSource(); MediaService::singleton()->addMediaSource($mediaManager);
/** * * @param string $initialVersion * @return string */ public function update($initialVersion) { $currentVersion = $initialVersion; //add portable shared libraries: $libBasePath = ROOT_PATH . 'taoQtiItem/views/js/portableSharedLibraries'; $libRootUrl = ROOT_URL . 'taoQtiItem/views/js/portableSharedLibraries'; $installBasePath = ROOT_PATH . 'taoQtiItem/install/scripts/portableSharedLibraries'; $registry = new SharedLibrariesRegistry($libBasePath, $libRootUrl); //migrate from 2.6 to 2.7.0 if ($currentVersion == '2.6') { $registry->registerFromFile('IMSGlobal/jquery_2_1_1', $installBasePath . '/IMSGlobal/jquery_2_1_1.js'); $registry->registerFromFile('OAT/lodash', $installBasePath . '/OAT/lodash.js'); $registry->registerFromFile('OAT/async', $installBasePath . '/OAT/async.js'); $registry->registerFromFile('OAT/raphael', $installBasePath . '/OAT/raphael.js'); $registry->registerFromFile('OAT/scale.raphael', $installBasePath . '/OAT/scale.raphael.js'); $registry->registerFromFile('OAT/util/xml', $installBasePath . '/OAT/util/xml.js'); $registry->registerFromFile('OAT/util/math', $installBasePath . '/OAT/util/math.js'); $registry->registerFromFile('OAT/util/html', $installBasePath . '/OAT/util/html.js'); $registry->registerFromFile('OAT/util/EventMgr', $installBasePath . '/OAT/util/EventMgr.js'); $registry->registerFromFile('OAT/util/event', $installBasePath . '/OAT/util/event.js'); $currentVersion = '2.7.0'; } //migrate from 2.7.0 to 2.7.1 if ($currentVersion == '2.7.0') { $registry->registerFromFile('OAT/sts/common', $installBasePath . '/OAT/sts/common.js'); $registry->registerFromFile('OAT/interact', $installBasePath . '/OAT/interact.js'); $registry->registerFromFile('OAT/interact-rotate', $installBasePath . '/OAT/interact-rotate.js'); $currentVersion = '2.7.1'; } //migrate from 2.7.0 to 2.7.1 if ($currentVersion == '2.7.1') { $registry->registerFromFile('OAT/sts/transform-helper', $installBasePath . '/OAT/sts/transform-helper.js'); $currentVersion = '2.7.2'; } //migrate from 2.7.2 to 2.7.3 if ($currentVersion == '2.7.2') { $registry->registerFromFile('IMSGlobal/jquery_2_1_1', $installBasePath . '/IMSGlobal/jquery_2_1_1.js'); $registry->registerFromFile('OAT/lodash', $installBasePath . '/OAT/lodash.js'); $registry->registerFromFile('OAT/async', $installBasePath . '/OAT/async.js'); $registry->registerFromFile('OAT/raphael', $installBasePath . '/OAT/raphael.js'); $registry->registerFromFile('OAT/scale.raphael', $installBasePath . '/OAT/scale.raphael.js'); $registry->registerFromFile('OAT/util/xml', $installBasePath . '/OAT/util/xml.js'); $registry->registerFromFile('OAT/util/math', $installBasePath . '/OAT/util/math.js'); $registry->registerFromFile('OAT/util/html', $installBasePath . '/OAT/util/html.js'); $registry->registerFromFile('OAT/util/EventMgr', $installBasePath . '/OAT/util/EventMgr.js'); $registry->registerFromFile('OAT/util/event', $installBasePath . '/OAT/util/event.js'); $registry->registerFromFile('OAT/sts/common', $installBasePath . '/OAT/sts/common.js'); $registry->registerFromFile('OAT/interact', $installBasePath . '/OAT/interact.js'); $registry->registerFromFile('OAT/interact-rotate', $installBasePath . '/OAT/interact-rotate.js'); $registry->registerFromFile('OAT/sts/transform-helper', $installBasePath . '/OAT/sts/transform-helper.js'); $currentVersion = '2.7.3'; } //migrate from 2.7.3 to 2.7.4 if ($currentVersion == '2.7.3') { $registry->registerFromFile('OAT/handlebars', $installBasePath . '/OAT/handlebars.js'); $currentVersion = '2.7.4'; } if ($currentVersion == '2.7.4') { $ext = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiItem'); $ext->setConfig('qtiCreator', array('multi-column' => false)); $currentVersion = '2.7.5'; } if ($currentVersion == '2.7.5') { $registry->registerFromFile('OAT/sts/stsEventManager', $installBasePath . '/OAT/sts/stsEventManager.js'); $currentVersion = '2.7.6'; } if ($currentVersion == '2.7.6') { $registry->registerFromFile('OAT/sts/common', $installBasePath . '/OAT/sts/common.js'); $currentVersion = '2.7.7'; } if ($currentVersion == '2.7.7') { $itemThemesDataPath = FILES_PATH . 'tao' . DIRECTORY_SEPARATOR . 'themes' . DIRECTORY_SEPARATOR; $itemThemesDataPathFs = \tao_models_classes_FileSourceService::singleton()->addLocalSource('Theme FileSource', $itemThemesDataPath); $websource = TokenWebSource::spawnWebsource($itemThemesDataPathFs); ThemeRegistry::getRegistry()->setWebSource($websource->getId()); ThemeRegistry::getRegistry()->createTarget('items', 'taoQtiItem/views/css/qti-runner.css'); ThemeRegistry::getRegistry()->registerTheme('tao', 'TAO', 'taoQtiItem/views/css/themes/default.css', array('items')); ThemeRegistry::getRegistry()->setDefaultTheme('items', 'tao'); $currentVersion = '2.7.8'; } if ($currentVersion == '2.7.8') { $clientLibRegistry = ClientLibRegistry::getRegistry(); $clientLibRegistry->register('qtiCustomInteractionContext', '../../../taoQtiItem/views/js/runtime/qtiCustomInteractionContext'); $clientLibRegistry->register('qtiInfoControlContext', '../../../taoQtiItem/views/js/runtime/qtiInfoControlContext'); $currentVersion = '2.7.9'; } if ($currentVersion == '2.7.9') { $currentVersion = '2.8.0'; } if ($currentVersion == '2.8.0') { $currentVersion = '2.8.1'; $registry->registerFromFile('OAT/sts/common', $installBasePath . '/OAT/sts/common.js'); } if ($currentVersion == '2.8.1') { $qtiItem = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiItem'); $qtiItem->setConfig('userScripts', array()); $currentVersion = '2.9.0'; } if ($currentVersion === '2.9.0') { $registry->registerFromFile('OAT/waitForMedia', $installBasePath . '/OAT/waitForMedia.js'); $currentVersion = '2.9.1'; } if ($currentVersion === '2.9.1') { $currentVersion = '2.10.0'; } if ($currentVersion === '2.10.0') { $currentVersion = '2.11.0'; } return $currentVersion; }