MINOR Added CMSTreeClasses() methods to Group and Folder, to mirror SiteTree behaviour and allow reusage in CMS tree implementations

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@92567 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2009-11-21 02:33:42 +00:00
parent 253dc1e24e
commit 84125b4416
2 changed files with 40 additions and 0 deletions

View File

@ -464,6 +464,26 @@ HTML;
function ChildFolders() { function ChildFolders() {
return DataObject::get("Folder", "\"ParentID\" = " . (int)$this->ID); return DataObject::get("Folder", "\"ParentID\" = " . (int)$this->ID);
} }
/**
* @return String
*/
function CMSTreeClasses($controller) {
$classes = sprintf('class-%s', $this->class);
if(!$this->canDelete())
$classes .= " nodelete";
if($controller->isCurrentPage($this))
$classes .= " current";
if(!$this->canEdit())
$classes .= " disabled";
$classes .= $this->markingClasses();
return $classes;
}
} }
class Folder_UnusedAssetsField extends CompositeField { class Folder_UnusedAssetsField extends CompositeField {

View File

@ -436,6 +436,26 @@ class Group extends DataObject {
} }
return false; return false;
} }
/**
* @return String
*/
function CMSTreeClasses($controller) {
$classes = sprintf('class-%s', $this->class);
if(!$this->canDelete())
$classes .= " nodelete";
if($controller->isCurrentPage($this))
$classes .= " current";
if(!$this->canEdit())
$classes .= " disabled";
$classes .= $this->markingClasses();
return $classes;
}
} }
?> ?>