Пример #1
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// InjectModule injects the module into the Pane
        /// </summary>
        /// <param name="module">The module to inject</param>
        /// <param name="pane">The pane</param>
        /// -----------------------------------------------------------------------------
        public bool InjectModule(Pane pane, ModuleInfo module)
        {
            bool bSuccess = true;

            //try to inject the module into the pane
            try
            {
                if (PortalSettings.ActiveTab.TabID == PortalSettings.UserTabId || PortalSettings.ActiveTab.ParentId == PortalSettings.UserTabId)
                {
                    var profileModule = ModuleControlFactory.LoadModuleControl(Page, module) as IProfileModule;
                    if (profileModule == null || profileModule.DisplayModule)
                    {
                        pane.InjectModule(module);
                    }
                }
                else
                {
                    pane.InjectModule(module);
                }
            }
            catch (ThreadAbortException)
            {
                //Response.Redirect may called in module control's OnInit method, so it will cause ThreadAbortException, no need any action here.
            }
            catch (Exception ex)
            {
                Exceptions.LogException(ex);
                bSuccess = false;
            }
            return(bSuccess);
        }
Пример #2
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// InjectModule injects the module into the Pane
        /// </summary>
        /// <param name="module">The module to inject</param>
        /// <param name="pane">The pane</param>
        /// <history>
        ///     [cnurse]	12/04/2007  created
        ///     [cnurse]    04/17/2009  Refactored to use SkinAdapter
        /// </history>
        /// -----------------------------------------------------------------------------
        public bool InjectModule(Pane pane, ModuleInfo module)
        {
            bool bSuccess = true;

            //try to inject the module into the pane
            try
            {
                if (PortalSettings.ActiveTab.TabID == PortalSettings.UserTabId || PortalSettings.ActiveTab.ParentId == PortalSettings.UserTabId)
                {
                    var profileModule = ModuleControlFactory.LoadModuleControl(Page, module) as IProfileModule;
                    if (profileModule == null || profileModule.DisplayModule)
                    {
                        pane.InjectModule(module);
                    }
                }
                else
                {
                    pane.InjectModule(module);
                }
            }
            catch (Exception ex)
            {
                Exceptions.LogException(ex);
                bSuccess = false;
            }
            return(bSuccess);
        }
Пример #3
0
        /// <summary>
        /// 绑定页面上需要加载的模块
        /// </summary>
        public void BindModule(DNNGo_ThemePlugin_MenuRowItem RowItem)
        {
            ModuleController objModules          = new ModuleController();
            ModuleInfo       ModuleConfiguration = objModules.GetModule(RowItem.BindModuleID, RowItem.BindTabID);

            if (ModuleConfiguration != null && ModuleConfiguration.ModuleID > 0)
            {
                //这里可以加上代码控制标题是否显示
                if (RowItem.MenuDisplayTitle == 1)
                {
                    BindString("<h3 class=\"submenu_title\">{0}</h3>", ModuleConfiguration.ModuleTitle);
                }

                BindString("<div class=\"menucontent\"> ");

                try
                {
                    //phContentHTML.Controls.Add(ModuleControlFactory.LoadModuleControl(Page, ModuleConfiguration));

                    //PortalModuleBase _Control = ControlUtilities.LoadControl<PortalModuleBase>(this, ModuleConfiguration.ModuleControl.ControlSrc);
                    //_Control.ID = String.Format("{0}_{1}", ModuleConfiguration.ModuleID, Path.GetFileNameWithoutExtension(ModuleConfiguration.ModuleControl.ControlSrc));
                    //_Control.ModuleContext.Configuration = ModuleConfiguration;
                    //_Control.ModuleConfiguration = ModuleConfiguration;
                    //phContentHTML.Controls.Add(_Control);

                    var control = ModuleControlFactory.LoadModuleControl(Page, ModuleConfiguration);
                    if (control != null)
                    {
                        control.ID = String.Format("{0}_{1}", ModuleConfiguration.ModuleID, Path.GetFileNameWithoutExtension(ModuleConfiguration.ModuleControl.ControlSrc));
                        phContentHTML.Controls.Add(control);
                    }
                }
                catch
                { }



                BindString("</div>");
            }
        }
Пример #4
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            AdminActionsJSON  = "[]";
            CustomActionsJSON = "[]";
            Panes             = "[]";
            try
            {
                SupportsQuickSettings = false;
                DisplayQuickSettings  = false;
                ModuleTitle           = ModuleContext.Configuration.ModuleTitle;
                var moduleDefinitionId   = ModuleContext.Configuration.ModuleDefID;
                var quickSettingsControl = ModuleControlController.GetModuleControlByControlKey("QuickSettings", moduleDefinitionId);

                if (quickSettingsControl != null)
                {
                    SupportsQuickSettings = true;
                    var control = ModuleControlFactory.LoadModuleControl(Page, ModuleContext.Configuration, "QuickSettings", quickSettingsControl.ControlSrc);
                    control.ID += ModuleContext.ModuleId;
                    quickSettings.Controls.Add(control);

                    DisplayQuickSettings = ModuleContext.Configuration.ModuleSettings.GetValueOrDefault("QS_FirstLoad", true);
                    ModuleController.Instance.UpdateModuleSetting(ModuleContext.ModuleId, "QS_FirstLoad", "False");

                    ClientResourceManager.RegisterScript(Page, "~/admin/menus/ModuleActions/dnnQuickSettings.js");
                }

                if (ActionRoot.Visible)
                {
                    //Add Menu Items
                    foreach (ModuleAction rootAction in ActionRoot.Actions)
                    {
                        //Process Children
                        var actions = new List <ModuleAction>();
                        foreach (ModuleAction action in rootAction.Actions)
                        {
                            if (action.Visible)
                            {
                                if ((EditMode && Globals.IsAdminControl() == false) ||
                                    (action.Secure != SecurityAccessLevel.Anonymous && action.Secure != SecurityAccessLevel.View))
                                {
                                    if (!action.Icon.Contains("://") &&
                                        !action.Icon.StartsWith("/") &&
                                        !action.Icon.StartsWith("~/"))
                                    {
                                        action.Icon = "~/images/" + action.Icon;
                                    }
                                    if (action.Icon.StartsWith("~/"))
                                    {
                                        action.Icon = Globals.ResolveUrl(action.Icon);
                                    }

                                    actions.Add(action);

                                    if (String.IsNullOrEmpty(action.Url))
                                    {
                                        validIDs.Add(action.ID);
                                    }
                                }
                            }
                        }

                        var oSerializer = new JavaScriptSerializer();
                        if (rootAction.Title == Localization.GetString("ModuleGenericActions.Action", Localization.GlobalResourceFile))
                        {
                            AdminActionsJSON = oSerializer.Serialize(actions);
                        }
                        else
                        {
                            if (rootAction.Title == Localization.GetString("ModuleSpecificActions.Action", Localization.GlobalResourceFile))
                            {
                                CustomActionsJSON = oSerializer.Serialize(actions);
                            }
                            else
                            {
                                SupportsMove = (actions.Count > 0);
                                Panes        = oSerializer.Serialize(PortalSettings.ActiveTab.Panes);
                            }
                        }
                    }
                    IsShared = ModuleContext.Configuration.AllTabs ||
                               PortalGroupController.Instance.IsModuleShared(ModuleContext.ModuleId, PortalController.Instance.GetPortal(PortalSettings.PortalId)) ||
                               TabController.Instance.GetTabsByModuleID(ModuleContext.ModuleId).Count > 1;
                }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }