Skip to content

Commit

Permalink
Merge pull request #2 from studio1gmbh/id-to-place-settings-gh
Browse files Browse the repository at this point in the history
Workflow Extend Bundle v1.1.0
  • Loading branch information
AKriebisch committed Apr 6, 2023
2 parents f594a1e + fc834bf commit 74a11ca
Show file tree
Hide file tree
Showing 5 changed files with 182 additions and 4 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Expand Up @@ -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
5 changes: 4 additions & 1 deletion README.md
Expand Up @@ -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
Last modified: 2023-04-06
Binary file added docs/place_settings.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
171 changes: 171 additions & 0 deletions 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;
},

});
5 changes: 3 additions & 2 deletions src/WorkflowExtendBundle.php
Expand Up @@ -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',
];
}

Expand Down Expand Up @@ -69,6 +70,6 @@ public function getNiceName()
*/
public function getVersion()
{
return '1.0.1';
return '1.1.0';
}
}

0 comments on commit 74a11ca

Please sign in to comment.