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 * 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; $parentID = (int)$page->ParentID;
$title = Convert::raw2js($page->TreeTitle()); $title = Convert::raw2js($page->TreeTitle());
$response = <<<JS $response = <<<JS
var newNode = $('sitetree').createTreeNode($page->ID, \"$title\", \"$page->class\"); var newNode = $('sitetree').createTreeNode($page->ID, "$title", "$page->class");
var parentNode = $('sitetree').getTreeNodeByIdx($parentID); var parentNode = $('sitetree').getTreeNodeByIdx($parentID);
if(parentNode) parentNode.appendTreeNode(newNode);\n" if(parentNode) parentNode.appendTreeNode(newNode);
($selected ? "newNode.selectTreeNode();\n" : "") ;
JS; JS;
$response .= ($select ? "newNode.selectTreeNode();\n" : "") ;
FormResponse::add($response); FormResponse::add($response);
return FormResponse::respond(); return FormResponse::respond();
} }