diff --git a/code/MemberTableField.php b/code/MemberTableField.php index dc9321ea..1db481b5 100755 --- a/code/MemberTableField.php +++ b/code/MemberTableField.php @@ -89,30 +89,6 @@ class MemberTableField extends ComplexTableField { if(!$hidePassword) { $fieldList["SetPassword"] = "Password"; } - - if(isset($_REQUEST['ctf']['childID']) && $memberID = $_REQUEST['ctf']['childID']) { - $SNG_member = DataObject::get_by_id($this->stat("data_class"),$memberID); - } else { - $SNG_member = singleton(Object::getCustomClass($this->stat("data_class"))); - } - - // If the fieldset is passed, use it, else use the formfields returned - // from the object via a string method call. - if(is_a($this->detailFormFields,"Fieldset")){ - $detailFormFields = $this->detailFormFields; - } else if(is_string($this->detailFormFields)){ - $functioncall = $this->detailFormFields; - if($SNG_member->hasMethod($functioncall)){ - $detailFields = $childData->$functioncall(); - } - } else { - $detailFormFields = $SNG_member->getCMSFields(); - } - - - $this->detailFormValidator = $SNG_member->getValidator(); - - $this->pageSize = $pageLimit; // Legacy: Use setCustomSourceItems() instead. if($members) { @@ -121,7 +97,7 @@ class MemberTableField extends ComplexTableField { $this->hidePassword = $hidePassword; - parent::__construct($controller, $name, $sourceClass, $fieldList, $detailFormFields); + parent::__construct($controller, $name, $sourceClass, $fieldList); Requirements::javascript(CMS_DIR . '/javascript/MemberTableField.js'); Requirements::javascript(CMS_DIR . "/javascript/MemberTableField_popup.js"); @@ -168,51 +144,6 @@ class MemberTableField extends ComplexTableField { return "{$this->Link()}&methodName=add"; } - /** - * TODO Check if this was modified as a result of the - * Ajax changes. As a single method, it should be fairly safe - */ - function DetailForm() { - $ID = Convert::raw2xml(isset($_REQUEST['ctf']['ID']) - ? $_REQUEST['ctf']['ID'] - : ''); - $childID = isset($_REQUEST['ctf']['childID']) ? Convert::raw2xml($_REQUEST['ctf']['childID']) : 0; - $childClass = Convert::raw2xml($_REQUEST['fieldName']); - $methodName = isset($_REQUEST['methodName']) ? $_REQUEST['methodName'] : ''; - - if($methodName == "add") { - $parentIdName = $this->getParentIdName($childClass,$this->getParentClass()); - if(!$parentIdName) { - user_error("ComplexTableField::DetailForm() Dataobject does not seem to have an 'has-one'-relationship", E_USER_WARNING); - return; - } - $this->detailFormFields->push(new HiddenField('parentClass'," ",$this->getParentClass())); - } - - // the ID field confuses the Controller-logic in finding the right view for ReferencedField - $this->detailFormFields->removeByName('ID'); - - $this->detailFormFields->push(new HiddenField("ctf[ID]"," ",$ID)); - // add a namespaced ID instead thats "converted" by saveComplexTableField() - $this->detailFormFields->push(new HiddenField("ctf[childID]","",$childID)); - $this->detailFormFields->push(new HiddenField("ClassName","",$this->sourceClass)); - - $form = Object::create('MemberTableField_Popup', $this, "DetailForm", $this->detailFormFields, $this->sourceClass, $methodName == "show", $this->detailFormValidator); - - if (is_numeric($childID)) { - if ($methodName == "show" || $methodName == "edit") { - $childData = DataObject::get_by_id($this->sourceClass, $childID); - $form->loadDataFrom($childData); - } - } - - if ($methodName == "show") { - $form->makeReadonly(); - } - - return $form; - } - function SearchForm() { $searchFields = new FieldGroup( new TextField('MemberSearch', _t('MemberTableField.SEARCH', 'Search')),