From 1bf68baa26d8c2a8d17e13eb16e46a27ae0f99f3 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Wed, 9 Apr 2008 11:34:10 +0000 Subject: [PATCH] Merged revisions 51659 via svnmerge from svn://svn.silverstripe.com/silverstripe/modules/sapphire/branches/2.2.0-mesq ........ r51659 | ischommer | 2008-03-26 15:43:01 +1300 (Wed, 26 Mar 2008) | 1 line ENHANCEMENT Moved Group field generation from SecurityAdmin->getEditForm() to Group->getCMSFields() ........ git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@52414 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- code/SecurityAdmin.php | 65 ++++++++---------------------------------- 1 file changed, 12 insertions(+), 53 deletions(-) diff --git a/code/SecurityAdmin.php b/code/SecurityAdmin.php index 3cd4c352..cf131487 100644 --- a/code/SecurityAdmin.php +++ b/code/SecurityAdmin.php @@ -52,60 +52,19 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider { public function getEditForm($id) { $record = DataObject::get_by_id("Group", $id); - if($record) { - $fields = new FieldSet( - new TabSet("Root", - new Tab(_t('SecurityAdmin.MEMBERS', 'Members'), - new TextField("Title", _t('SecurityAdmin.GROUPNAME', 'Group name')), - $memberList = new MemberTableField( - $this, - "Members", - $record, - null, - false - ) - ), + if(!$record) return false; + + $fields = $record->getCMSFields(); + + $actions = new FieldSet( + new FormAction('addmember',_t('SecurityAdmin.ADDMEMBER','Add Member')), + new FormAction('save',_t('SecurityAdmin.SAVE','Save')) + ); - new Tab(_t('SecurityAdmin.PERMISSIONS', 'Permissions'), - new LiteralField("", "

"._t('SecurityAdmin.ADVANCEDONLY',"This section is for advanced users only. - See this page - for more information.")."

"), - new TableField( - "Permissions", - "Permission", - array( - "Code" => _t('SecurityAdmin.CODE', 'Code'), - "Arg" => _t('SecurityAdmin.OPTIONALID', 'Optional ID'), - ), - array( - "Code" => "PermissionDropdownField", - "Arg" => "TextField", - ), - "GroupID", $id - ) - ) - ) - ); - - if(!Permission::check('EDIT_PERMISSIONS')) $fields->removeFieldFromTab('Root', 'Permissions'); - - $memberList->setController($this); - $memberList->setPermissions(array('show', 'edit', 'delete', 'export', 'add')); - $memberList->setParentClass('Group'); - $memberList->setPopupCaption(_t('SecurityAdmin.VIEWUSER', 'View User')); - - $fields->push($idField = new HiddenField("ID")); - $idField->setValue($id); - $actions = new FieldSet( - new FormAction('addmember',_t('SecurityAdmin.ADDMEMBER','Add Member')) - ); - - $actions->push(new FormAction('save',_t('SecurityAdmin.SAVE','Save'))); - - $form = new Form($this, "EditForm", $fields, $actions); - $form->loadDataFrom($record); - return $form; - } + $form = new Form($this, "EditForm", $fields, $actions); + $form->loadDataFrom($record); + + return $form; }