Permalink
Browse files

[#4601] Ensure children of protected Resources inherit by default the…

…ir parents Resource Groups in create UI
  • Loading branch information...
1 parent 7dfeeb0 commit f948cbf694bcdc6fcd330795a2302b05bb7b3a36 Shaun McCormick committed Jul 11, 2011
View
@@ -2,6 +2,7 @@
This file shows the changes in recent releases of MODX. The most current release is usually the
development release, and is only shown to give an idea of what's currently in the pipeline.
+- [#4601] Ensure children of protected Resources inherit by default their parent's Resource Groups in create UI
- [#4016] Update description text in grid when adding/updating element properties without need for page reload
- [#2860] Fix 'Sent On' date when viewing an expanded message
- [#4960] Prevent method declaration error for modPHPMailer::reset()
@@ -22,6 +22,8 @@
$sort = $modx->getOption('sort',$scriptProperties,'name');
$dir = $modx->getOption('dir',$scriptProperties,'ASC');
$resourceId = $modx->getOption('resource',$scriptProperties,0);
+$parent = $modx->getOption('parent',$scriptProperties,0);
+$mode = $modx->getOption('mode',$scriptProperties,'update');
/* get resource */
if (empty($resourceId)) {
@@ -40,10 +42,25 @@
$resourceGroupList = $resource->getGroupsList(array($sort => $dir), $isLimit ? $limit : 0, $start);
$resourceGroups = $resourceGroupList['collection'];
+$parentGroups = array();
+if (!empty($parent) && $mode == 'create') {
+ $parent = $modx->getObject('modResource',$parent);
+ if ($parent) {
+ $parentResourceGroups = $parent->getMany('ResourceGroupResources');
+ foreach ($parentResourceGroups as $parentResourceGroup) {
+ $parentGroups[] = $parentResourceGroup->get('document_group');
+ }
+ $parentGroups = array_unique($parentGroups);
+ }
+}
+
$list = array();
foreach ($resourceGroups as $resourceGroup) {
$resourceGroupArray = $resourceGroup->toArray();
$resourceGroupArray['access'] = (boolean) $resourceGroupArray['access'];
+ if (!empty($parent) && $mode == 'create') {
+ $resourceGroupArray['access'] = in_array($resourceGroupArray['id'],$parentGroups) ? true : false;
+ }
$list[] = $resourceGroupArray;
}
@@ -29,6 +29,7 @@ MODx.page.CreateResource = function(config) {
,access_permissions: config.access_permissions
,publish_document: config.publish_document
,show_tvs: config.show_tvs
+ ,mode: config.mode
}]
});
MODx.page.CreateResource.superclass.constructor.call(this,config);
@@ -33,6 +33,7 @@ MODx.page.UpdateResource = function(config) {
,publish_document: config.publish_document
,access_permissions: config.access_permissions
,show_tvs: config.show_tvs
+ ,mode: config.mode
}]
,buttons: this.getButtons(config)
});
@@ -13,6 +13,8 @@ MODx.grid.ResourceSecurity = function(config) {
,baseParams: {
action: 'getList'
,resource: config.resource
+ ,"parent": config["parent"]
+ ,mode: config.mode || 'update'
}
,saveParams: {
resource: config.resource
@@ -422,6 +422,8 @@ MODx.panel.Resource = function(config) {
xtype: 'modx-grid-resource-security'
,preventRender: true
,resource: config.resource
+ ,mode: config.mode || 'update'
+ ,"parent": config.record["parent"] || 0
,listeners: {
'afteredit': {fn:this.fieldChangeEvent,scope:this}
}
@@ -526,7 +528,7 @@ Ext.extend(MODx.panel.Resource,MODx.FormPanel,{
var g = Ext.getCmp('modx-grid-resource-security');
if (g) {
Ext.apply(o.form.baseParams,{
- resource_groups: g.encodeModified()
+ resource_groups: g.encode()
});
}
if (ta) {
@@ -42,6 +42,7 @@ public function loadCustomCssJs() {
,publish_document: "'.$this->canPublish.'"
,canSave: "'.($this->modx->hasPermission('save_document') ? 1 : 0).'"
,show_tvs: '.(!empty($this->tvCounts) ? 1 : 0).'
+ ,mode: "create"
});
});
// ]]>
@@ -45,6 +45,7 @@ public function loadCustomCssJs() {
,canDuplicate: "'.($this->canDuplicate ? 1 : 0).'"
,canDelete: "'.($this->canDelete ? 1 : 0).'"
,show_tvs: '.(!empty($this->tvCounts) ? 1 : 0).'
+ ,mode: "update"
});
});
// ]]>

0 comments on commit f948cbf

Please sign in to comment.