From 8cad2d1756f0e445ff715e40832b34fb3424a28e Mon Sep 17 00:00:00 2001 From: Robbie Averill Date: Fri, 27 Oct 2017 15:08:26 +1300 Subject: [PATCH] FIX Update ownerBaseClass in WorkflowApplicable for SS4 and convert to vendor module --- code/admin/AdvancedWorkflowAdmin.php | 8 +++----- code/extensions/AdvancedWorkflowExtension.php | 3 +-- code/extensions/WorkflowApplicable.php | 2 +- code/extensions/WorkflowEmbargoExpiryExtension.php | 14 ++++++-------- code/formfields/WorkflowField.php | 6 ++---- composer.json | 10 +++++++--- 6 files changed, 20 insertions(+), 23 deletions(-) diff --git a/code/admin/AdvancedWorkflowAdmin.php b/code/admin/AdvancedWorkflowAdmin.php index 543b03c6..81f1f713 100644 --- a/code/admin/AdvancedWorkflowAdmin.php +++ b/code/admin/AdvancedWorkflowAdmin.php @@ -86,11 +86,9 @@ protected function init() { parent::init(); - $module = ModuleLoader::getModule('symbiote/silverstripe-advancedworkflow'); - - Requirements::add_i18n_javascript($module->getRelativeResourcePath('client/lang')); - Requirements::javascript($module->getRelativeResourcePath('client/dist/js/advancedworkflow.js')); - Requirements::css($module->getRelativeResourcePath('client/dist/styles/advancedworkflow.css')); + Requirements::add_i18n_javascript('symbiote/silverstripe-advancedworkflow:client/lang'); + Requirements::javascript('symbiote/silverstripe-advancedworkflow:client/dist/js/advancedworkflow.js'); + Requirements::css('symbiote/silverstripe-advancedworkflow:client/dist/styles/advancedworkflow.css'); } /* diff --git a/code/extensions/AdvancedWorkflowExtension.php b/code/extensions/AdvancedWorkflowExtension.php index 2ddca7b5..ead360db 100644 --- a/code/extensions/AdvancedWorkflowExtension.php +++ b/code/extensions/AdvancedWorkflowExtension.php @@ -54,8 +54,7 @@ public function startworkflow($data, $form, $request) */ public function updateEditForm(Form $form) { - $module = ModuleLoader::getModule('symbiote/silverstripe-advancedworkflow'); - Requirements::javascript($module->getRelativeResourcePath('client/dist/js/advancedworkflow.js')); + Requirements::javascript('symbiote/silverstripe-advancedworkflow:client/dist/js/advancedworkflow.js'); $svc = singleton(WorkflowService::class); $p = $form->getRecord(); $active = $svc->getWorkflowFor($p); diff --git a/code/extensions/WorkflowApplicable.php b/code/extensions/WorkflowApplicable.php index 07453c03..931c1654 100644 --- a/code/extensions/WorkflowApplicable.php +++ b/code/extensions/WorkflowApplicable.php @@ -305,7 +305,7 @@ public function onAfterWrite() public function WorkflowInstances() { return WorkflowInstance::get()->filter(array( - 'TargetClass' => $this->ownerBaseClass, + 'TargetClass' => $this->owner->baseClass(), 'TargetID' => $this->owner->ID )); } diff --git a/code/extensions/WorkflowEmbargoExpiryExtension.php b/code/extensions/WorkflowEmbargoExpiryExtension.php index 320411d0..ecab9c0b 100644 --- a/code/extensions/WorkflowEmbargoExpiryExtension.php +++ b/code/extensions/WorkflowEmbargoExpiryExtension.php @@ -93,23 +93,21 @@ public function updateCMSFields(FieldList $fields) // requirements // ------------ - $module = ModuleLoader::getModule('symbiote/silverstripe-advancedworkflow'); - - Requirements::add_i18n_javascript($module->getRelativeResourcePath('client/lang')); + Requirements::add_i18n_javascript('symbiote/silverstripe-advancedworkflow:client/lang'); // Add timepicker functionality // @see /~https://github.com/trentrichardson/jQuery-Timepicker-Addon Requirements::css( - $module->getRelativeResourcePath('thirdparty/javascript/jquery-ui/timepicker/jquery-ui-timepicker-addon.css') + 'symbiote/silverstripe-advancedworkflow:thirdparty/javascript/jquery-ui/timepicker/jquery-ui-timepicker-addon.css' ); - Requirements::css($module->getRelativeResourcePath('client/dist/styles/advancedworkflow.css')); + Requirements::css('symbiote/silverstripe-advancedworkflow:client/dist/styles/advancedworkflow.css'); Requirements::javascript( - $module->getRelativeResourcePath('thirdparty/javascript/jquery-ui/timepicker/jquery-ui-sliderAccess.js') + 'symbiote/silverstripe-advancedworkflow:thirdparty/javascript/jquery-ui/timepicker/jquery-ui-sliderAccess.js' ); Requirements::javascript( - $module->getRelativeResourcePath('thirdparty/javascript/jquery-ui/timepicker/jquery-ui-timepicker-addon.js') + 'symbiote/silverstripe-advancedworkflow:thirdparty/javascript/jquery-ui/timepicker/jquery-ui-timepicker-addon.js' ); - Requirements::javascript($module->getRelativeResourcePath('client/dist/js/advancedworkflow.js')); + Requirements::javascript('symbiote/silverstripe-advancedworkflow:client/dist/js/advancedworkflow.js'); // Fields // ------ diff --git a/code/formfields/WorkflowField.php b/code/formfields/WorkflowField.php index 78240d65..c1f42bd3 100644 --- a/code/formfields/WorkflowField.php +++ b/code/formfields/WorkflowField.php @@ -95,10 +95,8 @@ public function getTemplate() public function FieldHolder($properties = array()) { - $workflow = ModuleLoader::getModule('symbiote/silverstripe-advancedworkflow'); - - Requirements::javascript($workflow->getRelativeResourcePath('client/dist/js/advancedworkflow.js')); - Requirements::css($workflow->getRelativeResourcePath('client/dist/styles/advancedworkflow.css')); + Requirements::javascript('symbiote/silverstripe-advancedworkflow:client/dist/js/advancedworkflow.js'); + Requirements::css('symbiote/silverstripe-advancedworkflow:client/dist/styles/advancedworkflow.css'); return $this->Field($properties); } diff --git a/composer.json b/composer.json index 11ef5a3c..93b386a1 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "symbiote/silverstripe-advancedworkflow", "description": "Adds configurable workflow support to the CMS, with a GUI for creating custom workflow definitions.", - "type": "silverstripe-module", + "type": "silverstripe-vendormodule", "keywords": ["silverstripe", "advancedworkflow", "workflow"], "license": "BSD-3-Clause", "authors": [ @@ -26,10 +26,14 @@ "squizlabs/php_codesniffer": "^3.0" }, "extra": { - "installer-name": "advancedworkflow", "branch-alias": { "dev-master": "5.0.x-dev" - } + }, + "expose": [ + "client/dist", + "client/lang", + "images" + ] }, "suggest": { "symbiote/silverstripe-queuedjobs": "Allow automated workflow transitions with queued system jobs"