MINOR Tidied up AssetAdmin->SiteTreeAsUL()

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@65409 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2008-11-06 22:56:24 +00:00
parent 97c2f470e0
commit e052d533f9

View File

@ -421,37 +421,33 @@ JS;
} }
/** /**
* Return the entire site tree as a nested set of ULs * Return the entire site tree as a nested UL.
* @return string HTML for site tree
*/ */
public function SiteTreeAsUL() { public function SiteTreeAsUL() {
$obj = singleton('Folder'); $obj = singleton('Folder');
$obj->setMarkingFilter("ClassName", "Folder"); $obj->setMarkingFilter('ClassName', 'Folder');
$obj->markPartialTree(); $obj->markPartialTree();
if($p = $this->currentPage()) $obj->markToExpose($p); if($p = $this->currentPage()) $obj->markToExpose($p);
// getChildrenAsUL is a flexible and complex way of traversing the tree // getChildrenAsUL is a flexible and complex way of traversing the tree
$siteTreeList = $obj->getChildrenAsUL(
'',
'"<li id=\"record-$child->ID\" class=\"$child->class" . $child->markingClasses() . ($extraArg->isCurrentPage($child) ? " current" : "") . "\">" . ' .
'"<a href=\"" . Director::link(substr($extraArg->Link(),0,-1), "show", $child->ID) . "\" class=\"" . ($child->hasChildren() ? " contents" : "") . "\" >" . $child->TreeTitle() . "</a>" ',
$this,
true
);
$siteTree = $obj->getChildrenAsUL("", // Wrap the root if needs be
' "<li id=\"record-$child->ID\" class=\"$child->class" . $child->markingClasses() . ($extraArg->isCurrentPage($child) ? " current" : "") . "\">" . ' .
' "<a href=\"" . Director::link(substr($extraArg->Link(),0,-1), "show", $child->ID) . "\" class=\"" . ($child->hasChildren() ? " contents" : "") . "\" >" . $child->TreeTitle() . "</a>" ',
$this, true);
// Wrap the root if needs be.
$rootLink = $this->Link() . 'show/root'; $rootLink = $this->Link() . 'show/root';
if(!isset($rootID)) {
if(!isset($rootID)) $siteTree = "<ul id=\"sitetree\" class=\"tree unformatted\"><li id=\"record-root\" class=\"Root\"><a href=\"$rootLink\"><strong>http://www.yoursite.com/assets</strong></a>" $siteTree = "<ul id=\"sitetree\" class=\"tree unformatted\"><li id=\"record-root\" class=\"Root\"><a href=\"$rootLink\"><strong>http://www.yoursite.com/assets</strong></a>"
. $siteTreeList . "</li></ul>";
. $siteTree . "</li></ul>"; }
return $siteTree; return $siteTree;
} }
/** /**