/// <summary>
        /// Loads suported locales and shows default values
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///     [vmasanas]	04/10/2004	Created
        ///     [vmasanas]	25/03/2006	Modified to support new host resources and incremental saving
        /// </history>
        protected void Page_Load(Object sender, EventArgs e)
        {
            try
            {
                if (!Page.IsPostBack)
                {
                    ClientAPI.AddButtonConfirm(cmdDelete, Localization.GetString("DeleteItem"));

                    // initialized available locales
                    BindLocaleList();

                    // init tree
                    InitTree();

                    // If returning from full editor, use params
                    // else load system global resource file by default
                    if (Request.QueryString["locale"] != null)
                    {
                        cboLocales.SelectedValue = Request.QueryString["locale"].ToString();
                    }
                    else
                    {
                        cboLocales.SelectedValue = Localization.SystemLocale;
                    }
                    if (PortalSettings.ActiveTab.ParentId == PortalSettings.AdminTabId)
                    {
                        rbMode.SelectedValue = "Portal";
                        rowMode.Visible      = false;
                    }
                    else
                    {
                        // portal mode only available on admin menu
                        rbMode.Items.RemoveAt(2);
                        string mode = Request.QueryString["mode"];
                        if (!String.IsNullOrEmpty(mode) && rbMode.Items.FindByValue(mode) != null)
                        {
                            rbMode.SelectedValue = mode;
                        }
                    }
                    if (Request.QueryString["resourcefile"] != null)
                    {
                        SelectedResourceFile = Server.MapPath("~/" + Globals.QueryStringDecode(Request.QueryString["resourcefile"]));
                    }
                    else
                    {
                        SelectedResourceFile = Server.MapPath(Localization.GlobalResourceFile);
                    }
                    DNNTree.SelectNodeByKey(SelectedResourceFile);

                    BindGrid();
                }
            }
            catch (Exception exc)  //Module failed to load
            {
                Exceptions.Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
예제 #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
        private Containers.Container LoadContainerFromQueryString(ModuleInfo module, HttpRequest request)
        {
            Containers.Container container = null;
            int previewModuleId            = -1;

            if (request.QueryString["ModuleId"] != null)
            {
                Int32.TryParse(request.QueryString["ModuleId"], out previewModuleId);
            }

            //load user container ( based on cookie )
            if ((request.QueryString["ContainerSrc"] != null) && (module.ModuleID == previewModuleId || previewModuleId == -1))
            {
                string containerSrc = SkinController.FormatSkinSrc(Globals.QueryStringDecode(request.QueryString["ContainerSrc"]) + ".ascx", PortalSettings);
                container = LoadContainerByPath(containerSrc);
            }
            return(container);
        }
예제 #4
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);
        }
예제 #5
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        ///   Loads suported locales and shows default values
        /// </summary>
        /// <param name = "sender"></param>
        /// <param name = "e"></param>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///   [vmasanas]	04/10/2004	Created
        ///   [vmasanas]	25/03/2006	Modified to support new host resources and incremental saving
        /// </history>
        /// -----------------------------------------------------------------------------
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            try
            {
                if (!Page.IsPostBack)
                {
                    ClientAPI.AddButtonConfirm(cmdDelete, Localization.GetString("DeleteItem"));

                    // init tree
                    LoadRootNodes();

                    Locale language = LocaleController.Instance.GetLocale(Locale);
                    languageLabel.Language = language.Code;

                    if (UserInfo.IsSuperUser)
                    {
                        string mode = Request.QueryString["mode"];
                        if (!string.IsNullOrEmpty(mode) && (rbMode.Items.FindByValue(mode) != null))
                        {
                            rbMode.SelectedValue = mode;
                        }
                        else
                        {
                            rbMode.SelectedValue = "Host";
                        }
                    }
                    else
                    {
                        rbMode.SelectedValue = "Portal";
                        rowMode.Visible      = false;
                    }

                    string PersonalHighlight = Convert.ToString(Personalization.GetProfile("LanguageEditor", "HighLight" + PortalId));
                    string highlight         = Request.QueryString["highlight"];
                    if (!string.IsNullOrEmpty(highlight) && highlight.ToLower() == "true")
                    {
                        chkHighlight.Checked = true;
                    }
                    else
                    {
                        if (!string.IsNullOrEmpty(PersonalHighlight))
                        {
                            chkHighlight.Checked = Convert.ToBoolean(PersonalHighlight);
                        }
                    }

                    if (!string.IsNullOrEmpty(Request.QueryString["resourcefile"]))
                    {
                        SelectedResourceFile = Server.MapPath("~/" + Globals.QueryStringDecode(Request.QueryString["resourcefile"]));
                    }
                    else
                    {
                        SelectedResourceFile = Server.MapPath(Localization.GlobalResourceFile);
                    }

                    if (!string.IsNullOrEmpty(Request.QueryString["message"]))
                    {
                        UI.Skins.Skin.AddModuleMessage(this, Localization.GetString(Request.QueryString["message"], LocalResourceFile), ModuleMessage.ModuleMessageType.GreenSuccess);
                    }

                    BindGrid(!IsPostBack);
                }
                //Module failed to load
            }
            catch (Exception exc)
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }