diff --git a/manager/assets/modext/widgets/core/modx.grid.js b/manager/assets/modext/widgets/core/modx.grid.js index 826d389778..70fc2f1740 100644 --- a/manager/assets/modext/widgets/core/modx.grid.js +++ b/manager/assets/modext/widgets/core/modx.grid.js @@ -55,6 +55,11 @@ MODx.grid.GridBase = function GridBase(config = {}) { }; Ext.applyIf(config.groupingConfig, groupingConfig); + if (Object.hasOwn(config, 'viewConfig') && Object.hasOwn(config.viewConfig, 'getRowClass')) { + Ext.applyIf(config.groupingConfig, { + getRowClass: config.viewConfig.getRowClass + }); + } Ext.applyIf(config, { view: new Ext.grid.GroupingView(config.groupingConfig) }); @@ -1147,9 +1152,13 @@ Ext.extend(MODx.grid.GridBase, Ext.grid.EditorGridPanel, { if (this.cm && Object.hasOwn(this.cm.config[0], 'expandRow')) { rowClasses.push('x-grid3-row-collapsed'); } - // Objects whose records can be activated/deactivated do not depend upon permission to delete - if (markActiveRows && Object.hasOwn(record.data, 'active')) { - const activeClass = record.data.active ? 'grid-row-active' : 'grid-row-inactive'; + /* + Objects whose records can be activated/deactivated do not depend upon + permission to delete; 'visible' prop is used in Form Customization grids, + 'active' in others + */ + if (markActiveRows && (Object.hasOwn(record.data, 'active') || Object.hasOwn(record.data, 'visible'))) { + const activeClass = record.data.active || record.data.visible ? 'grid-row-active' : 'grid-row-inactive'; rowClasses.push(activeClass); } // Early return if no deletion restrictions are in effect diff --git a/manager/assets/modext/widgets/fc/modx.panel.fcprofile.js b/manager/assets/modext/widgets/fc/modx.panel.fcprofile.js index 0a7f5099fc..5b288d76b2 100644 --- a/manager/assets/modext/widgets/fc/modx.panel.fcprofile.js +++ b/manager/assets/modext/widgets/fc/modx.panel.fcprofile.js @@ -150,7 +150,10 @@ Ext.reg('modx-panel-fc-profile', MODx.panel.FCProfile); MODx.grid.FCProfileUserGroups = function(config = {}) { Ext.applyIf(config, { id: 'modx-grid-fc-profile-usergroups', - fields: ['id', 'name'], + fields: [ + 'id', + 'name' + ], autoHeight: true, stateful: false, columns: [{ @@ -158,10 +161,14 @@ MODx.grid.FCProfileUserGroups = function(config = {}) { dataIndex: 'name', renderer: { fn: function(value, metaData, record) { - return this.renderLink(value, { - href: `?a=security/usergroup/update&id=${record.data.id}`, - target: '_blank' - }); + const canEditGroups = MODx.perm.usergroup_edit && MODx.perm.usergroup_save; + return canEditGroups + ? this.renderLink(value, { + href: `?a=security/usergroup/update&id=${record.data.id}`, + target: '_blank' + }) + : value + ; }, scope: this } diff --git a/manager/assets/modext/widgets/fc/modx.panel.fcset.js b/manager/assets/modext/widgets/fc/modx.panel.fcset.js index d2dfd980e6..4fbd1aed28 100644 --- a/manager/assets/modext/widgets/fc/modx.panel.fcset.js +++ b/manager/assets/modext/widgets/fc/modx.panel.fcset.js @@ -314,16 +314,7 @@ MODx.grid.FCSetFields = function(config = {}) { return Ext.util.Format.htmlEncode(v); } }], - viewConfig: { - forceFit: true, - enableRowBody: true, - scrollOffset: 0, - autoFill: true, - showPreview: true, - getRowClass: function(record, rowIndex, rowParams, store) { - return record.data.visible ? 'grid-row-active' : 'grid-row-inactive'; - } - } + viewConfig: this.getViewConfig(false, false, true) }); MODx.grid.FCSetFields.superclass.constructor.call(this, config); this.propRecord = Ext.data.Record.create(config.fields); @@ -370,16 +361,7 @@ MODx.grid.FCSetTabs = function(config = {}) { dataIndex: 'label', editor: { xtype: 'textfield' } }], - viewConfig: { - forceFit: true, - enableRowBody: true, - scrollOffset: 0, - autoFill: true, - showPreview: true, - getRowClass: function(record, rowIndex, rowParams, store) { - return record.data.visible ? 'grid-row-active' : 'grid-row-inactive'; - } - }, + viewConfig: this.getViewConfig(false, false, true), tbar: [{ text: _('create'), cls: 'primary-button', @@ -481,10 +463,14 @@ MODx.grid.FCSetTVs = function(config = {}) { width: 200, renderer: { fn: function(value, metaData, record) { - return this.renderLink(value, { - href: `?a=element/tv/update&id=${record.data.id}`, - target: '_blank' - }); + const canEditTvs = MODx.perm.edit_tv && MODx.perm.save_tv; + return canEditTvs + ? this.renderLink(value, { + href: `?a=element/tv/update&id=${record.data.id}`, + target: '_blank' + }) + : value + ; }, scope: this } @@ -512,16 +498,7 @@ MODx.grid.FCSetTVs = function(config = {}) { width: 70, editor: { xtype: 'textfield' } }], - viewConfig: { - forceFit: true, - enableRowBody: true, - scrollOffset: 0, - autoFill: true, - showPreview: true, - getRowClass: function(record, rowIndex, rowParams, store) { - return record.data.visible ? 'grid-row-active' : 'grid-row-inactive'; - } - } + viewConfig: this.getViewConfig(false, false, true) }); MODx.grid.FCSetTVs.superclass.constructor.call(this, config); this.propRecord = Ext.data.Record.create(config.fields);