mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 06:05:56 +00:00
ENHANCEMENT: Added page location fields in the behaviour tab, as an alternative to drag and drop
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.3@75815 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
a0f7e9f1a7
commit
2414eb30cc
@ -593,6 +593,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;
|
||||
@ -659,6 +660,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();
|
||||
|
||||
|
@ -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');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user