diff --git a/_build/templates/default/sass/index.scss b/_build/templates/default/sass/index.scss index 67a987c5d60..c92b65fb43f 100644 --- a/_build/templates/default/sass/index.scss +++ b/_build/templates/default/sass/index.scss @@ -1561,16 +1561,18 @@ iframe[classname="x-hidden"] { .x-panel-bwrap { background-color: transparent !important; } + + p { + &:not(:first-of-type) { + margin-top: 0.5rem; + } + } } .with-title .panel-desc { margin: 0; } -.panel-desc p { - padding: 0; -} - /* All the other wrapped element (forms need to be wrapped in a panel isolated from the other components) */ .main-wrapper { background-color: $white; diff --git a/core/lexicon/en/access.inc.php b/core/lexicon/en/access.inc.php index bbdb28d5795..ab33f92769c 100644 --- a/core/lexicon/en/access.inc.php +++ b/core/lexicon/en/access.inc.php @@ -92,6 +92,7 @@ $_lang['resource_group_err_create'] = 'An error occurred while trying to create the resource group.'; $_lang['resource_group_err_nf'] = 'Resource group not found.'; $_lang['resource_group_err_ns'] = 'Resource group not specified.'; +$_lang['resource_group_err_name_ns'] = 'Please enter a name for the Resource Group.'; $_lang['resource_group_err_remove'] = 'An error occurred while trying to delete the resource group.'; $_lang['resource_group_remove'] = 'Delete Resource Group'; $_lang['resource_group_remove_confirm'] = 'Are you sure you want to delete the resource group: "[[+resource_group]]"?'; diff --git a/core/lexicon/en/default.inc.php b/core/lexicon/en/default.inc.php index 93a8896ba0b..aedaf996be2 100644 --- a/core/lexicon/en/default.inc.php +++ b/core/lexicon/en/default.inc.php @@ -415,6 +415,7 @@ $_lang['resource_group'] = 'Resource Group'; $_lang['resource_group_id'] = 'RG ID'; $_lang['resource_groups'] = 'Resource Groups'; +$_lang['resource_groups_panel_desc'] = '

Drag Resources into and between Resource Groups.

By default, dragging a Resource from one group to another will move it, not copy it. To copy a Resource in one group to another group, press and hold the option/alt key before clicking and dragging the Resource.

'; $_lang['resource_management'] = 'Manage resources'; $_lang['resource_name'] = 'Resource name'; $_lang['resource_name_new'] = 'New Resource Name'; @@ -564,6 +565,7 @@ // Temporarily match old keys to new ones to ensure compatibility $_lang['clear_cache_on_save_msg'] = $_lang['clear_cache_on_save_desc']; +$_lang['rrg_drag'] = $_lang['resource_groups_panel_desc']; /* Shared lang entries for elements -- diff --git a/core/lexicon/en/user.inc.php b/core/lexicon/en/user.inc.php index 984b0326fe0..74e08096ec6 100644 --- a/core/lexicon/en/user.inc.php +++ b/core/lexicon/en/user.inc.php @@ -52,7 +52,6 @@ $_lang['role_remove_confirm'] = 'Are you sure you want to delete this role?'; $_lang['role_warn_authority_locked'] = 'This Role’s authority can not be changed because this Role is currently assigned to one or more Access Control List entries.'; $_lang['roles'] = 'Roles'; -$_lang['rrg_drag'] = 'Drag resources into resource groups here.'; $_lang['ugc_grid_title'] = 'User Group Access to Contexts'; $_lang['ugc_remove'] = 'Delete User Group Access to this Context'; $_lang['ugrg_grid_title'] = 'User Group Access to Resource Groups'; diff --git a/core/src/Revolution/Processors/Security/ResourceGroup/Create.php b/core/src/Revolution/Processors/Security/ResourceGroup/Create.php index aaf2dfa21f1..6e1625c3a2f 100644 --- a/core/src/Revolution/Processors/Security/ResourceGroup/Create.php +++ b/core/src/Revolution/Processors/Security/ResourceGroup/Create.php @@ -1,4 +1,5 @@ getProperty('name'); if (empty($name)) { - $this->addFieldError('name', $this->modx->lexicon('resource_group_ns_name')); + $this->addFieldError('name', $this->modx->lexicon('resource_group_err_name_ns')); } if ($this->doesAlreadyExist(['name' => $name])) { diff --git a/core/src/Revolution/Processors/Security/ResourceGroup/Update.php b/core/src/Revolution/Processors/Security/ResourceGroup/Update.php index 18fca13286e..68267d2ff1b 100644 --- a/core/src/Revolution/Processors/Security/ResourceGroup/Update.php +++ b/core/src/Revolution/Processors/Security/ResourceGroup/Update.php @@ -1,4 +1,5 @@ getProperty('name'); if (empty($name)) { - $this->addFieldError('name', $this->modx->lexicon('resource_group_err_ns_name')); + $this->addFieldError('name', $this->modx->lexicon('resource_group_err_name_ns')); } if ($this->alreadyExists($name)) { diff --git a/core/src/Revolution/Processors/Security/ResourceGroup/UpdateResourcesIn.php b/core/src/Revolution/Processors/Security/ResourceGroup/UpdateResourcesIn.php index ca91ea749fd..5eea148a526 100644 --- a/core/src/Revolution/Processors/Security/ResourceGroup/UpdateResourcesIn.php +++ b/core/src/Revolution/Processors/Security/ResourceGroup/UpdateResourcesIn.php @@ -1,4 +1,5 @@ getProperty('resource', ''), '_'), 1); - $resourceGroupId = substr(strrchr($this->getProperty('resourceGroup', ''), '_'), 1); + $resourceId = $this->getProperty('resource', ''); + $resourceGroupId = $this->getProperty('resourceGroup', ''); if (empty($resourceId) || empty($resourceGroupId)) { return $this->modx->lexicon('invalid_data'); @@ -56,10 +56,12 @@ public function beforeSave() return $this->modx->lexicon('resource_group_err_nf'); } - if ($this->doesAlreadyExist([ - 'document' => $this->resource->get('id'), - 'document_group' => $this->resourceGroup->get('id'), - ])) { + if ( + $this->doesAlreadyExist([ + 'document' => $this->resource->get('id'), + 'document_group' => $this->resourceGroup->get('id'), + ]) + ) { return $this->modx->lexicon($this->objectType . '_err_ae'); } @@ -91,5 +93,4 @@ public function cleanup() return $this->success('', $objArray); } - } diff --git a/manager/assets/modext/widgets/security/modx.panel.resource.group.js b/manager/assets/modext/widgets/security/modx.panel.resource.group.js index 2322871686e..79b7911fe2d 100644 --- a/manager/assets/modext/widgets/security/modx.panel.resource.group.js +++ b/manager/assets/modext/widgets/security/modx.panel.resource.group.js @@ -19,7 +19,7 @@ MODx.panel.ResourceGroups = function(config) { ,layout: 'form' ,defaults: { border: false ,autoHeight: true } ,items: [{ - html: '

'+_('rrg_drag')+'

' + html: _('resource_groups_panel_desc') ,xtype: 'modx-description' },{ layout: 'column' diff --git a/manager/assets/modext/widgets/security/modx.tree.resource.group.js b/manager/assets/modext/widgets/security/modx.tree.resource.group.js index 4a7a739b316..2d3a2c5952d 100644 --- a/manager/assets/modext/widgets/security/modx.tree.resource.group.js +++ b/manager/assets/modext/widgets/security/modx.tree.resource.group.js @@ -6,216 +6,284 @@ * @param {Object} config An object of options. * @xtype modx-tree-resourcegroup */ -MODx.tree.ResourceGroup = function(config) { - config = config || {}; - Ext.applyIf(config,{ - title: _('resource_groups') - ,url: MODx.config.connector_url - ,action: 'Security/ResourceGroup/GetNodes' - ,rootIconCls: 'icon-files-o' - ,root_id: '0' - ,root_name: _('resource_groups') - ,enableDrag: false - ,enableDrop: true - ,ddAppendOnly: true - ,useDefaultToolbar: true - ,baseParams: { +MODx.tree.ResourceGroup = function(config = {}) { + Ext.applyIf(config, { + title: _('resource_groups'), + url: MODx.config.connector_url, + action: 'Security/ResourceGroup/GetNodes', + rootIconCls: 'icon-files-o', + root_id: '0', + root_name: _('resource_groups'), + enableDrag: false, + enableDrop: true, + ddAppendOnly: true, + useDefaultToolbar: true, + baseParams: { limit: 0 - } - ,tbar: ['->', { - text: _('resource_group_create') - ,cls: 'primary-button' - ,scope: this - ,handler: this.createResourceGroup + }, + tbar: ['->', { + text: _('resource_group_create'), + cls: 'primary-button', + scope: this, + handler: this.createResourceGroup }] }); - MODx.tree.ResourceGroup.superclass.constructor.call(this,config); + MODx.tree.ResourceGroup.superclass.constructor.call(this, config); }; -Ext.extend(MODx.tree.ResourceGroup,MODx.tree.Tree,{ - forms: {} - ,windows: {} - ,stores: {} +Ext.extend(MODx.tree.ResourceGroup, MODx.tree.Tree, { + forms: {}, + windows: {}, + stores: {}, - ,getMenu: function() { - var n = this.cm.activeNode; - var m = []; - if (n.attributes.type == 'MODX\\Revolution\\modResourceGroup') { - m.push({ - text: _('resource_group_create') - ,handler: this.createResourceGroup + getMenu: function() { + const + { activeNode } = this.cm, + menu = [] + ; + if (activeNode.attributes.type === 'MODX\\Revolution\\modResourceGroup') { + menu.push({ + text: _('resource_group_create'), + handler: this.createResourceGroup }); - m.push('-'); - m.push({ - text: _('resource_group_update') - ,handler: this.updateResourceGroup + menu.push('-'); + menu.push({ + text: _('resource_group_update'), + handler: this.updateResourceGroup }); - m.push('-'); - m.push({ - text: _('resource_group_remove') - ,handler: this.removeResourceGroup + menu.push('-'); + menu.push({ + text: _('resource_group_remove'), + handler: this.removeResourceGroup }); - } else if (n.attributes.type == 'MODX\\Revolution\\modResource' || n.attributes.type == 'MODX\\Revolution\\modDocument') { - m.push({ - text: _('resource_group_access_remove') - ,handler: this.removeResource + } else if ( + activeNode.attributes.type === 'MODX\\Revolution\\modResource' + || activeNode.attributes.type === 'MODX\\Revolution\\modDocument' + ) { + menu.push({ + text: _('resource_group_access_remove'), + handler: this.removeResource }); } - return m; - } + return menu; + }, - ,updateResourceGroup: function(itm,e) { - var r = this.cm.activeNode.attributes.data; + updateResourceGroup: function(item, e) { + const record = this.cm.activeNode.attributes.data; if (!this.windows.updateResourceGroup) { this.windows.updateResourceGroup = MODx.load({ - xtype: 'modx-window-resourcegroup-update' - ,record: r - ,listeners: { - 'success': {fn:this.refresh,scope:this} + xtype: 'modx-window-resourcegroup-update', + record: record, + listeners: { + success: { + fn: this.refresh, + scope: this + } } }); } this.windows.updateResourceGroup.reset(); - this.windows.updateResourceGroup.setValues(r); + this.windows.updateResourceGroup.setValues(record); this.windows.updateResourceGroup.show(e.target); + }, - } - - ,removeResource: function(item,e) { - var n = this.cm.activeNode; - var resourceId = n.id.split('_'); resourceId = resourceId[1]; - var resourceGroupId = n.parentNode.id.substr(2).split('_'); resourceGroupId = resourceGroupId[1]; - + removeResource: function(item, e) { + const + { activeNode } = this.cm, + resourceId = activeNode.id.split('_')[1], + resourceGroupId = activeNode.parentNode.id.substr(2).split('_')[1] + ; MODx.msg.confirm({ - text: _('resource_group_access_remove_confirm') - ,url: this.config.url - ,params: { - action: 'Security/ResourceGroup/RemoveResource' - ,resource: resourceId - ,resourceGroup: resourceGroupId - } - ,listeners: { - 'success': {fn:this.refresh,scope:this} + text: _('resource_group_access_remove_confirm'), + url: this.config.url, + params: { + action: 'Security/ResourceGroup/RemoveResource', + resource: resourceId, + resourceGroup: resourceGroupId + }, + listeners: { + success: { + fn: this.refresh, + scope: this + } } }); - } + }, - ,removeResourceGroup: function(item,e) { - var n = this.cm.activeNode; - var id = n.id.substr(2).split('_'); id = id[1]; - var resource_group = n.text; + /** + * Removes the dragged resource from its source group (when not in copy mode) + * @param {Number} resourceId The id of the resource being moved + * @param {Number} previousGroupId The id of the resource group from which the dragged resource will be removed + */ + removeResourceFromPreviousGroup: function(resourceId, previousGroupId) { + MODx.Ajax.request({ + url: this.config.url, + scope: this, + params: { + resource: resourceId, + resourceGroup: previousGroupId, + action: 'Security/ResourceGroup/RemoveResource' + }, + listeners: { + failure: { + fn: function(response) { + Ext.Msg.alert(_('error'), response.message); + }, + scope: this + } + } + }); + }, + removeResourceGroup: function(item, e) { + const + { activeNode } = this.cm.activeNode, + resourceGroupId = activeNode.id.substr(2).split('_')[1], + resourceGroupName = activeNode.text + ; MODx.msg.confirm({ - text: _('resource_group_remove_confirm',{ - resource_group: resource_group - }) - ,url: this.config.url - ,params: { - action: 'Security/ResourceGroup/Remove' - ,id: id - } - ,listeners: { - 'success': {fn:this.refresh,scope:this} + text: _('resource_group_remove_confirm', { + resource_group: resourceGroupName + }), + url: this.config.url, + params: { + action: 'Security/ResourceGroup/Remove', + id: resourceGroupId + }, + listeners: { + failure: { + fn: function(response) { + Ext.Msg.alert(_('error'), response.message); + }, + scope: this + } } }); - } + }, - ,createResourceGroup: function(itm,e) { + createResourceGroup: function(item, e) { if (!this.windows.create) { this.windows.create = MODx.load({ - xtype: 'modx-window-resourcegroup-create' - ,listeners: { - 'success': {fn:this.refresh,scope:this} + xtype: 'modx-window-resourcegroup-create', + listeners: { + success: { + fn: this.refresh, + scope: this + } } }); } this.windows.create.show(e.target); - } + }, - ,_handleDrop: function(e){ - var n = e.dropNode; + _handleDrop: function(e) { + const node = e.dropNode; - if(this.isDocCopy(e,n)) { - var copy = new Ext.tree.TreeNode( - Ext.apply({leaf: true,allowDelete:true,expanded:true}, n.attributes) + if (this.isDocCopy(e, node)) { + const copy = new Ext.tree.TreeNode( + Ext.apply({ leaf: true, allowDelete: true, expanded: true }, node.attributes) ); copy.loader = undefined; - if(e.target.attributes.options){ + if (e.target.attributes.options) { e.target = this.createDGD(e.target, copy.text); } e.dropNode = copy; return true; } return false; - } + }, - ,isDocCopy: function(e, n) { - var a = e.target.attributes; - var docid = n.attributes.id.split('_'); docid = 'n_'+docid[1]; + isDocCopy: function(e, node) { + const docId = `n_${node.attributes.id.split('_')[1]}`; - if (e.target.findChild('id',docid) !== null) { return false; } - if (n.attributes.type != 'MODX\\Revolution\\modResource' && n.attributes.type != 'MODX\\Revolution\\modDocument') { return false; } - if (e.point != 'append') { return false; } - if (a.type != 'MODX\\Revolution\\modResourceGroup') { return false; } - return a.leaf !== true; - - } - - ,createDGD: function(n, text){ - var cnode = this.getNodeById(n.attributes.cmpId); + if (e.target.findChild('id', docId) !== null) { + return false; + } + if ( + node.attributes.type !== 'MODX\\Revolution\\modResource' + && node.attributes.type !== 'MODX\\Revolution\\modDocument' + ) { + return false; + } + if (e.point !== 'append') { + return false; + } + if (e.target.attributes.type !== 'MODX\\Revolution\\modResourceGroup') { + return false; + } + return e.target.attributes.leaf !== true; + }, - var node = new Ext.tree.TreeNode({ - text: text - ,cmpId:cnode.id - ,leaf: true - ,allowDelete:true - ,allowEdit:true - ,id:this._guid('o-') - }); + createDGD: function(n, text) { + const + cnode = this.getNodeById(n.attributes.cmpId), + node = new Ext.tree.TreeNode({ + text: text, + cmpId: cnode.id, + leaf: true, + allowDelete: true, + allowEdit: true, + id: this._guid('o-') + }) + ; cnode.childNodes[2].appendChild(node); cnode.childNodes[2].expand(false, false); return node; - } + }, - ,_handleDrag: function(dropEvent) { - Ext.Msg.show({ - title: _('please_wait') - ,msg: _('saving') - ,width: 240 - ,progress:true - ,closable:false - }); + _handleDrag: function(dropEvent) { + /* + - - Node id formats -- + dropEvent.target.attributes.id: + n_dg_[group-id], e.g., n_dg_2 + dropEvent.dropNode.attributes.id (the resource being moved): + from Contexts: [context-key]_[resource-id], e.g., web_18 + between Groups: n_[resource-id]_[source-group-id], e.g., n_35_1 + */ - MODx.util.Progress.reset(); - for(var i = 1; i < 20; i++) { - setTimeout('MODx.util.Progress.time('+i+','+MODx.util.Progress.id+')',i*1000); + if (Ext.isEmpty(dropEvent.target.attributes.id) || Ext.isEmpty(dropEvent.dropNode.attributes.id)) { + return; } + const + dropNodeId = dropEvent.dropNode.attributes.id.split('_'), + sourceIsGroup = dropNodeId.length === 3, + previousGroupId = sourceIsGroup ? dropNodeId[2] : false, + resourceGroupId = dropEvent.target.attributes.id.split('_')[2], + resourceId = dropNodeId[1] + ; MODx.Ajax.request({ - url: this.config.url - ,scope: this - ,params: { - resource: dropEvent.dropNode.attributes.id - ,resourceGroup: dropEvent.target.attributes.id - ,action: 'Security/ResourceGroup/UpdateResourcesIn' - } - ,listeners: { - 'success': {fn: function(r,o) { - MODx.util.Progress.reset(); - Ext.Msg.hide(); - if (!r.success) { - Ext.Msg.alert(_('error'),r.message); - return false; - } - this.refresh(); - return true; - },scope:this} + url: this.config.url, + scope: this, + params: { + resource: resourceId, + resourceGroup: resourceGroupId, + action: 'Security/ResourceGroup/UpdateResourcesIn' + }, + listeners: { + success: { + fn: function(response) { + // Cleanup source node when moving between groups + if (response.success && sourceIsGroup && !dropEvent.rawEvent.altKey) { + this.removeResourceFromPreviousGroup(resourceId, previousGroupId); + } + this.refresh(); + }, + scope: this + }, + failure: { + fn: function(response) { + Ext.Msg.alert(_('error'), response.message); + this.refresh(); + }, + scope: this + } } }); } }); -Ext.reg('modx-tree-resource-group',MODx.tree.ResourceGroup); +Ext.reg('modx-tree-resource-group', MODx.tree.ResourceGroup); /** * @class MODx.window.CreateResourceGroup @@ -223,121 +291,120 @@ Ext.reg('modx-tree-resource-group',MODx.tree.ResourceGroup); * @param {Object} config An object of configuration resource groups * @xtype modx-window-resourcegroup-create */ -MODx.window.CreateResourceGroup = function(config) { - config = config || {}; - this.ident = config.ident || 'modx-crgrp'+Ext.id(); - Ext.applyIf(config,{ - title: _('resource_group_create') - ,id: this.ident - ,width: 600 - ,stateful: false - ,url: MODx.config.connector_url - ,action: 'Security/ResourceGroup/Create' - ,fields: [{ - fieldLabel: _('name') - ,name: 'name' - ,id: 'modx-'+this.ident+'-name' - ,xtype: 'textfield' - ,anchor: '100%' - },{ - xtype: 'fieldset' - ,collapsible: true - ,collapsed: false - ,title: _('resource_group_automatic_access') - ,items: [{ - html: '

'+_('resource_group_automatic_access_desc')+'

' - ,cls: 'desc-under' - },{ - xtype: 'textfield' - ,name: 'access_contexts' - ,fieldLabel: _('contexts') - ,description: MODx.expandHelp ? '' : _('resource_group_access_contexts') - ,id: this.ident+'-access-contexts' - ,anchor: '100%' - ,value: 'web' - },{ - xtype: MODx.expandHelp ? 'label' : 'hidden' - ,forId: this.ident+'-access-contexts' - ,html: _('resource_group_access_contexts') - ,cls: 'desc-under' - },{ - layout: 'column' - ,border: false - ,defaults: { - layout: 'form' - ,labelAlign: 'top' - ,anchor: '100%' - ,border: false - } - ,items: [{ - columnWidth: .5 - ,items: [{ - boxLabel: _('resource_group_access_admin') - ,description: _('resource_group_access_admin_desc') - ,name: 'access_admin' - ,id: this.ident+'-access-admin' - ,xtype: 'checkbox' - ,checked: false - ,inputValue: 1 - ,anchor: '100%' - },{ - xtype: MODx.expandHelp ? 'label' : 'hidden' - ,forId: this.ident+'-access-admin' - ,html: _('resource_group_access_admin_desc') - ,cls: 'desc-under' - },{ - boxLabel: _('resource_group_access_anon') - ,description: _('resource_group_access_anon_desc') - ,name: 'access_anon' - ,id: this.ident+'-access-anon' - ,xtype: 'checkbox' - ,checked: false - ,inputValue: 1 - ,anchor: '100%' - },{ - xtype: MODx.expandHelp ? 'label' : 'hidden' - ,forId: this.ident+'-access-anon' - ,html: _('resource_group_access_anon_desc') - ,cls: 'desc-under' +MODx.window.CreateResourceGroup = function(config = {}) { + this.ident = config.ident || `modx-create-resource-grp-${Ext.id()}`; + Ext.applyIf(config, { + title: _('resource_group_create'), + id: this.ident, + width: 600, + stateful: false, + url: MODx.config.connector_url, + action: 'Security/ResourceGroup/Create', + fields: [{ + fieldLabel: _('name'), + name: 'name', + id: `modx-${this.ident}-name`, + xtype: 'textfield', + allowBlank: false, + blankText: _('resource_group_err_name_ns'), + anchor: '100%' + }, { + xtype: 'fieldset', + collapsible: true, + collapsed: false, + title: _('resource_group_automatic_access'), + defaults: { + labelSeparator: '', + anchor: '100%' + }, + items: [{ + html: `

${_('resource_group_automatic_access_desc')}

`, + cls: 'desc-under' + }, { + xtype: 'textfield', + name: 'access_contexts', + fieldLabel: _('contexts'), + description: MODx.expandHelp ? '' : _('resource_group_access_contexts'), + id: `${this.ident}-access-contexts`, + value: 'web' + }, { + xtype: 'box', + hidden: !MODx.expandHelp, + html: _('resource_group_access_contexts'), + cls: 'desc-under' + }, { + layout: 'column', + border: false, + defaults: { + layout: 'form', + labelSeparator: '' + }, + items: [{ + columnWidth: 0.5, + items: [{ + boxLabel: _('resource_group_access_admin'), + description: _('resource_group_access_admin_desc'), + name: 'access_admin', + id: `${this.ident}-access-admin`, + xtype: 'checkbox', + checked: false, + inputValue: 1 + }, { + xtype: 'box', + hidden: !MODx.expandHelp, + html: _('resource_group_access_admin_desc'), + cls: 'desc-under' + }, { + boxLabel: _('resource_group_access_anon'), + description: _('resource_group_access_anon_desc'), + name: 'access_anon', + id: `${this.ident}-access-anon`, + xtype: 'checkbox', + checked: false, + inputValue: 1 + }, { + xtype: 'box', + hidden: !MODx.expandHelp, + html: _('resource_group_access_anon_desc'), + cls: 'desc-under' }] - },{ - columnWidth: .5 - ,items: [{ - boxLabel: _('resource_group_access_parallel') - ,description: _('resource_group_access_parallel_desc') - ,name: 'access_parallel' - ,id: this.ident+'-access-parallel' - ,xtype: 'checkbox' - ,checked: false - ,inputValue: 1 - ,anchor: '100%' - },{ - xtype: MODx.expandHelp ? 'label' : 'hidden' - ,forId: this.ident+'-access-parallel' - ,html: _('resource_group_access_parallel_desc') - ,cls: 'desc-under' - },{ - fieldLabel: _('resource_group_access_ugs') - ,description: _('resource_group_access_ugs_desc') - ,name: 'access_usergroups' - ,id: this.ident+'-access-usergroups' - ,xtype: 'textfield' - ,value: '' - ,anchor: '100%' - },{ - xtype: MODx.expandHelp ? 'label' : 'hidden' - ,forId: this.ident+'-access-usergroups' - ,html: _('resource_group_access_ugs_desc') - ,cls: 'desc-under' + }, { + columnWidth: 0.5, + items: [{ + boxLabel: _('resource_group_access_parallel'), + description: _('resource_group_access_parallel_desc'), + name: 'access_parallel', + id: `${this.ident}-access-parallel`, + xtype: 'checkbox', + checked: false, + inputValue: 1 + }, { + xtype: 'box', + hidden: !MODx.expandHelp, + html: _('resource_group_access_parallel_desc'), + cls: 'desc-under' + }, { + fieldLabel: _('resource_group_access_ugs'), + description: _('resource_group_access_ugs_desc'), + name: 'access_usergroups', + id: `${this.ident}-access-usergroups`, + xtype: 'textfield', + value: '', + anchor: '100%' + }, { + xtype: 'box', + hidden: !MODx.expandHelp, + html: _('resource_group_access_ugs_desc'), + cls: 'desc-under' }] }] }] }] }); - MODx.window.CreateResourceGroup.superclass.constructor.call(this,config); + MODx.window.CreateResourceGroup.superclass.constructor.call(this, config); }; -Ext.extend(MODx.window.CreateResourceGroup,MODx.Window); -Ext.reg('modx-window-resourcegroup-create',MODx.window.CreateResourceGroup); +Ext.extend(MODx.window.CreateResourceGroup, MODx.Window); +Ext.reg('modx-window-resourcegroup-create', MODx.window.CreateResourceGroup); /** * @class MODx.window.UpdateResourceGroup @@ -345,27 +412,28 @@ Ext.reg('modx-window-resourcegroup-create',MODx.window.CreateResourceGroup); * @param {Object} config An object of configuration resource groups * @xtype modx-window-resourcegroup-update */ -MODx.window.UpdateResourceGroup = function(config) { - config = config || {}; - this.ident = config.ident || 'urgrp'+Ext.id(); - Ext.applyIf(config,{ - title: _('resource_group_update') - ,id: this.ident - ,url: MODx.config.connector_url - ,action: 'Security/ResourceGroup/Update' - ,fields: [{ - name: 'id' - ,xtype: 'hidden' - ,id: 'modx-'+this.ident+'-id' - },{ - fieldLabel: _('name') - ,name: 'name' - ,id: 'modx-'+this.ident+'-name' - ,xtype: 'textfield' - ,anchor: '100%' +MODx.window.UpdateResourceGroup = function(config = {}) { + this.ident = config.ident || `modx-update-resource-grp-${Ext.id()}`; + Ext.applyIf(config, { + title: _('resource_group_update'), + id: this.ident, + url: MODx.config.connector_url, + action: 'Security/ResourceGroup/Update', + fields: [{ + name: 'id', + xtype: 'hidden', + id: `modx-${this.ident}-id` + }, { + fieldLabel: _('name'), + name: 'name', + id: `modx-${this.ident}-name`, + xtype: 'textfield', + allowBlank: false, + blankText: _('resource_group_err_name_ns'), + anchor: '100%' }] }); - MODx.window.UpdateResourceGroup.superclass.constructor.call(this,config); + MODx.window.UpdateResourceGroup.superclass.constructor.call(this, config); }; -Ext.extend(MODx.window.UpdateResourceGroup,MODx.Window); -Ext.reg('modx-window-resourcegroup-update',MODx.window.UpdateResourceGroup); +Ext.extend(MODx.window.UpdateResourceGroup, MODx.Window); +Ext.reg('modx-window-resourcegroup-update', MODx.window.UpdateResourceGroup);