Skip to content

Commit

Permalink
MINOR Added CMSTreeClasses() methods to Group and Folder, to mirror S…
Browse files Browse the repository at this point in the history
…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
chillu committed Nov 21, 2009
1 parent 253dc1e commit 84125b4
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
20 changes: 20 additions & 0 deletions filesystem/Folder.php
Expand Up @@ -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 {
Expand Down
20 changes: 20 additions & 0 deletions security/Group.php
Expand Up @@ -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.