From 84125b4416eb26fab734d87bf9d64806291031b7 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Sat, 21 Nov 2009 02:33:42 +0000 Subject: [PATCH] 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 --- filesystem/Folder.php | 20 ++++++++++++++++++++ security/Group.php | 20 ++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/filesystem/Folder.php b/filesystem/Folder.php index 99596e44f..e357e8d52 100755 --- a/filesystem/Folder.php +++ b/filesystem/Folder.php @@ -464,6 +464,26 @@ HTML; function ChildFolders() { 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 { diff --git a/security/Group.php b/security/Group.php index 19a7cae1e..0add3c65c 100644 --- a/security/Group.php +++ b/security/Group.php @@ -436,6 +436,26 @@ class Group extends DataObject { } 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; + } } ?>