Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Stephen Roberts 47 posts 516 karma points c-trib
    Nov 15, 2012 @ 15:10
    Stephen Roberts
    0

    Custom Content Picker

    Hey!,

    I want to render a tree in a dialog box in the backoffice like this it is used to move a content to a 'Shared Content' area of the site (as it is a multi-lingual site):

    however I want the tree to only render "Shared Content" not the notes above this. This tree is being rendered by the Umbraco TreeControl usercontrol, and when I set the start node property, nothing changes.

     

    Any Ideas?

    Tl;DR: How to render a content tree picker in the backend with a startNode set?

    Thanks!

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Nov 15, 2012 @ 15:44
    Jeroen Breuer
    0

    Have a look at this issue for some improvements: http://issues.umbraco.org/issue/U4-192. Don't think a start node can be used yet. For now I use MNTP for that: http://our.umbraco.org/forum/core/umbraco-5-general-discussion/28363-Umbraco-5-MNTP-features#comment107718

    Jeroen

  • Lee Kelleher 4020 posts 15802 karma points MVP 13x admin c-trib
    Nov 15, 2012 @ 15:57
    Lee Kelleher
    1

    Hi Stephen,

    MNTP uses a custom tree control called FilteredContentTree (there's also a Media one if you're interested).  Depending which version of Umbraco you are using (e.g. v4.8+) then this is now in the Umbraco core, otherwise for older versions, you can use uComponents (v3.x, v4.x).

    The FilteredContentTree control is inside the 'umbraco.editorControls.MultiNodeTreePicker' namespace.  From what I recall you will need to use the "umbraco.controls.Tree.CustomTreeControl" to render it.

    Keep in mind that I didn't develop MNTP... just a lot of hacking around with it.  So feel free to ask any questions, just can't guarantee any answers. ;-)

    Cheers, Lee.

  • Lee Kelleher 4020 posts 15802 karma points MVP 13x admin c-trib
    Nov 15, 2012 @ 15:59
    Lee Kelleher
    0

    Forgot to add... to see how MNTP does this, check the source for the constructor in "umbraco.editorControls.MultiNodeTreePicker.MNTP_DataEditor".

  • Stephen Roberts 47 posts 516 karma points c-trib
    Nov 15, 2012 @ 16:31
    Stephen Roberts
    0

    Cheers guys! however I Cannot figure out how to set the StartNodeID

    var contentTree = TreeDefinitionCollection.Instance.Single(x => x.Tree.Alias.ToUpper() == "CONTENT");
    
                    var filteredContentTree = new TreeDefinition(typeof(FilteredContentTree),
                                                                 new umbraco.BusinessLogic.ApplicationTree(true, false, 0,
                                                                           contentTree.Tree.ApplicationAlias,
                                                                           "FilteredContentTree",
                                                                           contentTree.Tree.Title,
                                                                           contentTree.Tree.IconClosed,
                                                                           contentTree.Tree.IconOpened,
                                                                           "umbraco.editorControls",
                                                                           "MultiNodeTreePicker.FilteredContentTree",
                                                                           contentTree.Tree.Action),
                                                                 contentTree.App);
    
                    TreeDefinitionCollection.Instance.Add(filteredContentTree);
                    CustomTreeControl treeControl  = new CustomTreeControl
                    {
                        ID = "TreePicker",
                        IsDialog = true,
                        ShowContextMenu = false,
                        DialogMode = TreeDialogModes.id,
                        Height = 300,
                        StartNodeID = 1220,
                        TreeType = "FilteredContentTree"
    
                    };
    
                    TreeContainer.Controls.Add(treeControl);

    but it isnt obeying the startNodeId >.< it still renders from the Root node :(

    Hopefully i'm missing something really stupid and its a simple fix :(

     

    Any ideas?

     

     

    Love you all..

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Nov 15, 2012 @ 16:38
    Jeroen Breuer
    0

    For DAMP I also set the start node of the media tree and copied that from how it works in MNTP. I don't know exactly what I did, but I remember it did give me a little trouble. Think it's best to look for "StartNode" in the source of MNTP and see in what places it all is used. Also had some javascript involved.

    Jeroen

  • Stephen Roberts 47 posts 516 karma points c-trib
    Nov 16, 2012 @ 12:25
    Stephen Roberts
    0

    Thanks guys, I got it working with an extension of FilteredContentTree

     

    <3

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Nov 17, 2012 @ 00:03
    Jeroen Breuer
    0

    Sounds like a good package ;-). 

    Jeroen

  • Dan White 206 posts 510 karma points c-trib
    Mar 02, 2013 @ 00:40
    Dan White
    0

    @Stephen

    I'm currently to to accomplish the same thing and having some trouble. Would you mind sharing your source?

    Thanks!

  • Stephen Roberts 47 posts 516 karma points c-trib
    Mar 04, 2013 @ 10:52
    Stephen Roberts
    1

    @Dan & everyone, I did write this into a blog post, albeit I forgot to publish the thing.

    http://offroadcode.com/blog/2013/3/4/hacking-the-umbraco-content-tree-picker-to-hide-content-to-make-it-easier-for-editors/

Please Sign in or register to post replies

Write your reply to:

Draft