Jump to:

23493 Posts in 18996 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » Hidng Site Tree Pages and Tabs in the Editor Content View of the CMS?

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

Page: 1 2 3 4
Go to End
Author Topic: 6788 Views
  • PP
    Avatar
    Community Member
    5 Posts

    Re: Hidng Site Tree Pages and Tabs in the Editor Content View of the CMS? Link to this post

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

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

  • erwanpia
    Avatar
    Community Member
    63 Posts

    Re: Hidng Site Tree Pages and Tabs in the Editor Content View of the CMS? Link to this post

    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

  • Taffy
    Avatar
    Community Member
    119 Posts

    Re: Hidng Site Tree Pages and Tabs in the Editor Content View of the CMS? Link to this post

    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

  • Aram
    Avatar
    Community Member
    598 Posts

    Re: Hidng Site Tree Pages and Tabs in the Editor Content View of the CMS? Link to this post

    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.

  • erwanpia
    Avatar
    Community Member
    63 Posts

    Re: Hidng Site Tree Pages and Tabs in the Editor Content View of the CMS? Link to this post

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

  • Aram
    Avatar
    Community Member
    598 Posts

    Re: Hidng Site Tree Pages and Tabs in the Editor Content View of the CMS? Link to this post

    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

  • Aram
    Avatar
    Community Member
    598 Posts

    Re: Hidng Site Tree Pages and Tabs in the Editor Content View of the CMS? Link to this post

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

  • PP
    Avatar
    Community Member
    5 Posts

    Re: Hidng Site Tree Pages and Tabs in the Editor Content View of the CMS? Link to this post

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

    6788 Views
Page: 1 2 3 4
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.