/// ----------------------------------------------------------------------------- /// <summary> /// Assigns common properties from passed in tab to newly created DNNNode that is added to the passed in DNNNodeCollection /// </summary> /// <param name="objTab">Tab to base DNNNode off of</param> /// <param name="objNodes">Node collection to append new node to</param> /// <param name="objBreadCrumbs">Hashtable of breadcrumb IDs to efficiently determine node's BreadCrumb property</param> /// <param name="objPortalSettings">Portal settings object to determine if node is selected</param> /// <param name="eToolTips"></param> /// <remarks> /// Logic moved to separate sub to make GetNavigationNodes cleaner /// </remarks> /// ----------------------------------------------------------------------------- private static void AddNode(TabInfo objTab, DNNNodeCollection objNodes, Hashtable objBreadCrumbs, PortalSettings objPortalSettings, ToolTipSource eToolTips) { var objNode = new DNNNode(); if (objTab.Title == "~") //NEW! { //A title (text) of ~ denotes a break objNodes.AddBreak(); } else { //assign breadcrumb and selected properties if (objBreadCrumbs.Contains(objTab.TabID)) { objNode.BreadCrumb = true; if (objTab.TabID == objPortalSettings.ActiveTab.TabID) { objNode.Selected = true; } } if (objTab.DisableLink) { objNode.Enabled = false; } objNode.ID = objTab.TabID.ToString(); objNode.Key = objNode.ID; objNode.Text = objTab.LocalizedTabName; objNode.NavigateURL = objTab.FullUrl; objNode.ClickAction = eClickAction.Navigate; objNode.Image = objTab.IconFile; objNode.LargeImage = objTab.IconFileLarge; switch (eToolTips) { case ToolTipSource.TabName: objNode.ToolTip = objTab.LocalizedTabName; break; case ToolTipSource.Title: objNode.ToolTip = objTab.Title; break; case ToolTipSource.Description: objNode.ToolTip = objTab.Description; break; } bool newWindow = false; if (objTab.TabSettings["LinkNewWindow"] != null && Boolean.TryParse((string)objTab.TabSettings["LinkNewWindow"], out newWindow) && newWindow) { objNode.Target = "_blank"; } objNodes.Add(objNode); } }
/// ----------------------------------------------------------------------------- /// <summary> /// This function provides a central location to obtain a generic node collection of the actions associated /// to a module based off of the current user's context /// </summary> /// <param name="objActionRoot">Root module action</param> /// <param name="objRootNode">Root node on which to populate children</param> /// <param name="objControl">ActionControl to base actions off of</param> /// <param name="intDepth">How many levels deep should be populated</param> /// <returns></returns> /// <remarks> /// </remarks> /// ----------------------------------------------------------------------------- public static DNNNodeCollection GetActionNodes(ModuleAction objActionRoot, DNNNode objRootNode, Control objControl, int intDepth) { DNNNodeCollection objCol = objRootNode.ParentNode.DNNNodes; var objActionControl = objControl as IActionControl; if (objActionControl != null) { AddChildActions(objActionRoot, objRootNode, objRootNode, objActionControl, intDepth); } return(objCol); }
/// ----------------------------------------------------------------------------- /// <summary> /// Allows for DNNNode object to be easily obtained based off of passed in ID /// </summary> /// <param name="strID">NodeID to retrieve</param> /// <param name="strNamespace">Namespace for node collection (usually control's ClientID)</param> /// <returns>DNNNode</returns> /// <remarks> /// Primary purpose of this is to obtain the DNNNode needed for the events exposed by the NavigationProvider /// </remarks> /// ----------------------------------------------------------------------------- public static DNNNode GetNavigationNode(string strID, string strNamespace) { //TODO: FIX THIS MESS! DNNNodeCollection objNodes = GetNavigationNodes(strNamespace); DNNNode objNode = objNodes.FindNode(strID); var objReturnNodes = new DNNNodeCollection(strNamespace); objReturnNodes.Import(objNode); objReturnNodes[0].ID = strID; return(objReturnNodes[0]); }
/// <summary> /// Converts a <see cref="DNNNodeCollection"/> into a <see cref="List{MenuNode}"/>. /// </summary> /// <param name="dnnNodes">The DNNNodeCollection to convert.</param> /// <param name="parent">The parent node in which to place the nodes.</param> /// <returns><see cref="List{MenuNode}"/>.</returns> public static List <MenuNode> ConvertDNNNodeCollection(DNNNodeCollection dnnNodes, MenuNode parent) { var result = new List <MenuNode>(); foreach (DNNNode node in dnnNodes) { result.Add(new MenuNode(node, parent)); } return(result); }
/// ----------------------------------------------------------------------------- /// <summary> /// This function provides a central location to obtain a generic node collection of the pages/tabs included in /// the current context's (user) navigation hierarchy /// </summary> /// <param name="objRootNode">Node in which to add children to</param> /// <param name="eToolTips">Enumerator to determine what text to display in the tooltips</param> /// <param name="intStartTabId">If using Populate On Demand, then this is the tab id of the root element to retrieve (-1 for no POD)</param> /// <param name="intDepth">If Populate On Demand is enabled, then this parameter determines the number of nodes to retrieve beneath the starting tab passed in (intStartTabId) (-1 for no POD)</param> /// <param name="intNavNodeOptions">Bitwise integer containing values to determine what nodes to display (self, siblings, parent)</param> /// <returns>Collection of DNNNodes</returns> /// <remarks> /// Returns a subset of navigation nodes based off of passed in starting node id and depth /// </remarks> /// <history> /// [Jon Henning] 8/9/2005 Created /// </history> /// ----------------------------------------------------------------------------- public static DNNNodeCollection GetNavigationNodes(DNNNode objRootNode, ToolTipSource eToolTips, int intStartTabId, int intDepth, int intNavNodeOptions) { int i; PortalSettings objPortalSettings = PortalController.GetCurrentPortalSettings(); bool blnFoundStart = intStartTabId == -1; var objBreadCrumbs = new Hashtable(); var objTabLookup = new Hashtable(); DNNNodeCollection objRootNodes = objRootNode.DNNNodes; int intLastBreadCrumbId = 0; //--- cache breadcrumbs in hashtable so we can easily set flag on node denoting it as a breadcrumb node (without looping multiple times) --- for (i = 0; i <= (objPortalSettings.ActiveTab.BreadCrumbs.Count - 1); i++) { objBreadCrumbs.Add(((TabInfo)objPortalSettings.ActiveTab.BreadCrumbs[i]).TabID, 1); intLastBreadCrumbId = ((TabInfo)objPortalSettings.ActiveTab.BreadCrumbs[i]).TabID; } var objTabController = new TabController(); List <TabInfo> portalTabs = TabController.GetTabsBySortOrder(objPortalSettings.PortalId, objPortalSettings.CultureCode, true); List <TabInfo> hostTabs = TabController.GetTabsBySortOrder(Null.NullInteger, Localization.SystemLocale, true); foreach (TabInfo objTab in portalTabs) { objTabLookup.Add(objTab.TabID, objTab); } foreach (TabInfo objTab in hostTabs) { objTabLookup.Add(objTab.TabID, objTab); } foreach (TabInfo objTab in portalTabs) { try { ProcessTab(objRootNode, objTab, objTabLookup, objBreadCrumbs, intLastBreadCrumbId, eToolTips, intStartTabId, intDepth, intNavNodeOptions); } catch (Exception ex) { throw ex; } } foreach (TabInfo objTab in hostTabs) { try { ProcessTab(objRootNode, objTab, objTabLookup, objBreadCrumbs, intLastBreadCrumbId, eToolTips, intStartTabId, intDepth, intNavNodeOptions); } catch (Exception ex) { throw ex; } } return(objRootNodes); }
public void BindDropDown() { DNNNodeCollection objNodes = Navigation.GetActionNodes(m_menuActionRoot, this, Control.NavigationControl); foreach (DNNNode objNode in objNodes) { ProcessNodes(objNode); } Control.Bind(objNodes); this.Visible = DisplayControl(objNodes); }
/// ----------------------------------------------------------------------------- /// <summary> /// BindMenu binds the Navigation Provider to the Node Collection /// </summary> /// <param name="objNodes">The Nodes collection to bind</param> /// ----------------------------------------------------------------------------- private void BindMenu(DNNNodeCollection objNodes) { Visible = ActionManager.DisplayControl(objNodes); if (Visible) { //since we always bind we need to clear the nodes for providers that maintain their state ProviderControl.ClearNodes(); foreach (DNNNode objNode in objNodes) { ProcessNodes(objNode); } ProviderControl.Bind(objNodes); } }
private void BindMenu(DNNNodeCollection objNodes) { Visible = DisplayControl(objNodes); if (!Visible) { return; } navProvider.ClearNodes(); foreach (DNNNode node in objNodes) { ProcessNode(node); } navProvider.Bind(objNodes, false); }
/// <summary> /// This function provides a central location to obtain a generic node collection of the actions associated /// to a module based off of the current user's context /// </summary> /// <param name="objActionRoot">Root module action</param> /// <param name="objModule">Module whose actions you wish to obtain</param> /// <param name="intDepth">How many levels deep should be populated</param> /// <returns></returns> /// <remarks> /// </remarks> /// <history> /// [Jon Henning] 5/15/2006 Created /// </history> public static DNNNodeCollection GetActionNodes(ModuleAction objActionRoot, ActionBase objModule, int intDepth) { DNNNodeCollection objCol = new DNNNodeCollection(objModule.ClientID); if (objActionRoot.Visible) { objCol.Add(); DNNNode objRoot = objCol[0]; objRoot.ID = objActionRoot.ID.ToString(); objRoot.Key = objActionRoot.ID.ToString(); objRoot.Text = objActionRoot.Title; objRoot.NavigateURL = objActionRoot.Url; objRoot.Image = objActionRoot.Icon; AddChildActions(objActionRoot, objRoot, objRoot.ParentNode, objModule, UserController.GetCurrentUserInfo(), intDepth); } return(objCol); }
public override void Bind(DNNNodeCollection objNodes) { foreach (DNNNode dnnNode in objNodes) { DNNNode objNode = dnnNode; if (objNode.ClickAction == eClickAction.PostBack) { DropDown.AutoPostBack = true; //its all or nothing... } string strLevelPrefix = new String('_', objNode.Level); if (objNode.IsBreak) { DropDown.Items.Add("-------------------"); } else { DropDown.Items.Add(new ListItem(strLevelPrefix + objNode.Text, objNode.ID)); } Bind(objNode.DNNNodes); } }
/// ----------------------------------------------------------------------------- /// <summary> /// This function provides a central location to obtain a generic node collection of the actions associated /// to a module based off of the current user's context /// </summary> /// <param name="objActionRoot">Root module action</param> /// <param name="objControl">ActionControl to base actions off of</param> /// <param name="intDepth">How many levels deep should be populated</param> /// <returns></returns> /// <remarks> /// </remarks> /// <history> /// [Jon Henning] 5/15/2006 Created /// </history> /// ----------------------------------------------------------------------------- public static DNNNodeCollection GetActionNodes(ModuleAction objActionRoot, Control objControl, int intDepth) { var objCol = new DNNNodeCollection(objControl.ClientID); var objActionControl = objControl as IActionControl; if (objActionControl != null) { if (objActionRoot.Visible) { objCol.Add(); DNNNode objRoot = objCol[0]; objRoot.ID = objActionRoot.ID.ToString(); objRoot.Key = objActionRoot.ID.ToString(); objRoot.Text = objActionRoot.Title; objRoot.NavigateURL = objActionRoot.Url; objRoot.Image = objActionRoot.Icon; objRoot.Enabled = false; AddChildActions(objActionRoot, objRoot, objRoot.ParentNode, objActionControl, intDepth); } } return(objCol); }
/// <summary> /// DisplayControl determines whether the control should be displayed /// </summary> /// <param name="objNodes"> /// The obj nodes. /// </param> /// <returns> /// The display control. /// </returns> protected bool DisplayControl(DNNNodeCollection objNodes) { return(this.ActionManager.DisplayControl(objNodes)); }
public abstract void Bind(DNNNodeCollection objNodes);
public DNNNodeCollection LocaliseNodes(DNNNodeCollection nodes) { return(null); }
public override void Bind(DNNNodeCollection objNodes) { DNNNode objNode; TreeNode objTreeItem; int intIndex; if (IndicateChildren == false) { IndicateChildImageSub = ""; IndicateChildImageRoot = ""; this.IndicateChildImageExpandedSub = ""; this.IndicateChildImageExpandedRoot = ""; } if (this.CSSNodeSelectedRoot.Length > 0 && this.CSSNodeSelectedRoot == this.CSSNodeSelectedSub) { Tree.DefaultNodeCssClassSelected = this.CSSNodeSelectedRoot; //set on parent, thus decreasing overall payload } //For i = 0 To objNodes.Count - 1 'Each objNode In objNodes foreach (DNNNode tempLoopVar_objNode in objNodes) { objNode = tempLoopVar_objNode; //objNode = objNodes(i) if (objNode.Level == 0) // root Tree { intIndex = Tree.TreeNodes.Import(objNode, true); objTreeItem = Tree.TreeNodes[intIndex]; //objTreeItem.ID = objNode.ID if (objNode.Enabled == false) { objTreeItem.ClickAction = eClickAction.Expand; } if (!String.IsNullOrEmpty(this.CSSNodeRoot)) { objTreeItem.CssClass = this.CSSNodeRoot; } if (!String.IsNullOrEmpty(this.CSSNodeHoverRoot)) { objTreeItem.CSSClassHover = this.CSSNodeHoverRoot; } if (!String.IsNullOrEmpty(this.NodeLeftHTMLRoot)) { //objTreeItem.LeftHTML = Me.NodeLeftHTMLRoot } if (Tree.DefaultNodeCssClassSelected.Length == 0 && this.CSSNodeSelectedRoot.Length > 0) { objTreeItem.CSSClassSelected = this.CSSNodeSelectedRoot; } objTreeItem.CSSIcon = " "; //< ignore for root...??? if (objNode.BreadCrumb) { objTreeItem.CssClass = this.CSSBreadCrumbRoot; //If NodeLeftHTMLBreadCrumbRoot <> "" Then objTreeItem.LeftHTML = NodeLeftHTMLBreadCrumbRoot //If NodeRightHTMLBreadCrumbRoot <> "" Then objTreeItem.RightHTML = NodeRightHTMLBreadCrumbRoot //If objNode.Selected Then '<--- not necessary - control handles it // objTreeItem.CSSClassSelected = Me.CSSNodeSelectedRoot //End If } if (!String.IsNullOrEmpty(this.NodeRightHTMLRoot)) { //objTreeItem.RightHTML = NodeRightHTMLRoot } } else { try { TreeNode objParent = Tree.TreeNodes.FindNode(objNode.ParentNode.ID); if (objParent == null) //POD { objParent = Tree.TreeNodes[Tree.TreeNodes.Import(objNode.ParentNode.Clone(), true)]; } objTreeItem = objParent.TreeNodes.FindNode(objNode.ID); if (objTreeItem == null) //POD { objTreeItem = objParent.TreeNodes[objParent.TreeNodes.Import(objNode.Clone(), true)]; } //objTreeItem.ID = objNode.ID if (objNode.Enabled == false) { objTreeItem.ClickAction = eClickAction.Expand; } //objTreeItem.Selected = objNode.Selected if (!String.IsNullOrEmpty(CSSNodeHover)) { objTreeItem.CSSClassHover = CSSNodeHover; } if (!String.IsNullOrEmpty(NodeLeftHTMLSub)) { //objTreeItem.LeftHTML = NodeLeftHTML } if (Tree.DefaultNodeCssClassSelected.Length == 0 && this.CSSNodeSelectedSub.Length > 0) { objTreeItem.CSSClassSelected = this.CSSNodeSelectedSub; } if (objNode.BreadCrumb) { objTreeItem.CssClass = this.CSSBreadCrumbSub; //If NodeLeftHTMLBreadCrumb <> "" Then objTreeItem.LeftHTML = NodeLeftHTMLBreadCrumb //If NodeRightHTMLBreadCrumb <> "" Then objTreeItem.RightHTML = NodeRightHTMLBreadCrumb //If objNode.Selected Then // objTreeItem.ItemCss = Me.CSSNodeActive //End If } if (!String.IsNullOrEmpty(this.NodeRightHTMLSub)) { //objTreeItem.RightHTML = Me.NodeRightHTML } } catch { // throws exception if the parent tab has not been loaded ( may be related to user role security not allowing access to a parent tab ) objTreeItem = null; } } if (objNode.Image.Length > 0) { if (objNode.Image.StartsWith("/") == false && this.PathImage.Length > 0) { objNode.Image = this.PathImage + objNode.Image; } objTreeItem.Image = objNode.Image; } objTreeItem.ToolTip = objNode.ToolTip; //End Select if (objNode.Selected) { Tree.SelectNode(objNode.ID); } Bind(objNode.DNNNodes); } }
public void Bind(DNNNodeCollection objNodes, bool localise) { var clientOptions = new List <ClientOption>(); var ignoreProperties = new List <string> { "CustomAttributes", "NavigationControl", "SupportsPopulateOnDemand", "NodeXmlPath", "NodeSelector", "IncludeContext", "IncludeHidden", "IncludeNodes", "ExcludeNodes", "NodeManipulator" }; foreach (var prop in typeof(NavigationProvider).GetProperties(BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.Instance)) { if (!string.IsNullOrEmpty(prop.Name) && !ignoreProperties.Contains(prop.Name)) { var propValue = prop.GetValue(this, null); if (propValue != null) { if (propValue is bool) { clientOptions.Add(new ClientBoolean(prop.Name, propValue.ToString())); } else if (propValue is int || propValue is decimal || propValue is double) { clientOptions.Add(new ClientNumber(prop.Name, propValue.ToString())); } else { clientOptions.Add(new ClientString(prop.Name, propValue.ToString())); } } } } if (CustomAttributes != null) { foreach (var attr in CustomAttributes) { if (!string.IsNullOrEmpty(attr.Name)) { clientOptions.Add(new ClientString(attr.Name, attr.Value)); } } } if (localise) { objNodes = Localiser.LocaliseDNNNodeCollection(objNodes); } menuControl.RootNode = new MenuNode(objNodes); menuControl.SkipLocalisation = !localise; menuControl.MenuSettings = new Settings { MenuStyle = GetCustomAttribute("MenuStyle") ?? MenuStyle ?? "DNNMenu", NodeXmlPath = GetCustomAttribute("NodeXmlPath"), NodeSelector = GetCustomAttribute("NodeSelector"), IncludeContext = Convert.ToBoolean(GetCustomAttribute("IncludeContext") ?? "false"), IncludeHidden = Convert.ToBoolean(GetCustomAttribute("IncludeHidden") ?? "false"), IncludeNodes = GetCustomAttribute("IncludeNodes"), ExcludeNodes = GetCustomAttribute("ExcludeNodes"), NodeManipulator = GetCustomAttribute("NodeManipulator"), ClientOptions = clientOptions, TemplateArguments = TemplateArguments, }; }
public DNNNodeCollection LocaliseNodes(DNNNodeCollection nodes) { return(LE.Instance.ProcessNavigationNodes(nodes)); }
public DNNNodeCollection LocaliseNodes(DNNNodeCollection nodes) { return((locNodes == null) ? null : (DNNNodeCollection)locNodes.Invoke(locApi, new object[] { nodes })); }
public override void Bind(DNNNodeCollection objNodes) { DNNNode objNode = null; MenuNode objMenuItem; DNNNode objPrevNode = null; bool RootFlag = false; int intIndex; if (IndicateChildren == false) { IndicateChildImageSub = ""; IndicateChildImageRoot = ""; } if (!String.IsNullOrEmpty(CSSNodeSelectedRoot) && CSSNodeSelectedRoot == CSSNodeSelectedSub) { Menu.DefaultNodeCssClassSelected = CSSNodeSelectedRoot; //set on parent, thus decreasing overall payload } //JH - 2/5/07 - support for custom attributes foreach (CustomAttribute objAttr in CustomAttributes) { switch (objAttr.Name.ToLower()) { case "submenuorientation": Menu.SubMenuOrientation = (UI.WebControls.Orientation)Enum.Parse(Menu.SubMenuOrientation.GetType(), objAttr.Value); break; case "usetables": Menu.RenderMode = DNNMenu.MenuRenderMode.Normal; break; case "rendermode": Menu.RenderMode = (DNNMenu.MenuRenderMode)Enum.Parse(typeof(DNNMenu.MenuRenderMode), objAttr.Value); break; case "animationtype": Menu.Animation.AnimationType = (AnimationType)Enum.Parse(typeof(AnimationType), objAttr.Value); break; case "easingdirection": Menu.Animation.EasingDirection = (EasingDirection)Enum.Parse(typeof(EasingDirection), objAttr.Value); break; case "easingtype": Menu.Animation.EasingType = (EasingType)Enum.Parse(typeof(EasingType), objAttr.Value); break; case "animationinterval": Menu.Animation.Interval = int.Parse(objAttr.Value); break; case "animationlength": Menu.Animation.Length = int.Parse(objAttr.Value); break; } } foreach (DNNNode node in objNodes) { objNode = node; if (objNode.Level == 0) //root menu { intIndex = Menu.MenuNodes.Import(objNode, false); objMenuItem = Menu.MenuNodes[intIndex]; if (objNode.BreadCrumb && string.IsNullOrEmpty(NodeRightHTMLBreadCrumbRoot) == false) { objMenuItem.RightHTML += NodeRightHTMLBreadCrumbRoot; } else if (string.IsNullOrEmpty(NodeRightHTMLRoot) == false) { objMenuItem.RightHTML = NodeRightHTMLRoot; } if (RootFlag) //first root item has already been entered { AddSeparator("All", objPrevNode, objNode, objMenuItem); } else { if (string.IsNullOrEmpty(SeparatorLeftHTML) == false || string.IsNullOrEmpty(SeparatorLeftHTMLBreadCrumb) == false || string.IsNullOrEmpty(SeparatorLeftHTMLActive) == false) { AddSeparator("Left", objPrevNode, objNode, objMenuItem); } RootFlag = true; } if (objNode.BreadCrumb && string.IsNullOrEmpty(NodeLeftHTMLBreadCrumbRoot) == false) { objMenuItem.LeftHTML += NodeLeftHTMLBreadCrumbRoot; } else if (string.IsNullOrEmpty(NodeLeftHTMLRoot) == false) { objMenuItem.LeftHTML += NodeLeftHTMLRoot; } if (!String.IsNullOrEmpty(CSSNodeRoot)) { objMenuItem.CSSClass = CSSNodeRoot; } if (!String.IsNullOrEmpty(CSSNodeHoverRoot) && CSSNodeHoverRoot != CSSNodeHoverSub) { objMenuItem.CSSClassHover = CSSNodeHoverRoot; } objMenuItem.CSSIcon = " "; //< ignore for root...??? if (objNode.BreadCrumb) { if (!String.IsNullOrEmpty(CSSBreadCrumbRoot)) { objMenuItem.CSSClass = CSSBreadCrumbRoot; } if (objNode.Selected && String.IsNullOrEmpty(Menu.DefaultNodeCssClassSelected)) { objMenuItem.CSSClassSelected = CSSNodeSelectedRoot; } } } else //If Not blnRootOnly Then { try { MenuNode objParent = Menu.MenuNodes.FindNode(objNode.ParentNode.ID); if (objParent == null) //POD { objParent = Menu.MenuNodes[Menu.MenuNodes.Import(objNode.ParentNode.Clone(), true)]; } objMenuItem = objParent.MenuNodes.FindNode(objNode.ID); if (objMenuItem == null) //POD { objMenuItem = objParent.MenuNodes[objParent.MenuNodes.Import(objNode.Clone(), true)]; } if (!String.IsNullOrEmpty(NodeLeftHTMLSub)) { objMenuItem.LeftHTML = NodeLeftHTMLSub; } if (!String.IsNullOrEmpty(NodeRightHTMLSub)) { objMenuItem.RightHTML = NodeRightHTMLSub; } if (!String.IsNullOrEmpty(CSSNodeHoverSub) && CSSNodeHoverRoot != CSSNodeHoverSub) { objMenuItem.CSSClassHover = CSSNodeHoverSub; } if (objNode.BreadCrumb) { if (!String.IsNullOrEmpty(CSSBreadCrumbSub)) { objMenuItem.CSSClass = CSSBreadCrumbSub; } if (!String.IsNullOrEmpty(NodeLeftHTMLBreadCrumbSub)) { objMenuItem.LeftHTML = NodeLeftHTMLBreadCrumbSub; } if (!String.IsNullOrEmpty(NodeRightHTMLBreadCrumbSub)) { objMenuItem.RightHTML = NodeRightHTMLBreadCrumbSub; } if (objNode.Selected && String.IsNullOrEmpty(Menu.DefaultNodeCssClassSelected)) { objMenuItem.CSSClass = CSSNodeSelectedSub; } } } catch { //throws exception if the parent tab has not been loaded ( may be related to user role security not allowing access to a parent tab ) objMenuItem = null; } } if (!String.IsNullOrEmpty(objNode.Image)) { if (objNode.Image.StartsWith("~/images/")) { objNode.Image = objNode.Image.Replace("~/images/", PathSystemImage); } else if (objNode.Image.StartsWith("~/")) { objNode.Image = Globals.ResolveUrl(objNode.Image); } else if (!objNode.Image.Contains("://") && objNode.Image.StartsWith("/") == false && !String.IsNullOrEmpty(PathImage)) { objNode.Image = PathImage + objNode.Image; } objMenuItem.Image = objNode.Image; } if (objMenuItem.IsBreak) { objMenuItem.CSSClass = CSSBreak; } objMenuItem.ToolTip = objNode.ToolTip; Bind(objNode.DNNNodes); objPrevNode = objNode; } if (objNode != null && objNode.Level == 0) //root menu { //solpartactions has a hardcoded image with no path information. Assume if value is present and no path we need to add one. if (!String.IsNullOrEmpty(IndicateChildImageSub) && IndicateChildImageSub.IndexOf("/") == -1) { IndicateChildImageSub = PathSystemImage + IndicateChildImageSub; } if (!String.IsNullOrEmpty(IndicateChildImageRoot) && IndicateChildImageRoot.IndexOf("/") == -1) { IndicateChildImageRoot = PathSystemImage + IndicateChildImageRoot; } } }
public override void Bind(DNNNodeCollection objNodes) { TreeNode objTreeItem; if (IndicateChildren == false) { IndicateChildImageSub = ""; IndicateChildImageRoot = ""; IndicateChildImageExpandedSub = ""; IndicateChildImageExpandedRoot = ""; } if (!String.IsNullOrEmpty(CSSNodeSelectedRoot) && CSSNodeSelectedRoot == CSSNodeSelectedSub) { Tree.DefaultNodeCssClassSelected = CSSNodeSelectedRoot; //set on parent, thus decreasing overall payload } foreach (DNNNode objNode in objNodes) { if (objNode.Level == 0) //root Tree { int intIndex = Tree.TreeNodes.Import(objNode, true); objTreeItem = Tree.TreeNodes[intIndex]; if (objNode.Enabled == false) { objTreeItem.ClickAction = eClickAction.Expand; } if (!String.IsNullOrEmpty(CSSNodeRoot)) { objTreeItem.CssClass = CSSNodeRoot; } if (!String.IsNullOrEmpty(CSSNodeHoverRoot)) { objTreeItem.CSSClassHover = CSSNodeHoverRoot; } if (String.IsNullOrEmpty(Tree.DefaultNodeCssClassSelected) && !String.IsNullOrEmpty(CSSNodeSelectedRoot)) { objTreeItem.CSSClassSelected = CSSNodeSelectedRoot; } objTreeItem.CSSIcon = " "; //< ignore for root...??? if (objNode.BreadCrumb) { objTreeItem.CssClass = CSSBreadCrumbRoot; } } else { try { TreeNode objParent = Tree.TreeNodes.FindNode(objNode.ParentNode.ID); if (objParent == null) //POD { objParent = Tree.TreeNodes[Tree.TreeNodes.Import(objNode.ParentNode.Clone(), true)]; } objTreeItem = objParent.TreeNodes.FindNode(objNode.ID); if (objTreeItem == null) //POD { objTreeItem = objParent.TreeNodes[objParent.TreeNodes.Import(objNode.Clone(), true)]; } if (objNode.Enabled == false) { objTreeItem.ClickAction = eClickAction.Expand; } if (!String.IsNullOrEmpty(CSSNodeHover)) { objTreeItem.CSSClassHover = CSSNodeHover; } if (String.IsNullOrEmpty(Tree.DefaultNodeCssClassSelected) && !String.IsNullOrEmpty(CSSNodeSelectedSub)) { objTreeItem.CSSClassSelected = CSSNodeSelectedSub; } if (objNode.BreadCrumb) { objTreeItem.CssClass = CSSBreadCrumbSub; } } catch { //throws exception if the parent tab has not been loaded ( may be related to user role security not allowing access to a parent tab ) objTreeItem = null; } } if (!String.IsNullOrEmpty(objNode.Image)) { if (objNode.Image.StartsWith("~/images/")) { objNode.Image = objNode.Image.Replace("~/images/", PathSystemImage); } else if (!objNode.Image.Contains("://") && objNode.Image.StartsWith("/") == false && !String.IsNullOrEmpty(PathImage)) { objNode.Image = PathImage + objNode.Image; } objTreeItem.Image = objNode.Image; } objTreeItem.ToolTip = objNode.ToolTip; //End Select if (objNode.Selected) { Tree.SelectNode(objNode.ID); } Bind(objNode.DNNNodes); } }
public MenuNode(DNNNodeCollection dnnNodes) { Children = ConvertDNNNodeCollection(dnnNodes, this); }
public override void Bind(DNNNodeCollection objNodes) { DNNNode objNode = null; SPMenuItemNode objMenuItem = null; DNNNode objPrevNode = null; bool RootFlag = false; if (IndicateChildren == false) { } else { if (!String.IsNullOrEmpty(IndicateChildImageRoot)) { Menu.RootArrow = true; } } foreach (DNNNode node in objNodes) { objNode = node; try { if (objNode.Level == 0) { if (RootFlag) { AddSeparator("All", objPrevNode, objNode); } else { if (!String.IsNullOrEmpty(SeparatorLeftHTML) || !String.IsNullOrEmpty(SeparatorLeftHTMLBreadCrumb) || !String.IsNullOrEmpty(SeparatorLeftHTMLActive)) { AddSeparator("Left", objPrevNode, objNode); } RootFlag = true; } if (objNode.Enabled == false) { objMenuItem = new SPMenuItemNode(Menu.AddMenuItem(objNode.ID, objNode.Text, "")); } else { if (!String.IsNullOrEmpty(objNode.JSFunction)) { objMenuItem = new SPMenuItemNode(Menu.AddMenuItem(objNode.ID, objNode.Text, GetClientScriptURL(objNode.JSFunction, objNode.ID))); } else { objMenuItem = new SPMenuItemNode(Menu.AddMenuItem(objNode.ID, objNode.Text, objNode.NavigateURL)); } } if (!String.IsNullOrEmpty(StyleRoot)) { objMenuItem.ItemStyle = StyleRoot; } if (!String.IsNullOrEmpty(CSSNodeRoot)) { objMenuItem.ItemCss = CSSNodeRoot; } if (!String.IsNullOrEmpty(CSSNodeHoverRoot)) { objMenuItem.ItemSelectedCss = CSSNodeHoverRoot; } if (!String.IsNullOrEmpty(NodeLeftHTMLRoot)) { objMenuItem.LeftHTML = NodeLeftHTMLRoot; } if (objNode.BreadCrumb) { objMenuItem.ItemCss = objMenuItem.ItemCss + " " + CSSBreadCrumbRoot; if (!String.IsNullOrEmpty(NodeLeftHTMLBreadCrumbRoot)) { objMenuItem.LeftHTML = NodeLeftHTMLBreadCrumbRoot; } if (!String.IsNullOrEmpty(NodeRightHTMLBreadCrumbRoot)) { objMenuItem.RightHTML = NodeRightHTMLBreadCrumbRoot; } if (objNode.Selected) { objMenuItem.ItemCss = objMenuItem.ItemCss + " " + CSSNodeSelectedRoot; } } if (!String.IsNullOrEmpty(NodeRightHTMLRoot)) { objMenuItem.RightHTML = NodeRightHTMLRoot; } } else if (objNode.IsBreak) { Menu.AddBreak(objNode.ParentNode.ID); } else { try { if (objNode.Enabled == false) { objMenuItem = new SPMenuItemNode(Menu.AddMenuItem(objNode.ParentNode.ID, objNode.ID, " " + objNode.Text, "")); } else { if (!String.IsNullOrEmpty(objNode.JSFunction)) { objMenuItem = new SPMenuItemNode(Menu.AddMenuItem(objNode.ParentNode.ID, objNode.ID, " " + objNode.Text, GetClientScriptURL(objNode.JSFunction, objNode.ID))); } else { objMenuItem = new SPMenuItemNode(Menu.AddMenuItem(objNode.ParentNode.ID, objNode.ID, " " + objNode.Text, objNode.NavigateURL)); } } if (objNode.ClickAction == eClickAction.PostBack) { objMenuItem.RunAtServer = true; } if (!String.IsNullOrEmpty(CSSNodeHoverSub)) { objMenuItem.ItemSelectedCss = CSSNodeHoverSub; } if (!String.IsNullOrEmpty(NodeLeftHTMLSub)) { objMenuItem.LeftHTML = NodeLeftHTMLSub; } if (objNode.BreadCrumb) { objMenuItem.ItemCss = CSSBreadCrumbSub; if (!String.IsNullOrEmpty(NodeLeftHTMLBreadCrumbSub)) { objMenuItem.LeftHTML = NodeLeftHTMLBreadCrumbSub; } if (!String.IsNullOrEmpty(NodeRightHTMLBreadCrumbSub)) { objMenuItem.RightHTML = NodeRightHTMLBreadCrumbSub; } if (objNode.Selected) { objMenuItem.ItemCss = CSSNodeSelectedSub; DNNNode objParentNode = objNode; do { objParentNode = objParentNode.ParentNode; Menu.FindMenuItem(objParentNode.ID).ItemCss = CSSNodeSelectedSub; } while (objParentNode.Level != 0); Menu.FindMenuItem(objParentNode.ID).ItemCss = CSSBreadCrumbRoot + " " + CSSNodeSelectedRoot; } } if (!String.IsNullOrEmpty(NodeRightHTMLSub)) { objMenuItem.RightHTML = NodeRightHTMLSub; } } catch { objMenuItem = null; } } if (!String.IsNullOrEmpty(objNode.Image)) { if (objNode.Image.StartsWith("~/images/")) { objMenuItem.Image = objNode.Image.Replace("~/images/", ""); } else if (objNode.Image.IndexOf("/") > -1) { string strImage = objNode.Image; if (strImage.StartsWith(Menu.IconImagesPath)) { strImage = strImage.Substring(Menu.IconImagesPath.Length); } if (strImage.IndexOf("/") > -1) { objMenuItem.Image = strImage.Substring(strImage.LastIndexOf("/") + 1); if (strImage.StartsWith("/")) { objMenuItem.ImagePath = strImage.Substring(0, strImage.LastIndexOf("/") + 1); } else if (strImage.StartsWith("~/")) { objMenuItem.ImagePath = Globals.ResolveUrl(strImage.Substring(0, strImage.LastIndexOf("/") + 1)); } else { objMenuItem.ImagePath = Menu.IconImagesPath + strImage.Substring(0, strImage.LastIndexOf("/") + 1); } } else { objMenuItem.Image = strImage; } } else { objMenuItem.Image = objNode.Image; } } if (!String.IsNullOrEmpty(objNode.ToolTip)) { objMenuItem.ToolTip = objNode.ToolTip; } Bind(objNode.DNNNodes); } catch (Exception ex) { throw ex; } objPrevNode = objNode; } if (objNode != null && objNode.Level == 0) { if (!String.IsNullOrEmpty(SeparatorRightHTML) || !String.IsNullOrEmpty(SeparatorRightHTMLBreadCrumb) || !String.IsNullOrEmpty(SeparatorRightHTMLActive)) { AddSeparator("Right", objPrevNode, null); } } }
private static void ProcessTab(DNNNode objRootNode, TabInfo objTab, Hashtable objTabLookup, Hashtable objBreadCrumbs, int intLastBreadCrumbId, ToolTipSource eToolTips, int intStartTabId, int intDepth, int intNavNodeOptions) { PortalSettings objPortalSettings = PortalController.Instance.GetCurrentPortalSettings(); DNNNodeCollection objRootNodes = objRootNode.DNNNodes; bool showHidden = (intNavNodeOptions & (int)NavNodeOptions.IncludeHiddenNodes) == (int)NavNodeOptions.IncludeHiddenNodes; if (CanShowTab(objTab, TabPermissionController.CanAdminPage(), true, showHidden)) //based off of tab properties, is it shown { DNNNodeCollection objParentNodes; DNNNode objParentNode = objRootNodes.FindNode(objTab.ParentId.ToString()); bool blnParentFound = objParentNode != null; if (objParentNode == null) { objParentNode = objRootNode; } objParentNodes = objParentNode.DNNNodes; if (objTab.TabID == intStartTabId) { //is this the starting tab if ((intNavNodeOptions & (int)NavNodeOptions.IncludeParent) != 0) { //if we are including parent, make sure there is one, then add if (objTabLookup[objTab.ParentId] != null) { AddNode((TabInfo)objTabLookup[objTab.ParentId], objParentNodes, objBreadCrumbs, objPortalSettings, eToolTips); objParentNode = objRootNodes.FindNode(objTab.ParentId.ToString()); objParentNodes = objParentNode.DNNNodes; } } if ((intNavNodeOptions & (int)NavNodeOptions.IncludeSelf) != 0) { //if we are including our self (starting tab) then add AddNode(objTab, objParentNodes, objBreadCrumbs, objPortalSettings, eToolTips); } } else if (((intNavNodeOptions & (int)NavNodeOptions.IncludeSiblings) != 0) && IsTabSibling(objTab, intStartTabId, objTabLookup)) { //is this a sibling of the starting node, and we are including siblings, then add it AddNode(objTab, objParentNodes, objBreadCrumbs, objPortalSettings, eToolTips); } else { if (blnParentFound) //if tabs parent already in hierarchy (as is the case when we are sending down more than 1 level) { //parent will be found for siblings. Check to see if we want them, if we don't make sure tab is not a sibling if (((intNavNodeOptions & (int)NavNodeOptions.IncludeSiblings) != 0) || IsTabSibling(objTab, intStartTabId, objTabLookup) == false) { //determine if tab should be included or marked as pending bool blnPOD = (intNavNodeOptions & (int)NavNodeOptions.MarkPendingNodes) != 0; if (IsTabPending(objTab, objParentNode, objRootNode, intDepth, objBreadCrumbs, intLastBreadCrumbId, blnPOD)) { if (blnPOD) { objParentNode.HasNodes = true; //mark it as a pending node } } else { AddNode(objTab, objParentNodes, objBreadCrumbs, objPortalSettings, eToolTips); } } } else if ((intNavNodeOptions & (int)NavNodeOptions.IncludeSelf) == 0 && objTab.ParentId == intStartTabId) { //if not including self and parent is the start id then add AddNode(objTab, objParentNodes, objBreadCrumbs, objPortalSettings, eToolTips); } } } }
public override void Bind(DNNNodeCollection objNodes) { DNNNode objNode = null; SPMenuItemNode objMenuItem = null; DNNNode objPrevNode = null; bool isRootFlag = false; if (IndicateChildren == false) { //should this be spacer.gif??? //IndicateChildImageSub = "" //IndicateChildImageRoot = "" } else { if (!String.IsNullOrEmpty(IndicateChildImageRoot)) { Menu.RootArrow = true; } } foreach (DNNNode dnnNode in objNodes) { objNode = dnnNode; try { if (objNode.Level == 0) // root menu { if (isRootFlag) //first root item has already been entered { AddSeparator("All", objPrevNode, objNode); } else { if (!String.IsNullOrEmpty(SeparatorLeftHTML) || !String.IsNullOrEmpty(SeparatorLeftHTMLBreadCrumb) || !String.IsNullOrEmpty(SeparatorLeftHTMLActive)) { AddSeparator("Left", objPrevNode, objNode); } isRootFlag = true; } if (objNode.Enabled == false) { objMenuItem = new SPMenuItemNode(Menu.AddMenuItem(objNode.ID.ToString(), objNode.Text, "")); } else { string jsFunction = objNode.JSFunction; if ((jsFunction != null) && (jsFunction.Length > 0)) { objMenuItem = new SPMenuItemNode(Menu.AddMenuItem(objNode.ID.ToString(), objNode.Text, GetClientScriptURL(objNode.JSFunction, objNode.ID))); } else { objMenuItem = new SPMenuItemNode(Menu.AddMenuItem(objNode.ID.ToString(), objNode.Text, objNode.NavigateURL)); } } if (StyleRoot != null && StyleRoot.Length > 0) { objMenuItem.ItemStyle = this.StyleRoot; } if (!String.IsNullOrEmpty(CSSNodeRoot)) { objMenuItem.ItemCss = this.CSSNodeRoot; } if (!String.IsNullOrEmpty(CSSNodeHoverRoot)) { objMenuItem.ItemSelectedCss = this.CSSNodeHoverRoot; } if (!String.IsNullOrEmpty(NodeLeftHTMLRoot)) { objMenuItem.LeftHTML = this.NodeLeftHTMLRoot; } if (objNode.BreadCrumb) { objMenuItem.ItemCss = objMenuItem.ItemCss + " " + this.CSSBreadCrumbRoot; if (!String.IsNullOrEmpty(NodeLeftHTMLBreadCrumbRoot)) { objMenuItem.LeftHTML = NodeLeftHTMLBreadCrumbRoot; } if (!String.IsNullOrEmpty(NodeRightHTMLBreadCrumbRoot)) { objMenuItem.RightHTML = NodeRightHTMLBreadCrumbRoot; } if (objNode.Selected) { objMenuItem.ItemCss = objMenuItem.ItemCss + " " + this.CSSNodeSelectedRoot; } } if (!String.IsNullOrEmpty(NodeRightHTMLRoot)) { objMenuItem.RightHTML = NodeRightHTMLRoot; } } else if (objNode.IsBreak) { Menu.AddBreak(objNode.ParentNode.ID.ToString()); } else //If Not blnRootOnly Then { try { if (objNode.Enabled == false) { objMenuItem = new SPMenuItemNode(Menu.AddMenuItem(objNode.ParentNode.ID.ToString(), objNode.ID.ToString(), " " + objNode.Text, "")); } else { string jsFunction = objNode.JSFunction; if (!String.IsNullOrEmpty(jsFunction)) { objMenuItem = new SPMenuItemNode(Menu.AddMenuItem(objNode.ParentNode.ID.ToString(), objNode.ID.ToString(), " " + objNode.Text, GetClientScriptURL(objNode.JSFunction, objNode.ID))); } else { objMenuItem = new SPMenuItemNode(Menu.AddMenuItem(objNode.ParentNode.ID.ToString(), objNode.ID.ToString(), " " + objNode.Text, objNode.NavigateURL)); } } if (objNode.ClickAction == eClickAction.PostBack) { objMenuItem.RunAtServer = true; } if (!String.IsNullOrEmpty(CSSNodeHoverSub)) { objMenuItem.ItemSelectedCss = CSSNodeHoverSub; } if (!String.IsNullOrEmpty(NodeLeftHTMLSub)) { objMenuItem.LeftHTML = NodeLeftHTMLSub; } if (objNode.BreadCrumb) { objMenuItem.ItemCss = this.CSSBreadCrumbSub; if (!String.IsNullOrEmpty(NodeLeftHTMLBreadCrumbSub)) { objMenuItem.LeftHTML = NodeLeftHTMLBreadCrumbSub; } if (!String.IsNullOrEmpty(NodeRightHTMLBreadCrumbSub)) { objMenuItem.RightHTML = NodeRightHTMLBreadCrumbSub; } if (objNode.Selected) { objMenuItem.ItemCss = this.CSSNodeSelectedSub; } } if (!String.IsNullOrEmpty(NodeRightHTMLSub)) { objMenuItem.RightHTML = this.NodeRightHTMLSub; } } catch { // throws exception if the parent tab has not been loaded ( may be related to user role security not allowing access to a parent tab ) objMenuItem = null; } //Else // objMenuItem = Nothing } if (objMenuItem != null) { if (!String.IsNullOrEmpty(objNode.Image)) { //if image contains a path if (objNode.Image.IndexOf("/") > -1) { string strImage = objNode.Image; //if path (or portion) is already set in header of menu truncate it off if (strImage.StartsWith(Menu.IconImagesPath)) { strImage = strImage.Substring(Menu.IconImagesPath.Length); } if (strImage.IndexOf("/") > -1) //if the image still contains path info assign it { objMenuItem.Image = strImage.Substring(strImage.LastIndexOf("/") + 1); if (strImage.StartsWith("/")) //is absolute path? { objMenuItem.ImagePath = strImage.Substring(0, strImage.LastIndexOf("/") + 1); } else { objMenuItem.ImagePath = Menu.IconImagesPath + strImage.Substring(0, strImage.LastIndexOf("/") + 1); } } else { objMenuItem.Image = strImage; } } else { objMenuItem.Image = objNode.Image; } } if (String.IsNullOrEmpty(objNode.ToolTip)) { objMenuItem.ToolTip = objNode.ToolTip; } } Bind(objNode.DNNNodes); } catch (Exception ex) { throw (ex); } objPrevNode = objNode; } if (objNode != null && objNode.Level == 0) // root menu { if (!String.IsNullOrEmpty(SeparatorRightHTML) || !String.IsNullOrEmpty(SeparatorRightHTMLBreadCrumb) || !String.IsNullOrEmpty(SeparatorRightHTMLActive)) { AddSeparator("Right", objPrevNode, null); } } }
/// ----------------------------------------------------------------------------- /// <summary> /// This function provides a central location to obtain a generic node collection of the pages/tabs included in /// the current context's (user) navigation hierarchy /// </summary> /// <param name="strNamespace">Namespace (typically control's ClientID) of node collection to create</param> /// <param name="eToolTips">Enumerator to determine what text to display in the tooltips</param> /// <param name="intStartTabId">If using Populate On Demand, then this is the tab id of the root element to retrieve (-1 for no POD)</param> /// <param name="intDepth">If Populate On Demand is enabled, then this parameter determines the number of nodes to retrieve beneath the starting tab passed in (intStartTabId) (-1 for no POD)</param> /// <param name="intNavNodeOptions">Bitwise integer containing values to determine what nodes to display (self, siblings, parent)</param> /// <returns>Collection of DNNNodes</returns> /// <remarks> /// Returns a subset of navigation nodes based off of passed in starting node id and depth /// </remarks> /// <history> /// [Jon Henning] 8/9/2005 Created /// </history> /// ----------------------------------------------------------------------------- public static DNNNodeCollection GetNavigationNodes(string strNamespace, ToolTipSource eToolTips, int intStartTabId, int intDepth, int intNavNodeOptions) { var objCol = new DNNNodeCollection(strNamespace); return(GetNavigationNodes(new DNNNode(objCol.XMLNode), eToolTips, intStartTabId, intDepth, intNavNodeOptions)); }
/// <summary> /// Responsible for the populating of the underlying navigation control /// </summary> /// <param name="objNodes">Node hierarchy used in control population</param> /// <remarks></remarks> public override void Bind(DNNNodeCollection objNodes) { MenuItem objMenuItem = null; DNNNode objPrevNode; if (IndicateChildren == false) { IndicateChildImageSub = ""; IndicateChildImageRoot = ""; } string strLeftHTML = ""; string strRightHTML = ""; foreach (DNNNode objNode in objNodes) { if (objNode.IsBreak) { } else { strLeftHTML = ""; strRightHTML = ""; if (objNode.Level == 0) //root menu { Menu.Items.Add(GetMenuItem(objNode)); objMenuItem = Menu.Items[Menu.Items.Count - 1]; if (!String.IsNullOrEmpty(NodeLeftHTMLRoot)) { strLeftHTML = NodeLeftHTMLRoot; } if (objNode.BreadCrumb) { if (!String.IsNullOrEmpty(NodeLeftHTMLBreadCrumbRoot)) { strLeftHTML = NodeLeftHTMLBreadCrumbRoot; } if (!String.IsNullOrEmpty(NodeRightHTMLBreadCrumbRoot)) { strRightHTML = NodeRightHTMLBreadCrumbRoot; } } if (!String.IsNullOrEmpty(NodeRightHTMLRoot)) { strRightHTML = NodeRightHTMLRoot; } } else { try { MenuItem objParent = Menu.FindItem(GetValuePath(objNode.ParentNode)); objParent.ChildItems.Add(GetMenuItem(objNode)); objMenuItem = objParent.ChildItems[objParent.ChildItems.Count - 1]; if (!String.IsNullOrEmpty(NodeLeftHTMLSub)) { strLeftHTML = NodeLeftHTMLSub; } if (objNode.BreadCrumb) { if (!String.IsNullOrEmpty(NodeLeftHTMLBreadCrumbSub)) { strLeftHTML = NodeLeftHTMLBreadCrumbSub; } if (!String.IsNullOrEmpty(NodeRightHTMLBreadCrumbSub)) { strRightHTML = NodeRightHTMLBreadCrumbSub; } } if (!String.IsNullOrEmpty(NodeRightHTMLSub)) { strRightHTML = NodeRightHTMLSub; } } catch { //throws exception if the parent tab has not been loaded ( may be related to user role security not allowing access to a parent tab ) objMenuItem = null; } } if (objMenuItem != null) { //Append LeftHTML/RightHTML to menu's text property if (!String.IsNullOrEmpty(strLeftHTML)) { objMenuItem.Text = strLeftHTML + objMenuItem.Text; } if (!String.IsNullOrEmpty(strRightHTML)) { objMenuItem.Text = objMenuItem.Text + strRightHTML; } } //Figure out image paths if (!String.IsNullOrEmpty(objNode.Image)) { if (objNode.Image.StartsWith("~/images/")) { objNode.Image = objNode.Image.Replace("~/images/", PathSystemImage); } else if (!objNode.Image.Contains("://") && objNode.Image.StartsWith("/") == false && !String.IsNullOrEmpty(PathImage)) { objNode.Image = PathImage + objNode.Image; } objMenuItem.ImageUrl = objNode.Image; } Bind(objNode.DNNNodes); objPrevNode = objNode; } } }
public override void Bind(DNNNodeCollection objNodes) { Bind(objNodes, true); }
/// <summary> /// Loads the Menu. /// </summary> /// <param name="cssClassNameNormal"> /// The CSS Class Name Normal. /// </param> /// <param name="cssClassNameContext"> /// The CSS Class Name Context. /// </param> private void LoadMenu(string cssClassNameNormal, string cssClassNameContext) { try { // DNN 4.x DNNNodeCollection objNodes = Navigation.GetActionNodes( this.m_menuActionRoot, this, this.Control.NavigationControl); this.RegisterJavaScript(cssClassNameNormal, cssClassNameContext); this.IncludeStyleSheet(); foreach (DNNNode node in objNodes) { if (node.DNNNodes.Count <= 1) { continue; } // ContextMenu if (this.bContextMode && this.IncludeJs) { this.ctlModulMenuUl = new HtmlGenericControl("ul"); this.ctlModulMenuUl.Attributes["id"] = this.ClientID; this.ctlModulMenuUl.Attributes["class"] = cssClassNameContext; this.phModuleMenu.Controls.Add(this.ctlModulMenuUl); } else { this.ctlModulMenuMainUl = new HtmlGenericControl("ul"); this.phModuleMenu.Controls.Add(this.ctlModulMenuMainUl); this.ctlModulMenuMainUl.Attributes["class"] = cssClassNameNormal; this.ctlModulMenuli = new HtmlGenericControl("li"); this.ctlModulMenuMainUl.Controls.Add(this.ctlModulMenuli); // Render Main Link Text if (!string.IsNullOrEmpty(this.sMenuLink) && this.displayLink) { this.ctlModulMenuli.InnerText = this.sMenuLink; } // Render Main Icon if (!string.IsNullOrEmpty(this.sMenuIcon) && this.displayIcon) { var mainIcon = new HtmlImage { Src = this.SetIconPath(this.MenuIcon, true), Alt = "ModuleActionsMenu" }; mainIcon.Attributes.Add("title", "Module Actions Menu"); this.ctlModulMenuli.Controls.Add(mainIcon); } string mainIconCss = cssClassNameNormal.Replace( "ModuleOptionsMenu", "ModuleOptionsMenuMainIcon"); if (!this.displayLink) { mainIconCss = string.Format("{0} MainLinkText", mainIconCss); } this.ctlModulMenuli.Attributes["class"] = mainIconCss; if (this.userAgent.IndexOf("MSIE") > -1) { this.ctlModulMenuli.Attributes["onmouseover"] = string.Format("this.className='{0} sfhover'", mainIconCss); this.ctlModulMenuli.Attributes["onmouseout"] = string.Format("this.className='{0}'", mainIconCss); } this.ctlModulMenuUl = new HtmlGenericControl("ul"); this.ctlModulMenuli.Controls.Add(this.ctlModulMenuUl); } foreach (DNNNode mainNode in node.DNNNodes) { this.RenderNode(mainNode, this.ctlModulMenuUl); } } } catch (Exception exc) { Exceptions.ProcessModuleLoadException(this, exc); } }
/// <summary> /// Localizes the menu nodes. /// </summary> /// <param name="nodes">The collection of nodes to localize.</param> /// <returns>The localized collection of nodes.</returns> public static DNNNodeCollection LocaliseDNNNodeCollection(DNNNodeCollection nodes) { return((LocalisationApi == null) ? nodes : (LocalisationApi.LocaliseNodes(nodes) ?? nodes)); }
private static void SaveDnnNodesToDictionary(IDictionary <string, DNNNode> nodesDict, DNNNodeCollection nodes) { foreach (DNNNode node in nodes) { if (!nodesDict.ContainsKey(node.ID)) { nodesDict.Add(node.ID, node); } if (node.HasNodes) { SaveDnnNodesToDictionary(nodesDict, node.DNNNodes); } } }