protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            CheckClearCache();
            this.SetWlwSupport();
            ReadItemType();
            LoadControlType();

            //add on a query string param so that we can grab ALL content, not just for this moduleId. hk
            string title = Localization.GetString(ModuleActionType.ExportModule, Localization.GlobalResourceFile);
            foreach (ModuleAction action in Actions)
            {
                if (action.Title == title)
                {
                    //todo: duplicate the action to allow for exporting all content, or just local
                    ModuleAction ma = new ModuleAction(GetNextActionID(), action.Title,action.CommandName, action.CommandArgument,action.Icon,action.Url,action.ClientScript,action.UseActionEvent,action.Secure,action.Visible,action.NewWindow);
                    action.Url = action.Url + "?all=1";
                    action.Title = Localization.GetString("ExportAll", LocalSharedResourceFile);

                    Actions.Insert(action.ID-1,ma);
                    break;
                }
            }
        }
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// AddMenuMoveActions Adds the Move actions to the Action Menu
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///     [cnurse]    01/04/2008  Refactored from LoadActions
        /// </history>
        /// -----------------------------------------------------------------------------
        private void AddMenuMoveActions()
        {
            //module movement
            _moduleMoveActions = new ModuleAction(GetNextActionID(), Localization.GetString(ModuleActionType.MoveRoot, Localization.GlobalResourceFile), string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, false);

            //move module up/down
            if (Configuration != null)
            {
                if ((Configuration.ModuleOrder != 0) && (Configuration.PaneModuleIndex > 0))
                {
                    _moduleMoveActions.Actions.Add(GetNextActionID(),
                                               Localization.GetString(ModuleActionType.MoveTop, Localization.GlobalResourceFile),
                                               ModuleActionType.MoveTop,
                                               Configuration.PaneName,
                                               "action_top.gif",
                                               "",
                                               false,
                                               SecurityAccessLevel.View,
                                               true,
                                               false);
                    _moduleMoveActions.Actions.Add(GetNextActionID(),
                                               Localization.GetString(ModuleActionType.MoveUp, Localization.GlobalResourceFile),
                                               ModuleActionType.MoveUp,
                                               Configuration.PaneName,
                                               "action_up.gif",
                                               "",
                                               false,
                                               SecurityAccessLevel.View,
                                               true,
                                               false);
                }
                if ((Configuration.ModuleOrder != 0) && (Configuration.PaneModuleIndex < (Configuration.PaneModuleCount - 1)))
                {
                    _moduleMoveActions.Actions.Add(GetNextActionID(),
                                               Localization.GetString(ModuleActionType.MoveDown, Localization.GlobalResourceFile),
                                               ModuleActionType.MoveDown,
                                               Configuration.PaneName,
                                               "action_down.gif",
                                               "",
                                               false,
                                               SecurityAccessLevel.View,
                                               true,
                                               false);
                    _moduleMoveActions.Actions.Add(GetNextActionID(),
                                               Localization.GetString(ModuleActionType.MoveBottom, Localization.GlobalResourceFile),
                                               ModuleActionType.MoveBottom,
                                               Configuration.PaneName,
                                               "action_bottom.gif",
                                               "",
                                               false,
                                               SecurityAccessLevel.View,
                                               true,
                                               false);
                }
            }

            //move module to pane
            foreach (object obj in PortalSettings.ActiveTab.Panes)
            {
                var pane = obj as string;
                if (!string.IsNullOrEmpty(pane) && Configuration != null && !Configuration.PaneName.Equals(pane, StringComparison.InvariantCultureIgnoreCase))
                {
                    _moduleMoveActions.Actions.Add(GetNextActionID(),
                                               Localization.GetString(ModuleActionType.MovePane, Localization.GlobalResourceFile) + " " + pane,
                                               ModuleActionType.MovePane,
                                               pane,
                                               "action_move.gif",
                                               "",
                                               false,
                                               SecurityAccessLevel.View,
                                               true,
                                               false);
                }
            }

        }
 private void AddPrintAction()
 {
     var action = new ModuleAction(GetNextActionID())
                      {
                          Title = Localization.GetString(ModuleActionType.PrintModule, Localization.GlobalResourceFile),
                          CommandName = ModuleActionType.PrintModule,
                          CommandArgument = "",
                          Icon = "action_print.gif",
                          Url = NavigateUrl(TabId,
                                          "",
                                          false,
                                          "mid=" + ModuleId,
                                          "SkinSrc=" + Globals.QueryStringEncode("[G]" + SkinController.RootSkin + "/" + Globals.glbHostSkinFolder + "/" + "No Skin"),
                                          "ContainerSrc=" + Globals.QueryStringEncode("[G]" + SkinController.RootContainer + "/" + Globals.glbHostSkinFolder + "/" + "No Container"),
                                          "dnnprintmode=true"),
                          Secure = SecurityAccessLevel.Anonymous,
                          UseActionEvent = true,
                          Visible = true,
                          NewWindow = true
                      };
     _moduleGenericActions.Actions.Add(action);
 }
