diff --git a/CHANGELOG.md b/CHANGELOG.md index 52bd152..6f60311 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,8 +2,11 @@ All notable changes to the Workflow Extend Bundle will be documented in this file. +## [1.1.0] - 2023-04-06 +- Added ID to place settings + ## [1.0.1] - 2023-01-20 - Check if PimcoreWorkflowDesignerBundle is present and add javascript only if it is. ## [1.0.0] - 2023-01-13 -- initial release +- Initial release diff --git a/README.md b/README.md index ab31d19..8b5b18f 100755 --- a/README.md +++ b/README.md @@ -101,7 +101,10 @@ Can be found in `var/log/workflow-extend-bundle.log`. - Adds the `data` option to the workflow configuration - A patch file is needed, since there is no other way to extend the dependency injection configuration of the workflow bundle +- [placeSettings.js](src/Resources/public/js/pimcore/configuration/item/placeSettings.js) + - Extends the Pimcore Workflow Designer by additional field for the state id + - ![Backend Configuration](docs/place_settings.png) --- -Last Modified: 2023-01-20 \ No newline at end of file +Last modified: 2023-04-06 \ No newline at end of file diff --git a/docs/place_settings.png b/docs/place_settings.png new file mode 100644 index 0000000..7bc9ed7 Binary files /dev/null and b/docs/place_settings.png differ diff --git a/src/Resources/public/js/pimcore/configuration/item/placeSettings.js b/src/Resources/public/js/pimcore/configuration/item/placeSettings.js new file mode 100644 index 0000000..25589dd --- /dev/null +++ b/src/Resources/public/js/pimcore/configuration/item/placeSettings.js @@ -0,0 +1,171 @@ +/** + * Created by PhpStorm. + * User: akriebisch + * Date: 06.04.23 + * Time: 09:10 + */ + +/** + * Extend the original place settings panel + * @see workflow-designer/src/Resources/public/js/pimcore/configuration/item/placeSettings.js + * + * Most of the code is copied from the original file, due to the fact that the original file is not extendable. + * Changes are marked with "Studio1 start" and "Studio1 end". + */ + +pimcore.registerNS('pimcore.plugin.studio1.workflowDesigner.item.placeSettings'); +pimcore.bundle.workflowDesigner.item.placeSettings = Class.create(pimcore.bundle.workflowDesigner.item.placeSettings, { + + + initialize: function(placeId, placeData, callback) { + + // Studio1 start + placeData.id = placeId; + // Studio1 end + const data = placeData || {}; + placeData.permissions = placeData.permissions || []; + + this.window = new Ext.window.Window({ + title: t('bundle_wfdesigner_place_settings'), + modal: true, + resizeable: false, + layout: 'fit', + width: 800, + height: '90%', + autoScroll: true, + buttons: [ + { + text: t('apply'), + iconCls: 'pimcore_icon_apply', + handler: function(){ + const values = this.generalFormPanel.getValues(); + let permissions = []; + + if(this.permissionPanel) { + this.permissionPanel.items.items.forEach(function(item) { + permissions.push(item.getValues()); + }); + } else { + permissions = placeData.permissions; + } + + values.permissions = permissions; + + if(callback) { + callback(values); + } + + this.window.hide(); + this.window.destroy(); + + }.bind(this) + } + ], + items: [ + this.getFormPanel(data) + ] + }); + + const user = pimcore.globalmanager.get('user'); + if(user.isAllowed('permission_workflow_designer_place_permissions')) { + this.initPermissionPanel(placeData.permissions); + } + this.window.show(); + }, + + getFormPanel: function(placeData) { + this.generalFormPanel = Ext.create('Pimcore.WorkflowDesigner.StructuredValueForm', { + defaults: { + labelWidth: 180, + listeners: pimcore.bundle.workflowDesigner.tooltipDefinition.definition.listeners + }, + items: [ + // Studio1 start + { + xtype: 'textfield', + fieldLabel: t('id'), + name: '__ignore_name', + value: placeData.id, + readOnly: true, + width: 540, + }, { + // Studio1 end + xtype: 'textfield', + fieldLabel: t('label'), + name: 'label', + value: placeData.label, + width: 540, + tooltip: t('bundle_wfdesigner_tooltip_place_name') + },{ + xtype: 'textfield', + fieldLabel: t('title'), + name: 'title', + value: placeData.title, + width: 540, + tooltip: t('bundle_wfdesigner_tooltip_place_title') + },{ + xtype: 'checkbox', + name: 'visibleInHeader', + value: placeData.hasOwnProperty('visibleInHeader') ? placeData.visibleInHeader : true, + inputValue: true, + uncheckedValue: false, + fieldLabel: t('bundle_wfdesigner_place_visibleInHeader'), + tooltip: t('bundle_wfdesigner_tooltip_place_visibleInHeader') + },{ + xtype: 'colorfield', + name: 'color', + value: (placeData.color) ? placeData.color : '000000', + fieldLabel: t('color'), + tooltip: t('bundle_wfdesigner_tooltip_place_color') + },{ + xtype: 'checkbox', + name: 'colorInverted', + value: placeData.colorInverted, + inputValue: true, + uncheckedValue: false, + fieldLabel: t('bundle_wfdesigner_place_colorInverted'), + tooltip: t('bundle_wfdesigner_tooltip_place_colorInverted') + } + ] + }); + + const items = [{ + xtype: 'fieldset', + width: '100%', + title: t('bundle_wfdesigner_general'), + items: [ + this.generalFormPanel + ] + }]; + + const user = pimcore.globalmanager.get('user'); + if(user.isAllowed('permission_workflow_designer_place_permissions')) { + items.push({ + xtype: 'fieldset', + width: '100%', + collapsible: true, + title: t('bundle_wfdesigner_place_permissions'), + items: [ + { + xtype: 'displayfield', + value: t('bundle_wfdesigner_tooltip_place_permissions') + }, + this.buildPermissionPanel() + ] + }); + } + + this.mainPanel = Ext.create('Ext.panel.Panel', { + border: false, + frame:false, + bodyStyle: 'padding:10px', + items: items, + labelWidth: 130, + collapsible: false, + autoScroll: true + }); + + return this.mainPanel; + }, + +}); \ No newline at end of file diff --git a/src/WorkflowExtendBundle.php b/src/WorkflowExtendBundle.php index 5024df8..b30d1be 100755 --- a/src/WorkflowExtendBundle.php +++ b/src/WorkflowExtendBundle.php @@ -38,7 +38,8 @@ public function getJsPaths() } return [ - '/bundles/workflowextend/js/pimcore/configuration/item/transitionSettings.js' + '/bundles/workflowextend/js/pimcore/configuration/item/transitionSettings.js', + '/bundles/workflowextend/js/pimcore/configuration/item/placeSettings.js', ]; } @@ -69,6 +70,6 @@ public function getNiceName() */ public function getVersion() { - return '1.0.1'; + return '1.1.0'; } }