1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Custom SiteMapPanel in Dashboard/Page/Map

Custom SiteMapPanel in Dashboard/Page/Map

4 posts, 0 answered
  1. Pierre
    Pierre avatar
    433 posts
    Registered:
    16 Feb 2006
    13 Mar 2009
    Link to this post
    Hi,
    It's posible to modify the "SitemapPanel of  Telerik.Cms.Web.UI" in Dashboard/Pages/Map (Pages.aspx). I'm searching to hide some pages based on roles and usernames in the treeview of pages admin side. For sample, I have one group with 2 pages (a,b) and allowed for user in same role, I'm searching to hide these pages with some tests like this page is in role and profile of user have the page registred. Thanks, Regards. 
  2. Parvan
    Parvan avatar
    151 posts
    Registered:
    24 Sep 2012
    16 Mar 2009
    Link to this post
    Hello Pierre,

    Thank you for using our services.

    You can extend the SiteMapPanel control - I attached an example class which must be placed into your site App_Code folder.

    You need also to edit this file located at
    [~your site]\Sitefinity\Admin\Pages.aspx:
    ... 
    <%@ Register Assembly="App_Code" Namespace="Telerik.Cms.Web.UI" TagPrefix="cc1" %> 
    ... 
    <cc1:CustomSiteMapPanel ID="siteMap" PageEditorID="pageEditor" runat="server" /> 
    ... 

    Check which page should be hidden depending on user role as the example:
    CustomSiteMapPanel.cs:
    protected void TraverseAllPages(RadTreeNode node) 
        Guid pageGuid = new Guid(node.Value); 
        ICmsPage page = manager.GetPage(pageGuid) as ICmsPage; 
        if (page != null && 
        page.Title == "samplePage" && 
        UserManager.IsCurrentUserInRole("administrators")) 
        { // hide this page 
               node.Visible = false
        } 
        foreach (RadTreeNode childNode in node.Nodes) 
        { 
            TraverseAllPages(childNode); 
        } 

    I hope this information will help you.

    All the best,
    Parvan
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. Pierre
    Pierre avatar
    433 posts
    Registered:
    16 Feb 2006
    16 Mar 2009
    Link to this post
    Hi Parvan,

    It's fantastic! Thanks BUT I can't select any page in my treeview. Adding this custom have inactivated the selecting pages. Could you help us litle more plz.

    Regards and thanks.
  4. Parvan
    Parvan avatar
    151 posts
    Registered:
    24 Sep 2012
    19 Mar 2009
    Link to this post
    Hello Pierre,

    I have attached you an updated version of the CustomSiteMapPanel.cs, as well as the javascript file SiteMapPanel.js.

    Setup:
    1. Copy/Replace the new CustomSiteMapPanel.cs into the App_Code folder
    2. Copy the javascript file into ~[your site]/Sitefinity/Admin/SiteMapPanel.js

    Then you will be able to select pages from the SiteMapPanel.

    Greetings,
    Parvan
    the Telerik team


    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Register for webinar
4 posts, 0 answered