示例#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="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;
 }
示例#5
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">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);
                            }
                        }
                    }
                }
            }
        }
示例#6
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="objControl">ActionControl to base actions off of</param>
 /// <returns></returns>
 /// <remarks>
 /// </remarks>
 /// <history>
 /// 	[Jon Henning]	8/9/2005	Created
 /// </history>
 /// -----------------------------------------------------------------------------
 public static DNNNodeCollection GetActionNodes(ModuleAction objActionRoot, Control objControl)
 {
     return GetActionNodes(objActionRoot, objControl, -1);
 }
 ///-----------------------------------------------------------------------------
 /// <summary>
 /// Copies the elements of the specified <see cref="T:DotNetNuke.Entities.Modules.Actions.ModuleAction" />
 ///  array to the end of the collection.
 /// </summary>
 /// <param name="value">An array of type <see cref="T:DotNetNuke.Entities.Modules.Actions.ModuleAction" />
 ///  containing the objects to add to the collection.</param>
 /// <history>
 /// 	[Joe] 	10/9/2003	Created
 /// </history>
 ///-----------------------------------------------------------------------------
 public void AddRange(ModuleAction[] value)
 {
     int i;
     for (i = 0; i <= value.Length - 1; i++)
     {
         Add(value[i]);
     }
 }
示例#8
0
 ///-----------------------------------------------------------------------------
 /// <summary>
 /// </summary>
 /// <param name="Action"></param>
 /// <param name="ModuleConfiguration"></param>
 /// <remarks></remarks>
 /// <history>
 /// 	[Joe] 	10/26/2003	Created
 /// </history>
 ///-----------------------------------------------------------------------------
 public ActionEventArgs(ModuleAction Action, ModuleInfo ModuleConfiguration)
 {
     _action = Action;
     _moduleConfiguration = ModuleConfiguration;
 }
        ///-----------------------------------------------------------------------------
        /// <summary>
		/// Add an element of the specified <see cref="T:DotNetNuke.Entities.Modules.Actions.ModuleAction" /> to the end of the collection.
        /// </summary>
		/// <param name="value">An object of type <see cref="T:DotNetNuke.Entities.Modules.Actions.ModuleAction" /> to add to the collection.</param>
		/// <returns>The index of the newly added <see cref="T:DotNetNuke.Entities.Modules.Actions.ModuleAction" /></returns>
        /// <history>
        /// 	[Joe] 	10/9/2003	Created
        /// </history>
        ///-----------------------------------------------------------------------------
        public int Add(ModuleAction value)
        {
            return List.Add(value);
        }
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Add an element of the specified <see cref="T:DotNetNuke.Entities.Modules.Actions.ModuleAction" /> to the end of the collection.
        /// </summary>
        /// <param name="ID">This is the identifier to use for this action.</param>
        /// <param name="Title">This is the title that will be displayed for this action</param>
        /// <param name="CmdName">The command name passed to the client when this action is 
        /// clicked.</param>
        /// <param name="CmdArg">The command argument passed to the client when this action is 
        /// clicked.</param>
        /// <param name="Icon">The URL of the Icon to place next to this action</param>
        /// <param name="Url">The destination URL to redirect the client browser when this 
        /// action is clicked.</param>
        /// <param name="ClientScript">Client side script to be run when the this action is 
        /// clicked.</param>
        /// <param name="UseActionEvent">Determines whether client will receive an event
        /// notification</param>
        /// <param name="Secure">The security access level required for access to this action</param>
        /// <param name="Visible">Whether this action will be displayed</param>
        /// <param name="NewWindow">Whether open in new window.</param>
		/// <returns>The index of the newly added <see cref="T:DotNetNuke.Entities.Modules.Actions.ModuleAction" /></returns>
		/// <remarks>This method creates a new <see cref="T:DotNetNuke.Entities.Modules.Actions.ModuleAction" /> with the specified
        /// values, adds it to the collection and returns the index of the newly created ModuleAction.</remarks>
        ///         /// <history>
        /// 	[jbrinkman]	5/22/2004	Created
        /// </history>
        /// -----------------------------------------------------------------------------
        public ModuleAction Add(int ID, string Title, string CmdName, string CmdArg, string Icon, string Url, string ClientScript, bool UseActionEvent, SecurityAccessLevel Secure, bool Visible,
                                bool NewWindow)
        {
            var ModAction = new ModuleAction(ID, Title, CmdName, CmdArg, Icon, Url, ClientScript, UseActionEvent, Secure, Visible, NewWindow);
            Add(ModAction);
            return ModAction;
        }
