Feature: Add important information to `Pages` data source
I'm submitting a ... [x] feature request
...about
[x] .NET API (ToSic.Sxc.DataSources > Pages)
Current behavior Currently, the following page information is available: https://github.com/2sic/2sxc/blob/21d3f020d68b2bd609bd243fd07148a8e39e9000/Src/Sxc/ToSic.Sxc/DataSources/CmsBases/PagesBase.cs#L55-L67
Desired behavior There are key pieces of information missing in order to utilize this API effectively for certain use cases (e.g., building footer nav/menu, showing site map, etc.).
DisabledTargetHidden(Perhaps this is supposed to be handled viaVisiblebut not only is the naming confusing, but it also does not seem to match. See the following sample data from dnndave.com whereVisibleshowsfalsebut the page is clearly visible toAll Userson the site.)
{
"Title": "DNN Dave Videos",
"Name": "Videos",
"ParentId": -1,
"Visible": false,
"Path": "//Videos",
"Url": "https://dnndave.com/Videos",
"Id": 21,
"Guid": "daa1517c-2a1e-4a1f-b42d-2463c05ece46",
"Modified": "2021-12-27T15:33:40.05Z",
"Created": "2021-05-21T14:15:58.593Z"
}
Furthermore, it is not clear if page permissions are respected. For instance, if a user does not have permission to view the page, will it show in returned page data?
Instructions to Reproduce the Problem
- Build a visual query using
Source > Pages. - Run query.
- View results.
Why change the behavior? One of the use cases for using the Pages source would be to build navigation menus or site maps. Currently, it is impossible to do it fully "right" (like you can using DDR Menu.
Your environment n/a
- 2sxc version(s): 14.07.04
- Browser: [all]
- DNN: [all]
- Language: [any/all]
Anything you would like to add I realize this is a completely different context, but it would be ideal to follow the same data model as provided currently in DDRMenu: https://docs.dnncommunity.org/content/tutorials/themes/theme-objects/ddrmenu/ddrmenu-razor-templates-overview/index.html#data-model
This is great and much needed. I have had more than a few situations where in my 2sxc App razor view I've needed to get the results of the visible (by current user's permissions) pages starting at a particular page (root node) and get is peers or children or both/recusively... and this datasource doesn't seem to deliver much of what you need or would expect in any real world scenario (that I can think of). Even if you take the time to used the TabId to .GetTab() returning a TabInfo class for the page, its still not as useful as the way the DDR Menu returns its nodes/node.
So yeah, I LOVE this idea and just a few improvements would make this a go to datasource!
Also, when you consider that recent versions of 2sxc have made it easier to do stuff from places like the theme (outside), having this DataSource provide a full and useful set of page details on par with MenuNode would open up a ton of creative possibilities for navigation, (mega)menus, sidebars, tabbed info, galleries, and more.
I'm just looking into this. IsVisible is Dnn property, and I believe it's tied to being visible in the navigation.
So it's not user-permissions based.
We'll look into that separately.
@iJungleboy I wanted to circle back to you all on this as I have seen no movement on this issue. It is a roadblock for several client projects now and the only alternatives to date are:
- Not using this API and going with a much more complex DNN API solution.
- Using a brittle (hard-coded) approach for handling
DisabledandHiddenpages. This is not ideal as it doesn't work if the client decides to rename pages, etc.
I was under the impression that sponsorship would have motivated my one and only issue to be prioritized. Is that not the case?
@david-poindexter We looked at this about a month ago, because we thought it would be a quick fix. But we quickly realized that it's going to be complex.
I don't remember the exact reason but I believe that we ran into various properties whose purpose and causality isn't 100% clear. It's important that when we do make a change, we know exactly what we're doing and can document this too. So it became clear that it's not a 30min fix but more a 4h+.
We do intend to do it, but till XMas we must prioritize 2sxc 15 which is almost done.
It's possible that we could address this too, but I would expect it to probably be in 15.01 or 15.02 after the holidays.
Sorry to keep you waiting...
Thank you for the response and additional insight. This is going to have a much larger impact to our project work as we have made the mistake of risking use of this datasource and thinking that 5 months would be more than ample time to work out the kinks here. Lesson learned. 😊👍🏼
I believe this is why I wanted to use the DNN docs - to verify assumptions about the exact purpose of certain properties. Any idea if that will come back soon? https://github.com/DNNCommunity/DNNDocs/issues/685
we'll prioritize this right after releasing v15, maybe we can even get it into the release.
@iJungleboy we have tried multiple things to resolve the DNN Docs issue with publishing the API docs, and so far nothing has worked and we still don't know what exactly broke it. We are suspicious of the tooling version upgrades (DocFx, Nuke, GitHub Actions runners, etc.), but have been unable to isolate it yet. For now, it is best to just use the object browser in Visual Studio. :)
Thanks to the docs, I was able to enhance this, but it's probably not quite there yet.
This is the template object which shows the properties we're transporting: https://github.com/2sic/2sxc/commit/3156a18da9ddfb2e855a48b3c88e5a78bff6ee90#diff-275c1718798e154b031611545f683101a25b41ca30c51511f15b18889e3098dd
I added properties such as:
- Clickable
- Order (1-based)
- Level (1-based)
- IsDeleted (currently always false)
- HasChildren
I'm also working on it so it's better documented in the docs, which I'll regenerate in a few mins.
What I can't find - also not in the docs are properties such as
- Target
Also note that as of now, the data source respects user permissions and only provides data which the user can see.
I also added the following properties
- Parent
- Children
These are also IEntity lists, so you can navigate the object tree 🚀
@iJungleboy this is fantastic for future projects. Thanks so much!
So, for Target, you can get that via: TabSettings["LinkNewWindow"] (boolean)
It's not pretty, but that's how it is. :)
Just added LinkTarget which will be "" or "_blank" :)
Much appreciated!
This really looks great, thank you!!