/// ----------------------------------------------------------------------------- /// <summary> /// ProcessModule processes the module which is attached to this container. /// </summary> private void ProcessModule() { if (this._tracelLogger.IsDebugEnabled) { this._tracelLogger.Debug($"Container.ProcessModule Start (TabId:{this.PortalSettings.ActiveTab.TabID},ModuleID: {this.ModuleConfiguration.ModuleDefinition.DesktopModuleID}): Module FriendlyName: '{this.ModuleConfiguration.ModuleDefinition.FriendlyName}')"); } if (this.ContentPane != null) { // Process Content Pane Attributes this.ProcessContentPane(); // always add the actions menu as the first item in the content pane. if (this.InjectActionMenu && !ModuleHost.IsViewMode(this.ModuleConfiguration, this.PortalSettings) && this.Request.QueryString["dnnprintmode"] != "true") { JavaScript.RequestRegistration(CommonJs.DnnPlugins); this.ContentPane.Controls.Add(this.LoadControl(this.PortalSettings.DefaultModuleActionMenu)); // register admin.css ClientResourceManager.RegisterAdminStylesheet(this.Page, Globals.HostPath + "admin.css"); } // Process Module Header this.ProcessHeader(); // Try to load the module control this._moduleHost = new ModuleHost(this.ModuleConfiguration, this.ParentSkin, this); if (this._tracelLogger.IsDebugEnabled) { this._tracelLogger.Debug($"Container.ProcessModule Info (TabId:{this.PortalSettings.ActiveTab.TabID},ModuleID: {this.ModuleConfiguration.ModuleDefinition.DesktopModuleID}): ControlPane.Controls.Add(ModuleHost:{this._moduleHost.ID})"); } this.ContentPane.Controls.Add(this.ModuleHost); // Process Module Footer this.ProcessFooter(); // Process the Action Controls if (this.ModuleHost != null && this.ModuleControl != null) { this.ProcessChildControls(this); } // Add Module Stylesheets this.ProcessStylesheets(this.ModuleHost != null); } if (this._tracelLogger.IsDebugEnabled) { this._tracelLogger.Debug($"Container.ProcessModule End (TabId:{this.PortalSettings.ActiveTab.TabID},ModuleID: {this.ModuleConfiguration.ModuleDefinition.DesktopModuleID}): Module FriendlyName: '{this.ModuleConfiguration.ModuleDefinition.FriendlyName}')"); } }
/// ----------------------------------------------------------------------------- /// <summary> /// ProcessModule processes the module which is attached to this container /// </summary> /// <history> /// [cnurse] 12/05/2007 Created /// </history> /// ----------------------------------------------------------------------------- private void ProcessModule() { if (ContentPane != null) { //Process Content Pane Attributes ProcessContentPane(); // always add the actions menu as the first item in the content pane. if (InjectActionMenu && !ModuleHost.IsViewMode(ModuleConfiguration, PortalSettings) && Request.QueryString["dnnprintmode"] != "true") { ContentPane.Controls.Add(LoadControl("~/admin/Menus/ModuleActions/ModuleActions.ascx")); //register admin.css ClientResourceManager.RegisterAdminStylesheet(Page, Globals.HostPath + "admin.css"); } //Process Module Header ProcessHeader(); //Try to load the module control _moduleHost = new ModuleHost(ModuleConfiguration, ParentSkin, this); ContentPane.Controls.Add(ModuleHost); //Process Module Footer ProcessFooter(); //Process the Action Controls if (ModuleHost != null && ModuleControl != null) { ProcessChildControls(this); } //Add Module Stylesheets ProcessStylesheets(ModuleHost != null); } }
/// ----------------------------------------------------------------------------- /// <summary> /// Recursive function to add module's actions to the DNNNodeCollection based off of passed in ModuleActions /// </summary> /// <param name="parentAction">Parent action</param> /// <param name="parentNode">Parent node</param> /// <param name="rootNode">Root Node.</param> /// <param name="actionControl">ActionControl to base actions off of</param> /// <param name="intDepth">How many levels deep should be populated</param> /// <remarks> /// </remarks> /// <history> /// [Jon Henning] 5/15/2006 Created /// </history> /// ----------------------------------------------------------------------------- private static void AddChildActions(ModuleAction parentAction, DNNNode parentNode, DNNNode rootNode, IActionControl actionControl, int intDepth) { //Add Menu Items foreach (ModuleAction action in parentAction.Actions) { bool isActionPending = IsActionPending(parentNode, rootNode, intDepth); if (action.Title == "~") { if (isActionPending == false) { //A title (text) of ~ denotes a break parentNode.DNNNodes.AddBreak(); } } else { //if action is visible and user has permission if (action.Visible && (action.Secure != SecurityAccessLevel.Anonymous || (!ModuleHost.IsViewMode(actionControl.ModuleControl.ModuleContext.Configuration, PortalSettings.Current)) && ModulePermissionController.HasModuleAccess(action.Secure, Null.NullString, actionControl.ModuleControl.ModuleContext.Configuration))) { if (isActionPending) { parentNode.HasNodes = true; } else { int i = parentNode.DNNNodes.Add(); DNNNode node = parentNode.DNNNodes[i]; node.ID = action.ID.ToString(); node.Key = action.ID.ToString(); node.Text = action.Title; //no longer including SPACE in generic node collection, each control must handle how they want to display if (string.IsNullOrEmpty(action.ClientScript) && string.IsNullOrEmpty(action.Url) && string.IsNullOrEmpty(action.CommandArgument)) { node.Enabled = false; } else if (!string.IsNullOrEmpty(action.ClientScript)) { node.JSFunction = action.ClientScript; node.ClickAction = eClickAction.None; } else { node.NavigateURL = action.Url; if (action.UseActionEvent == false && !String.IsNullOrEmpty(node.NavigateURL)) { node.ClickAction = eClickAction.Navigate; if (action.NewWindow) { node.Target = "_blank"; } } else { node.ClickAction = eClickAction.PostBack; } } node.Image = action.Icon; if (action.HasChildren()) //if action has children then call function recursively { AddChildActions(action, node, rootNode, actionControl, intDepth); } } } } } }