示例#11
0
        private void MoveUpDown( ModuleAction Command )
        {
            ModuleController objModules = new ModuleController();
            switch (Command.CommandName)
            {
                case ModuleActionType.MoveTop:

                    objModules.UpdateModuleOrder(PortalModule.TabId, PortalModule.ModuleConfiguration.ModuleID, 0, Command.CommandArgument);
                    break;
                case ModuleActionType.MoveUp:

                    objModules.UpdateModuleOrder(PortalModule.TabId, PortalModule.ModuleConfiguration.ModuleID, PortalModule.ModuleConfiguration.ModuleOrder - 3, Command.CommandArgument);
                    break;
                case ModuleActionType.MoveDown:

                    objModules.UpdateModuleOrder(PortalModule.TabId, PortalModule.ModuleConfiguration.ModuleID, PortalModule.ModuleConfiguration.ModuleOrder + 3, Command.CommandArgument);
                    break;
                case ModuleActionType.MoveBottom:

                    objModules.UpdateModuleOrder(PortalModule.TabId, PortalModule.ModuleConfiguration.ModuleID, (PortalModule.ModuleConfiguration.PaneModuleCount * 2) + 1, Command.CommandArgument);
                    break;
            }

            objModules.UpdateTabModuleOrder(PortalModule.TabId, PortalModule.PortalId);

            // Redirect to the same page to pick up changes
            Response.Redirect(Request.RawUrl, true);
        }
示例#12
0
        private void MoveToPane( ModuleAction Command )
        {
            ModuleController objModules = new ModuleController();

            objModules.UpdateModuleOrder(PortalModule.TabId, PortalModule.ModuleConfiguration.ModuleID, -1, Command.CommandArgument);
            objModules.UpdateTabModuleOrder(PortalModule.TabId, PortalModule.PortalId);

            // Redirect to the same page to pick up changes
            Response.Redirect(Request.RawUrl, true);
        }
示例#13
0
 private void DoAction( ModuleAction Command )
 {
     if (Command.NewWindow)
     {
         Response.Write("<script>window.open('" + Command.Url + "','_blank')</script>");
     }
     else
     {
         Response.Redirect(Command.Url, true);
     }
 }
示例#14
0
        private void Delete( ModuleAction Command )
        {
            ModuleController objModules = new ModuleController();

            ModuleInfo objModule = objModules.GetModule(int.Parse(Command.CommandArgument), PortalModule.TabId, false);
            if (objModule != null)
            {
                objModules.DeleteTabModule(PortalModule.TabId, int.Parse(Command.CommandArgument));

                UserInfo m_UserInfo = UserController.GetCurrentUserInfo();
                EventLogController objEventLog = new EventLogController();
                objEventLog.AddLog(objModule, this.PortalSettings, m_UserInfo.UserID, "", EventLogController.EventLogType.MODULE_SENT_TO_RECYCLE_BIN);
            }

            // Redirect to the same page to pick up changes
            Response.Redirect(Request.RawUrl, true);
        }
        ///-----------------------------------------------------------------------------
        /// <summary>
        /// Gets a value indicating whether the collection contains the specified <see cref="T:DotNetNuke.Entities.Modules.Actions.ModuleAction" />.
        /// </summary>
        /// <param name="value">The <see cref="T:DotNetNuke.Entities.Modules.Actions.ModuleAction" /> to search for in the collection.</param>
        /// <returns><b>true</b> if the collection contains the specified object; otherwise, <b>false</b>.</returns>
        /// <example>
        /// <code>
        /// ' Tests for the presence of a ModuleAction in the 
        /// ' collection, and retrieves its index if it is found.
        /// Dim testModuleAction = New ModuleAction(5, "Edit Action", "Edit")
        /// Dim itemIndex As Integer = -1
        /// If collection.Contains(testModuleAction) Then
        ///    itemIndex = collection.IndexOf(testModuleAction)
        /// End If
        /// </code>
        /// </example>
        /// <history>
        /// 	[Joe] 	10/9/2003	Created
        /// </history>
        ///-----------------------------------------------------------------------------
        public bool Contains(ModuleAction value)
        {
			//If value is not of type ModuleAction, this will return false.
            return List.Contains(value);
        }
