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; }
private void BindMenu(DNNNodeCollection objNodes) { Visible = DisplayControl(objNodes); if (Visible) { Control.ClearNodes(); //since we always bind we need to clear the nodes for providers that maintain their state foreach (DNNNode objNode in objNodes) { ProcessNodes(objNode); } Control.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); }
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 ); } }
protected void Bind(DNNNodeCollection objNodes) { Control.Bind(objNodes); }
public abstract void Bind( DNNNodeCollection objNodes );
/// ----------------------------------------------------------------------------- /// <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> /// <history> /// [Jon Henning] 8/9/2005 Created /// </history> /// ----------------------------------------------------------------------------- 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> /// 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> /// <param name="objActionRoot">Root Action object used in searching</param> /// <param name="objControl">ActionControl to base actions off of</param> /// <returns>DNNNode</returns> /// <remarks> /// Primary purpose of this is to obtain the DNNNode needed for the events exposed by the NavigationProvider /// </remarks> /// <history> /// [Jon Henning] 5/15/2006 Created /// </history> /// ----------------------------------------------------------------------------- public static DNNNode GetActionNode(string strID, string strNamespace, ModuleAction objActionRoot, Control objControl) { DNNNodeCollection objNodes = GetActionNodes(objActionRoot, objControl, -1); DNNNode objNode = objNodes.FindNode(strID); var objReturnNodes = new DNNNodeCollection(strNamespace); objReturnNodes.Import(objNode); objReturnNodes[0].ID = strID; return objReturnNodes[0]; }
public void LoadXml(string strXml) { m_objNodes = new DNNNodeCollection(strXml, ""); }
/// ----------------------------------------------------------------------------- /// <summary> /// /// </summary> /// <param name="nodes"></param> /// <param name="text"></param> /// <remarks> /// </remarks> /// <history> /// [Jon Henning] 5/6/2005 Created /// </history> /// ----------------------------------------------------------------------------- public DNNTextSuggestEventArgs(DNNNodeCollection nodes, string text) { this._nodes = nodes; this._text = text; }
private void BindMenu( DNNNodeCollection objNodes ) { this.Visible = DisplayControl( objNodes ); if( this.Visible ) { this.Control.ClearNodes(); //since we always bind we need to clear the nodes for providers that maintain their state foreach( DNNNode objNode in objNodes ) { ProcessNodes( objNode ); } Control.Bind( objNodes ); } }
/// <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 ) { if( IndicateChildren == false ) { IndicateChildImageSub = ""; IndicateChildImageRoot = ""; } foreach( DNNNode tempLoopVar_objNode in objNodes ) { DNNNode objNode = tempLoopVar_objNode; if( objNode.IsBreak ) { //Not sure how to make breaks work... //If Not objMenuItem Is Nothing Then // objMenuItem.SeparatorImageUrl = "~/images/spacer.gif" //End If } else { string strLeftHTML = ""; string strRightHTML = ""; MenuItem objMenuItem; if( objNode.Level == 0 ) // root menu { Menu.Items.Add( GetMenuItem( objNode ) ); objMenuItem = Menu.Items[Menu.Items.Count - 1]; if( !String.IsNullOrEmpty(this.NodeLeftHTMLRoot) ) { strLeftHTML = this.NodeLeftHTMLRoot; } if( objNode.BreadCrumb ) { if( !String.IsNullOrEmpty(NodeLeftHTMLBreadCrumbRoot) ) { strLeftHTML = NodeLeftHTMLBreadCrumbRoot; } if( !String.IsNullOrEmpty(NodeRightHTMLBreadCrumbRoot) ) { strRightHTML = NodeRightHTMLBreadCrumbRoot; } } if( !String.IsNullOrEmpty(this.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(this.NodeRightHTMLSub) ) { strRightHTML = 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; } } //Append LeftHTML/RightHTML to menu's text property if( objMenuItem != null ) { if( strLeftHTML.Length > 0 ) { objMenuItem.Text = strLeftHTML + objMenuItem.Text; } if( strRightHTML.Length > 0 ) { objMenuItem.Text = objMenuItem.Text + strRightHTML; } } //Figure out image paths if( objNode.Image.Length > 0 ) { if( objNode.Image.StartsWith( "/" ) == false && this.PathImage.Length > 0 ) { objNode.Image = this.PathImage + objNode.Image; } if( objMenuItem != null ) { objMenuItem.ImageUrl = objNode.Image; } } Bind( objNode.DNNNodes ); //DNNNode objPrevNode = objNode; } } }
public override void Bind(DNNNodeCollection objNodes) { string strLevelPrefix; foreach (DNNNode objNode in objNodes) { if (objNode.Level == 0) { DropDown.Items.Clear(); } if (objNode.ClickAction == eClickAction.PostBack) { DropDown.AutoPostBack = true; } 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); } }
public void LoadXml( string strXml ) { m_objNodes = new DNNNodeCollection( strXml, "" ); }
/// ----------------------------------------------------------------------------- /// <summary> /// DisplayControl determines whether the associated Action control should be /// displayed /// </summary> /// <history> /// [cnurse] 12/23/2007 documented /// </history> /// ----------------------------------------------------------------------------- public bool DisplayControl(DNNNodeCollection objNodes) { if (objNodes != null && objNodes.Count > 0 && PortalSettings.UserMode != PortalSettings.Mode.View) { DNNNode objRootNode = objNodes[0]; if (objRootNode.HasNodes && objRootNode.DNNNodes.Count == 0) { //if has pending node then display control return true; } else if (objRootNode.DNNNodes.Count > 0) { //verify that at least one child is not a break foreach (DNNNode childNode in objRootNode.DNNNodes) { if (!childNode.IsBreak) { //Found a child so make Visible return true; } } } } return false; }
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 MenuNode(DNNNodeCollection dnnNodes) { Children = ConvertDNNNodeCollection(dnnNodes, this); }
protected bool DisplayControl(DNNNodeCollection objNodes) { if (objNodes != null && objNodes.Count > 0 && m_tabPreview == false) { DNNNode objRootNode = objNodes[0]; if (objRootNode.HasNodes && objRootNode.DNNNodes.Count == 0) { //if has pending node then display control return true; } else if (objRootNode.DNNNodes.Count > 0) { //verify that at least one child is not a break foreach (DNNNode childNode in objRootNode.DNNNodes) { if (!childNode.IsBreak) { //Found a child so make Visible return true; } } } } return false; }
/// ----------------------------------------------------------------------------- /// <summary> /// DisplayControl determines whether the control should be displayed /// </summary> /// <history> /// [cnurse] 12/23/2007 documented /// </history> /// ----------------------------------------------------------------------------- protected bool DisplayControl(DNNNodeCollection objNodes) { return ActionManager.DisplayControl(objNodes); }
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); } } }
/// ----------------------------------------------------------------------------- /// <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> /// <history> /// [Jon Henning] 8/9/2005 Created /// </history> /// ----------------------------------------------------------------------------- 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)) { objNode.Target = "_new"; } objNodes.Add(objNode); } }
/// <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> /// <remarks> /// Logic moved to separate sub to make GetNavigationNodes cleaner /// </remarks> /// <history> /// [Jon Henning] 8/9/2005 Created /// </history> /// <param name="eToolTips"></param> private static void AddNode(TabInfo objTab, DNNNodeCollection objNodes, Hashtable objBreadCrumbs, PortalSettings objPortalSettings, ToolTipSource eToolTips) { DNNNode 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.TabName; objNode.NavigateURL = objTab.FullUrl; objNode.ClickAction = eClickAction.Navigate; //admin tabs have their images found in a different location, since the DNNNode has no concept of an admin tab, this must be set here if (objTab.IsAdminTab) { if (objTab.IconFile != "") { objNode.Image = Globals.ApplicationPath + "/images/" + objTab.IconFile; } } else { if (objTab.IconFile != "") { objNode.Image = objTab.IconFile; } } switch (eToolTips) { case ToolTipSource.TabName: objNode.ToolTip = objTab.TabName; break; case ToolTipSource.Title: objNode.ToolTip = objTab.Title; break; case ToolTipSource.Description: objNode.ToolTip = objTab.Description; break; } 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="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> /// 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; }
/// ----------------------------------------------------------------------------- /// <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); }
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 static DNNNodeCollection LocaliseDNNNodeCollection(DNNNodeCollection nodes) { return (LocalisationApi == null) ? nodes : (LocalisationApi.LocaliseNodes(nodes) ?? nodes); }
public DNNNodeCollection LocaliseNodes(DNNNodeCollection nodes) { return null; }
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; } } }
/// ----------------------------------------------------------------------------- /// <summary> /// BindMenu binds the Navigation Provider to the Node Collection /// </summary> /// <param name="objNodes">The Nodes collection to bind</param> /// <history> /// [cnurse] 12/24/2007 created /// </history> /// ----------------------------------------------------------------------------- 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); } }
public DNNNodeCollection LocaliseNodes(DNNNodeCollection nodes) { return LE.Instance.ProcessNavigationNodes(nodes); }
public override void Bind(DNNNodeCollection objNodes) { Bind(objNodes, true); }