Repository navigation
Conversation
- DNNContext can be created from a client ID; ResolveUrl falls back to Globals.ResolveUrl without a host control. - Template processors use DNNContext.ClientID; XSLT resolves URLs without a Page. - XsltFunctions.GetUserText resolves through DNNContext instead of the never-set DDRMenuHostControl item. - MenuNode only converts postback URLs when a WebForms page is available. - TemplateDefinition.PreRender registers resources through IClientResourceController and writes head content and fallback scripts through IPageService when no Page exists. - Thread IClientResourceController and IPageService through MenuBase, MenuView, SkinObject, DDRMenuNavigationProvider and DDRMenuControl; previous public signatures are kept and deprecated in 10.4.0. Co-authored-by: Cursor <cursoragent@cursor.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Allows DDRMenu to render without a WebForms host control or
System.Web.UI.Page.Changes
Host control independence
DNNContextgets a newDNNContext(string clientID)constructor and aClientIDproperty.Pagereturnsnullinstead of throwing when there is no host control.ResolveUrlfalls back toGlobals.ResolveUrlwhen there is no host control.RazorTemplateProcessor,TokenTemplateProcessorandXsltTemplateProcessoruseDNNContext.Current.ClientIDinstead ofHostControl.ClientID.XsltTemplateProcessorresolves paths withPage.ResolveUrlwhen a page exists, and withGlobals.ResolveUrlotherwise.MenuNode.ApplyContextonly convertspostback:URLs when a WebForms page is available.Resource and head registration without a Page
TemplateDefinition.PreRender(internal) now receivesIClientResourceControllerandIPageServiceinstead of resolving the controller from the service locator.jsObjectscripts):ClientScript.RegisterClientScriptBlock.IPageService.AddToHead, skipping any script that is already there.Page.Header, becauseDefault.aspxhas already consumed theIPageServicehead tags by the time controls pre-render.IPageService.AddToHead.Bug fix
XsltFunctions.GetUserTextreadHttpContext.Items["DDRMenuHostControl"], which nothing sets. For anonymous users it therefore returned an exception message instead of the localized "Register" text. It now usesDNNContext.Current.ResolveUrl.Public API
The new dependencies are passed through
MenuBase,MenuView,SkinObject,DDRMenuNavigationProviderand the internalDDRMenuControl. Every public member whose signature changed keeps its old signature as an overload, deprecated in 10.4.0.MenuBasector(ILocaliser, IHostSettings, ITabController, IClientResourceController, IPageService)Instantiate(ILocaliser, IHostSettings, ITabController, IClientResourceController, IPageService, string)ctor(ILocaliser, IHostSettings, ITabController)Instantiate(ILocaliser, IHostSettings, ITabController, string)MenuViewctor(..., IClientResourceController, IPageService)ctor(ILocaliser, IHostSettings, ITabController)SkinObjectctor(..., IClientResourceController, IPageService)ctor(ILocaliser, IHostSettings, ITabController)DDRMenuNavigationProviderctor(..., IClientResourceController, IPageService)ctor(ILocaliser, IHostSettings, ITabController)DNNContextctor(string clientID),ClientIDWhen the new constructor parameters are
null, they are resolved from the current service provider, the same as the existing parameters.Review feedback from #7526 addressed here
DNNContextURL helpers now work whenHostControlisnull.ScriptKeysare now registered when there is no page, so MVC rendering keeps the fallback script behavior.develop.Testing
DNN_Platform.slncompile, includingDotNetNuke.Modules.DDRMenuandDotNetNuke.Tests.Modules.DDRMenu.Related to #