示例#16
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);
                            }
                        }
                    }
                }
            }
        }
 ///-----------------------------------------------------------------------------
 /// <summary>
 /// Gets the index in the collection of the specified <see cref="T:DotNetNuke.Entities.Modules.Actions.ModuleActionCollection" />, 
 /// if it exists in the collection.
 /// </summary>
 /// <param name="value">The <see cref="T:DotNetNuke.Entities.Modules.Actions.ModuleAction" /> to locate in the collection.</param>
 /// <returns>The index in the collection of the specified object, if found; otherwise, -1.</returns>
 /// <example> This example tests for the presense of a ModuleAction in the
 /// collection, and retrieves its index if it is found.
 /// <code>
 ///   Dim testModuleAction = New ModuleAction(5, "Edit Action", "Edit")
 ///   Dim itemIndex As Integer = -1
 ///   If collection.Contains(testModuleAction) Then
 ///     itemIndex = collection.IndexOf(testModuleAction)
 ///   End If
 /// </code>
 /// </example>
 /// <history>
 /// 	[Joe] 	10/9/2003	Created
 /// </history>
 ///-----------------------------------------------------------------------------
 public int IndexOf(ModuleAction value)
 {
     return List.IndexOf(value);
 }
        private static void GetClientScriptURL( ModuleAction Action, WebControl control )
        {
            if( Action.ClientScript.Length > 0 )
            {
                string Script = Action.ClientScript;

                int JSPos = Script.ToLower().IndexOf( "javascript:" );
                if( JSPos > - 1 )
                {
                    Script = Script.Substring( JSPos + 11 );
                }

                string FormatScript = "javascript: return {0};";

                control.Attributes.Add( "onClick", string.Format( FormatScript, Script ) );
            }
        }
 ///-----------------------------------------------------------------------------
 /// <summary>
 /// Add an element of the specified <see cref="T:DotNetNuke.Entities.Modules.Actions.ModuleAction" /> to the 
 /// collection at the designated index.
 /// </summary>
 /// <param name="index">An <see cref="T:system.int32">Integer</see> to indicate the location to add the object to the collection.</param>
 /// <param name="value">An object of type <see cref="T:DotNetNuke.Entities.Modules.Actions.ModuleAction" /> to add to the collection.</param>
 /// <example>
 /// <code>
 /// ' Inserts a ModuleAction at index 0 of the collection. 
 /// collection.Insert(0, New ModuleAction(5, "Edit Action", "Edit"))
 /// </code>
 /// </example>
 /// <history>
 /// 	[Joe] 	10/9/2003	Created
 /// </history>
 ///-----------------------------------------------------------------------------
 public void Insert(int index, ModuleAction value)
 {
     List.Insert(index, value);
 }
示例#20
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];
 }
 ///----------------------------------------------------------------------------- 
 /// <summary>
 /// Remove the specified object of type <see cref="T:DotNetNuke.Entities.Modules.Actions.ModuleAction" /> from the collection.
 /// </summary>
 /// <param name="value">An object of type <see cref="T:DotNetNuke.Entities.Modules.Actions.ModuleAction" /> to remove from the collection.</param>
 /// <example>
 /// <code>
 /// ' Removes the specified ModuleAction from the collection. 
 /// Dim testModuleAction = New ModuleAction(5, "Edit Action", "Edit")
 /// collection.Remove(testModuleAction)
 /// </code>
 /// </example>
 /// <history>
 /// 	[Joe] 	10/9/2003	Created
 /// </history>
 ///-----------------------------------------------------------------------------
 public void Remove(ModuleAction value)
 {
     List.Remove(value);
 }
