fixed virtual page creation. yay!

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@42848 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Jeremy Shipman 2007-10-01 05:23:04 +00:00
parent bdf7da1842
commit 5d425fa6ed

View File

@ -573,15 +573,15 @@ JS;
/**
* Return JavaScript code to generate a tree node for the given page, if visible
*/
public function addTreeNodeJS($page, $selected = false) {
public function addTreeNodeJS($page, $select = false) {
$parentID = (int)$page->ParentID;
$title = Convert::raw2js($page->TreeTitle());
$response = <<<JS
var newNode = $('sitetree').createTreeNode($page->ID, \"$title\", \"$page->class\");
var parentNode = $('sitetree').getTreeNodeByIdx($parentID);
if(parentNode) parentNode.appendTreeNode(newNode);\n"
($selected ? "newNode.selectTreeNode();\n" : "") ;
var newNode = $('sitetree').createTreeNode($page->ID, "$title", "$page->class");
var parentNode = $('sitetree').getTreeNodeByIdx($parentID);
if(parentNode) parentNode.appendTreeNode(newNode);
JS;
$response .= ($select ? "newNode.selectTreeNode();\n" : "") ;
FormResponse::add($response);
return FormResponse::respond();
}