コード例 #1
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// GetPopUpSkin gets the Skin that is used in modal popup.
        /// </summary>
        /// <param name="page">The Page.</param>
        /// <returns></returns>
        /// -----------------------------------------------------------------------------
        public static Skin GetPopUpSkin(PageBase page)
        {
            Skin skin = null;

            // attempt to find and load a popup skin from the assigned skinned source
            string skinSource = Globals.IsAdminSkin() ? SkinController.FormatSkinSrc(page.PortalSettings.DefaultAdminSkin, page.PortalSettings) : page.PortalSettings.ActiveTab.SkinSrc;

            if (!string.IsNullOrEmpty(skinSource))
            {
                skinSource = SkinController.FormatSkinSrc(SkinController.FormatSkinPath(skinSource) + "popUpSkin.ascx", page.PortalSettings);

                if (File.Exists(HttpContext.Current.Server.MapPath(SkinController.FormatSkinSrc(skinSource, page.PortalSettings))))
                {
                    skin = LoadSkin(page, skinSource);
                }
            }

            // error loading popup skin - load default popup skin
            if (skin == null)
            {
                skinSource = Globals.HostPath + "Skins/_default/popUpSkin.ascx";
                skin       = LoadSkin(page, skinSource);
            }

            // set skin path
            page.PortalSettings.ActiveTab.SkinPath = SkinController.FormatSkinPath(skinSource);

            // set skin id to an explicit short name to reduce page payload and make it standards compliant
            skin.ID = "dnn";

            return(skin);
        }
コード例 #2
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// GetSkin gets the Skin.
        /// </summary>
        /// <param name="page">The Page.</param>
        /// <returns></returns>
        /// -----------------------------------------------------------------------------
        public static Skin GetSkin(PageBase page)
        {
            Skin   skin       = null;
            string skinSource = Null.NullString;

            // skin preview
            if (page.Request.QueryString["SkinSrc"] != null)
            {
                skinSource = SkinController.FormatSkinSrc(Globals.QueryStringDecode(page.Request.QueryString["SkinSrc"]) + ".ascx", page.PortalSettings);
                skin       = LoadSkin(page, skinSource);
            }

            // load user skin ( based on cookie )
            if (skin == null)
            {
                HttpCookie skinCookie = page.Request.Cookies["_SkinSrc" + page.PortalSettings.PortalId];
                if (skinCookie != null)
                {
                    if (!string.IsNullOrEmpty(skinCookie.Value))
                    {
                        skinSource = SkinController.FormatSkinSrc(skinCookie.Value + ".ascx", page.PortalSettings);
                        skin       = LoadSkin(page, skinSource);
                    }
                }
            }

            // load assigned skin
            if (skin == null)
            {
                // DNN-6170 ensure skin value is culture specific
                // skinSource = Globals.IsAdminSkin() ? SkinController.FormatSkinSrc(page.PortalSettings.DefaultAdminSkin, page.PortalSettings) : page.PortalSettings.ActiveTab.SkinSrc;
                skinSource = Globals.IsAdminSkin() ? PortalController.GetPortalSetting("DefaultAdminSkin", page.PortalSettings.PortalId,
                                                                                       Host.DefaultPortalSkin, page.PortalSettings.CultureCode) : page.PortalSettings.ActiveTab.SkinSrc;
                if (!string.IsNullOrEmpty(skinSource))
                {
                    skinSource = SkinController.FormatSkinSrc(skinSource, page.PortalSettings);
                    skin       = LoadSkin(page, skinSource);
                }
            }

            // error loading skin - load default
            if (skin == null)
            {
                skinSource = SkinController.FormatSkinSrc(SkinController.GetDefaultPortalSkin(), page.PortalSettings);
                skin       = LoadSkin(page, skinSource);
            }

            // set skin path
            page.PortalSettings.ActiveTab.SkinPath = SkinController.FormatSkinPath(skinSource);

            // set skin id to an explicit short name to reduce page payload and make it standards compliant
            skin.ID = "dnn";

            return(skin);
        }