示例#22
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="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>
 /// Initializes a new instance of the <see cref="T:DotNetNuke.Entities.Modules.Actions.ModuleActionCollection" />
 ///  class containing the specified array of <see cref="T:DotNetNuke.Entities.Modules.Actions.ModuleAction" /> objects.
 /// </summary>
 /// <param name="value">An array of <see cref="T:DotNetNuke.Entities.Modules.Actions.ModuleAction" /> objects 
 /// with which to initialize the collection. </param>
 /// <remarks>This overloaded constructor copies the <see cref="T:DotNetNuke.Entities.Modules.Actions.ModuleAction" />s
 ///  from the indicated array.</remarks>
 /// <history>
 /// 	[Joe] 	10/9/2003	Created
 /// </history>
 ///-----------------------------------------------------------------------------
 public ModuleActionCollection(ModuleAction[] value)
 {
     AddRange(value);
 }
示例#24
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="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);
 }
示例#25
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;
 }
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// AddHelpActions Adds the Help actions to the Action Menu
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        /// 	[cnurse]	05/12/2005	Documented
        ///     [cnurse]    01/19/2006  Moved from ActionBase
        ///     [cnurse]    12/24/2007  Renamed (from SetHelpVisibility)
        /// </history>
        /// -----------------------------------------------------------------------------
        private void AddHelpActions()
        {
            var url = string.Empty;
            if (!string.IsNullOrEmpty(Configuration.ModuleControl.HelpURL) && Host.EnableModuleOnLineHelp && PortalSettings.EnablePopUps)
            {
                url = UrlUtils.PopUpUrl(Configuration.ModuleControl.HelpURL, PortalSettings, false, false, 550, 950);
            }
            else
            {
                url = NavigateUrl(TabId, "Help", false, "ctlid=" + Configuration.ModuleControlId, "moduleid=" + ModuleId);
            }

            var helpAction = new ModuleAction(GetNextActionID())
                                 {
                                     Title = Localization.GetString(ModuleActionType.ModuleHelp, Localization.GlobalResourceFile),
                                     CommandName = ModuleActionType.ModuleHelp,
                                     CommandArgument = "",
                                     Icon = "action_help.gif",
                                     Url = url,
                                     Secure = SecurityAccessLevel.Edit,
                                     Visible = true,
                                     NewWindow = false,
                                     UseActionEvent = true
                                 };
            _moduleGenericActions.Actions.Add(helpAction);
        }
示例#27
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;
 }
 private void AddSyndicateAction()
 {
     var action = new ModuleAction(GetNextActionID())
                      {
                          Title = Localization.GetString(ModuleActionType.SyndicateModule, Localization.GlobalResourceFile),
                          CommandName = ModuleActionType.SyndicateModule,
                          CommandArgument = "",
                          Icon = "action_rss.gif",
                          Url = NavigateUrl(PortalSettings.ActiveTab.TabID, "", "RSS.aspx", false, "moduleid=" + ModuleId),
                          Secure = SecurityAccessLevel.Anonymous,
                          UseActionEvent = true,
                          Visible = true,
                          NewWindow = true
                      };
     _moduleGenericActions.Actions.Add(action);
 }
