mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
MINOR Removed unused SecurityAdmin->MemberForm() and savemember() (see MemberTableField) (from r113281)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.3@113308 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
924bb63477
commit
84dfacb254
@ -23,7 +23,6 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider {
|
||||
'removememberfromgroup',
|
||||
'savemember',
|
||||
'AddRecordForm',
|
||||
'MemberForm',
|
||||
'EditForm'
|
||||
);
|
||||
|
||||
@ -106,66 +105,6 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider {
|
||||
}
|
||||
}
|
||||
|
||||
public function MemberForm() {
|
||||
$id = $_REQUEST['ID'] ? $_REQUEST['ID'] : Session::get('currentMember');
|
||||
if($id) return $this->getMemberForm($id);
|
||||
}
|
||||
|
||||
public function getMemberForm($id) {
|
||||
if($id && $id != 'new') $record = DataObject::get_by_id('Member', (int) $id);
|
||||
if($record || $id == 'new') {
|
||||
$fields = new FieldSet(
|
||||
new HiddenField('MemberListBaseGroup', '', $this->currentPageID() )
|
||||
);
|
||||
|
||||
if($extraFields = $record->getCMSFields()) {
|
||||
foreach($extraFields as $extra) {
|
||||
$fields->push( $extra );
|
||||
}
|
||||
}
|
||||
|
||||
$fields->push($idField = new HiddenField('ID'));
|
||||
$fields->push($groupIDField = new HiddenField('GroupID'));
|
||||
|
||||
$actions = new FieldSet();
|
||||
$actions->push(new FormAction('savemember', _t('SecurityAdmin.SAVE')));
|
||||
|
||||
$form = new Form($this, 'MemberForm', $fields, $actions);
|
||||
if($record) $form->loadDataFrom($record);
|
||||
|
||||
$idField->setValue($id);
|
||||
$groupIDField->setValue($this->currentPageID());
|
||||
|
||||
return $form;
|
||||
}
|
||||
}
|
||||
|
||||
function savemember() {
|
||||
$data = $_REQUEST;
|
||||
$className = $this->stat('subitem_class');
|
||||
|
||||
$id = $_REQUEST['ID'];
|
||||
if($id == 'new') $id = null;
|
||||
|
||||
if($id) {
|
||||
$record = DataObject::get_by_id($className, $id);
|
||||
if($record && !$record->canEdit()) return Security::permissionFailure($this);
|
||||
} else {
|
||||
if(!singleton($this->stat('subitem_class'))->canCreate()) return Security::permissionFailure($this);
|
||||
$record = new $className();
|
||||
}
|
||||
|
||||
$record->update($data);
|
||||
$record->ID = $id;
|
||||
$record->write();
|
||||
|
||||
$record->Groups()->add($data['GroupID']);
|
||||
|
||||
FormResponse::add("reloadMemberTableField();");
|
||||
|
||||
return FormResponse::respond();
|
||||
}
|
||||
|
||||
function addmember($className=null) {
|
||||
$data = $_REQUEST;
|
||||
unset($data['ID']);
|
||||
|
@ -245,7 +245,6 @@ CMSRightForm.prototype = {
|
||||
this.loadNewPage(response.responseText);
|
||||
|
||||
var subform;
|
||||
if(subform = $('Form_MemberForm')) subform.close();
|
||||
if(subform = $('Form_SubForm')) subform.close();
|
||||
|
||||
if(this.elements.ID) {
|
||||
@ -343,7 +342,6 @@ function autoSave(confirmation, callAfter) {
|
||||
var __forms = []
|
||||
if($('Form_EditForm')) __forms.push($('Form_EditForm'));
|
||||
if($('Form_SubForm')) __forms.push($('Form_SubForm'));
|
||||
if($('Form_MemberForm')) __forms.push($('Form_MemberForm'));
|
||||
|
||||
var __somethingHasChanged = false;
|
||||
var __callAfter = callAfter;
|
||||
|
Loading…
Reference in New Issue
Block a user