Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Hidng Site Tree Pages and Tabs in the Editor Content View of the CMS?


Reply


26 Posts   7136 Views

Avatar
PP

Community Member, 5 Posts

11 January 2009 at 6:49am

this is sam's original solution, tho it is user-wide, and we need user-specific access permissions.

http://open.silverstripe.com/changeset/65856

Avatar
erwanpia

Community Member, 63 Posts

14 January 2009 at 9:04pm

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

Avatar
Taffy

Community Member, 119 Posts

14 January 2009 at 10:51pm

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

Avatar
Carbon Crayon

Community Member, 598 Posts

14 January 2009 at 11:46pm

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.

Avatar
erwanpia

Community Member, 63 Posts

15 January 2009 at 12:26am

Edited: 15/01/2009 12:30am

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);

Avatar
Carbon Crayon

Community Member, 598 Posts

15 January 2009 at 12:51am

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 :)

Avatar
Carbon Crayon

Community Member, 598 Posts

16 January 2009 at 11:49am

Edited: 16/01/2009 11:50am

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 ;)

Avatar
PP

Community Member, 5 Posts

16 January 2009 at 1:13pm

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!!!