this is sam's original solution, tho it is user-wide, and we need user-specific access permissions.
We've moved the forum!
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
- Previous 10 entries
- 1
- Page 22(current)
- 3
- 4
- Next 10 entries
Hi, Hiding tree pages for group A when editable permissions are not set is easy : read the LeftAndMain::getsiteTree for method and find out that the disabled class attribute is set for tree nodes that are not editable on the a tag but also on the li tag
the stylesheet cms_left.css only configures the a tag (color change)
ul.tree span.a a.disabled {
color: #999;
cursor: pointer;
}
ul.tree span.a a.disabled * {
padding: 0;
background: none;
color: #999;
cursor: pointer;
}
I managed to hide the nodes not editable by group A just by adding a css instruction
ul.tree li.disabled {display:none;}
but that doesn't solve the following : how to display editable subnodes of non editable node ?
Good luck
You may want to look at the workflow module. http://www.silverstripe.org/cms-workflow-module/
The SilverStripe guys are still working on it but you may be able to play around with it to see if it meets some of your requirments.
Roadmap - http://open.silverstripe.com/milestone/cmsworkflow%200.1
erwanpia - that's a little crude as it doesn't actually hide the tree node itself, it just hides the title, so you still get the little + next to the empty title and then just empty spaces if there are no children. I would love to see it so that the whole node was not drawn at all.
Hi aram, I admit that's crude but I disagree with little + : the display:node applies to the node (li tag) and also hides the little +.
tested on firefox and IE.
I would love to disable HTML rendering at this stage but this has to be done inside LeftAndMain.php :: getChildrenasUL template usin $child->canEdit() or canAddChildren condition as coded below in SS 2.2.3 release
hint anyone ?
// getChildrenAsUL is a flexible and complex way of traversing the tree
$siteTree = $obj->getChildrenAsUL("", '
"<li id=\"record-$child->ID\" class=\"" . $child->CMSTreeClasses($extraArg) . "\">" .
"<a href=\"" . Director::link(substr($extraArg->Link(),0,-1), "show", $child->ID) . "\" class=\"" . $child->CMSTreeClasses($extraArg) . "\" title=\"' . _t('LeftAndMain.PAGETYPE','Page type: ') . '".$child->class."\" >" .
($child->TreeTitle()) .
"</a>"
'
,$this, true);
ahh sorry, was being a muppet, had added the display:none to the already existing .disabled classes instead of adding the new one you suggested!
Thanks for that, it's actually a pretty good work around for now, just the problem you mentioned about not being able to edit children.
cheers :)
Ive found a way to hide the create page buttons in the CMS based on member status/group.
You need to first greate a testing function in cms/code/CMSMain.php. I kept it simple and only tested wether the user was an admin, but this could easily be extended to test group membership etc.
function IsAdmin(){
return Member::currentUser()->isAdmin();
}
Then in cms/templates/Inclides/CMSMain_left.ss you can just create an if control between lines 10 and 88 to decide whether to include the buttons or not:
.
.
.
<div id="sitetree_holder">
<% if IsAdmin %>
<ul id="TreeActions">
.
.
.
</div>
<% end_if %>
<div id="sitetree_ul">
.
.
.
I think we are almost there? albeit in a bit of a hackish way ;)
hackish is fine if it's working =)
@erwanpia - your solution solved my immediate problem. so simple, so logical.
@aram - i think this was a huge obstacle to using the cms for clients, so i'd love to see the entire issue solved!
@taffy -workflow seems like overkill for my needs, at least as of now.
thx everyone!!!
- Previous 10 entries
- 1
- Page 22(current)
- 3
- 4
- Next 10 entries