public MenuNode(DNNNode dnnNode, MenuNode parent) { TabId = Convert.ToInt32(dnnNode.ID); Text = dnnNode.Text; Url = (dnnNode.ClickAction == eClickAction.PostBack) ? "postback:" + dnnNode.ID : String.IsNullOrEmpty(dnnNode.JSFunction) ? dnnNode.NavigateURL : "javascript:" + dnnNode.JSFunction; Enabled = dnnNode.Enabled; Selected = dnnNode.Selected; Breadcrumb = dnnNode.BreadCrumb; Separator = dnnNode.IsBreak; Icon = dnnNode.Image; Target = dnnNode.Target; Title = null; Keywords = null; Description = null; Parent = parent; CommandName = dnnNode.get_CustomAttribute("CommandName"); CommandArgument = dnnNode.get_CustomAttribute("CommandArgument"); DNNAbstract.DNNNodeToMenuNode(dnnNode, this); if ((dnnNode.DNNNodes != null) && (dnnNode.DNNNodes.Count > 0)) Children = ConvertDNNNodeCollection(dnnNode.DNNNodes, this); }
/// <summary> /// Computes valuepath necessary for ASP.NET controls to guarantee uniqueness /// </summary> /// <param name="objNode"></param> /// <returns>ValuePath</returns> /// <remarks>Not sure if it is ok to hardcode the "\" separator, but also not sure where I would get it from</remarks> private string GetValuePath(DNNNode objNode) { DNNNode objParent = objNode.ParentNode; string strPath = GetSafeValue(objNode.Key, ""); do { if (objParent == null || objParent.Level == -1) { break; } strPath = GetSafeValue(objParent.Key, "") + "\\" + strPath; objParent = objParent.ParentNode; } while (true); return(strPath); }
/// ----------------------------------------------------------------------------- /// <summary> /// DNNTxtBannerGroup_PopulateOnDemand runs when something is entered on the /// BannerGroup field /// </summary> /// <remarks> /// </remarks> /// <history> /// [vmasanas] 9/29/2006 Implement a callback to display current groups /// to user so the BannerGroup can be easily selected /// </history> /// ----------------------------------------------------------------------------- protected void DNNTxtBannerGroup_PopulateOnDemand(object source, DNNTextSuggestEventArgs e) { DataTable dt; DNNNode objNode; var objBanners = new BannerController(); dt = objBanners.GetBannerGroups(PortalId); DataRow[] dr; dt.CaseSensitive = false; dr = dt.Select("GroupName like '" + e.Text + "%'"); foreach (DataRow d in dr) { objNode = new DNNNode(d["GroupName"].ToString()); objNode.ID = e.Nodes.Count.ToString(); e.Nodes.Add(objNode); } }
public int Add(string strID, string strKey, string strText, string strNavigateURL, string strJSFunction, string strTarget, string strToolTip, bool blnEnabled, string strCSSClass, string strCSSClassSelected, string strCSSClassHover) //DNNNode { int intIndex = Add(); DNNNode objNode = this[intIndex]; if (strID.Length > 0) { objNode.ID = strID; } objNode.Key = strKey; objNode.Text = strText; objNode.NavigateURL = strNavigateURL; objNode.JSFunction = strJSFunction; objNode.Target = strTarget; objNode.ToolTip = strToolTip; objNode.Enabled = blnEnabled; objNode.CSSClass = strCSSClass; objNode.CSSClassSelected = strCSSClassSelected; objNode.CSSClassHover = strCSSClassHover; return(intIndex); //objNode }
private void BuildNodes(DNNNode objNode) { DNNNodeCollection objNodes; objNodes = GetNavigationNodes(objNode); Control.ClearNodes(); //since we always bind we need to clear the nodes for providers that maintain their state Bind(objNodes); }
private string GetSeparatorText(string strNormal, string strBreadCrumb, string strSelection, DNNNode objNode) { string strRet = ""; if (!String.IsNullOrEmpty(strNormal)) { strRet = strNormal; } if (!String.IsNullOrEmpty(strBreadCrumb) && objNode != null && objNode.BreadCrumb) { strRet = strBreadCrumb; } if (!String.IsNullOrEmpty(strSelection) && objNode != null && objNode.Selected) { strRet = strSelection; } return strRet; }
public void Remove(DNNNode value) { this.XMLNode.RemoveChild(value.XmlNode); }
protected void RaiseEvent_PopulateOnDemand( DNNNode objNode ) { if( PopulateOnDemandEvent != null ) { PopulateOnDemandEvent( new NavigationEventArgs( objNode.ID, objNode ) ); } }
/// ----------------------------------------------------------------------------- /// <summary> /// Recursive function to add module's actions to the DNNNodeCollection based off of passed in ModuleActions /// </summary> /// <param name="objParentAction">Parent action</param> /// <param name="objParentNode">Parent node</param> /// <param name="objActionControl">ActionControl to base actions off of</param> /// <remarks> /// </remarks> /// <history> /// [Jon Henning] 8/9/2005 Created /// </history> /// ----------------------------------------------------------------------------- private static void AddChildActions(ModuleAction objParentAction, DNNNode objParentNode, IActionControl objActionControl) { AddChildActions(objParentAction, objParentNode, objParentNode, objActionControl, -1); }
/// ----------------------------------------------------------------------------- /// <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> /// <history> /// [Jon Henning] 5/15/2006 Created /// </history> /// ----------------------------------------------------------------------------- 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; }
private static bool IsTabPending(TabInfo objTab, DNNNode objParentNode, DNNNode objRootNode, int intDepth, Hashtable objBreadCrumbs, int intLastBreadCrumbId, bool blnPOD) { // //A //| //--B //| | //| --B-1 //| | | //| | --B-1-1 //| | | //| | --B-1-2 //| | //| --B-2 //| | //| --B-2-1 //| | //| --B-2-2 //| //--C // | // --C-1 // | | // | --C-1-1 // | | // | --C-1-2 // | // --C-2 // | // --C-2-1 // | // --C-2-2 //if we aren't restricting depth then its never pending if (intDepth == -1) { return false; } //parents level + 1 = current node level //if current node level - (roots node level) <= the desired depth then not pending if (objParentNode.Level + 1 - objRootNode.Level <= intDepth) { return false; } //--- These checks below are here so tree becomes expands to selected node --- if (blnPOD) { //really only applies to controls with POD enabled, since the root passed in may be some node buried down in the chain //and the depth something like 1. We need to include the appropriate parent's and parent siblings //Why is the check for POD required? Well to allow for functionality like RootOnly requests. We do not want any children //regardless if they are a breadcrumb //if tab is in the breadcrumbs then obviously not pending if (objBreadCrumbs.Contains(objTab.TabID)) { return false; } //if parent is in the breadcrumb and it is not the last breadcrumb then not pending //in tree above say we our breadcrumb is (A, B, B-2) we want our tree containing A, B, B-2 AND B-1 AND C since A and B are expanded //we do NOT want B-2-1 and B-2-2, thus the check for Last Bread Crumb if (objBreadCrumbs.Contains(objTab.ParentId) && intLastBreadCrumbId != objTab.ParentId) { return false; } } return true; }
/// <summary> /// Recursive function to add module's actions to the DNNNodeCollection based off of passed in ModuleActions /// </summary> /// <param name="objParentAction">Parent action</param> /// <param name="objParentNode">Parent node</param> /// <param name="objModule">Module to base actions off of</param> /// <param name="objUserInfo">User Info Object</param> /// <remarks> /// </remarks> /// <history> /// [Jon Henning] 8/9/2005 Created /// </history> /// <param name="objControl"></param> private static void AddChildActions(ModuleAction objParentAction, DNNNode objParentNode, ActionBase objModule, UserInfo objUserInfo, Control objControl) { AddChildActions(objParentAction, objParentNode, objParentNode, objModule, objUserInfo, -1); }
/// <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 blnAdminMode = PortalSecurity.IsInRoles(objPortalSettings.AdministratorRoleName) | PortalSecurity.IsInRoles(objPortalSettings.ActiveTab.AdministratorRoles.ToString()); //bool blnFoundStart = intStartTabId == -1; //if -1 then we want all Hashtable objBreadCrumbs = new Hashtable(); Hashtable objTabLookup = new Hashtable(); DNNNodeCollection objRootNodes = objRootNode.DNNNodes; int intLastBreadCrumbId = 0; TabInfo objTab; //--- 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; } for (i = 0; i < objPortalSettings.DesktopTabs.Count; i++) { objTab = (TabInfo)(objPortalSettings.DesktopTabs[i]); objTabLookup.Add(objTab.TabID, objTab); } for (i = 0; i < objPortalSettings.DesktopTabs.Count; i++) { try { objTab = (TabInfo)(objPortalSettings.DesktopTabs[i]); if (IsTabShown(objTab, blnAdminMode)) //based off of tab properties, is it shown { DNNNode objParentNode = objRootNodes.FindNode(objTab.ParentId.ToString()); bool blnParentFound = objParentNode != null; if (objParentNode == null) { objParentNode = objRootNode; } DNNNodeCollection objParentNodes = objParentNode.DNNNodes; //If objTab.ParentId = -1 OrElse ((intNavNodeOptions And NavNodeOptions.IncludeRootOnly) = 0) Then 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); } } } //End If } catch (Exception ex) { throw ex; } } return objRootNodes; }
/// <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="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, DNNNode objRootNode, ActionBase objModule, int intDepth) { DNNNodeCollection objCol = objRootNode.ParentNode.DNNNodes; AddChildActions(objActionRoot, objRootNode, objRootNode, objModule, UserController.GetCurrentUserInfo(), intDepth); return objCol; }
/// <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); } }
public int Add() // DNNNode { DNNNode objNode = new DNNNode(); this.XMLNode.AppendChild( this.XMLDoc.ImportNode( objNode.XmlNode, false ) ); objNode.ID = objNode.ParentNameSpace + "_" + Count; return this.XMLNode.ChildNodes.Count - 1; //Return objNode }
//Protected Overrides Sub OnInsert(ByVal index As Integer, ByVal value As Object) // If m_bNodeCollectionInterfaceCall = False Then Me.InsertAfter(index, CType(value, DNNNode)) //End Sub //Protected Overrides Sub OnRemove(ByVal index As Integer, ByVal value As Object) // If m_bNodeCollectionInterfaceCall = False Then Me.Remove(CType(value, DNNNode)) //End Sub //Protected Overrides Sub OnSet(ByVal index As Integer, ByVal oldValue As Object, ByVal newValue As Object) // Me.Item(index) = CType(newValue, DNNNode) //End Sub //Protected Overrides Sub OnClear() // Me.Clear() //End Sub //Public Shadows Sub Clear() // Dim i As Integer // For i = Me.XMLNode.ChildNodes.Count - 1 To 0 Step -1 // Me.XMLNode.RemoveChild(Me.XMLNode.ChildNodes(i)) // Next //End Sub public bool Contains( DNNNode value ) { if( this.FindNode( value.ID ) == null ) { return false; } else { return true; } }
public int Import(DNNNode objNode) { return(Import(objNode, true)); }
private static bool IsActionPending(DNNNode objParentNode, DNNNode objRootNode, int intDepth) { //if we aren't restricting depth then its never pending if (intDepth == -1) { return false; } //parents level + 1 = current node level //if current node level - (roots node level) <= the desired depth then not pending if (objParentNode.Level + 1 - objRootNode.Level <= intDepth) { return false; } return true; }
/// <summary> /// Recursive function to add module's actions to the DNNNodeCollection based off of passed in ModuleActions /// </summary> /// <param name="objParentAction">Parent action</param> /// <param name="objParentNode">Parent node</param> /// <param name="objRootNode"></param> /// <param name="objModule">Module to base actions off of</param> /// <param name="objUserInfo">User Info Object</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 objParentAction, DNNNode objParentNode, DNNNode objRootNode, ActionBase objModule, UserInfo objUserInfo, int intDepth) { // Add Menu Items foreach (ModuleAction objAction in objParentAction.Actions) { bool blnPending = IsActionPending(objParentNode, objRootNode, intDepth); if (objAction.Title == "~") { if (blnPending == false) { //A title (text) of ~ denotes a break objParentNode.DNNNodes.AddBreak(); } } else { //if action is visible and user has permission if (objAction.Visible & PortalSecurity.HasNecessaryPermission(objAction.Secure, (PortalSettings)(HttpContext.Current.Items["PortalSettings"]), objModule.ModuleConfiguration, objUserInfo.UserID.ToString())) { //(if edit mode and not admintab and not admincontrol) if (blnPending) { objParentNode.HasNodes = true; } else { int i = objParentNode.DNNNodes.Add(); DNNNode objNode = objParentNode.DNNNodes[i]; objNode.ID = objAction.ID.ToString(); objNode.Key = objAction.ID.ToString(); objNode.Text = objAction.Title; //no longer including SPACE in generic node collection, each control must handle how they want to display // HACK : Modified to not error if object is null. //if (objAction.ClientScript.Length > 0) if (!String.IsNullOrEmpty(objAction.ClientScript)) { objNode.JSFunction = objAction.ClientScript; objNode.ClickAction = eClickAction.None; } else { objNode.NavigateURL = objAction.Url; // HACK : Modified to handle null string in objNode.NavigateURL //if (objAction.UseActionEvent == false && objNode.NavigateURL.Length > 0) if (objAction.UseActionEvent == false && !String.IsNullOrEmpty(objNode.NavigateURL)) { objNode.ClickAction = eClickAction.Navigate; } else { objNode.ClickAction = eClickAction.PostBack; } } objNode.Image = objAction.Icon; if (objAction.HasChildren()) //if action has children then call function recursively { AddChildActions(objAction, objNode, objRootNode, objModule, objUserInfo, intDepth); } } } } } }
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.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); } } } }
private void ProcessNodes(DNNNode objParent) { if (!String.IsNullOrEmpty(objParent.Image)) { } else if (objParent.HasNodes) //imagepath applied in provider... { objParent.Image = ResolveUrl(NodeClosedImage); } else { objParent.Image = ResolveUrl(NodeLeafImage); } foreach (DNNNode objNode in objParent.DNNNodes) { ProcessNodes(objNode); } }
/// ----------------------------------------------------------------------------- /// <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; }
/// ----------------------------------------------------------------------------- /// <summary> /// ProcessNodes proceses a single node and its children /// </summary> /// <param name="objParent">The Node to process</param> /// <history> /// [cnurse] 12/24/2007 created /// </history> /// ----------------------------------------------------------------------------- private void ProcessNodes(DNNNode objParent) { if (!String.IsNullOrEmpty(objParent.JSFunction)) { objParent.JSFunction = string.Format("if({0}){{{1}}};", objParent.JSFunction, Page.ClientScript.GetPostBackEventReference(ProviderControl.NavigationControl, objParent.ID)); } foreach (DNNNode objNode in objParent.DNNNodes) { ProcessNodes(objNode); } }
protected void RaiseEvent_NodeClick( DNNNode objNode ) { if( NodeClickEvent != null ) { NodeClickEvent( new NavigationEventArgs( objNode.ID, objNode ) ); } }
public DNNNodeCollection GetNavigationNodes(DNNNode objNode) { int intRootParent = PortalSettings.ActiveTab.TabID; DNNNodeCollection objNodes = null; Navigation.ToolTipSource eToolTips; int intNavNodeOptions = 0; int intDepth = ExpandDepth; switch (Level.ToLower()) { case "child": break; case "parent": intNavNodeOptions = (int) Navigation.NavNodeOptions.IncludeParent + (int) Navigation.NavNodeOptions.IncludeSelf; break; case "same": intNavNodeOptions = (int) Navigation.NavNodeOptions.IncludeSiblings + (int) Navigation.NavNodeOptions.IncludeSelf; break; default: intRootParent = -1; intNavNodeOptions = (int) Navigation.NavNodeOptions.IncludeSiblings + (int) Navigation.NavNodeOptions.IncludeSelf; break; } if (ShowHiddenTabs) intNavNodeOptions += (int) Navigation.NavNodeOptions.IncludeHiddenNodes; switch (ToolTip.ToLower()) { case "name": eToolTips = Navigation.ToolTipSource.TabName; break; case "title": eToolTips = Navigation.ToolTipSource.Title; break; case "description": eToolTips = Navigation.ToolTipSource.Description; break; default: eToolTips = Navigation.ToolTipSource.None; break; } if (PopulateNodesFromClient && Control.SupportsPopulateOnDemand) { intNavNodeOptions += (int) Navigation.NavNodeOptions.MarkPendingNodes; } if (PopulateNodesFromClient && Control.SupportsPopulateOnDemand == false) { ExpandDepth = -1; } if (StartTabId != -1) { intRootParent = StartTabId; } if (objNode != null) { intRootParent = Convert.ToInt32(objNode.ID); intNavNodeOptions = (int) Navigation.NavNodeOptions.MarkPendingNodes; objNodes = Navigation.GetNavigationNodes(objNode, eToolTips, intRootParent, intDepth, intNavNodeOptions); } else { objNodes = Navigation.GetNavigationNodes(Control.ClientID, eToolTips, intRootParent, intDepth, intNavNodeOptions); } return objNodes; }
public static void DNNNodeToMenuNode(DNNNode dnnNode, MenuNode menuNode) { menuNode.LargeImage = dnnNode.LargeImage; }
public void InsertBefore(int index, DNNNode value) { XmlNode objXmlNode = this.XMLDoc.ImportNode(value.XmlNode, true); this.XMLNode.InsertBefore(objXmlNode, this.XMLNode.ChildNodes[index]); }
private void ProcessNodes(DNNNode objParent) { if (!String.IsNullOrEmpty(objParent.JSFunction)) { ClientAPI.RegisterClientVariable(Page, "__dnn_CSAction_" + Control.NavigationControl.ClientID + "_" + objParent.ID, objParent.JSFunction, true); } objParent.ClickAction = eClickAction.None; //since GO button is handling actions dont allow selected index change fire postback foreach (DNNNode objNode in objParent.DNNNodes) { ProcessNodes(objNode); } }
/// <summary> /// The BuildTree helper method is used to build the tree /// </summary> /// <remarks> /// </remarks> /// <history> /// [cnurse] 12/8/2004 Created /// [Jon Henning] 3/21/06 Updated to handle Auto-expand and AddUpNode /// </history> private void BuildTree( DNNNode objNode, bool blnPODRequest ) //JH - POD { bool blnAddUpNode = false; DNNNodeCollection objNodes; objNodes = GetNavigationNodes( objNode ); if( blnPODRequest == false ) { switch( Level.ToLower() ) { case "root": break; case "child": blnAddUpNode = true; break; default: if( Level.ToLower() != "root" && PortalSettings.ActiveTab.BreadCrumbs.Count > 1 ) { blnAddUpNode = true; } break; } } //add goto Parent node if( blnAddUpNode ) { DNNNode objParentNode = new DNNNode(); objParentNode.ID = PortalSettings.ActiveTab.ParentId.ToString(); objParentNode.Key = objParentNode.ID; objParentNode.Text = Localization.GetString( "Parent", Localization.GetResourceFile( this, MyFileName ) ); objParentNode.ToolTip = Localization.GetString( "GoUp", Localization.GetResourceFile( this, MyFileName ) ); objParentNode.CSSClass = NodeCssClass; objParentNode.Image = ResolveUrl( TreeGoUpImage ); objParentNode.ClickAction = eClickAction.PostBack; objNodes.InsertBefore( 0, objParentNode ); } DNNNode objPNode; foreach( DNNNode tempLoopVar_objPNode in objNodes ) //clean up to do in processnodes??? { objPNode = tempLoopVar_objPNode; ProcessNodes( objPNode ); } this.Bind( objNodes ); //technically this should always be a dnntree. If using dynamic controls Nav.ascx should be used. just being safe. if( this.Control.NavigationControl is DNNTree ) { DNNTree objTree = (DNNTree)this.Control.NavigationControl; if( objTree.SelectedTreeNodes.Count > 0 ) { TreeNode objTNode = (TreeNode)objTree.SelectedTreeNodes[1]; if( objTNode.DNNNodes.Count > 0 ) //only expand it if nodes are not pending { objTNode.Expand(); } } } }
private void AddSeparator(string strType, DNNNode objPrevNode, DNNNode objNextNode, MenuNode objMenuItem) { string strLeftHTML = SeparatorLeftHTML + SeparatorLeftHTMLBreadCrumb + SeparatorLeftHTMLActive; string strRightHTML = SeparatorRightHTML + SeparatorRightHTMLBreadCrumb + SeparatorRightHTMLActive; string strHTML = SeparatorHTML + strLeftHTML + strRightHTML; if (!String.IsNullOrEmpty(strHTML)) { string strSeparator = ""; string strSeparatorLeftHTML = ""; string strSeparatorRightHTML = ""; string strSeparatorClass = ""; string strLeftSeparatorClass = ""; string strRightSeparatorClass = ""; if (string.IsNullOrEmpty(strLeftHTML) == false) { strLeftSeparatorClass = GetSeparatorText(CSSLeftSeparator, CSSLeftSeparatorBreadCrumb, CSSLeftSeparatorSelection, objNextNode); strSeparatorLeftHTML = GetSeparatorText(SeparatorLeftHTML, SeparatorLeftHTMLBreadCrumb, SeparatorLeftHTMLActive, objNextNode); } if (string.IsNullOrEmpty(SeparatorHTML) == false) { if (!String.IsNullOrEmpty(CSSSeparator)) { strSeparatorClass = CSSSeparator; } strSeparator = SeparatorHTML; } if (string.IsNullOrEmpty(strRightHTML) == false) { strRightSeparatorClass = GetSeparatorText(CSSRightSeparator, CSSRightSeparatorBreadCrumb, CSSRightSeparatorSelection, objNextNode); strSeparatorRightHTML = GetSeparatorText(SeparatorRightHTML, SeparatorRightHTMLBreadCrumb, SeparatorRightHTMLActive, objNextNode); } if (string.IsNullOrEmpty(strSeparatorRightHTML) == false) { objMenuItem.RightHTML += GetSeparatorMarkup(strRightSeparatorClass, strSeparatorRightHTML); } if (string.IsNullOrEmpty(strSeparator) == false && strType == "All") { objMenuItem.LeftHTML += GetSeparatorMarkup(strSeparatorClass, strSeparator); } if (string.IsNullOrEmpty(strSeparatorLeftHTML) == false) { objMenuItem.LeftHTML += GetSeparatorMarkup(strLeftSeparatorClass, strSeparatorLeftHTML); } } }
private void ProcessNodes( DNNNode objParent ) { //If Boolean.Parse(GetValue(RootOnly, "False")) AndAlso objParent.HasNodes Then // objParent.HasNodes = False //End If if( !String.IsNullOrEmpty(objParent.Image) ) { //imagepath applied in provider... } else if( objParent.HasNodes ) { objParent.Image = ResolveUrl( NodeClosedImage ); } else { objParent.Image = ResolveUrl( this.NodeLeafImage ); } DNNNode objNode; foreach( DNNNode tempLoopVar_objNode in objParent.DNNNodes ) { objNode = tempLoopVar_objNode; ProcessNodes( objNode ); } }
/// <summary> /// Initializes a new instance of the <see cref="NavDataPageHierarchyData"/> class. /// </summary> /// <param name="obj"></param> public NavDataPageHierarchyData(DNNNode obj) { this.m_objNode = obj; }
/// ----------------------------------------------------------------------------- /// <summary> /// Recursive function to add module's actions to the DNNNodeCollection based off of passed in ModuleActions /// </summary> /// <param name="objParentAction">Parent action</param> /// <param name="objParentNode">Parent node</param> /// <param name="objRootNode">Root Node.</param> /// <param name="objActionControl">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 objParentAction, DNNNode objParentNode, DNNNode objRootNode, IActionControl objActionControl, int intDepth) { //Add Menu Items bool blnPending; foreach (ModuleAction objAction in objParentAction.Actions) { blnPending = IsActionPending(objParentNode, objRootNode, intDepth); if (objAction.Title == "~") { if (blnPending == false) { //A title (text) of ~ denotes a break objParentNode.DNNNodes.AddBreak(); } } else { //if action is visible and user has permission if (objAction.Visible && (objAction.Secure != SecurityAccessLevel.Anonymous || ModulePermissionController.HasModuleAccess(SecurityAccessLevel.Edit, string.Empty, objActionControl.ModuleControl.ModuleContext.Configuration)) && ModulePermissionController.HasModuleAccess(objAction.Secure, Null.NullString, objActionControl.ModuleControl.ModuleContext.Configuration)) { if (blnPending) { objParentNode.HasNodes = true; } else { DNNNode objNode; int i = objParentNode.DNNNodes.Add(); objNode = objParentNode.DNNNodes[i]; objNode.ID = objAction.ID.ToString(); objNode.Key = objAction.ID.ToString(); objNode.Text = objAction.Title; //no longer including SPACE in generic node collection, each control must handle how they want to display if (string.IsNullOrEmpty(objAction.ClientScript) && string.IsNullOrEmpty(objAction.Url) && string.IsNullOrEmpty(objAction.CommandArgument)) { objNode.Enabled = false; } else if (!string.IsNullOrEmpty(objAction.ClientScript)) { objNode.JSFunction = objAction.ClientScript; objNode.ClickAction = eClickAction.None; } else { objNode.NavigateURL = objAction.Url; if (objAction.UseActionEvent == false && !String.IsNullOrEmpty(objNode.NavigateURL)) { objNode.ClickAction = eClickAction.Navigate; if (objAction.NewWindow) { objNode.Target = "_blank"; } } else { objNode.ClickAction = eClickAction.PostBack; } } objNode.Image = objAction.Icon; if (objAction.HasChildren()) //if action has children then call function recursively { AddChildActions(objAction, objNode, objRootNode, objActionControl, intDepth); } } } } } }
/// ----------------------------------------------------------------------------- /// <summary> /// DNNTxtBannerGroup_PopulateOnDemand runs when something is entered on the /// BannerGroup field /// </summary> /// <remarks> /// </remarks> /// <history> /// [vmasanas] 9/29/2006 Implement a callback to display current groups /// to user so the BannerGroup can be easily selected /// </history> /// ----------------------------------------------------------------------------- protected void PopulateBannersOnDemand(object source, DNNTextSuggestEventArgs e) { var objBanners = new BannerController(); var dt = objBanners.GetBannerGroups(PortalId); dt.CaseSensitive = false; var dr = dt.Select("GroupName like '" + e.Text + "%'"); foreach (var d in dr) { var objNode = new DNNNode(d["GroupName"].ToString()) {ID = e.Nodes.Count.ToString()}; e.Nodes.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> /// <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); } }