Esempio n. 1
0
        /// <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);
                            }
                        }
                    }
                }
            }
        }
Esempio n. 2
0
 /// <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);
 }
Esempio n. 3
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="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;
 }
Esempio n. 4
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;
 }
Esempio n. 5
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>
 /// <returns></returns>
 /// <remarks>
 /// </remarks>
 /// <history>
 /// 	[Jon Henning]	8/9/2005	Created
 /// </history>
 /// <param name="objControl"></param>
 public static DNNNodeCollection GetActionNodes(ModuleAction objActionRoot, ActionBase objModule, Control objControl)
 {
     return GetActionNodes(objActionRoot, objModule, -1);
 }
Esempio n. 6
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="objModule">Module 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, ActionBase objModule)
 {
     DNNNodeCollection objNodes = GetActionNodes(objActionRoot, objModule, -1);
     DNNNode objNode = objNodes.FindNode(strID);
     DNNNodeCollection objReturnNodes = new DNNNodeCollection(strNamespace);
     objReturnNodes.Import(objNode);
     objReturnNodes[0].ID = strID;
     return objReturnNodes[0];
 }