elofgren: BUGFIX: Make adding newsletter types work again (was broken by r38923). Fix long-standing problem of whole page reloading when adding a Newsletter type. Now it is always added via AJAX.

(merged from branches/gsoc)


git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@42006 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2007-09-16 01:29:40 +00:00
parent 456ce4ebcc
commit ed0232eb71
2 changed files with 15 additions and 8 deletions

View File

@ -256,12 +256,15 @@ AddForm.prototype = {
form_submit : function() {
var st = $('sitetree');
if( st.selected.length )
selectedNode = st.selected[0];
else
selectedNode = st.selected;
if (st) {
if( st.selected && st.selected.length ) {
selectedNode = st.selected[0];
} else {
selectedNode = st.selected;
}
} else {
var selectedNode = null;
}
var parentID = null;
while( selectedNode && !parentID ) {
@ -275,8 +278,9 @@ AddForm.prototype = {
alert("You have to save a page before adding children underneath it");
} else {
this.elements.ParentID.value = parentID;
if (this.elements) {
this.elements.ParentID.value = parentID;
}
var type = 'draft';
var selectIDPrefix = 'draft_' + parentID + '_';

View File

@ -27,4 +27,7 @@
</li>
<% end_control %>
</ul>
<% else %>
<ul id="sitetree" class="tree unformatted">
</ul>
<% end_if %>