コード例 #1
0
        private bool ProcessSlaveModule()
        {
            var success     = true;
            var key         = UIUtilities.GetControlKey();
            var moduleId    = UIUtilities.GetModuleId(key);
            var slaveModule = UIUtilities.GetSlaveModule(moduleId, key, PortalSettings.ActiveTab.TabID);

            Pane pane;

            Panes.TryGetValue(Globals.glbDefaultPane.ToLowerInvariant(), out pane);
            slaveModule.PaneName     = Globals.glbDefaultPane;
            slaveModule.ContainerSrc = PortalSettings.ActiveTab.ContainerSrc;
            if (String.IsNullOrEmpty(slaveModule.ContainerSrc))
            {
                slaveModule.ContainerSrc = PortalSettings.DefaultPortalContainer;
            }
            slaveModule.ContainerSrc  = SkinController.FormatSkinSrc(slaveModule.ContainerSrc, PortalSettings);
            slaveModule.ContainerPath = SkinController.FormatSkinPath(slaveModule.ContainerSrc);

            var moduleControl = ModuleControlController.GetModuleControlByControlKey(key, slaveModule.ModuleDefID);

            if (moduleControl != null)
            {
                slaveModule.ModuleControlId = moduleControl.ModuleControlID;
                slaveModule.IconFile        = moduleControl.IconFile;

                string permissionKey;
                switch (slaveModule.ModuleControl.ControlSrc)
                {
                case "Admin/Modules/ModuleSettings.ascx":
                    permissionKey = "MANAGE";
                    break;

                case "Admin/Modules/Import.ascx":
                    permissionKey = "IMPORT";
                    break;

                case "Admin/Modules/Export.ascx":
                    permissionKey = "EXPORT";
                    break;

                default:
                    permissionKey = "CONTENT";
                    break;
                }

                if (ModulePermissionController.HasModuleAccess(slaveModule.ModuleControl.ControlType, permissionKey, slaveModule))
                {
                    success = InjectModule(pane, slaveModule);
                }
                else
                {
                    Response.Redirect(Globals.AccessDeniedURL(Localization.GetString("ModuleAccess.Error")), true);
                }
            }

            return(success);
        }
