Merged from branches/2.3

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@75905 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2009-05-04 01:27:35 +00:00
parent e77cfb1427
commit a9ea6549c3
4 changed files with 43 additions and 5 deletions

View File

@ -594,6 +594,7 @@ JS;
// HACK: This should be turned into something more general
$originalClass = $record->ClassName;
$originalStatus = $record->Status;
$originalParentID = $record->ParentID;
$record->HasBrokenLink = 0;
$record->HasBrokenFile = 0;
@ -660,6 +661,10 @@ JS;
if($originalStatus != $record->Status) {
$message .= sprintf(_t('LeftAndMain.STATUSTO'," Status changed to '%s'"),$record->Status);
}
if($originalParentID != $record->ParentID) {
FormResponse::add("if(\$('sitetree').setNodeParentID) \$('sitetree').setNodeParentID($record->ID, $record->ParentID);");
}
$record->write();

View File

@ -153,6 +153,9 @@ class PageCommentInterface extends RequestHandler {
new FormAction("postcomment", _t('PageCommentInterface.POST', 'Post'))
));
// Set it so the user gets redirected back down to the form upon form fail
$form->setRedirectToFormOnValidationError(true);
// Optional Spam Protection.
if(class_exists('SpamProtecterManager')) {
// Update the form to add the protecter field to it
@ -295,6 +298,7 @@ class PageCommentInterface_Form extends Form {
return Director::redirect(Director::baseURL(). $page->URLSegment.'#PageComment_'.$comment->ID);
}
}
return Director::redirectBack(); // worst case, just go back to the page
}
}

View File

@ -85,14 +85,34 @@ Behaviour.register({
onchange: function() {
alert('The page type will be updated after the page is saved');
}
}
});
},
Behaviour.register({
'#Form_EditForm' : {
changeDetection_fieldsToIgnore : {
'restricted-chars[Form_EditForm_URLSegment]' : true,
'Sort' : true
}
}
});
},
// ParentType / ParentID field combination
'#Form_EditForm_ParentType' : {
initialize : function() {
$('Form_EditForm_ParentType_root').onclick = this.rootClick.bind(this);
$('Form_EditForm_ParentType_subpage').onclick = this.showHide;
this.showHide();
},
rootClick : function() {
$('Form_EditForm_ParentID').setValue(0);
this.showHide();
},
showHide : function() {
if($('Form_EditForm_ParentType_root').checked) {
Element.hide('ParentID');
} else {
Element.show('ParentID');
}
}
}
});

View File

@ -102,6 +102,15 @@ TreeAPI.prototype = {
});
},
/**
* Set the parent ID of a tree node
*/
setNodeParentID: function (idx, parentID) {
var treeNode = this.getTreeNodeByIdx(idx);
var parentNode = this.getTreeNodeByIdx(parentID);
parentNode.appendTreeNode(treeNode);
},
setCurrentByIdx : function(idx) {
if(this.selected) {
var i,item;