diff --git a/admin/code/AdminRootController.php b/admin/code/AdminRootController.php index 765500c03..77a394ce6 100644 --- a/admin/code/AdminRootController.php +++ b/admin/code/AdminRootController.php @@ -1,5 +1,9 @@ * - * @package cms - * @subpackage batchaction + * @package framework + * @subpackage admin */ abstract class CMSBatchAction extends Object { diff --git a/admin/code/CMSBatchActionHandler.php b/admin/code/CMSBatchActionHandler.php index d3229e694..a8854e662 100644 --- a/admin/code/CMSBatchActionHandler.php +++ b/admin/code/CMSBatchActionHandler.php @@ -3,8 +3,8 @@ /** * Special request handler for admin/batchaction * - * @package cms - * @subpackage batchaction + * @package framework + * @subpackage admin */ class CMSBatchActionHandler extends RequestHandler { diff --git a/admin/code/CMSForm.php b/admin/code/CMSForm.php index a03d51178..39641a95c 100644 --- a/admin/code/CMSForm.php +++ b/admin/code/CMSForm.php @@ -1,6 +1,11 @@ setCurrentPageID(Member::currentUserID()); $form = parent::getEditForm($id, $fields); - if($form instanceof SS_HTTPResponse) return $form; + if($form instanceof SS_HTTPResponse) { + return $form; + } + $form->Fields()->removeByName('LastVisited'); $form->Fields()->push(new HiddenField('ID', null, Member::currentUserID())); $form->Actions()->push( @@ -32,11 +40,21 @@ class CMSProfileController extends LeftAndMain { ->setAttribute('data-icon', 'accept') ->setUseButtonTag(true) ); + $form->Actions()->removeByName('action_delete'); - $form->setValidator(new Member_Validator()); $form->setTemplate('Form'); $form->setAttribute('data-pjax-fragment', null); - if($form->Fields()->hasTabset()) $form->Fields()->findOrMakeTab('Root')->setTemplate('CMSTabSet'); + + if($member = Member::currentUser()) { + $form->setValidator($member->getValidator()); + } else { + $form->setValidator(Injector::inst()->get('Member')->getValidator()); + } + + if($form->Fields()->hasTabset()) { + $form->Fields()->findOrMakeTab('Root')->setTemplate('CMSTabSet'); + } + $form->addExtraClass('member-profile-form root-form cms-edit-form cms-panel-padded center'); return $form; diff --git a/admin/code/GroupImportForm.php b/admin/code/GroupImportForm.php index e4271f002..a544e8373 100644 --- a/admin/code/GroupImportForm.php +++ b/admin/code/GroupImportForm.php @@ -1,10 +1,11 @@ getRecord($id); - if($record && !$record->canView()) return Security::permissionFailure($this); + + if($record && !$record->canView()) { + return Security::permissionFailure($this); + } $memberList = GridField::create( 'Members', @@ -70,7 +75,16 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider { ->addComponent(new GridFieldButtonRow('after')) ->addComponent(new GridFieldExportButton('buttons-after-left')) )->addExtraClass("members_grid"); - $memberListConfig->getComponentByType('GridFieldDetailForm')->setValidator(new Member_Validator()); + + if($record && method_exists($record, 'getValidator')) { + $validator = $record->getValidator(); + } else { + $validator = Injector::inst()->get('Member')->getValidator(); + } + + $memberListConfig + ->getComponentByType('GridFieldDetailForm') + ->setValidator($validator); $groupList = GridField::create( 'Groups', diff --git a/forms/RequiredFields.php b/forms/RequiredFields.php index 1e3adbd08..960a2bcde 100644 --- a/forms/RequiredFields.php +++ b/forms/RequiredFields.php @@ -1,10 +1,12 @@ required = array(); + return $this; } @@ -50,7 +55,9 @@ class RequiredFields extends Validator { * Debug helper */ public function debug() { - if(!is_array($this->required)) return false; + if(!is_array($this->required)) { + return false; + } $result = "