SF 4.1 SP1 SiteMap DataProvider PageGroups

Posted by Community Admin on 04-Aug-2018 16:35

SF 4.1 SP1 SiteMap DataProvider PageGroups

All Replies

Posted by Community Admin on 13-May-2011 00:00

I have a Panelbar which gets its data from Site Map Data Source.

I have two issues which I was expecting somehow to work out of the box

1) If I have a PageGroup without any pages under it
a) they are shown in navigation
b) when clicked I get an error

Object reference not set to an instance of an object.

2) When I tell the page not to be shown the page is still included in the navigation

------------------
To me all the widgets should in some way be usable for end user clients

a) The information you need to enter "SitefinitySiteMap" as provider is not possible for any enduser
b) The above requirements should be implemented. Otherwise you will have a 100% need to programm you navigation widget.

Markus

Posted by Community Admin on 16-May-2011 00:00

Hi Markus Berchtold,

By default the SiteMapDataSource returns all the pages. We have additional logic implemented in our navigation widgets that is doing the desired functionality (checking whether a page is a group page and if it has children it will be shown in navigation, if not - we hide it, etc.) To achieve the desired functionality you can map a RadPanelBar as a template for our Navigation control and thus you will benefit all the implemented logic and you will have the visual representation of the PanelBar. Please include the attached template to your project and set the navigation control as per the screenshot I've included in my reply. I hope this information helps. If you have any additional questions, please let me know.



Kind regards,
Boyan Barnev
the Telerik team

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
[View:/cfs-file/__key/communityserver-discussions-components-files/297/271008_5F00_PanelBarTemplate.rar:320:240]

Posted by Community Admin on 16-May-2011 00:00

Dear Boyan

Thanks for the solution, will give it a try in a couple of minutes.

When would it make sense for me that when using SitefinitySiteMap as a provider to have all pages returned?

At the moment I would not know why an end-user (who is of course not able to use the Data SiteMap at all because he never know what to fill in) would want to show pages, not to be shown in navigation, or pagegroups without a page under it.

Markus

Posted by Community Admin on 16-May-2011 00:00

Dear Boyan

Sorry this seems to be far of from what I want since when using this solution I can not set starting node offset.

Top Menu

PRODUCT A, PRODUCT B, PRODUCT C

PanelBar when PRODUCT A clicked

Sub A1
Sub A1.1
Sub A1.2
Sub A2
Sub A2.1
Sub A2.2

PanelBar when PRODUCT B is clicked

Sub B1
Sub B1.1
Sub B1.2
Sub B2
Sub B2.1
Sub B2.2

At the moment I simply think that SF can not provide this functionality and I must programm that stuff.

Markus

Posted by Community Admin on 16-May-2011 00:00

Hi Markus,

You can easily do this from using the API by getting PageNode and its child nodes. Clicked item can be persisted in a cookie or an attribute, so you can access it event after post back.  There are still some issue with the navigation control and we will work on them, so I hope that they will be sorted out.

All the best,
Ivan Dimitrov
the Telerik team

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 17-May-2011 00:00

Dear Ivan

Well the task is a bit more complicated then simply finding child nodes. Let's say you google a page and land on the 3rd level of the navigation.

a) you need to to find the top level page.
For example if you land on Sub B 2.1 you need to go all the way up to PRODUCT B
b) you have to build then the PanelBar with an StartingNodedOffset 1 or include starting node false. Don't know which is the right way to do.
c) you have to exclude all pages not to be shown in navigation
d) you have to exclude all pages (and child pages) for which the visitor has no rights
e) you have to exclude all GroupPages without children
f) you have to make sure that the panelbar is expanded to the Sub B 2.1 menu item
g) you have to give the B 2.1 menu the selected css class

So since this can all be easely done with the API do you have a good link or code example?

Markus

PS: Sure hope SFwill provide such comon and basic scenarios in the neer future.

Posted by Community Admin on 17-May-2011 00:00

Hello Markus ,

All this could be done in ItemDataBound method of the navigation control that you use

1. Getting the parent - it could be done with a while loop where the Parent !=null
2.StartingNodedOffset is a property of the SiteMapDataSource. You do not need to set it, because you can build the items at runtime
3. Inside ItemDataBound you have access to the PageSiteNode, so you can check ShowInNavigation and call e.Item.Visible = false
4 and 5.  Could be combined with 3 in a helper metod

var pageNode = e.Node as PageSiteNode;
            if (pageNode != null)
           
                if (!pageNode.ShowInNavigation ||
                    (!pageNode.IsGroupPage && pageNode.Hidden) ||
                    (String.IsNullOrEmpty(pageNode.Title) && // used in multilingual; captures the cases of synced, split, and group pages
                        pageNode.Id != SiteInitializer.FrontendRootNodeId)) // ensures that the root node is not hidden and thus all other pages
               
                    e.IsAccessible = false;
                    return;
               

                //The page should be hidden if it is a group page and it has no child pages.
                if (pageNode.IsGroupPage && pageNode.ChildNodes.Count < 1)
               
                    e.IsAccessible = false;
                    return;
               
           

Then you only have to set the selected node. Hope that this helps as a workaround or a custom solution

Greetings,
Ivan Dimitrov
the Telerik team

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 17-May-2011 00:00

Dear Ivan

It's a starting point but I still will have to do a lot of searching in help, forum and even more cut and past till that works.

Would it be thinkable for Telerik to provide widgets for stuff you want to include to SF but can not do fast.

For example the including of a panel bar navigation element could be very complex for you guys in the current NavigationWidget (layout, UI, functionallity) but it might be easy for you guys to create a widget for us to use

This is not only an idea for my problem now but there might be other things you will not be able to include into Q2 but YOU could solve for ALL of us easely in a widget.

Markus

Posted by Community Admin on 18-May-2011 00:00

Thanks for the provided sample, Ivan, this was exactly what I needed for my custom PanelBar navigation.  Pasting your logic in my code saved me a lot of work, and I had the control done in less than 5 minutes. Keep up with the good job!

Posted by Community Admin on 18-May-2011 00:00

@ Ibrahim

Any chance you are willing to sent me your panelBar solution to mb @ marktold.com

Markus

Posted by Community Admin on 20-May-2011 00:00

@ Mehdi Ibrahim

Dear Mehdi - I am trying to get in touch with you. mb @ marktold.com 

I would appreciate it if I could contact you somehow: LinkedIn, messenger, mai, phone.

Markus

This thread is closed