コード例 #1
0
ファイル: Navigation.cs プロジェクト: biganth/Curt
        /// -----------------------------------------------------------------------------
        /// <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;
        }
コード例 #2
0
 /// <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;
 }
コード例 #3
0
ファイル: Navigation.cs プロジェクト: biganth/Curt
        /// -----------------------------------------------------------------------------
        /// <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);
            }
        }
コード例 #4
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);
            }
        }