mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
elofgren: BUGFIX: If no selection is made in the left tree, and a draft is added, parentID won't be set, so don't rely on it being set in Javascript and instead add a hidden ParentID field that is returned by PHP and use that so it is alway set correctly. This solves a bug where Newsletter drafts will be added, but not show up in the left tree (because of a Javascript error), if no selection has been made.
(merged from branches/gsoc) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@42059 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
d17251a311
commit
e63c16fcff
@ -384,6 +384,8 @@ class NewsletterAdmin extends LeftAndMain {
|
|||||||
$fields = $email->getCMSFields($this);
|
$fields = $email->getCMSFields($this);
|
||||||
$fields->push($idField = new HiddenField("ID"));
|
$fields->push($idField = new HiddenField("ID"));
|
||||||
$idField->setValue($myId);
|
$idField->setValue($myId);
|
||||||
|
$fields->push($ParentidField = new HiddenField("ParentID"));
|
||||||
|
$ParentidField->setValue($email->ParentID);
|
||||||
$fields->push($typeField = new HiddenField("Type"));
|
$fields->push($typeField = new HiddenField("Type"));
|
||||||
$typeField->setValue('Newsletter');
|
$typeField->setValue('Newsletter');
|
||||||
//$fields->push(new HiddenField("executeForm", "", "EditForm") );
|
//$fields->push(new HiddenField("executeForm", "", "EditForm") );
|
||||||
|
@ -300,6 +300,9 @@ AddForm.prototype = {
|
|||||||
|
|
||||||
// create a new node and add it to the site tree
|
// create a new node and add it to the site tree
|
||||||
if( type == 'draft' ) {
|
if( type == 'draft' ) {
|
||||||
|
// BUGFIX: If no selection is made in the left tree, and a draft is added, parentID won't be set,
|
||||||
|
// so we need to use the value from the Draft edit form.
|
||||||
|
parentID = $('Form_EditForm_ParentID').value;
|
||||||
$('sitetree').addDraftNode('New draft newsletter', parentID, $('Form_EditForm_ID').value );
|
$('sitetree').addDraftNode('New draft newsletter', parentID, $('Form_EditForm_ID').value );
|
||||||
} else {
|
} else {
|
||||||
$('sitetree').addTypeNode('New newsletter type', $('Form_EditForm_ID').value );
|
$('sitetree').addTypeNode('New newsletter type', $('Form_EditForm_ID').value );
|
||||||
|
Loading…
Reference in New Issue
Block a user