Beispiel #1
0
        /// -----------------------------------------------------------------------------
        /// <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);
            }
        }
Beispiel #2
0
        /// <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);
            }
        }