diff --git a/public/js/pimcore/asset/metadata/tags/abstract.js b/public/js/pimcore/asset/metadata/tags/abstract.js index 30cdf63fbb..d41bfc4dde 100644 --- a/public/js/pimcore/asset/metadata/tags/abstract.js +++ b/public/js/pimcore/asset/metadata/tags/abstract.js @@ -160,5 +160,14 @@ pimcore.asset.metadata.tags.abstract = Class.create({ handleGridOpenAction:function (grid, rowIndex) { + }, + + initEditorConfig: function (field) { + const editorConfig = {}; + if (field.config && field.config.width && field.config.width !== '100%' && intval(field.config.width) > 10) { + editorConfig.width = field.config.width; + } + + return editorConfig; } }); diff --git a/public/js/pimcore/asset/metadata/tags/input.js b/public/js/pimcore/asset/metadata/tags/input.js index 93d1f36511..ffd1ca9239 100644 --- a/public/js/pimcore/asset/metadata/tags/input.js +++ b/public/js/pimcore/asset/metadata/tags/input.js @@ -30,15 +30,7 @@ pimcore.asset.metadata.tags.input = Class.create(pimcore.asset.metadata.tags.abs }, getGridColumnEditor: function(field) { - var editorConfig = {}; - - if (field.config) { - if (field.config.width) { - if (intval(field.config.width) > 10) { - editorConfig.width = field.config.width; - } - } - } + const editorConfig = this.initEditorConfig(field); return new Ext.form.TextField(editorConfig); }, diff --git a/public/js/pimcore/asset/metadata/tags/select.js b/public/js/pimcore/asset/metadata/tags/select.js index 64494ed37f..37203a22ef 100644 --- a/public/js/pimcore/asset/metadata/tags/select.js +++ b/public/js/pimcore/asset/metadata/tags/select.js @@ -47,32 +47,24 @@ pimcore.asset.metadata.tags.select = Class.create(pimcore.asset.metadata.tags.ab }, getCellEditor: function (field, record) { - var key = field.key; + const key = field.key; - var value = record.data[key]; - var options = record.data[key + "%options"]; + const value = record.data[key]; + let options = record.data[key + '%options']; options = this.prepareStoreDataAndFilterLabels(options); - var store = new Ext.data.Store({ + const store = new Ext.data.Store({ autoDestroy: true, fields: ['key', 'value'], data: options }); - var editorConfig = {}; - - if (field.config) { - if (field.config.width) { - if (intval(field.config.width) > 10) { - editorConfig.width = field.config.width; - } - } - } + let editorConfig = this.initEditorConfig(field); editorConfig = Object.assign(editorConfig, { store: store, - triggerAction: "all", + triggerAction: 'all', editable: false, - mode: "local", + mode: 'local', valueField: 'value', displayField: 'key', value: value, @@ -87,29 +79,19 @@ pimcore.asset.metadata.tags.select = Class.create(pimcore.asset.metadata.tags.ab }, getGridColumnEditor: function(field) { - - var storeData = this.prepareStoreDataAndFilterLabels(field.layout.config); - var store = new Ext.data.Store({ + const storeData = this.prepareStoreDataAndFilterLabels(field.layout.config); + const store = new Ext.data.Store({ autoDestroy: true, fields: ['key', 'value'], data: storeData }); - - var editorConfig = {}; - - if (field.config) { - if (field.config.width) { - if (intval(field.config.width) > 10) { - editorConfig.width = field.config.width; - } - } - } + let editorConfig = this.initEditorConfig(field); editorConfig = Object.assign(editorConfig, { store: store, - triggerAction: "all", + triggerAction: 'all', editable: false, - mode: "local", + mode: 'local', valueField: 'value', displayField: 'key', displayTpl: Ext.create('Ext.XTemplate', diff --git a/public/js/pimcore/asset/metadata/tags/textarea.js b/public/js/pimcore/asset/metadata/tags/textarea.js index 0e138c38ab..e0a8d31565 100644 --- a/public/js/pimcore/asset/metadata/tags/textarea.js +++ b/public/js/pimcore/asset/metadata/tags/textarea.js @@ -37,19 +37,10 @@ pimcore.asset.metadata.tags.textarea = Class.create(pimcore.asset.metadata.tags. }, getGridColumnEditor: function(field) { - var editorConfig = {}; - - if (field.config) { - if (field.config.width) { - if (intval(field.config.width) > 10) { - editorConfig.width = field.config.width; - } - } - } + if (field.type == 'textarea') { + const editorConfig = this.initEditorConfig(field); - // TEXTAREA - if (field.type == "textarea") { - return new Ext.form.TextArea(editorConfig); + return new Ext.form.TextArea(editorConfig); } }, @@ -115,4 +106,4 @@ pimcore.asset.metadata.tags.textarea = Class.create(pimcore.asset.metadata.tags. return ""; } } -}); \ No newline at end of file +}); diff --git a/public/js/pimcore/element/helpers/gridCellEditor.js b/public/js/pimcore/element/helpers/gridCellEditor.js index 8adfdf4ea5..65094d0a76 100644 --- a/public/js/pimcore/element/helpers/gridCellEditor.js +++ b/public/js/pimcore/element/helpers/gridCellEditor.js @@ -74,7 +74,8 @@ Ext.define('pimcore.element.helpers.gridCellEditor', { } tag.updateContext({ - cellEditing: true + cellEditing: true, + fieldname: fieldInfo.key }); if (typeof tag["finishSetup"] !== "undefined") { diff --git a/public/js/pimcore/object/gridcolumn/operator/StringContains.js b/public/js/pimcore/object/gridcolumn/operator/StringContains.js index 5fd89a8f16..ab874fa731 100644 --- a/public/js/pimcore/object/gridcolumn/operator/StringContains.js +++ b/public/js/pimcore/object/gridcolumn/operator/StringContains.js @@ -134,6 +134,7 @@ pimcore.object.gridcolumn.operator.stringcontains = Class.create(pimcore.object. commitData: function(params) { this.node.set('isOperator', true); + this.node.data.configAttributes.label = this.textField.getValue(); this.node.data.configAttributes.search = this.searchField.getValue(); this.node.data.configAttributes.insensitive = this.insensitiveField.getValue(); this.node.set('text', this.textField.getValue()); @@ -149,4 +150,4 @@ pimcore.object.gridcolumn.operator.stringcontains = Class.create(pimcore.object. } return true; } -}); \ No newline at end of file +}); diff --git a/public/js/pimcore/object/helpers/grid.js b/public/js/pimcore/object/helpers/grid.js index bcd4942024..d5919330ba 100644 --- a/public/js/pimcore/object/helpers/grid.js +++ b/public/js/pimcore/object/helpers/grid.js @@ -429,7 +429,7 @@ pimcore.object.helpers.grid = Class.create({ getColumnWidth: function(field, defaultValue) { if (field.width) { return field.width; - } else if(field.layout && field.layout.width) { + } else if (field.layout && field.layout.width && field.layout.width !== '100%' && intval(field.layout.width) > 10) { return field.layout.width; } else { return defaultValue; diff --git a/public/js/pimcore/object/tags/abstract.js b/public/js/pimcore/object/tags/abstract.js index 5bb3866e27..9992b97573 100644 --- a/public/js/pimcore/object/tags/abstract.js +++ b/public/js/pimcore/object/tags/abstract.js @@ -311,4 +311,13 @@ pimcore.object.tags.abstract = Class.create({ this.globalLanguage = pimcore.globalmanager.get('global_language_' + this.getContext().objectId); } }, + + initEditorConfig: function (field) { + const editorConfig = {}; + if (field.config && field.config.width && field.config.width !== '100%' && intval(field.config.width) > 10) { + editorConfig.width = field.config.width; + } + + return editorConfig; + } }); diff --git a/public/js/pimcore/object/tags/booleanSelect.js b/public/js/pimcore/object/tags/booleanSelect.js index 38e24b47e2..aff1670209 100644 --- a/public/js/pimcore/object/tags/booleanSelect.js +++ b/public/js/pimcore/object/tags/booleanSelect.js @@ -56,28 +56,22 @@ pimcore.object.tags.booleanSelect = Class.create(pimcore.object.tags.abstract, { }, - getCellEditor: function ( field, record) { - var key = field.key; - if(field.layout.noteditable) { + getCellEditor: function (field, record) { + if (field.layout.noteditable) { return null; } - var value = record.data[key]; - var options = record.data[key + "%options"]; + const key = field.key; + const value = record.data[key]; + const options = record.data[key + "%options"]; - var store = new Ext.data.Store({ + const store = new Ext.data.Store({ autoDestroy: true, fields: ['key',"value"], data: options }); - var editorConfig = {}; - - if (field.config) { - if (field.config.width) { - editorConfig.width = field.config.width; - } - } + let editorConfig = this.initEditorConfig(field); editorConfig = Object.assign(editorConfig, { store: store, @@ -93,11 +87,11 @@ pimcore.object.tags.booleanSelect = Class.create(pimcore.object.tags.abstract, { }, getGridColumnEditor: function(field) { - if(field.layout.noteditable) { + if (field.layout.noteditable) { return null; } - var store = new Ext.data.JsonStore({ + const store = new Ext.data.JsonStore({ autoDestroy: true, proxy: { type: 'memory', @@ -111,19 +105,13 @@ pimcore.object.tags.booleanSelect = Class.create(pimcore.object.tags.abstract, { data: field.layout }); - var editorConfig = {}; - - if (field.config) { - if (field.config.width) { - editorConfig.width = field.config.width; - } - } + let editorConfig = this.initEditorConfig(field); editorConfig = Object.assign(editorConfig, { store: store, - triggerAction: "all", + triggerAction: 'all', editable: false, - mode: "local", + mode: 'local', valueField: 'value', displayField: 'key' }); diff --git a/public/js/pimcore/object/tags/input.js b/public/js/pimcore/object/tags/input.js index 8849116e28..a618ee996c 100644 --- a/public/js/pimcore/object/tags/input.js +++ b/public/js/pimcore/object/tags/input.js @@ -42,19 +42,12 @@ pimcore.object.tags.input = Class.create(pimcore.object.tags.abstract, { }, getGridColumnEditor: function(field) { - var editorConfig = {}; - - if (field.config) { - if (field.config.width) { - if (intval(field.config.width) > 10) { - editorConfig.width = field.config.width; - } - } - } - - if(field.layout.noteditable) { + if (field.layout.noteditable) { return null; } + + const editorConfig = this.initEditorConfig(field); + return new Ext.form.TextField(editorConfig); }, diff --git a/public/js/pimcore/object/tags/numeric.js b/public/js/pimcore/object/tags/numeric.js index 54fcfaf3b7..1daab451cb 100644 --- a/public/js/pimcore/object/tags/numeric.js +++ b/public/js/pimcore/object/tags/numeric.js @@ -33,44 +33,32 @@ pimcore.object.tags.numeric = Class.create(pimcore.object.tags.abstract, { }, getGridColumnEditor: function (field) { - var editorConfig = {}; - - var decimalPrecision = 20; - if (field.layout.noteditable) { return null; } - if (field.config) { - if (field.config.width) { - if (intval(field.config.width) > 10) { - editorConfig.width = field.config.width; - } - } - } - - if (field.layout["unsigned"]) { - editorConfig.minValue = 0; - } + if (field.type == 'numeric') { + const editorConfig = this.initEditorConfig(field); - if (is_numeric(field.layout["minValue"])) { - editorConfig.minValue = field.layout.minValue; - } + if (field.layout['unsigned']) { + editorConfig.minValue = 0; + } - if (is_numeric(field.layout["maxValue"])) { - editorConfig.maxValue = field.layout.maxValue; - } + if (is_numeric(field.layout['minValue'])) { + editorConfig.minValue = field.layout.minValue; + } - if (field.layout["integer"]) { - editorConfig.decimalPrecision = 0; - } else if (field.layout["decimalPrecision"]) { - editorConfig.decimalPrecision = field.layout["decimalPrecision"]; - } else { - editorConfig.decimalPrecision = 20; - } + if (is_numeric(field.layout['maxValue'])) { + editorConfig.maxValue = field.layout.maxValue; + } - if (field.type == "numeric") { - editorConfig.decimalPrecision = decimalPrecision; + if (field.layout['integer']) { + editorConfig.decimalPrecision = 0; + } else if (field.layout['decimalPrecision']) { + editorConfig.decimalPrecision = field.layout['decimalPrecision']; + } else { + editorConfig.decimalPrecision = 20; + } // we have to use Number since the spinner trigger don't work in grid -> seems to be a bug of Ext return new Ext.form.field.Number(editorConfig); diff --git a/public/js/pimcore/object/tags/rgbaColor.js b/public/js/pimcore/object/tags/rgbaColor.js index d8435b1b00..5a74c80a97 100644 --- a/public/js/pimcore/object/tags/rgbaColor.js +++ b/public/js/pimcore/object/tags/rgbaColor.js @@ -57,17 +57,12 @@ pimcore.object.tags.rgbaColor = Class.create(pimcore.object.tags.abstract, { }, getGridColumnEditor: function (field) { - var editorConfig = {}; - - if (field.config) { - if (field.config.width) { - editorConfig.width = field.config.width; - } - } - if (field.layout.noteditable) { return null; } + + const editorConfig = this.initEditorConfig(field); + return new Ext.form.TextField(editorConfig); }, diff --git a/public/js/pimcore/object/tags/select.js b/public/js/pimcore/object/tags/select.js index 11cb865c33..33f5fecbd6 100644 --- a/public/js/pimcore/object/tags/select.js +++ b/public/js/pimcore/object/tags/select.js @@ -108,36 +108,28 @@ pimcore.object.tags.select = Class.create(pimcore.object.tags.abstract, { }, getCellEditor: function (field, record) { - var key = field.key; - if(field.layout.noteditable) { + if (field.layout.noteditable) { return null; } - var value = record.data[key]; - var options = record.data[key + "%options"]; + const key = field.key; + const value = record.data[key]; + let options = record.data[key + '%options']; options = this.prepareStoreDataAndFilterLabels(options); - var store = new Ext.data.Store({ + const store = new Ext.data.Store({ autoDestroy: true, fields: ['key', 'value'], data: options }); - var editorConfig = {}; - - if (field.config) { - if (field.config.width) { - if (intval(field.config.width) > 10) { - editorConfig.width = field.config.width; - } - } - } + let editorConfig = this.initEditorConfig(field); editorConfig = Object.assign(editorConfig, { store: store, - triggerAction: "all", + triggerAction: 'all', editable: false, - mode: "local", + mode: 'local', valueField: 'value', displayField: 'key', value: value, @@ -152,37 +144,29 @@ pimcore.object.tags.select = Class.create(pimcore.object.tags.abstract, { }, getGridColumnEditor: function(field) { - if(field.layout.noteditable) { + if (field.layout.noteditable) { return null; } - var storeData = this.prepareStoreDataAndFilterLabels(field.layout.options); + const storeData = this.prepareStoreDataAndFilterLabels(field.layout.options); - if(!field.layout.mandatory) { - storeData.unshift({'value': '', 'key': "(" + t("empty") + ")"}); + if (!field.layout.mandatory) { + storeData.unshift({'value': '', 'key': '(' + t('empty') + ')'}); } - - var store = new Ext.data.Store({ + + const store = new Ext.data.Store({ autoDestroy: true, fields: ['key', 'value'], data: storeData }); - var editorConfig = {}; - - if (field.config) { - if (field.config.width) { - if (intval(field.config.width) > 10) { - editorConfig.width = field.config.width; - } - } - } + let editorConfig = this.initEditorConfig(field); editorConfig = Object.assign(editorConfig, { store: store, - triggerAction: "all", + triggerAction: 'all', editable: false, - mode: "local", + mode: 'local', valueField: 'value', displayField: 'key', displayTpl: Ext.create('Ext.XTemplate', diff --git a/public/js/pimcore/object/tags/textarea.js b/public/js/pimcore/object/tags/textarea.js index 160020655d..e75bd8e12c 100644 --- a/public/js/pimcore/object/tags/textarea.js +++ b/public/js/pimcore/object/tags/textarea.js @@ -26,22 +26,15 @@ pimcore.object.tags.textarea = Class.create(pimcore.object.tags.abstract, { }, getGridColumnEditor: function(field) { - var editorConfig = {}; - - if (field.config) { - if (field.config.width) { - if (intval(field.config.width) > 10) { - editorConfig.width = field.config.width; - } - } - } - - if(field.layout.noteditable) { + if (field.layout.noteditable) { return null; } + // TEXTAREA - if (field.type == "textarea") { - return new Ext.form.TextArea(editorConfig); + if (field.type == 'textarea') { + const editorConfig = this.initEditorConfig(field); + + return new Ext.form.TextArea(editorConfig); } }, diff --git a/public/js/pimcore/object/tags/urlSlug.js b/public/js/pimcore/object/tags/urlSlug.js index 67a1a727be..1f5af728b4 100644 --- a/public/js/pimcore/object/tags/urlSlug.js +++ b/public/js/pimcore/object/tags/urlSlug.js @@ -33,17 +33,12 @@ pimcore.object.tags.urlSlug = Class.create(pimcore.object.tags.abstract, { }, getGridColumnEditor: function (field) { - var editorConfig = {}; - - if (field.config) { - if (field.config.width) { - editorConfig.width = field.config.width; - } - } - if (field.layout.noteditable) { return null; } + + const editorConfig = this.initEditorConfig(field); + return new Ext.form.TextField(editorConfig); }, diff --git a/public/js/pimcore/object/tags/video.js b/public/js/pimcore/object/tags/video.js index 371f882ce7..dcd2422500 100644 --- a/public/js/pimcore/object/tags/video.js +++ b/public/js/pimcore/object/tags/video.js @@ -233,6 +233,12 @@ pimcore.object.tags.video = Class.create(pimcore.object.tags.abstract, { var data = Ext.decode(res.response.responseText); if (data["id"] && data["type"] == "video") { this.data.id = data["id"]; + this.data.type = "asset"; + this.data.data = data["fullpath"]; + this.data.poster = null; + this.data.title = ''; + this.data.description = ''; + this.dirty = true; } this.updateVideo(); diff --git a/public/js/pimcore/object/tags/wysiwyg.js b/public/js/pimcore/object/tags/wysiwyg.js index 948b57cd0d..c4d324afc8 100644 --- a/public/js/pimcore/object/tags/wysiwyg.js +++ b/public/js/pimcore/object/tags/wysiwyg.js @@ -33,21 +33,11 @@ pimcore.object.tags.wysiwyg = Class.create(pimcore.object.tags.abstract, { * @extjs since HTMLEditor seems not working properly in grid, this feature is deactivated for now */ /*getGridColumnEditor: function(field) { - var editorConfig = {}; - - if (field.config) { - if (field.config.width) { - if (intval(field.config.width) > 10) { - editorConfig.width = field.config.width; - } - } - } - - if(field.layout.noteditable) { + if (field.layout.noteditable) { return null; } // WYSIWYG - if (field.type == "wysiwyg") { + if (field.type == 'wysiwyg') { return Ext.create('Ext.form.HtmlEditor', { width: 500, height: 300 @@ -268,4 +258,3 @@ pimcore.object.tags.wysiwyg = Class.create(pimcore.object.tags.abstract, { return this.getValue(); } }); - diff --git a/public/js/pimcore/object/tree.js b/public/js/pimcore/object/tree.js index 1504983fb0..aaaf7c8e35 100644 --- a/public/js/pimcore/object/tree.js +++ b/public/js/pimcore/object/tree.js @@ -267,14 +267,16 @@ pimcore.registerNS("pimcore.object.tree"); onTreeNodesDrop: function (node, data, overModel, dropPosition, eOpts) { if (typeof this.treeNodeMoveParameter.oldParent.getOwnerTree !== "function") { + if (dropPosition == "before" || dropPosition == "after") { + return; + } + Ext.Array.each(data.records, function (record) { if (this.onTreeNodeBeforeMove(record, record.parentNode, overModel)) { this.onTreeNodeMove(record, record.parentNode, overModel, 0); } }.bind(this)); - } - if (typeof this.treeNodeMoveParameter.oldParent.getOwnerTree !== "function") { return; } diff --git a/translations/admin.de.yaml b/translations/admin.de.yaml index 12b534ba9c..beda1d9db6 100644 --- a/translations/admin.de.yaml +++ b/translations/admin.de.yaml @@ -1132,4 +1132,5 @@ keybinding_users: Users keybinding_roles: Roles remove_focal_point: Remove Focal Point username: Benutzername +invalid_option: 'Invalide Option Feld [ {field} ]: Bitte valide Option für das Select / Multiselect field [ {field} ] wählen. Aktueller Wert: "{option}"' ... diff --git a/translations/admin.en.yaml b/translations/admin.en.yaml index f65f0be866..79ca726d42 100644 --- a/translations/admin.en.yaml +++ b/translations/admin.en.yaml @@ -1018,3 +1018,4 @@ male: Male female: Female pdf_js_unsafe: This PDF file contains JavaScript. If you want to view it, please download and open it in your local PDF viewer. pdf_scan_in_progress: 'Preview not available: PDF is being scanned. This may take a while.' +invalid_option: 'Invalid Option field [ {field} ]: Please choose a valid option for select / multiselect field [ {field} ]. Current value: "{option}"' \ No newline at end of file