From 792f6606aeb2f4adf2e1dc369cd59993bda331c7 Mon Sep 17 00:00:00 2001 From: Sam Sipasseuth Date: Thu, 14 Jul 2016 17:31:15 +0200 Subject: [PATCH 1/4] migrated to new pci format --- controller/PciSamples.php | 33 ------------ manifest.php | 11 ++-- model/CreatorHook.php | 51 ------------------- model/CreatorRegistry.php | 44 ---------------- scripts/install/RegisterPci.php | 42 +++++++++++++++ scripts/install/addHook.php | 23 --------- scripts/update/Updater.php | 11 ++-- .../{runtime => creator}/tpl/markup.tpl | 0 .../dev/textReaderInteraction/pciCreator.js | 7 ++- .../dev/textReaderInteraction/pciCreator.json | 38 ++++++++++---- 10 files changed, 86 insertions(+), 174 deletions(-) delete mode 100644 controller/PciSamples.php delete mode 100644 model/CreatorHook.php delete mode 100644 model/CreatorRegistry.php create mode 100644 scripts/install/RegisterPci.php delete mode 100644 scripts/install/addHook.php rename views/js/pciCreator/dev/textReaderInteraction/{runtime => creator}/tpl/markup.tpl (100%) diff --git a/controller/PciSamples.php b/controller/PciSamples.php deleted file mode 100644 index ca8f74b..0000000 --- a/controller/PciSamples.php +++ /dev/null @@ -1,33 +0,0 @@ - 'pciSamples', 'label' => 'QTI PCI samples', 'description' => '', 'license' => 'GPL-2.0', - 'version' => '0.2.1', + 'version' => '1.0.0', 'author' => 'Open Assessment Technologies', - 'requires' => array('qtiItemPci' => '>=0.1'), - // for compatibility - 'dependencies' => array('qtiItemPci'), + 'requires' => array('qtiItemPci' => '>=1.0.0'), 'managementRole' => 'http://www.tao.lu/Ontologies/generis.rdf#pciSamplesManager', 'acl' => array( array('grant', 'http://www.tao.lu/Ontologies/generis.rdf#pciSamplesManager', array('ext'=>'pciSamples')), ), 'install' => array( 'php' => array( - dirname(__FILE__).'/scripts/install/addHook.php' + RegisterPci::class ) ), 'update' => 'oat\\pciSamples\\scripts\\update\\Updater', diff --git a/model/CreatorHook.php b/model/CreatorHook.php deleted file mode 100644 index bd6e4f9..0000000 --- a/model/CreatorHook.php +++ /dev/null @@ -1,51 +0,0 @@ -getDevImplementations(); - foreach($hooks as $hook){ - $config->addInteraction($hook); - } - } - -} diff --git a/model/CreatorRegistry.php b/model/CreatorRegistry.php deleted file mode 100644 index a83bac7..0000000 --- a/model/CreatorRegistry.php +++ /dev/null @@ -1,44 +0,0 @@ -getExtensionById('pciSamples'); - return $extension->getConstant('DIR_VIEWS').'js/pciCreator/dev/'; - } - - protected function getBaseDevUrl(){ - $extension = common_ext_ExtensionsManager::singleton()->getExtensionById('pciSamples'); - return $extension->getConstant('BASE_WWW').'js/pciCreator/dev/'; - } - -} \ No newline at end of file diff --git a/scripts/install/RegisterPci.php b/scripts/install/RegisterPci.php new file mode 100644 index 0000000..3f06ba0 --- /dev/null +++ b/scripts/install/RegisterPci.php @@ -0,0 +1,42 @@ +setServiceLocator(ServiceManager::getServiceManager()); + + $viewDir = \common_ext_ExtensionsManager::singleton()->getExtensionById('pciSamples')->getConstant('DIR_VIEWS'); + + $sourceTextReader = $viewDir.implode(DIRECTORY_SEPARATOR, ['js', 'pciCreator', 'dev', 'textReaderInteraction']).DIRECTORY_SEPARATOR; + var_dump($sourceTextReader); + $service->registerFromDirectorySource($sourceTextReader); + + return new \common_report_Report(\common_report_Report::TYPE_SUCCESS, 'Portable Element Plugins for Qti Creator added to Tao Qti Item extension'); + } +} diff --git a/scripts/install/addHook.php b/scripts/install/addHook.php deleted file mode 100644 index e1890ee..0000000 --- a/scripts/install/addHook.php +++ /dev/null @@ -1,23 +0,0 @@ -setVersion('0.2.1'); } - - return null; + if($this->isVersion('0.2.1')){ + $registerPci = new RegisterPci(); + $registerPci([]); + $this->setVersion('1.0.0'); + } } } \ No newline at end of file diff --git a/views/js/pciCreator/dev/textReaderInteraction/runtime/tpl/markup.tpl b/views/js/pciCreator/dev/textReaderInteraction/creator/tpl/markup.tpl similarity index 100% rename from views/js/pciCreator/dev/textReaderInteraction/runtime/tpl/markup.tpl rename to views/js/pciCreator/dev/textReaderInteraction/creator/tpl/markup.tpl diff --git a/views/js/pciCreator/dev/textReaderInteraction/pciCreator.js b/views/js/pciCreator/dev/textReaderInteraction/pciCreator.js index aa79477..a90e942 100644 --- a/views/js/pciCreator/dev/textReaderInteraction/pciCreator.js +++ b/views/js/pciCreator/dev/textReaderInteraction/pciCreator.js @@ -1,12 +1,11 @@ /*global define*/ define([ - './creator/widget/Widget', - 'taoQtiItem/qtiCreator/editor/customInteractionRegistry', + 'textReaderInteraction/creator/widget/Widget', 'textReaderInteraction/runtime/js/renderer', - 'tpl!./runtime/tpl/markup', + 'tpl!textReaderInteraction/creator/tpl/markup', 'tpl!textReaderInteraction/creator/tpl/pages', 'tpl!textReaderInteraction/creator/tpl/navigation' -], function (Widget, registry, Renderer, markupTpl, pagesTpl, navigationTpl) { +], function (Widget, Renderer, markupTpl, pagesTpl, navigationTpl) { 'use strict'; var _typeIdentifier = 'textReaderInteraction'; diff --git a/views/js/pciCreator/dev/textReaderInteraction/pciCreator.json b/views/js/pciCreator/dev/textReaderInteraction/pciCreator.json index 52729fa..a596673 100644 --- a/views/js/pciCreator/dev/textReaderInteraction/pciCreator.json +++ b/views/js/pciCreator/dev/textReaderInteraction/pciCreator.json @@ -2,18 +2,9 @@ "typeIdentifier": "textReaderInteraction", "label": "Text reader", "description": "The Paging widget combines a scrolling widget with additional paging controls.", - "version": "0.1", + "version": "0.2.0", "author": "Aleh Hutnikau", "email": "contact@taotesting.com", - "libraries": [ - "IMSGlobal/jquery_2_1_1", - "./runtime/js/renderer", - "./runtime/js/tabs" - ], - "css": [ - "./runtime/css/textReaderInteraction.css" - ], - "entryPoint": "./runtime/textReaderInteraction.js", "tags": [ "reader", "paging" @@ -23,5 +14,32 @@ "response": { "baseType": "boolean", "cardinality": "single" + }, + "runtime" : { + "hook" : "./runtime/textReaderInteraction.js", + "libraries" : [ + "IMSGlobal/jquery_2_1_1", + "./runtime/js/renderer.js", + "./runtime/js/tabs.js" + ], + "stylesheets" : [ + "./runtime/css/textReaderInteraction.css" + ] + }, + "creator" : { + "icon": "./creator/media/icon.svg", + "hook": "./pciCreator.js", + "libraries" : [ + "./creator/tpl/markup.tpl", + "./creator/tpl/propertiesForm.tpl", + "./creator/tpl/navigation.tpl", + "./creator/tpl/pages.tpl", + "./creator/widget/Widget.js", + "./creator/widget/states/Question.js", + "./creator/widget/states/states.js" + ], + "stylesheets" : [ + "./creator/css/textReaderInteraction.css" + ] } } \ No newline at end of file From 4bfaf9ff2d6792e23b643ac9d6232454db59d840 Mon Sep 17 00:00:00 2001 From: Sam Sipasseuth Date: Wed, 3 Aug 2016 10:44:02 +0200 Subject: [PATCH 2/4] removed var_dump --- scripts/install/RegisterPci.php | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/install/RegisterPci.php b/scripts/install/RegisterPci.php index 3f06ba0..6596c1b 100644 --- a/scripts/install/RegisterPci.php +++ b/scripts/install/RegisterPci.php @@ -34,7 +34,6 @@ public function __invoke($params) $viewDir = \common_ext_ExtensionsManager::singleton()->getExtensionById('pciSamples')->getConstant('DIR_VIEWS'); $sourceTextReader = $viewDir.implode(DIRECTORY_SEPARATOR, ['js', 'pciCreator', 'dev', 'textReaderInteraction']).DIRECTORY_SEPARATOR; - var_dump($sourceTextReader); $service->registerFromDirectorySource($sourceTextReader); return new \common_report_Report(\common_report_Report::TYPE_SUCCESS, 'Portable Element Plugins for Qti Creator added to Tao Qti Item extension'); From 0018e398188bbcc5425460ca371d94c57ea41aca Mon Sep 17 00:00:00 2001 From: Sam Sipasseuth Date: Sun, 28 Aug 2016 12:02:05 +0200 Subject: [PATCH 3/4] removed old hook --- scripts/update/Updater.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/update/Updater.php b/scripts/update/Updater.php index 4f700d5..2b36da3 100644 --- a/scripts/update/Updater.php +++ b/scripts/update/Updater.php @@ -21,8 +21,8 @@ namespace oat\pciSamples\scripts\update; - use oat\pciSamples\scripts\install\RegisterPci; +use oat\taoQtiItem\model\HookRegistry; class Updater extends \common_ext_ExtensionUpdater { @@ -42,6 +42,9 @@ public function update($initialVersion) { if($this->isVersion('0.2.1')){ $registerPci = new RegisterPci(); $registerPci([]); + + HookRegistry::getRegistry()->remove('pciSamplesCreator'); + $this->setVersion('1.0.0'); } } From a1da395ffa7c48c4669e3ce72755d58dc12d4604 Mon Sep 17 00:00:00 2001 From: cmoyon Date: Tue, 13 Sep 2016 16:42:24 +0200 Subject: [PATCH 4/4] scripts/install/RegisterPci.php --- scripts/install/RegisterPci.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/install/RegisterPci.php b/scripts/install/RegisterPci.php index 6596c1b..7d8d48a 100644 --- a/scripts/install/RegisterPci.php +++ b/scripts/install/RegisterPci.php @@ -22,6 +22,7 @@ use common_ext_action_InstallAction; use oat\oatbox\service\ServiceManager; +use oat\taoQtiItem\model\portableElement\exception\PortableElementVersionIncompatibilityException; use oat\taoQtiItem\model\portableElement\PortableElementService; class RegisterPci extends common_ext_action_InstallAction @@ -33,8 +34,14 @@ public function __invoke($params) $viewDir = \common_ext_ExtensionsManager::singleton()->getExtensionById('pciSamples')->getConstant('DIR_VIEWS'); - $sourceTextReader = $viewDir.implode(DIRECTORY_SEPARATOR, ['js', 'pciCreator', 'dev', 'textReaderInteraction']).DIRECTORY_SEPARATOR; - $service->registerFromDirectorySource($sourceTextReader); + try { + $sourceTextReader = $viewDir.implode(DIRECTORY_SEPARATOR, ['js', 'pciCreator', 'dev', 'textReaderInteraction']); + $service->registerFromDirectorySource($sourceTextReader); + } catch (PortableElementVersionIncompatibilityException $e) { + \common_Logger::i($e->getMessage()); + } + + return new \common_report_Report(\common_report_Report::TYPE_SUCCESS, 'Portable Element Plugins for Qti Creator added to Tao Qti Item extension'); }