mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
ENHANCEMENT Saving group relations on SecurityAdmin->EditForm()/RootForm() through TreeMultiselectField instead of hidden 'Group'/'GroupID' values
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@99579 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
d68bbc2c01
commit
ca3b8d5792
@ -308,15 +308,12 @@ class MemberTableField extends ComplexTableField {
|
||||
function saveComplexTableField($data, $form, $params) {
|
||||
$className = $this->sourceClass();
|
||||
$childData = new $className();
|
||||
$form->saveInto($childData);
|
||||
|
||||
// Needs to write before saveInto() to ensure the 'Groups' TreeMultiselectField saves
|
||||
$childData->write();
|
||||
|
||||
// Only write group if no specific assignments have been set
|
||||
if(isset($data['Groups']) && $data['Groups']) {
|
||||
$childData->Groups()->setByIDList(explode(',', $data['Groups']));
|
||||
} else {
|
||||
$childData->Groups()->add($data['GroupID']);
|
||||
}
|
||||
$form->saveInto($childData);
|
||||
$childData->write();
|
||||
|
||||
$closeLink = sprintf(
|
||||
'<small><a href="' . $_SERVER['HTTP_REFERER'] . '" onclick="javascript:window.top.GB_hide(); return false;">(%s)</a></small>',
|
||||
@ -452,19 +449,6 @@ class MemberTableField_Item extends ComplexTableField_Item {
|
||||
|
||||
class MemberTableField_ItemRequest extends ComplexTableField_ItemRequest {
|
||||
|
||||
function saveComplexTableField($data, $form, $request) {
|
||||
parent::saveComplexTableField($data, $form, $request);
|
||||
|
||||
$childData = $this->dataObj();
|
||||
|
||||
// Only write group if no specific assignments have been set
|
||||
if(isset($data['Groups']) && $data['Groups']) {
|
||||
$childData->Groups()->setByIDList(explode(',', $data['Groups']));
|
||||
} else {
|
||||
$childData->Groups()->add($data['GroupID']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deleting an item from a member table field should just remove that member from the group
|
||||
*/
|
||||
|
@ -88,6 +88,7 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider {
|
||||
);
|
||||
// unset 'inlineadd' permission, we don't want inline addition
|
||||
$memberList->setPermissions(array('show', 'edit', 'delete', 'add'));
|
||||
$memberList->setRelationAutoSetting(false);
|
||||
|
||||
$fields = new FieldSet(
|
||||
new TabSet(
|
||||
|
Loading…
Reference in New Issue
Block a user