Permalink
Browse files

MINOR Added CMSTreeClasses() methods to Group and Folder, to mirror S…

…iteTree 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
  • Loading branch information...
1 parent 253dc1e commit 84125b4416eb26fab734d87bf9d64806291031b7 @chillu chillu committed Nov 21, 2009
Showing with 40 additions and 0 deletions.
  1. +20 −0 filesystem/Folder.php
  2. +20 −0 security/Group.php
View
@@ -464,6 +464,26 @@ function getUploadIframe() {
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 {
View
@@ -436,6 +436,26 @@ function allowedIPAddress($ip) {
}
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;
+ }
}
?>

0 comments on commit 84125b4

Please sign in to comment.