-
Notifications
You must be signed in to change notification settings - Fork 0
/
placeSettings.js
171 lines (153 loc) · 5.84 KB
/
placeSettings.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
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;
},
});