public static TinyEditorConfigurationResult LoadTinyEditorConfiguration() { TinyEditorConfigurationResult configurationResult = new TinyEditorConfigurationResult(); using (new SecurityEnabler()) { string queryString = WebUtil.GetQueryString("so", Sitecore.Configuration.Settings.GetSetting("TinyEditor.DefaultProfile")); Assert.IsNotNull((object)queryString, "source"); Database coreDB = Sitecore.Data.Database.GetDatabase("core"); Assert.IsNotNull((object)coreDB, "database"); Sitecore.Data.Items.Item profile1 = coreDB.GetItem(queryString); if (profile1 != null) { TinyEditorConfiguration editorConfiguration = TinyEditorConfiguration.Create(profile1); configurationResult = editorConfiguration.Apply(); } else { Sitecore.Data.Items.Item profile2 = coreDB.GetItem(Settings.HtmlEditor.DefaultProfile); if (profile2 != null) { TinyEditorConfiguration editorConfiguration = TinyEditorConfiguration.Create(profile2); configurationResult = editorConfiguration.Apply(); } } } return(configurationResult); }
/// <summary> /// Raises the <see cref="E:System.Web.UI.Control.Load" /> event. /// </summary> /// <param name="e"> /// The <see cref="T:System.EventArgs" /> object that contains the event data. /// </param> protected override void OnLoad(EventArgs e) { User user = Sitecore.Context.User; if (!user.IsInRole(Constants.SitecoreClientUsersRole) && !user.IsAdministrator) { WebUtil.RedirectToLoginPage(); } base.OnLoad(e); if (this.IsPostBack || string.IsNullOrEmpty(WebUtil.GetQueryString("hdl"))) { return; } TinyEditorConfigurationResult configurationResult = new TinyEditorConfigurationResult(); using (new UserSwitcher(user)) { using (new SecurityEnabler()) { string queryString = WebUtil.GetQueryString("so", Sitecore.Configuration.Settings.GetSetting("TinyEditor.DefaultProfile")); Assert.IsNotNull((object)queryString, "source"); Database database = Sitecore.Context.Database; Assert.IsNotNull((object)database, "database"); Sitecore.Data.Items.Item profile1 = database.GetItem(queryString); if (profile1 != null) { TinyEditorConfiguration editorConfiguration = TinyEditorConfiguration.Create(profile1); configurationResult = editorConfiguration.Apply(); } else { Sitecore.Data.Items.Item profile2 = database.GetItem(Settings.HtmlEditor.DefaultProfile); if (profile2 != null) { TinyEditorConfiguration editorConfiguration = TinyEditorConfiguration.Create(profile2); configurationResult = editorConfiguration.Apply(); } } } } this.RegisterMediaPrefixes(); this.EditorToolbar.Value = configurationResult.EditorToolbar; this.EditorPlugins.Value = configurationResult.EditorPlugins; this.EditorInitCallback.Value = configurationResult.EditorInitCallback; this.EditorMenubar.Value = configurationResult.EditorMenubar; this.EditorBranding.Value = configurationResult.EditorBranding; this.CSSPath.Value = Sitecore.Configuration.Settings.GetSetting("WebStylesheet"); this.RenderScriptConstants(); this.LoadHtml(); }