mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
Merged revisions 52797 via svnmerge from
http://svn.silverstripe.com/open/modules/cms/branches/govtsecurity ........ r52797 | sminnee | 2008-04-15 22:22:33 +1200 (Tue, 15 Apr 2008) | 1 line Fixed interaction of MemberTableField and member validation ........ git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@53456 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
9ca05b3546
commit
0341a8685e
@ -116,6 +116,7 @@ class MemberTableField extends ComplexTableField {
|
||||
parent::__construct($controller, $name, $sourceClass, $fieldList);
|
||||
|
||||
Requirements::javascript('cms/javascript/MemberTableField.js');
|
||||
Requirements::javascript("cms/javascript/MemberTableField_popup.js");
|
||||
|
||||
// construct the filter and sort
|
||||
if(isset($_REQUEST['MemberOrderByField'])) {
|
||||
@ -376,22 +377,36 @@ class MemberTableField_Popup extends ComplexTableField_Popup {
|
||||
}
|
||||
|
||||
$this->saveInto($childObject);
|
||||
$childObject->write();
|
||||
|
||||
// custom behaviour for MemberTableField: add member to current group
|
||||
$childObject->Groups()->add($_REQUEST['GroupID']);
|
||||
|
||||
$form = $this->controller->DetailForm($childObject->ID);
|
||||
|
||||
$valid = $childObject->validate();
|
||||
if($valid->valid()) {
|
||||
$childObject->write();
|
||||
|
||||
// custom behaviour for MemberTableField: add member to current group
|
||||
$childObject->Groups()->add($_REQUEST['GroupID']);
|
||||
|
||||
} else {
|
||||
$form->sessionMessage($valid->message(), 'bad');
|
||||
}
|
||||
|
||||
|
||||
// if ajax-call in an iframe, update window
|
||||
if(Director::is_ajax()) {
|
||||
// Newly saved objects need their ID reflected in the reloaded form to avoid double saving
|
||||
$form = $this->controller->DetailForm($childObject->ID);
|
||||
$form->loadDataFrom($childObject);
|
||||
FormResponse::update_dom_id($form->FormName(), $form->formHtmlContent(), true, 'update');
|
||||
|
||||
if($valid->valid()) {
|
||||
FormResponse::update_dom_id($form->FormName(), $form->formHtmlContent(), true, 'update');
|
||||
} else {
|
||||
FormResponse::load_form($form->forTemplate(), $form->FormName());
|
||||
}
|
||||
|
||||
return FormResponse::respond();
|
||||
} else {
|
||||
Director::redirectBack();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
@ -2,7 +2,7 @@ MemberTableFieldPopupForm = Class.extend("ComplexTableFieldPopupForm");
|
||||
MemberTableFieldPopupForm.prototype = {
|
||||
initialize: function() {
|
||||
this.ComplexTableFieldPopupForm.initialize();
|
||||
|
||||
|
||||
Behaviour.register({
|
||||
"form#MemberTableField_Popup_DetailForm .Actions input.action": {
|
||||
onclick: this.submitForm.bind(this)
|
||||
|
Loading…
Reference in New Issue
Block a user