protected void Page_Load(object sender, EventArgs e) { // If ID�s not specified return if ((TemplateID == 0) || (GatewayID == 0)) { return; } // Get gateway name NotificationGatewayInfo ngi = NotificationGatewayInfoProvider.GetNotificationGatewayInfo(GatewayID); if (ngi == null) { throw new Exception("NotificationGatewayInfo with this GatewayID does not exist."); } // Setup control according to NotificationGatewayInfo plcSubject.Visible = ngi.GatewaySupportsEmail; plcPlainText.Visible = ngi.GatewaySupportsPlainText; plcHTMLText.Visible = ngi.GatewaySupportsHTMLText; if (plcHTMLText.Visible) { // Initialize HTML editor htmlText.AutoDetectLanguage = false; htmlText.DefaultLanguage = Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName; htmlText.EditorAreaCSS = CssStylesheetInfoProvider.GetHtmlEditorAreaCss(SiteContext.CurrentSiteName); htmlText.ToolbarSet = "Basic"; htmlText.MediaDialogConfig.UseFullURL = true; htmlText.LinkDialogConfig.UseFullURL = true; htmlText.QuickInsertConfig.UseFullURL = true; } // If gateway does not support any of text fields inform about it. if (!ngi.GatewaySupportsEmail && !ngi.GatewaySupportsHTMLText && !ngi.GatewaySupportsPlainText) { ShowWarning(string.Format(GetString("notifications.templatetext.notextbox"), HTMLHelper.HTMLEncode(ngi.GatewayDisplayName))); } // Get existing TemplateTextInfoObject or create new object NotificationTemplateTextInfo ntti = NotificationTemplateTextInfoProvider.GetNotificationTemplateTextInfo(GatewayID, TemplateID); if (ntti == null) { ntti = new NotificationTemplateTextInfo(); } // Set edited object EditedObject = ntti; // Setup properties if (!URLHelper.IsPostback()) { TemplateSubject = ntti.TemplateSubject; TemplateHTMLText = ntti.TemplateHTMLText; TemplatePlainText = ntti.TemplatePlainText; } }
/// <summary> /// Initializes HTML editor's settings. /// </summary> protected void InitHTMLEditor() { htmlContent.AutoDetectLanguage = false; htmlContent.DefaultLanguage = Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName; // Set direction htmlContent.ContentsLangDirection = LanguageDirection.LeftToRight; if (CultureHelper.IsPreferredCultureRTL()) { htmlContent.ContentsLangDirection = LanguageDirection.RightToLeft; } if (SiteContext.CurrentSite != null) { htmlContent.EditorAreaCSS = CssStylesheetInfoProvider.GetHtmlEditorAreaCss(SiteContext.CurrentSiteName); } }
protected void Page_Load(object sender, EventArgs e) { // Set control properties editor.AutoDetectLanguage = false; editor.DefaultLanguage = Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName; if (Form != null) { editor.DialogParameters = Form.DialogParameters; } // Get editor area toolbar editor.ToolbarSet = DataHelper.GetNotEmpty(GetValue("toolbarset"), (Form != null) ? Form.HtmlAreaToolbar : String.Empty); editor.ToolbarLocation = DataHelper.GetNotEmpty(GetValue("toolbarlocation"), (Form != null) ? Form.HtmlAreaToolbarLocation : String.Empty); // Set form dimensions editor.Width = Width; editor.Height = Height; // Get editor area starting path String startingPath = ValidationHelper.GetString(GetValue("startingpath"), String.Empty); editor.StartingPath = startingPath; // Set current context resolver editor.ResolverName = ResolverName; // Get editor area css file string cssStylesheet = ValidationHelper.GetString(GetValue("cssstylesheet"), String.Empty); if (!String.IsNullOrEmpty(cssStylesheet)) { editor.EditorAreaCSS = CSSHelper.GetStylesheetUrl(cssStylesheet); } else if (SiteContext.CurrentSite != null) { editor.EditorAreaCSS = CssStylesheetInfoProvider.GetHtmlEditorAreaCss(SiteContext.CurrentSiteName); } // Set live site info editor.IsLiveSite = IsLiveSite; // Set direction editor.ContentsLangDirection = CultureHelper.IsPreferredCultureRTL() ? LanguageDirection.RightToLeft : LanguageDirection.LeftToRight; // Get dialog configuration DialogConfiguration mediaConfig = GetDialogConfiguration(); if (mediaConfig != null) { // Override starting path from main configuration if (!String.IsNullOrEmpty(startingPath)) { mediaConfig.ContentStartingPath = startingPath; mediaConfig.LibStartingPath = startingPath; } // Set configuration for 'Insert image or media' dialog editor.MediaDialogConfig = mediaConfig; // Set configuration for 'Insert link' dialog editor.LinkDialogConfig = mediaConfig.Clone(); // Set configuration for 'Quickly insert image' dialog editor.QuickInsertConfig = mediaConfig.Clone(); } // Set CSS settings if (!String.IsNullOrEmpty(ControlStyle)) { editor.Attributes.Add("style", ControlStyle); ControlStyle = null; } if (!String.IsNullOrEmpty(CssClass)) { editor.CssClass = CssClass; } CheckRegularExpression = true; CheckFieldEmptiness = true; if (ShowAddStampButton) { //Add stamp button RegisterAndShowStampButton(); } }
protected void ApplySettings() { EnsureChildControls(); if (!StopProcessing) { // Create controls by actual page mode switch (ViewMode) { case ViewModeEnum.Edit: case ViewModeEnum.EditDisabled: { // Display the region control based on the region type switch (RegionType) { case CMSEditableRegionTypeEnum.HtmlEditor: // HTML Editor if (IsDialogEdit) { Editor.ToolbarLocation = "out:CKToolbar"; Editor.Title = Title; // Maximize editor to fill entire dialog Editor.RemoveButtons.Add("Maximize"); if (!DeviceContext.CurrentDevice.IsMobile) { // Desktop browsers Editor.Config["on"] = "{ 'instanceReady' : function(e) { e.editor.execCommand( 'maximize' ); } }"; } } // Set toolbar location if (HtmlAreaToolbarLocation != "") { // Show the toolbar if (HtmlAreaToolbarLocation.ToLowerCSafe() == "out:cktoolbar") { mShowToolbar = true; } Editor.ToolbarLocation = HtmlAreaToolbarLocation; } // Set the visual appearance if (HtmlAreaToolbar != "") { Editor.ToolbarSet = HtmlAreaToolbar; } // Get editor area css file if (HTMLEditorCssStylesheet != "") { Editor.EditorAreaCSS = CSSHelper.GetStylesheetUrl(HTMLEditorCssStylesheet); } else if (SiteContext.CurrentSite != null) { Editor.EditorAreaCSS = CssStylesheetInfoProvider.GetHtmlEditorAreaCss(SiteContext.CurrentSiteName); } // Set "Insert image or media" dialog configuration Editor.MediaDialogConfig.ResizeToHeight = ResizeToHeight; Editor.MediaDialogConfig.ResizeToWidth = ResizeToWidth; Editor.MediaDialogConfig.ResizeToMaxSideSize = ResizeToMaxSideSize; // Set "Insert link" dialog configuration Editor.LinkDialogConfig.ResizeToHeight = ResizeToHeight; Editor.LinkDialogConfig.ResizeToWidth = ResizeToWidth; Editor.LinkDialogConfig.ResizeToMaxSideSize = ResizeToMaxSideSize; // Set "Quickly insert image" configuration Editor.QuickInsertConfig.ResizeToHeight = ResizeToHeight; Editor.QuickInsertConfig.ResizeToWidth = ResizeToWidth; Editor.QuickInsertConfig.ResizeToMaxSideSize = ResizeToMaxSideSize; break; case CMSEditableRegionTypeEnum.TextArea: case CMSEditableRegionTypeEnum.TextBox: // TextBox if (RegionType == CMSEditableRegionTypeEnum.TextArea) { txtValue.TextMode = TextBoxMode.MultiLine; } else { txtValue.TextMode = TextBoxMode.SingleLine; } if (DialogWidth > 0) { txtValue.Width = new Unit(DialogWidth - 8); } else { // Default width is 100% txtValue.Width = new Unit(100, UnitType.Percentage); } if (DialogHeight > 0) { txtValue.Height = new Unit(DialogHeight); } txtValue.Wrap = WordWrap; break; } } break; } } }