mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
Merge branch '3.5' into 3.6
This commit is contained in:
commit
9e903f801f
@ -102,6 +102,11 @@ class CMSFileAddController extends LeftAndMain {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
$form->loadDataFrom($folder);
|
$form->loadDataFrom($folder);
|
||||||
|
|
||||||
|
if($this->currentPageID()){
|
||||||
|
// Make sure this controller know current folder when AJAX 'fileexists' is fired.
|
||||||
|
$uploadField->setConfig('urlFileExists', Controller::join_links($uploadField->link('fileexists'), '?ID=' . $this->currentPageID()));
|
||||||
|
}
|
||||||
|
|
||||||
$this->extend('updateEditForm', $form);
|
$this->extend('updateEditForm', $form);
|
||||||
|
|
||||||
|
@ -1247,7 +1247,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
$id = (isset($data['ID'])) ? (int) $data['ID'] : null;
|
$id = (isset($data['ID'])) ? (int) $data['ID'] : null;
|
||||||
$version = (isset($data['Version'])) ? (int) $data['Version'] : null;
|
$version = (isset($data['Version'])) ? (int) $data['Version'] : null;
|
||||||
|
|
||||||
$record = DataObject::get_by_id($this->stat('tree_class'), $id);
|
$record = Versioned::get_latest_version($this->stat('tree_class'), $id);
|
||||||
if($record && !$record->canEdit()) return Security::permissionFailure($this);
|
if($record && !$record->canEdit()) return Security::permissionFailure($this);
|
||||||
|
|
||||||
if($version) {
|
if($version) {
|
||||||
|
@ -1575,7 +1575,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
parent::onBeforeDelete();
|
parent::onBeforeDelete();
|
||||||
|
|
||||||
// If deleting this page, delete all its children.
|
// If deleting this page, delete all its children.
|
||||||
if(SiteTree::config()->enforce_strict_hierarchy && $children = $this->AllChildren()) {
|
if($this->isInDB() && SiteTree::config()->enforce_strict_hierarchy && $children = $this->AllChildren()) {
|
||||||
foreach($children as $child) {
|
foreach($children as $child) {
|
||||||
$child->delete();
|
$child->delete();
|
||||||
}
|
}
|
||||||
@ -2837,7 +2837,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
}
|
}
|
||||||
$flags = $this->getStatusFlags();
|
$flags = $this->getStatusFlags();
|
||||||
$treeTitle = sprintf(
|
$treeTitle = sprintf(
|
||||||
"<span class=\"jstree-pageicon page-icon class-%s\"></span><span class=\"item\" data-allowedchildren=\"%s\">%s</span>",
|
"<span class=\"jstree-pageicon class-%s\"></span><span class=\"item\" data-allowedchildren=\"%s\">%s</span>",
|
||||||
Convert::raw2htmlid($this->class),
|
Convert::raw2htmlid($this->class),
|
||||||
Convert::raw2att(Convert::raw2json($children)),
|
Convert::raw2att(Convert::raw2json($children)),
|
||||||
Convert::raw2xml(str_replace(array("\n","\r"),"",$this->MenuTitle))
|
Convert::raw2xml(str_replace(array("\n","\r"),"",$this->MenuTitle))
|
||||||
|
@ -254,8 +254,7 @@
|
|||||||
*
|
*
|
||||||
* A "rollback" to a specific version needs user confirmation.
|
* A "rollback" to a specific version needs user confirmation.
|
||||||
*/
|
*/
|
||||||
$('.cms-edit-form .Actions #Form_EditForm_action_rollback').entwine({
|
$('.cms-edit-form .Actions #Form_EditForm_action_doRollback').entwine({
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function: onclick
|
* Function: onclick
|
||||||
*
|
*
|
||||||
|
@ -276,7 +276,25 @@ class SiteTreeTest extends SapphireTest {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetByLink() {
|
public function testNoCascadingDeleteWithoutID() {
|
||||||
|
Config::inst()->update('SiteTree', 'enforce_strict_hierarchy', true);
|
||||||
|
$count = SiteTree::get()->count();
|
||||||
|
$this->assertNotEmpty($count);
|
||||||
|
$obj = new SiteTree();
|
||||||
|
$this->assertFalse($obj->exists());
|
||||||
|
$fail = true;
|
||||||
|
try {
|
||||||
|
$obj->delete();
|
||||||
|
} catch (LogicException $e) {
|
||||||
|
$fail = false;
|
||||||
|
}
|
||||||
|
if ($fail) {
|
||||||
|
$this->fail('Failed to throw delete exception');
|
||||||
|
}
|
||||||
|
$this->assertCount($count, SiteTree::get());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetByLink() {
|
||||||
$home = $this->objFromFixture('Page', 'home');
|
$home = $this->objFromFixture('Page', 'home');
|
||||||
$about = $this->objFromFixture('Page', 'about');
|
$about = $this->objFromFixture('Page', 'about');
|
||||||
$staff = $this->objFromFixture('Page', 'staff');
|
$staff = $this->objFromFixture('Page', 'staff');
|
||||||
|
Loading…
Reference in New Issue
Block a user