示例#29
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);
 }
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// LoadActions loads the Actions collections
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///     [cnurse]    01/19/2006  created
        /// </history>
        /// -----------------------------------------------------------------------------
        private void LoadActions(HttpRequest request)
        {
            _actions = new ModuleActionCollection();
            _moduleGenericActions = new ModuleAction(GetNextActionID(), Localization.GetString("ModuleGenericActions.Action", Localization.GlobalResourceFile), string.Empty, string.Empty, string.Empty);
            int maxActionId = Null.NullInteger;

            //check if module Implements Entities.Modules.IActionable interface
            var actionable = _moduleControl as IActionable;
            if (actionable != null)
            {
                _moduleSpecificActions = new ModuleAction(GetNextActionID(), Localization.GetString("ModuleSpecificActions.Action", Localization.GlobalResourceFile), string.Empty, string.Empty, string.Empty);

                ModuleActionCollection moduleActions = actionable.ModuleActions;

                foreach (ModuleAction action in moduleActions)
                {
                    if (ModulePermissionController.HasModuleAccess(action.Secure, "CONTENT", Configuration))
                    {
                        if (String.IsNullOrEmpty(action.Icon))
                        {
                            action.Icon = "edit.gif";
                        }
                        if (action.ID > maxActionId)
                        {
                            maxActionId = action.ID;
                        }
                        _moduleSpecificActions.Actions.Add(action);

                        if (!UIUtilities.IsLegacyUI(ModuleId, action.ControlKey, PortalId) && action.Url.Contains("ctl"))
                        {
                            action.ClientScript = UrlUtils.PopUpUrl(action.Url, _moduleControl as Control, PortalSettings, true, false);
                        }
                    }
                }
                if (_moduleSpecificActions.Actions.Count > 0)
                {
                    _actions.Add(_moduleSpecificActions);
                }
            }

            //Make sure the Next Action Id counter is correct
            int actionCount = GetActionsCount(_actions.Count, _actions);
            if (_nextActionId < maxActionId)
            {
                _nextActionId = maxActionId;
            }
            if (_nextActionId < actionCount)
            {
                _nextActionId = actionCount;
            }

            //Custom injection of Module Settings when shared as ViewOnly
            if (Configuration != null && (Configuration.IsShared && Configuration.IsShareableViewOnly)
                    && TabPermissionController.CanAddContentToPage())
            {
                _moduleGenericActions.Actions.Add(GetNextActionID(),
                             Localization.GetString("ModulePermissions.Action", Localization.GlobalResourceFile),
                             "ModulePermissions",
                             "",
                             "action_settings.gif",
                             NavigateUrl(TabId, "ModulePermissions", false, "ModuleId=" + ModuleId, "ReturnURL=" + FilterUrl(request)),
                             false,
                             SecurityAccessLevel.ViewPermissions,
                             true,
                             false);
            }
            else
            {
                if (!Globals.IsAdminControl() && ModulePermissionController.HasModuleAccess(SecurityAccessLevel.Admin, "DELETE,MANAGE", Configuration))
                {
                    if (ModulePermissionController.HasModuleAccess(SecurityAccessLevel.Admin, "MANAGE", Configuration))
                    {
                        _moduleGenericActions.Actions.Add(GetNextActionID(),
                                                          Localization.GetString(ModuleActionType.ModuleSettings, Localization.GlobalResourceFile),
                                                          ModuleActionType.ModuleSettings,
                                                          "",
                                                          "action_settings.gif",
                                                          NavigateUrl(TabId, "Module", false, "ModuleId=" + ModuleId, "ReturnURL=" + FilterUrl(request)),
                                                          false,
                                                          SecurityAccessLevel.Edit,
                                                          true,
                                                          false);
                    }
                }
            }

            if (!string.IsNullOrEmpty(Configuration.DesktopModule.BusinessControllerClass))
            {
                //check if module implements IPortable interface, and user has Admin permissions
                if (Configuration.DesktopModule.IsPortable)
                {
                    if (ModulePermissionController.HasModuleAccess(SecurityAccessLevel.Admin, "EXPORT", Configuration))
                    {
                        _moduleGenericActions.Actions.Add(GetNextActionID(),
                                     Localization.GetString(ModuleActionType.ExportModule, Localization.GlobalResourceFile),
                                     "",
                                     "",
                                     "action_export.gif",
                                     NavigateUrl(PortalSettings.ActiveTab.TabID, "ExportModule", false, "moduleid=" + ModuleId, "ReturnURL=" + FilterUrl(request)),

                                     "",
                                     false,
                                     SecurityAccessLevel.View,
                                     true,
                                     false);
                    }
                    if (ModulePermissionController.HasModuleAccess(SecurityAccessLevel.Admin, "IMPORT", Configuration))
                    {
                        _moduleGenericActions.Actions.Add(GetNextActionID(),
                                     Localization.GetString(ModuleActionType.ImportModule, Localization.GlobalResourceFile),
                                     "",
                                     "",
                                     "action_import.gif",
                                     NavigateUrl(PortalSettings.ActiveTab.TabID, "ImportModule", false, "moduleid=" + ModuleId, "ReturnURL=" + FilterUrl(request)),
                                     "",
                                     false,
                                     SecurityAccessLevel.View,
                                     true,
                                     false);
                    }
                }
                if (Configuration.DesktopModule.IsSearchable && Configuration.DisplaySyndicate)
                {
                    AddSyndicateAction();
                }
            }

            //help module actions available to content editors and administrators
            const string permisisonList = "CONTENT,DELETE,EDIT,EXPORT,IMPORT,MANAGE";
            if (ModulePermissionController.HasModulePermission(Configuration.ModulePermissions, permisisonList) && request.QueryString["ctl"] != "Help")
            {
                AddHelpActions();
            }

            //Add Print Action
            if (Configuration.DisplayPrint)
            {
                //print module action available to everyone
                AddPrintAction();
            }
            if (ModulePermissionController.HasModuleAccess(SecurityAccessLevel.Host, "MANAGE", Configuration))
            {
                _moduleGenericActions.Actions.Add(GetNextActionID(),
                             Localization.GetString(ModuleActionType.ViewSource, Localization.GlobalResourceFile),
                             ModuleActionType.ViewSource,
                             "",
                             "action_source.gif",
                             NavigateUrl(TabId, "ViewSource", false, "ModuleId=" + ModuleId, "ctlid=" + Configuration.ModuleControlId, "ReturnURL=" + FilterUrl(request)),
                             false,
                             SecurityAccessLevel.Host,
                             true,
                             false);
            }



            if (!Globals.IsAdminControl() && ModulePermissionController.HasModuleAccess(SecurityAccessLevel.Admin, "DELETE,MANAGE", Configuration))
            {
                if (ModulePermissionController.HasModuleAccess(SecurityAccessLevel.Admin, "DELETE", Configuration))
                {
                    //Check if this is the owner instance of a shared module.
                    string confirmText = "confirm('" + ClientAPI.GetSafeJSString(Localization.GetString("DeleteModule.Confirm")) + "')";
                    if (!Configuration.IsShared)
                    {
                        var moduleController = new ModuleController();
                        if (moduleController.GetModuleTabs(Configuration.ModuleID).Cast<ModuleInfo>().Any(instance => instance.IsShared))
                        {
                            confirmText = "confirm('" + ClientAPI.GetSafeJSString(Localization.GetString("DeleteSharedModule.Confirm")) + "')";
                        }
                    }

                    _moduleGenericActions.Actions.Add(GetNextActionID(),
                                 Localization.GetString(ModuleActionType.DeleteModule, Localization.GlobalResourceFile),
                                 ModuleActionType.DeleteModule,
                                 Configuration.ModuleID.ToString(),
                                 "action_delete.gif",
                                 "",
                                 confirmText,
                                 false,
                                 SecurityAccessLevel.View,
                                 true,
                                 false);
                }
                if (ModulePermissionController.HasModuleAccess(SecurityAccessLevel.Admin, "MANAGE", Configuration))
                {
                    _moduleGenericActions.Actions.Add(GetNextActionID(),
                                 Localization.GetString(ModuleActionType.ClearCache, Localization.GlobalResourceFile),
                                 ModuleActionType.ClearCache,
                                 Configuration.ModuleID.ToString(),
                                 "action_refresh.gif",
                                 "",
                                 false,
                                 SecurityAccessLevel.View,
                                 true,
                                 false);
                }

                if (ModulePermissionController.HasModuleAccess(SecurityAccessLevel.Admin, "MANAGE", Configuration))
                {
                    //module movement
                    AddMenuMoveActions();
                }
            }

            if (_moduleGenericActions.Actions.Count > 0)
            {
                _actions.Add(_moduleGenericActions);
            }

            if (_moduleMoveActions != null && _moduleMoveActions.Actions.Count > 0)
            {
                _actions.Add(_moduleMoveActions);
            }

            foreach (ModuleAction action in _moduleGenericActions.Actions)
            {
                if (!UIUtilities.IsLegacyUI(ModuleId, action.ControlKey, PortalId) && action.Url.Contains("ctl"))
                {
                    action.ClientScript = UrlUtils.PopUpUrl(action.Url, _moduleControl as Control, PortalSettings, true, false);
                }
            }
        }
示例#31
0
 ///-----------------------------------------------------------------------------
 /// <summary>
 /// </summary>
 /// <param name="Action"></param>
 /// <param name="ModuleConfiguration"></param>
 /// <remarks></remarks>
 ///-----------------------------------------------------------------------------
 public ActionEventArgs(ModuleAction Action, ModuleInfo ModuleConfiguration)
 {
     _action = Action;
     _moduleConfiguration = ModuleConfiguration;
 }