From aca7f3f1871496110193917a4fa0bcbcb3d57bf2 Mon Sep 17 00:00:00 2001 From: Sebastian Blank Date: Wed, 6 Nov 2024 14:36:30 +0100 Subject: [PATCH 1/5] Fix: Filter for relation throws an error (#741) * Fix: Filter for relation throws an error * Take manyToManyObjectRelation width into account (relation filter/edit) * Fix wrong width when width is empty * The layout should always exists, otherwise it will break before * Allow % widths --- .../pimcore/element/helpers/gridCellEditor.js | 6 +- .../element/helpers/gridColumnConfig.js | 105 +++++++++--------- public/js/pimcore/functions.js | 14 +++ public/js/pimcore/object/tags/abstract.js | 12 +- 4 files changed, 74 insertions(+), 63 deletions(-) diff --git a/public/js/pimcore/element/helpers/gridCellEditor.js b/public/js/pimcore/element/helpers/gridCellEditor.js index 51ef1cfd40..8c9e510f96 100644 --- a/public/js/pimcore/element/helpers/gridCellEditor.js +++ b/public/js/pimcore/element/helpers/gridCellEditor.js @@ -90,12 +90,16 @@ Ext.define('pimcore.element.helpers.gridCellEditor', { items: [tag.getLayoutEdit()], bodyStyle: "padding: 10px;" }); + let width = 700; + if (tagType === 'manyToManyObjectRelation' && fieldInfo.layout.width && fieldInfo.layout.width !== '100%') { + width = sumWidths(fieldInfo.layout.width, 25); + } this.editWin = new Ext.Window({ modal: false, title: t("edit") + " " + fieldInfo.layout.title, items: [formPanel], bodyStyle: "background: #fff;", - width: 700, + width: width, maxHeight: 600, autoScroll: true, preventRefocus: true, // nasty hack because this is an internal property diff --git a/public/js/pimcore/element/helpers/gridColumnConfig.js b/public/js/pimcore/element/helpers/gridColumnConfig.js index 40fc56e195..d8e95c9493 100644 --- a/public/js/pimcore/element/helpers/gridColumnConfig.js +++ b/public/js/pimcore/element/helpers/gridColumnConfig.js @@ -386,9 +386,9 @@ pimcore.element.helpers.gridColumnConfig = { }, filterPrepare: function (column) { - var dataIndexName = column.dataIndex - var gridColumns = this.grid.getColumns(); - var columnIndex = -1; + const dataIndexName = column.dataIndex + const gridColumns = this.grid.getColumns(); + let columnIndex = -1; for (let i = 0; i < gridColumns.length; i++) { let dataIndex = gridColumns[i].dataIndex; if (dataIndex == dataIndexName) { @@ -404,63 +404,66 @@ pimcore.element.helpers.gridColumnConfig = { return; } - var fieldInfo = this.grid.getColumns()[columnIndex].config; + const fieldInfo = this.grid.getColumns()[columnIndex].config; - if((this.objecttype === "object") || (this.objecttype === "variant")) { + if (this.objecttype === "object" || this.objecttype === "variant") { if (!fieldInfo.layout || !fieldInfo.layout.layout) { return; } - var tagType = fieldInfo.layout.type; - var editor = new pimcore.object.tags[tagType](null, fieldInfo.layout.layout); + const tagType = fieldInfo.layout.type; + const editor = new pimcore.object.tags[tagType](null, fieldInfo.layout.layout); editor.setObject(this.object); - } - - editor.updateContext({ - containerType: "filterByRelationWindow" - }); + editor.updateContext({ + containerType: "filterByRelationWindow" + }); - var formPanel = Ext.create('Ext.form.Panel', { - xtype: "form", - border: false, - items: [editor.getLayoutEdit()], - bodyStyle: "padding: 10px;", - buttons: [ - { - text: t("clear_relation_filter"), - iconCls: "pimcore_icon_filter_condition pimcore_icon_overlay_delete", - handler: function () { - this.filterByRelationWindow.close(); - this.grid.store.filters.removeByKey("x-gridfilter-"+fieldInfo.dataIndex); - }.bind(this) - }, - { - text: t("apply_filter"), - iconCls: "pimcore_icon_filter pimcore_icon_overlay_add", - handler: function () { - if (formPanel.isValid() && typeof fieldInfo.getRelationFilter === "function") { - this.grid.filters.getStore().addFilter( - fieldInfo.getRelationFilter(fieldInfo.dataIndex, editor) - ); + const formPanel = Ext.create('Ext.form.Panel', { + xtype: "form", + border: false, + items: [editor.getLayoutEdit()], + bodyStyle: "padding: 10px;", + buttons: [ + { + text: t("clear_relation_filter"), + iconCls: "pimcore_icon_filter_condition pimcore_icon_overlay_delete", + handler: function () { this.filterByRelationWindow.close(); - } - }.bind(this) - } - ] - }); + this.grid.store.filters.removeByKey("x-gridfilter-"+fieldInfo.dataIndex); + }.bind(this) + }, + { + text: t("apply_filter"), + iconCls: "pimcore_icon_filter pimcore_icon_overlay_add", + handler: function () { + if (formPanel.isValid() && typeof fieldInfo.getRelationFilter === "function") { + this.grid.filters.getStore().addFilter( + fieldInfo.getRelationFilter(fieldInfo.dataIndex, editor) + ); + this.filterByRelationWindow.close(); + } + }.bind(this) + } + ] + }); - var title = t("filter_by_relation_field") + " " + fieldInfo.text; - this.filterByRelationWindow = new Ext.Window({ - autoScroll: true, - modal: false, - title: title, - items: [formPanel], - bodyStyle: "background: #fff;", - width: formPanel.items.items[0].width + 25, - maxHeight: 650 - }); - this.filterByRelationWindow.show(); - this.filterByRelationWindow.updateLayout(); + const title = t("filter_by_relation_field") + " " + fieldInfo.text; + let width = 700; + if (tagType === 'manyToManyObjectRelation' && fieldInfo.layout.layout.width && fieldInfo.layout.layout.width !== '100%') { + width = sumWidths(fieldInfo.layout.layout.width, 25); + } + this.filterByRelationWindow = new Ext.Window({ + autoScroll: true, + modal: false, + title: title, + items: [formPanel], + bodyStyle: "background: #fff;", + width: width, + maxHeight: 650 + }); + this.filterByRelationWindow.show(); + this.filterByRelationWindow.updateLayout(); + } }, batchPrepare: function (column, onlySelected, append, remove) { diff --git a/public/js/pimcore/functions.js b/public/js/pimcore/functions.js index c501472fe7..df8c2e8d79 100644 --- a/public/js/pimcore/functions.js +++ b/public/js/pimcore/functions.js @@ -1809,3 +1809,17 @@ function dateToServerTimezone(date) { return new Date(date.getTime() - diff); } + +function sumWidths(width1, width2) { + if (/^\d+$/.test(width1) && /^\d+$/.test(width2)) { + return parseInt(width1) + parseInt(width2); + } + if (/^\d+$/.test(width1)) { + width1 += 'px'; + } + if (/^\d+$/.test(width2)) { + width2 += 'px'; + } + + return 'calc(' + width1 + ' + ' + width2 + ')'; +} diff --git a/public/js/pimcore/object/tags/abstract.js b/public/js/pimcore/object/tags/abstract.js index 9992b97573..eb70246920 100644 --- a/public/js/pimcore/object/tags/abstract.js +++ b/public/js/pimcore/object/tags/abstract.js @@ -271,17 +271,7 @@ pimcore.object.tags.abstract = Class.create({ }, sumWidths: function (width1, width2) { - if (/^\d+$/.test(width1) && /^\d+$/.test(width2)) { - return parseInt(width1) + parseInt(width2); - } - if (/^\d+$/.test(width1)) { - width1 += 'px'; - } - if (/^\d+$/.test(width2)) { - width2 += 'px'; - } - - return 'calc(' + width1 + ' + ' + width2 + ')'; + return sumWidths(width1, width2); }, /** From cfb446e183d785fdae8f0ec2cec836b10ed11ff5 Mon Sep 17 00:00:00 2001 From: Mihail Gutuleac Date: Mon, 28 Oct 2024 12:21:42 +0200 Subject: [PATCH 2/5] Fix background for external transparent image --- public/js/pimcore/object/tags/externalImage.js | 1 + 1 file changed, 1 insertion(+) diff --git a/public/js/pimcore/object/tags/externalImage.js b/public/js/pimcore/object/tags/externalImage.js index 657636241f..748aa0a2ae 100644 --- a/public/js/pimcore/object/tags/externalImage.js +++ b/public/js/pimcore/object/tags/externalImage.js @@ -163,6 +163,7 @@ pimcore.object.tags.externalImage = Class.create(pimcore.object.tags.abstract, { backgroundSize: "contain", backgroundImage: "url(" + path + ")", backgroundPosition: "center center", + backgroundColor: "white", backgroundRepeat: "no-repeat" }); body.repaint(); From aca95bae77df86c4f67b339b74fc07fb380c749e Mon Sep 17 00:00:00 2001 From: Sebastian Blank Date: Fri, 8 Nov 2024 11:23:30 +0100 Subject: [PATCH 3/5] Fix: Encrypted Field's Label settings don't change (#735) --- public/js/pimcore/object/tags/encryptedField.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/public/js/pimcore/object/tags/encryptedField.js b/public/js/pimcore/object/tags/encryptedField.js index 23f9be6e37..a5d2a8b8f2 100644 --- a/public/js/pimcore/object/tags/encryptedField.js +++ b/public/js/pimcore/object/tags/encryptedField.js @@ -23,6 +23,8 @@ pimcore.object.tags.encryptedField = Class.create(pimcore.object.tags.abstract, if (typeof pimcore.object.tags[fieldConfig.delegateDatatype] !== "undefined") { var delegateFieldConfig = fieldConfig.delegate || {}; + delegateFieldConfig.labelWidth = fieldConfig.labelWidth; + delegateFieldConfig.labelAlign = fieldConfig.labelAlign; this.delegate = new pimcore.object.tags[fieldConfig.delegateDatatype](data, delegateFieldConfig); } this.fieldConfig = fieldConfig; From 88aeebf1a2c6564ef10278c37bb03858fee5cbf3 Mon Sep 17 00:00:00 2001 From: Bohdan Fil <37467703+djbodya@users.noreply.github.com> Date: Fri, 1 Nov 2024 20:33:18 +0200 Subject: [PATCH 4/5] Update PimcoreApp-all_1.css This fix must remove error like so "No route found https://pimcore.mamadecor.pl/bundles/pimcoreadmin/extjs/images/grid/col-move-top.png%22%20(from%20%22https://pimcore.mamadecor.pl/bundles/pimcoreadmin/extjs/css/PimcoreApp-all_1.css" (cherry picked from commit c93ae6fd99710200f4d69f90ed110c0e7ea1b549) --- public/extjs/css/PimcoreApp-all_1.css | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/public/extjs/css/PimcoreApp-all_1.css b/public/extjs/css/PimcoreApp-all_1.css index 1906ddcbb4..ab0b9cddb7 100644 --- a/public/extjs/css/PimcoreApp-all_1.css +++ b/public/extjs/css/PimcoreApp-all_1.css @@ -13308,7 +13308,7 @@ a.x-color-picker-item:hover { position: absolute; top: -8px; left: -12px; - background-image: url(../images/grid/dd-insert-arrow-right.png); + background-image: url(../img/grid/dd-insert-arrow-right.png); height: 16px; width: 16px; } @@ -13317,7 +13317,7 @@ a.x-color-picker-item:hover { position: absolute; top: -8px; right: -11px; - background-image: url(../images/grid/dd-insert-arrow-left.png); + background-image: url(../img/grid/dd-insert-arrow-left.png); height: 16px; width: 16px; } @@ -13329,11 +13329,11 @@ a.x-color-picker-item:hover { } .x-col-move-top { - background-image: url(../images/grid/col-move-top.png); + background-image: url(../img/grid/col-move-top.png); } .x-col-move-bottom { - background-image: url(../images/grid/col-move-bottom.png); + background-image: url(../img/grid/col-move-bottom.png); } .x-grid-header-ct { From aa26912611decdba8ed1c2cb48ff3d251f5ad36c Mon Sep 17 00:00:00 2001 From: JiaJia Ji Date: Fri, 15 Nov 2024 12:02:59 +0100 Subject: [PATCH 5/5] [Bug]: Fix Icon library Jquery CSP problem (#749) --- src/Security/ContentSecurityPolicyHandler.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Security/ContentSecurityPolicyHandler.php b/src/Security/ContentSecurityPolicyHandler.php index 225bc4bef2..748c3450a6 100644 --- a/src/Security/ContentSecurityPolicyHandler.php +++ b/src/Security/ContentSecurityPolicyHandler.php @@ -59,6 +59,7 @@ class ContentSecurityPolicyHandler implements LoggerAwareInterface ], self::SCRIPT_OPT => [ 'https://buttons.github.io/buttons.js', // GitHub star button on login page + 'https://code.jquery.com/', // jQuery for the icon library ], self::FRAME_OPT => [ 'https://www.youtube-nocookie.com/', // Video preview thumbnail for YouTube