コード例 #3
0
        protected void Page_Init(Object sender, EventArgs e)
        {
            InitializePage();

            UserControl ctlSkin = null;

            if (Request.QueryString["SkinSrc"] != null)
            {
                PortalSettings.ActiveTab.SkinSrc = SkinController.FormatSkinSrc(Globals.QueryStringDecode(Request.QueryString["SkinSrc"]) + ".ascx", PortalSettings);
                ctlSkin = LoadSkin(PortalSettings.ActiveTab.SkinSrc);
            }

            // load user skin ( based on cookie )
            if (ctlSkin == null)
            {
                if (Request.Cookies["_SkinSrc" + PortalSettings.PortalId] != null)
                {
                    if (!String.IsNullOrEmpty(Request.Cookies["_SkinSrc" + PortalSettings.PortalId].Value))
                    {
                        PortalSettings.ActiveTab.SkinSrc = SkinController.FormatSkinSrc(Request.Cookies["_SkinSrc" + PortalSettings.PortalId].Value + ".ascx", PortalSettings);
                        ctlSkin = LoadSkin(PortalSettings.ActiveTab.SkinSrc);
                    }
                }
            }

            // load assigned skin
            if (ctlSkin == null)
            {
                if (Globals.IsAdminSkin(PortalSettings.ActiveTab.IsAdminTab))
                {
                    SkinInfo objSkin = SkinController.GetSkin(SkinInfo.RootSkin, PortalSettings.PortalId, SkinType.Admin);
                    if (objSkin != null)
                    {
                        PortalSettings.ActiveTab.SkinSrc = objSkin.SkinSrc;
                    }
                    else
                    {
                        PortalSettings.ActiveTab.SkinSrc = "";
                    }
                }

                if (!String.IsNullOrEmpty(PortalSettings.ActiveTab.SkinSrc))
                {
                    PortalSettings.ActiveTab.SkinSrc = SkinController.FormatSkinSrc(PortalSettings.ActiveTab.SkinSrc, PortalSettings);
                    ctlSkin = LoadSkin(PortalSettings.ActiveTab.SkinSrc);
                }
            }

            // error loading skin - load default
            if (ctlSkin == null)
            {
                // could not load skin control - load default skin
                if (Globals.IsAdminSkin(PortalSettings.ActiveTab.IsAdminTab))
                {
                    PortalSettings.ActiveTab.SkinSrc = Globals.HostPath + SkinInfo.RootSkin + Globals.glbDefaultSkinFolder + Globals.glbDefaultAdminSkin;
                }
                else
                {
                    PortalSettings.ActiveTab.SkinSrc = Globals.HostPath + SkinInfo.RootSkin + Globals.glbDefaultSkinFolder + Globals.glbDefaultSkin;
                }
                ctlSkin = LoadSkin(PortalSettings.ActiveTab.SkinSrc);
            }

            // set skin path
            PortalSettings.ActiveTab.SkinPath = SkinController.FormatSkinPath(PortalSettings.ActiveTab.SkinSrc);

            // set skin id to an explicit short name to reduce page payload and make it standards compliant
            ctlSkin.ID = "dnn";

            // add CSS links
            ManageStyleSheets(false);

            // add skin to page
            SkinPlaceHolder.Controls.Add(ctlSkin);

            // add CSS links
            ManageStyleSheets(true);

            // ClientCallback Logic
            ClientAPI.HandleClientAPICallbackEvent(this);
        }
コード例 #4
0
        private Containers.Container LoadNoContainer(ModuleInfo module)
        {
            string noContainerSrc = "[G]" + SkinController.RootContainer + "/_default/No Container.ascx";

            Containers.Container container = null;

            //if the module specifies that no container should be used
            if (module.DisplayTitle == false)
            {
                //always display container if the current user is the administrator or the module is being used in an admin case
                bool displayTitle = ModulePermissionController.CanEditModuleContent(module) || Globals.IsAdminSkin();
                //unless the administrator is in view mode
                if (displayTitle)
                {
                    displayTitle = (PortalSettings.UserMode != PortalSettings.Mode.View);
                }

                if (displayTitle == false)
                {
                    container = LoadContainerByPath(SkinController.FormatSkinSrc(noContainerSrc, PortalSettings));
                }
            }
            return(container);
        }