ENHANCEMENT Allowing custom 'root forms' when id values '0' or 'root' are passed from the tree selection.

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@98710 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2010-02-10 23:06:34 +00:00
parent 52c5e35768
commit 49dd8ddfa5
2 changed files with 7 additions and 3 deletions

View File

@ -513,7 +513,7 @@ class LeftAndMain extends Controller {
// Wrap the root if needs be. // Wrap the root if needs be.
if(!$rootID) { if(!$rootID) {
$rootLink = '#'; $rootLink = $this->Link('show') . '/root';
// This lets us override the tree title with an extension // This lets us override the tree title with an extension
if($this->hasMethod('getCMSTreeTitle')) $treeTitle = $this->getCMSTreeTitle(); if($this->hasMethod('getCMSTreeTitle')) $treeTitle = $this->getCMSTreeTitle();
@ -820,12 +820,16 @@ JS;
$form->setFields($readonlyFields); $form->setFields($readonlyFields);
} }
} else { } else {
$form = $this->EmptyForm(); $form = $this->RootForm();
} }
return $form; return $form;
} }
function RootForm() {
return $this->EmptyForm();
}
/** /**
* Returns a placeholder form, used by {@link getEditForm()} if no record is selected. * Returns a placeholder form, used by {@link getEditForm()} if no record is selected.
* Our javascript logic always requires a form to be present in the CMS interface. * Our javascript logic always requires a form to be present in the CMS interface.

View File

@ -26,7 +26,7 @@ var _HANDLER_FORMS = {
onmatch: function() { onmatch: function() {
// make sure current ID of loaded form is actually selected in tree // make sure current ID of loaded form is actually selected in tree
var id = $('#Form_EditForm :input[name=ID]').val(); var id = $('#Form_EditForm :input[name=ID]').val();
if(id) this[0].setCurrentByIdx(id); this[0].setCurrentByIdx(id);
} }
}; };
}); });