コード例 #2
0
ファイル: Skin.cs プロジェクト: gvhung/thegioicuaban.com
        private bool ProcessMasterModules()
        {
            bool bSuccess = true;

            if (TabPermissionController.CanViewPage())
            {
                if (!CheckExpired())
                {
                    if ((PortalSettings.ActiveTab.StartDate < DateTime.Now && PortalSettings.ActiveTab.EndDate > DateTime.Now) || Globals.IsLayoutMode())
                    {
                        if (PortalSettings.ActiveTab.Modules.Count > 0)
                        {
                            foreach (ModuleInfo objModule in PortalSettings.ActiveTab.Modules)
                            {
                                if (ModulePermissionController.CanViewModule(objModule) && objModule.IsDeleted == false)
                                {
                                    if ((objModule.StartDate < DateTime.Now && objModule.EndDate > DateTime.Now) || Common.Globals.IsLayoutMode() || Common.Globals.IsEditMode())
                                    {
                                        Pane pane   = null;
                                        bool bFound = Panes.TryGetValue(objModule.PaneName.ToLowerInvariant(), out pane);
                                        if (!bFound)
                                        {
                                            bFound = Panes.TryGetValue(Common.Globals.glbDefaultPane.ToLowerInvariant(), out pane);
                                        }
                                        if (bFound)
                                        {
                                            bSuccess = InjectModule(pane, objModule);
                                        }
                                        else
                                        {
                                            ModuleLoadException lex;
                                            lex = new ModuleLoadException(PANE_LOAD_ERROR);
                                            Controls.Add(new ErrorContainer(PortalSettings, MODULELOAD_ERROR, lex).Container);
                                            Exceptions.LogException(lex);
                                        }
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        AddPageMessage(this, "", TABACCESS_ERROR, UI.Skins.Controls.ModuleMessage.ModuleMessageType.YellowWarning);
                    }
                }
                else
                {
                    AddPageMessage(this, "", string.Format(CONTRACTEXPIRED_ERROR, PortalSettings.PortalName, Common.Globals.GetMediumDate(PortalSettings.ExpiryDate.ToString()), PortalSettings.Email), UI.Skins.Controls.ModuleMessage.ModuleMessageType.RedError);
                }
            }
            else
            {
                Response.Redirect(Common.Globals.AccessDeniedURL(TABACCESS_ERROR), true);
            }
            return(bSuccess);
        }
コード例 #3
0
        private Pane GetPane(ModuleInfo module)
        {
            Pane pane;
            bool found = Panes.TryGetValue(module.PaneName.ToLowerInvariant(), out pane);

            if (!found)
            {
                Panes.TryGetValue(Globals.glbDefaultPane.ToLowerInvariant(), out pane);
            }

            return(pane);
        }
コード例 #4
0
ファイル: Skin.cs プロジェクト: gvhung/thegioicuaban.com
        private bool ProcessSlaveModule()
        {
            ModuleController objModules  = new ModuleController();
            ModuleInfo       objModule   = null;
            ModuleInfo       slaveModule = null;
            int    moduleId = -1;
            string key      = "";
            bool   bSuccess = true;

            if (Request.QueryString["mid"] != null)
            {
                Int32.TryParse(Request.QueryString["mid"], out moduleId);
            }
            if (Request.QueryString["ctl"] != null)
            {
                key = Request.QueryString["ctl"];
            }
            if (Request.QueryString["moduleid"] != null && (key.ToLower() == "module" || key.ToLower() == "help"))
            {
                Int32.TryParse(Request.QueryString["moduleid"], out moduleId);
            }
            if (moduleId != -1)
            {
                objModule = objModules.GetModule(moduleId, PortalSettings.ActiveTab.TabID, false);
                if (objModule != null)
                {
                    slaveModule = objModule.Clone();
                }
            }
            if (slaveModule == null)
            {
                slaveModule             = new ModuleInfo();
                slaveModule.ModuleID    = moduleId;
                slaveModule.ModuleDefID = -1;
                slaveModule.TabID       = PortalSettings.ActiveTab.TabID;
            }
            if (Request.QueryString["moduleid"] != null && (key.ToLower() == "module" || key.ToLower() == "help"))
            {
                slaveModule.ModuleDefID = -1;
            }
            if (Request.QueryString["dnnprintmode"] != "true")
            {
                slaveModule.ModuleTitle = "";
            }
            slaveModule.Header           = "";
            slaveModule.Footer           = "";
            slaveModule.StartDate        = DateTime.MinValue;
            slaveModule.EndDate          = DateTime.MaxValue;
            slaveModule.PaneName         = Common.Globals.glbDefaultPane;
            slaveModule.Visibility       = VisibilityState.None;
            slaveModule.Color            = "";
            slaveModule.Border           = "";
            slaveModule.DisplayTitle     = true;
            slaveModule.DisplayPrint     = false;
            slaveModule.DisplaySyndicate = false;
            slaveModule.ContainerSrc     = PortalSettings.ActiveTab.ContainerSrc;
            if (string.IsNullOrEmpty(slaveModule.ContainerSrc))
            {
                slaveModule.ContainerSrc = PortalSettings.DefaultPortalContainer;
            }
            slaveModule.ContainerSrc  = SkinController.FormatSkinSrc(slaveModule.ContainerSrc, PortalSettings);
            slaveModule.ContainerPath = SkinController.FormatSkinPath(slaveModule.ContainerSrc);
            Pane pane   = null;
            bool bFound = Panes.TryGetValue(Common.Globals.glbDefaultPane.ToLowerInvariant(), out pane);
            ModuleControlInfo objModuleControl = ModuleControlController.GetModuleControlByControlKey(key, slaveModule.ModuleDefID);

            if (objModuleControl != null)
            {
                slaveModule.ModuleControlId = objModuleControl.ModuleControlID;
                slaveModule.IconFile        = objModuleControl.IconFile;
                if (ModulePermissionController.HasModuleAccess(slaveModule.ModuleControl.ControlType, Null.NullString, slaveModule))
                {
                    bSuccess = InjectModule(pane, slaveModule);
                }
                else
                {
                    Response.Redirect(Common.Globals.AccessDeniedURL(MODULEACCESS_ERROR), true);
                }
            }
            return(bSuccess);
        }