/// <summary> /// Returns correct URL of the select path dialog. /// </summary> /// <param name="textboxId">Client ID of the textbox where result should be returned.</param> private string GetDocumentDialogUrl(string textboxId) { var config = new DialogConfiguration { HideLibraries = true, HideAnchor = true, HideAttachments = true, HideContent = false, HideEmail = true, HideWeb = true, EditorClientID = textboxId, ContentSelectedSite = SiteContext.CurrentSiteName, OutputFormat = OutputFormatEnum.Custom, CustomFormatCode = "selectpath", SelectableContent = SelectableContentEnum.AllContent, SelectablePageTypes = SelectablePageTypeEnum.Standard, ContentSites = AvailableSitesEnum.OnlyCurrentSite }; string url = CMSDialogHelper.GetDialogUrl(config, false, false, null, false); url = URLHelper.RemoveParameterFromUrl(url, "hash"); url = URLHelper.AddParameterToUrl(url, "selectionmode", "single"); url = URLHelper.AddParameterToUrl(url, "hash", QueryHelper.GetHash(url)); return(url); }
private void SetupControls() { // Configuration of media dialog DialogConfiguration config = new DialogConfiguration(); config = new DialogConfiguration(); config.SelectableContent = SelectableContentEnum.AllFiles; config.OutputFormat = OutputFormatEnum.URL; config.HideWeb = true; config.HideContent = true; config.HideAttachments = true; config.ContentSites = AvailableSitesEnum.All; config.DialogWidth = 90; config.DialogHeight = 80; config.UseRelativeDimensions = true; config.LibSites = AvailableSitesEnum.All; //this.mediaSelector.UseCustomDialogConfig = true; //this.mediaSelector.DialogConfig = config; //this.mediaSelector.ShowPreview = false; //this.mediaSelector.ShowTextBox = true; //this.mediaSelector.IsLiveSite = true; // <cms:MediaSelector ID="mediaSelector" runat="server" Visible="true" /> }
protected void Page_Load(object sender, EventArgs e) { // Setup control mediaSelector.ImagePathTextBox.CssClass = "EditingFormMediaPathTextBox"; mediaSelector.ImagePreviewControl.CssClass = "EditingFormMediaPathPreview"; mediaSelector.SelectImageButton.Attributes.Add("class", "EditingFormMediaPathButton"); mediaSelector.ClearPathButton.Attributes.Add("class", "EditingFormMediaPathClearButton"); mediaSelector.ShowClearButton = true; if (!String.IsNullOrEmpty(this.ControlStyle)) { mediaSelector.Attributes.Add("style", this.ControlStyle); this.ControlStyle = null; } if (!String.IsNullOrEmpty(this.CssClass)) { mediaSelector.CssClass = this.CssClass; this.CssClass = null; } // Get dialog configuration DialogConfiguration mediaConfig = GetDialogConfiguration(this.FieldInfo); if (mediaConfig != null) { mediaConfig.SelectableContent = SelectableContentEnum.AllFiles; mediaConfig.OutputFormat = OutputFormatEnum.URL; mediaConfig.HideWeb = true; mediaSelector.DialogConfig = mediaConfig; mediaSelector.UseCustomDialogConfig = true; } this.CheckFieldEmptiness = true; }
/// <summary> /// Setups selection control. /// </summary> private void SetupControl() { // Setup control mediaSelector.ImagePathTextBox.AddCssClass("EditingFormMediaPathTextBox"); mediaSelector.PreviewControl.AddCssClass("EditingFormMediaPathPreview"); mediaSelector.SelectImageButton.AddCssClass("EditingFormMediaPathButton"); mediaSelector.ClearPathButton.AddCssClass("EditingFormMediaPathClearButton"); mediaSelector.AutoPostback = HasDependingFields; if (!String.IsNullOrEmpty(ControlStyle)) { mediaSelector.Attributes.Add("style", ControlStyle); ControlStyle = null; } if (!String.IsNullOrEmpty(CssClass)) { mediaSelector.CssClass = CssClass; CssClass = null; } // Get dialog configuration DialogConfiguration mediaConfig = GetDialogConfiguration(); if (mediaConfig != null) { mediaConfig.SelectableContent = SelectableContentEnum.AllFiles; mediaConfig.OutputFormat = OutputFormatEnum.URL; mediaConfig.HideWeb = true; mediaSelector.DialogConfig = mediaConfig; mediaSelector.UseCustomDialogConfig = true; mediaSelector.ShowPreview = ShowPreview; } }
/// <summary> /// Initializes HTML editor's settings. /// </summary> protected void InitHTMLeditor() { htmlEditor.AutoDetectLanguage = false; htmlEditor.DefaultLanguage = Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName; htmlEditor.ToolbarSet = "BizForm"; // Allow metafile attachments in media dialog if ((ObjectID > 0) && (!string.IsNullOrEmpty(ObjectType)) && (!string.IsNullOrEmpty(ObjectCategory))) { DialogConfiguration config = htmlEditor.MediaDialogConfig; config.MetaFileObjectID = ObjectID; config.MetaFileObjectType = ObjectType; config.MetaFileCategory = ObjectCategory; config.HideAttachments = false; } // Load CSS style for editor area if any if (CssStyleSheetID > 0) { CssStylesheetInfo cssi = CssStylesheetInfoProvider.GetCssStylesheetInfo(CssStyleSheetID); if (cssi != null) { htmlEditor.EditorAreaCSS = CSSHelper.GetStylesheetUrl(cssi.StylesheetName); } } }
private void SetDialogConfig(DialogConfiguration dialogConfig) { dialogConfig.UseFullURL = false; dialogConfig.MetaFileObjectID = BannerID; dialogConfig.MetaFileObjectType = BannerInfo.OBJECT_TYPE; dialogConfig.MetaFileCategory = "Banner"; dialogConfig.HideAttachments = false; }
private void SetDialogConfig(DialogConfiguration dialogConfig) { dialogConfig.UseFullURL = false; dialogConfig.MetaFileObjectID = BannerID; dialogConfig.MetaFileObjectType = SiteObjectType.BANNER; dialogConfig.MetaFileCategory = "Banner"; dialogConfig.HideAttachments = false; }
private void StripMenu_File_Configuration_Click(object sender, EventArgs e) { using (var dialog = new DialogConfiguration(Utility.Configuration.Config)) { if (dialog.ShowDialog(this) == System.Windows.Forms.DialogResult.OK) { dialog.ToConfiguration(Utility.Configuration.Config); Utility.Configuration.Instance.OnConfigurationChanged(); } } }
/// <summary> /// Returns Correct URL of the link dialog. /// </summary> /// <param name="nodeId">ID Of the node to be copied or moved</param> private string GetLinkDialogUrl(int nodeId) { DialogConfiguration config = ProductUIHelper.GetProductDialogConfig("linkdoc", null); string url = CMSDialogHelper.GetDialogUrl(config, false, false, null, false); // Prepare url for link dialog url = URLHelper.RemoveParameterFromUrl(url, "hash"); url = URLHelper.AddParameterToUrl(url, "sourcenodeids", nodeId.ToString()); url = URLHelper.AddParameterToUrl(url, "hash", QueryHelper.GetHash(url)); return(url); }
protected void Page_Load(object sender, EventArgs e) { // Initialize control imageSelector.ImagePathTextBox.CssClass = "EditingFormImagePathTextBox"; imageSelector.ImagePreviewControl.CssClass = "EditingFormImagePathPreview"; imageSelector.SelectImageButton.Attributes.Add("class", "EditingFormImagePathButton"); imageSelector.ClearPathButton.Attributes.Add("class", "EditingFormImagePathClearButton"); imageSelector.ShowClearButton = true; imageSelector.IsLiveSite = IsLiveSite; // Setup control if (GetValue("width") != null) { imageSelector.ImageWidth = ValidationHelper.GetInteger(GetValue("width"), 0); } if (GetValue("height") != null) { imageSelector.ImageHeight = ValidationHelper.GetInteger(GetValue("height"), 0); } if (GetValue("maxsidesize") != null) { imageSelector.ImageMaxSideSize = ValidationHelper.GetInteger(GetValue("maxsidesize"), 0); } // Apply CSS styles if (!String.IsNullOrEmpty(ControlStyle)) { imageSelector.Attributes.Add("style", ControlStyle); ControlStyle = null; } if (!String.IsNullOrEmpty(CssClass)) { imageSelector.CssClass = CssClass; CssClass = null; } // Set image selector dialog DialogConfiguration config = GetDialogConfiguration(FieldInfo); config.SelectableContent = SelectableContentEnum.OnlyImages; imageSelector.DialogConfig = config; imageSelector.ShowImagePreview = true; // Set properties speicific to File selection control if (IsFileSelection) { imageSelector.DialogConfig.SelectableContent = SelectableContentEnum.AllFiles; imageSelector.ShowImagePreview = false; } CheckFieldEmptiness = true; }
/// <summary> /// 添加对话框的服务。 /// </summary> /// <param name="services"></param> /// <param name="configure"></param> /// <returns></returns> public static IServiceCollection AddDialog(this IServiceCollection services, Action <DialogConfiguration> configure = default) { services.AddScoped <IDialogService, DialogService>(); var instance = new DialogConfiguration(); if (configure == null) { configure = (e) => e = instance; } configure.Invoke(instance); services.Configure(configure); return(services); }
/// <summary> /// Page load. /// </summary> protected void Page_Load(object sender, EventArgs e) { // Initialize editor bbEditor.TextArea.Columns = ValidationHelper.GetInteger(GetValue("cols"), 40); bbEditor.TextArea.Rows = ValidationHelper.GetInteger(GetValue("rows"), 5); bbEditor.ShowURL = ValidationHelper.GetBoolean(GetValue("showurl"), true); bbEditor.ShowQuote = ValidationHelper.GetBoolean(GetValue("showquote"), true); bbEditor.ShowImage = ValidationHelper.GetBoolean(GetValue("showimage"), true); bbEditor.ShowBold = ValidationHelper.GetBoolean(GetValue("showbold"), true); bbEditor.ShowItalic = ValidationHelper.GetBoolean(GetValue("showitalic"), true); bbEditor.ShowUnderline = ValidationHelper.GetBoolean(GetValue("showunderline"), true); bbEditor.ShowStrike = ValidationHelper.GetBoolean(GetValue("showstrike"), true); bbEditor.ShowColor = ValidationHelper.GetBoolean(GetValue("showcolor"), true); bbEditor.ShowCode = ValidationHelper.GetBoolean(GetValue("showcode"), true); bbEditor.UsePromptDialog = ValidationHelper.GetBoolean(GetValue("usepromptdialog"), true); bbEditor.ShowAdvancedImage = ValidationHelper.GetBoolean(GetValue("showadvancedimage"), false); bbEditor.ShowAdvancedURL = ValidationHelper.GetBoolean(GetValue("showadvancedurl"), false); int size = ValidationHelper.GetInteger(GetValue("size"), 0); if (size > 0) { bbEditor.TextArea.MaxLength = size; } bbEditor.IsLiveSite = IsLiveSite; if (!String.IsNullOrEmpty(CssClass)) { bbEditor.CssClass = CssClass; CssClass = null; } else if (String.IsNullOrEmpty(bbEditor.CssClass)) { bbEditor.CssClass = "BBEditorField"; } if (!string.IsNullOrEmpty(ControlStyle)) { bbEditor.TextArea.Attributes.Add("style", ControlStyle); ControlStyle = null; } DialogConfiguration config = GetDialogConfiguration(FieldInfo); bbEditor.ImageDialogConfig = config; bbEditor.URLDialogConfig = config.Clone(); CheckRegularExpression = true; CheckFieldEmptiness = true; }
/// <summary> /// Initializes HTML editor's settings. /// </summary> protected void InitHTMLeditor() { htmlEditor.AutoDetectLanguage = false; htmlEditor.DefaultLanguage = Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName; htmlEditor.ToolbarSet = "BizForm"; // Allow metafile attachments in media dialog if ((ObjectID > 0) && (!string.IsNullOrEmpty(ObjectType)) && (!string.IsNullOrEmpty(ObjectCategory))) { DialogConfiguration config = htmlEditor.MediaDialogConfig; config.MetaFileObjectID = ObjectID; config.MetaFileObjectType = ObjectType; config.MetaFileCategory = ObjectCategory; config.HideAttachments = false; } }
/// <summary> /// Initializes HTML editor's settings. /// </summary> protected void InitHTMLEditor() { htmlEditor.AutoDetectLanguage = false; htmlEditor.DefaultLanguage = Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName; htmlEditor.LinkDialogConfig.UseFullURL = true; htmlEditor.QuickInsertConfig.UseFullURL = true; htmlEditor.ToolbarSet = "BizForm"; DialogConfiguration config = htmlEditor.MediaDialogConfig; config.UseFullURL = true; config.MetaFileObjectID = formId; config.MetaFileObjectType = FormObjectType.BIZFORM; config.MetaFileCategory = MetaFileInfoProvider.OBJECT_CATEGORY_FORM_LAYOUT; config.HideAttachments = false; }
/// <summary> /// Initializes HTML editor's settings. /// </summary> protected void InitHTMLEditor() { htmlEditor.AutoDetectLanguage = false; htmlEditor.DefaultLanguage = Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName; htmlEditor.LinkDialogConfig.UseFullURL = true; htmlEditor.QuickInsertConfig.UseFullURL = true; htmlEditor.ToolbarSet = "BizForm"; DialogConfiguration config = htmlEditor.MediaDialogConfig; config.UseFullURL = true; config.MetaFileObjectID = formInfo.FormID; config.MetaFileObjectType = BizFormInfo.OBJECT_TYPE; config.MetaFileCategory = ObjectAttachmentsCategories.FORMLAYOUT; config.HideAttachments = false; }
/// <summary> /// Setup all contained controls. /// </summary> private void SetupControls() { // Reset error label lblError.Text = String.Empty; lblError.Visible = false; // Setup main radio button controls radCustomIcon.Text = GetString("iconselector.custom"); radCustomIcon.Attributes.Add("onclick", "SetAction_" + ClientID + "('switch','');RaiseHiddenPostBack_" + ClientID + "();"); radPredefinedIcon.Text = GetString("iconselector.predefined"); radPredefinedIcon.Attributes.Add("onclick", "SetAction_" + ClientID + "('switch','');RaiseHiddenPostBack_" + ClientID + "();"); radDoNotDisplay.Text = GetString("iconselector.donotdisplay"); radDoNotDisplay.Attributes.Add("onclick", "SetAction_" + ClientID + "('switch','');RaiseHiddenPostBack_" + ClientID + "();"); // Setup panels lblColor.ResourceString = MainPanelResourceName; lblSize.ResourceString = ChildPanelResourceName; // Configuration of media dialog DialogConfiguration config = new DialogConfiguration(); config.SelectableContent = SelectableContentEnum.OnlyImages; config.OutputFormat = OutputFormatEnum.URL; config.HideWeb = false; config.ContentSites = AvailableSitesEnum.All; config.DialogWidth = 90; config.DialogHeight = 80; config.UseRelativeDimensions = true; config.LibSites = AvailableSitesEnum.All; mediaSelector.UseCustomDialogConfig = true; mediaSelector.DialogConfig = config; mediaSelector.ShowPreview = false; mediaSelector.IsLiveSite = IsLiveSite; if (!RequestHelper.IsAsyncPostback()) { // Load initial data and ensure something is selected if ((!radCustomIcon.Checked) && (!radDoNotDisplay.Checked) && (!radPredefinedIcon.Checked)) { radPredefinedIcon.Checked = true; } HandleSwitchAction(); } }
/// <summary> /// Initializes HTML editor's settings. /// </summary> protected void InitHTMLEditor(EmailTemplateInfo emailTemplateObj) { htmlTemplateBody.AutoDetectLanguage = false; htmlTemplateBody.DefaultLanguage = Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName; htmlTemplateBody.ToolbarSet = "Newsletter"; if ((emailTemplateObj != null) && (emailTemplateObj.TemplateType == EmailTemplateType.DoubleOptIn)) { htmlTemplateBody.ResolverName = "NewsletterOptInResolver"; } else { htmlTemplateBody.ResolverName = "NewsletterResolver"; } DialogConfiguration config = htmlTemplateBody.MediaDialogConfig; config.MetaFileObjectID = (emailTemplateObj != null) ? emailTemplateObj.TemplateID : 0; config.MetaFileObjectType = EmailTemplateInfo.OBJECT_TYPE; config.MetaFileCategory = ObjectAttachmentsCategories.TEMPLATE; config.HideAttachments = false; }
/// <summary> /// Initializes HTML editor's settings. /// </summary> protected void InitHTMLEditor(EmailTemplateInfo emailTemplateObj) { htmlTemplateBody.AutoDetectLanguage = false; htmlTemplateBody.DefaultLanguage = Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName; htmlTemplateBody.ToolbarSet = "Newsletter"; htmlTemplateBody.LinkDialogConfig.UseFullURL = true; htmlTemplateBody.QuickInsertConfig.UseFullURL = true; if ((emailTemplateObj != null) && (emailTemplateObj.TemplateType == EmailTemplateType.DoubleOptIn)) { htmlTemplateBody.ResolverName = "NewsletterOptInResolver"; } else { htmlTemplateBody.ResolverName = "NewsletterResolver"; } DialogConfiguration config = htmlTemplateBody.MediaDialogConfig; config.UseFullURL = true; config.MetaFileObjectID = (emailTemplateObj != null) ? emailTemplateObj.TemplateID : 0; config.MetaFileObjectType = NewsletterObjectType.NEWSLETTERTEMPLATE; config.MetaFileCategory = MetaFileInfoProvider.OBJECT_CATEGORY_TEMPLATE; config.HideAttachments = false; }
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(); } }
/// <summary> /// Returns correct URL of the select path dialog. /// </summary> /// <param name="textboxId">Client ID of the textbox where result should be returned.</param> private string GetDocumentDialogUrl(string textboxId) { var config = new DialogConfiguration { HideLibraries = true, HideAnchor = true, HideAttachments = true, HideContent = false, HideEmail = true, HideWeb = true, EditorClientID = textboxId, ContentSelectedSite = SiteContext.CurrentSiteName, OutputFormat = OutputFormatEnum.Custom, CustomFormatCode = "selectpath", SelectableContent = SelectableContentEnum.AllContent, SelectablePageTypes = SelectablePageTypeEnum.Standard, ContentSites = AvailableSitesEnum.OnlyCurrentSite }; string url = CMSDialogHelper.GetDialogUrl(config, false, false, null, false); url = URLHelper.RemoveParameterFromUrl(url, "hash"); url = URLHelper.AddParameterToUrl(url, "selectionmode", "single"); url = URLHelper.AddParameterToUrl(url, "hash", QueryHelper.GetHash(url)); return url; }
/// <summary> /// Initializes all the nested controls and control itself. /// </summary> private void SetupControl() { // Register modal dialog handling script ScriptHelper.RegisterDialogScript(Page); // Setup buttons btnAdd.ToolTip = GetString("dialogs.actions.newfolder.desc"); btnCopy.ToolTip = GetString("media.tree.copyfolder"); btnMove.ToolTip = GetString("media.tree.movefolder"); btnDelete.ToolTip = GetString("media.folder.delete"); // If delete script is set if (!string.IsNullOrEmpty(DeleteScript)) { // Register delete script btnDelete.OnClientClick = DeleteScript.Replace("##FOLDERPATH##", Path.EnsureSlashes(FolderPath).Replace("'", "\\'")) + "return false;"; } // If folder path is set if (String.IsNullOrEmpty(FolderPath)) { // Disable delete action btnDelete.Enabled = false; // Disable move action btnMove.Enabled = false; } if (!FileSystemActionsEnabled) { // Disable file and folder actions btnAdd.Enabled = false; } if (!IsLiveSite) { Config = DialogConfiguration.GetDialogConfiguration(); if (Config != null) { switch (Config.CustomFormatCode.ToLowerCSafe()) { case "link": btnAdd.Visible = false; break; case "linkdoc": btnAdd.Visible = false; break; case "relationship": btnAdd.Visible = false; break; case "selectpath": btnAdd.Visible = false; break; } } } string disableMenuItem = @" function DisableNewFolderBtn() { $cmsj('#' + '" + btnAdd.ClientID + @"').attr('disabled', 'disabled'); }"; ScriptHelper.RegisterStartupScript(Page, typeof(string), "disableMenuItem", ScriptHelper.GetScript(disableMenuItem)); }
/// <summary> /// Loads content from specific newsletter template. /// </summary> private void LoadContent() { var urlHelper = new URLHelper(); EmailTemplateInfo emailTemplate = EmailTemplateInfoProvider.GetEmailTemplateInfo(mTemplateID); if ((emailTemplate == null) || string.IsNullOrEmpty(emailTemplate.TemplateBody)) { return; } // Remove security parameters from macros string templateText = MacroSecurityProcessor.RemoveSecurityParameters(emailTemplate.TemplateBody, true, null); if (!RequestHelper.IsPostBack() && (issue != null)) { // Load content of editable regions IssueHelper.LoadRegionsContents(ref regionsContents, issue.IssueText); } LiteralControl before; int count = 0; int textStart = 0; string toolbarLocation = "Out:CKToolbar"; string toolbarSetName = "Newsletter"; int editRegStart = templateText.IndexOfCSafe("$$", textStart); // Apply CSS e-mail template style Page.AddToHeader(CssLinkHelper.GetCssFileLink(EmailTemplateInfoProvider.GetStylesheetUrl(emailTemplate.TemplateName))); string domainName = SiteContext.CurrentSite.SiteIsContentOnly ? SiteContext.CurrentSite.SitePresentationURL : SiteContext.CurrentSite.DomainName; while (editRegStart >= 0) { count++; before = new LiteralControl(); // Get template text surrounding editable regions - make links absolute before.Text = urlHelper.MakeLinksAbsolute(templateText.Substring(textStart, (editRegStart - textStart)), domainName); plcContent.Controls.Add(before); // End of region editRegStart += 2; textStart = editRegStart; if (editRegStart < templateText.Length - 1) { int editRegEnd = templateText.IndexOfCSafe("$$", editRegStart); if (editRegEnd >= 0) { string region = templateText.Substring(editRegStart, editRegEnd - editRegStart); string[] parts = (region + ":" + ":").Split(':'); try { string name = parts[0]; if (!string.IsNullOrEmpty(name.Trim())) { Regex intNumber = RegexHelper.GetRegex("^[0-9]+"); int width = ValidationHelper.GetInteger(intNumber.Match(parts[1]).Value, 0); int height = ValidationHelper.GetInteger(intNumber.Match(parts[2]).Value, 0); CMSEditableRegion editableRegion = new CMSEditableRegion(); editableRegion.ID = name; editableRegion.RegionType = CMSEditableRegionTypeEnum.HtmlEditor; editableRegion.ViewMode = ViewModeEnum.Edit; editableRegion.DialogHeight = height; editableRegion.DialogWidth = width; editableRegion.WordWrap = false; editableRegion.HtmlAreaToolbarLocation = toolbarLocation; editableRegion.RegionTitle = name; editableRegion.UseStylesheet = false; editableRegion.HTMLEditorCssStylesheet = EmailTemplateInfoProvider.GetStylesheetUrl(emailTemplate.TemplateName); if (!mReadOnly) { editableRegion.HtmlAreaToolbar = toolbarSetName; } else { editableRegion.HtmlAreaToolbar = "Disabled"; } CMSHtmlEditor editor = editableRegion.HtmlEditor; editor.ExtraPlugins.Add("autogrow"); editor.AutoGrowMinHeight = height; editor.ResolverName = "NewsletterResolver"; DialogConfiguration dialogConfig = editor.MediaDialogConfig; dialogConfig.MetaFileObjectID = (issue != null) ? issue.IssueID : 0; dialogConfig.MetaFileObjectType = (issue != null) && issue.IssueIsVariant ? IssueInfo.OBJECT_TYPE_VARIANT : IssueInfo.OBJECT_TYPE; dialogConfig.MetaFileCategory = ObjectAttachmentsCategories.ISSUE; dialogConfig.HideAttachments = false; editableRegion.LoadContent(ValidationHelper.GetString(regionsContents[name.ToLowerCSafe()], string.Empty)); plcContent.Controls.Add(editableRegion); textStart = editRegEnd + 2; } } catch { } } } editRegStart = templateText.IndexOfCSafe("$$", textStart); } before = new LiteralControl(); before.Text = urlHelper.MakeLinksAbsolute(templateText.Substring(textStart), domainName); plcContent.Controls.Add(before); }
protected void Page_Load(object sender, EventArgs e) { // Set control properties editor.AutoDetectLanguage = false; editor.DefaultLanguage = System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName; string toolbarSet = editor.ToolbarSet; if (this.Form != null) { editor.DialogParameters = this.Form.DialogParameters; // Get editor area toolbar toolbarSet = DataHelper.GetNotEmpty(this.GetValue("toolbarset"), this.Form.HtmlAreaToolbar); editor.ToolbarSet = toolbarSet; editor.ToolbarLocation = DataHelper.GetNotEmpty(this.GetValue("toolbarlocation"), this.Form.HtmlAreaToolbarLocation); // Set form dimensions editor.Width = new Unit(ValidationHelper.GetInteger(this.GetValue("width"), 700)); editor.Height = new Unit(ValidationHelper.GetInteger(this.GetValue("height"), 300)); // Get editor area starting path editor.StartingPath = ValidationHelper.GetString(this.GetValue("startingpath"), ""); // Get editor area css file string mCssStylesheet = ValidationHelper.GetString(this.GetValue("cssstylesheet"), ""); if (!String.IsNullOrEmpty(mCssStylesheet)) { editor.EditorAreaCSS = CSSHelper.GetStylesheetUrl(mCssStylesheet); } else if (toolbarSet.Equals("Wireframe", StringComparison.InvariantCultureIgnoreCase)) { // Special case for wireframe editor editor.EditorAreaCSS = CSSHelper.GetCSSUrl("~/CMSAdminControls/CKeditor/skins/kentico/wireframe.css"); } else if (CMSContext.CurrentSite != null) { editor.EditorAreaCSS = FormHelper.GetHtmlEditorAreaCss(CMSContext.CurrentSiteName); } } // Set live site info editor.IsLiveSite = this.IsLiveSite; // Set direction if (CultureHelper.IsPreferredCultureRTL()) { editor.ContentsLangDirection = LanguageDirection.RightToLeft; } else { editor.ContentsLangDirection = LanguageDirection.LeftToRight; } // Get dialog configuration DialogConfiguration mediaConfig = GetDialogConfiguration(this.FieldInfo); if (mediaConfig != null) { // 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(this.ControlStyle)) { editor.Attributes.Add("style", this.ControlStyle); this.ControlStyle = null; } if (!String.IsNullOrEmpty(this.CssClass)) { editor.CssClass = this.CssClass; this.CssClass = null; } this.CheckRegularExpression = true; this.CheckFieldEmptiness = true; }
/// <summary> /// Initializes all the nested controls. /// </summary> private void SetupControls() { // Register modal dialog script ScriptHelper.RegisterDialogScript(Page); string disableMenuItem = @"function DisableNewFileBtn() { $j('#dialogsUploaderDiv').attr('style', 'display:none;'); $j('#dialogsUploaderDisabledDiv').removeAttr('style'); } function DisableNewFolderBtn() { " + menuBtnNewFolder.DisableButtonFunction + " }"; ScriptHelper.RegisterStartupScript(Page, typeof(string), "disableMenuItem", ScriptHelper.GetScript(disableMenuItem)); if (!FileSystemActionsEnabled) { // Disable file and folder actions menuBtnNewFolder.Enabled = false; ScriptHelper.RegisterStartupScript(Page, typeof(string), "disableNewFile", ScriptHelper.GetScript("DisableNewFileBtn();")); } if (!IsLiveSite) { // Initialize help switch (SourceType) { case MediaSourceEnum.DocumentAttachments: helpElem.TopicName = "dialogs_{0}attachments"; break; case MediaSourceEnum.MediaLibraries: helpElem.TopicName = "dialogs_{0}media"; break; case MediaSourceEnum.Web: helpElem.TopicName = "dialogs_{0}web"; break; case MediaSourceEnum.MetaFile: helpElem.TopicName = "dialogs_{0}metafiles"; break; default: helpElem.TopicName = "dialogs_{0}content"; break; } Config = DialogConfiguration.GetDialogConfiguration(); if ((Config != null) && (Config.OutputFormat == OutputFormatEnum.BBLink) || (Config.OutputFormat == OutputFormatEnum.HTMLLink)) { helpElem.TopicName = string.Format(helpElem.TopicName, "link_"); } else { helpElem.TopicName = helpElem.TopicName.Replace("{0}", ""); } switch (Config.CustomFormatCode.ToLowerCSafe()) { case "copy": helpElem.TopicName = "document_copy"; break; case "move": helpElem.TopicName = "document_move"; break; case "link": helpElem.TopicName = "document_link"; menuBtnNewFolder.Visible = false; break; case "linkdoc": helpElem.TopicName = "document_linkdoc"; menuBtnNewFolder.Visible = false; break; case "relationship": helpElem.TopicName = "select_node_for_relationship"; menuBtnNewFolder.Visible = false; break; case "selectpath": helpElem.TopicName = "select_path"; menuBtnNewFolder.Visible = false; break; } // Media library mode if (DisplayMode == ControlDisplayModeEnum.Simple) { helpElem.StopProcessing = true; pnlHelp.Visible = false; } } else { helpElem.StopProcessing = true; pnlHelp.Visible = false; } // Register resizer script for fullscreen mode if (AllowFullscreen) { ScriptHelper.RegisterResizer(Page); } }
protected void Page_Load(object sender, EventArgs e) { // Set control properties editor.AutoDetectLanguage = false; editor.DefaultLanguage = Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName; string toolbarSet = editor.ToolbarSet; if (Form != null) { editor.DialogParameters = Form.DialogParameters; } // Get editor area toolbar toolbarSet = DataHelper.GetNotEmpty(GetValue("toolbarset"), (Form != null) ? Form.HtmlAreaToolbar : ""); editor.ToolbarSet = toolbarSet; editor.ToolbarLocation = DataHelper.GetNotEmpty(GetValue("toolbarlocation"), (Form != null) ? Form.HtmlAreaToolbarLocation : ""); // Set form dimensions UnitType widthUnitType = GetUnitType(GetValue("widthunittype")); UnitType heightUnitType = GetUnitType(GetValue("heightunittype")); editor.Width = new Unit(ValidationHelper.GetInteger(GetValue("width"), 700), widthUnitType); editor.Height = new Unit(ValidationHelper.GetInteger(GetValue("height"), 300), heightUnitType); // Get editor area starting path String startingPath = ValidationHelper.GetString(GetValue("startingpath"), ""); editor.StartingPath = startingPath; // Set current context resolver editor.ResolverName = ResolverName; // Get editor area css file string mCssStylesheet = ValidationHelper.GetString(GetValue("cssstylesheet"), ""); if (!String.IsNullOrEmpty(mCssStylesheet)) { editor.EditorAreaCSS = CSSHelper.GetStylesheetUrl(mCssStylesheet); } else if (toolbarSet.EqualsCSafe("Wireframe", true)) { // Special case for wireframe editor editor.EditorAreaCSS = "~/CMSAdminControls/CKeditor/skins/kentico/wireframe.css"; } else if (CMSContext.CurrentSite != null) { editor.EditorAreaCSS = FormHelper.GetHtmlEditorAreaCss(CMSContext.CurrentSiteName); } // Set live site info editor.IsLiveSite = IsLiveSite; // Set direction if (CultureHelper.IsPreferredCultureRTL()) { editor.ContentsLangDirection = LanguageDirection.RightToLeft; } else { editor.ContentsLangDirection = LanguageDirection.LeftToRight; } // Get dialog configuration DialogConfiguration mediaConfig = GetDialogConfiguration(FieldInfo); 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; CssClass = null; } CheckRegularExpression = true; CheckFieldEmptiness = true; }
/// <summary> /// Loads the site selection from the given configuration. Returns true if the site was loaded from configuration /// </summary> /// <param name="config">Dialog configuration</param> private bool LoadSiteFromConfig(DialogConfiguration config) { if (!string.IsNullOrEmpty(config.ContentSelectedSite)) { contentTree.SiteName = config.ContentSelectedSite; siteSelector.SiteName = config.ContentSelectedSite; return true; } return false; }
/// <summary> /// Loads content from specific newsletter template. /// </summary> private void LoadContent() { EmailTemplateInfo emailTemplate = EmailTemplateInfoProvider.GetEmailTemplateInfo(mTemplateID); if ((emailTemplate == null) || string.IsNullOrEmpty(emailTemplate.TemplateBody)) { return; } // Remove security parameters from macros string templateText = MacroResolver.RemoveSecurityParameters(emailTemplate.TemplateBody, true, null); if (!RequestHelper.IsPostBack() && (issue != null)) { // Load content of editable regions IssueHelper.LoadRegionsContents(ref regionsContents, issue.IssueText); } CMSEditableRegion editableRegion = null; LiteralControl before = null; int count = 0; int textStart = 0; string region = null; string[] parts = null; string name = null; int width = 0; int height = 0; string toolbarLocation = "Out:CKEditorToolbar"; string toolbarSetName = "Newsletter"; int editRegStart = templateText.IndexOfCSafe("$$", textStart); int editRegEnd = 0; // Apply CSS e-mail template style HTMLHelper.AddToHeader(Page, CSSHelper.GetCSSFileLink(EmailTemplateInfoProvider.GetStylesheetUrl(emailTemplate.TemplateName))); while (editRegStart >= 0) { count++; before = new LiteralControl(); // Get template text surrounding editable regions - make links absolute before.Text = URLHelper.MakeLinksAbsolute(templateText.Substring(textStart, (editRegStart - textStart))); plcContent.Controls.Add(before); // End of region editRegStart += 2; textStart = editRegStart; if (editRegStart < templateText.Length - 1) { editRegEnd = templateText.IndexOfCSafe("$$", editRegStart); if (editRegEnd >= 0) { region = templateText.Substring(editRegStart, editRegEnd - editRegStart); parts = (region + ":" + ":").Split(':'); try { name = parts[0]; if (!string.IsNullOrEmpty(name.Trim())) { width = ValidationHelper.GetInteger(parts[1], 0); height = ValidationHelper.GetInteger(parts[2], 0); editableRegion = new CMSEditableRegion(); editableRegion.ID = name; editableRegion.RegionType = CMSEditableRegionTypeEnum.HtmlEditor; editableRegion.ViewMode = ViewModeEnum.Edit; editableRegion.DialogHeight = height; editableRegion.DialogWidth = width; editableRegion.WordWrap = false; editableRegion.HtmlAreaToolbarLocation = toolbarLocation; editableRegion.RegionTitle = name; editableRegion.UseStylesheet = false; editableRegion.HTMLEditorCssStylesheet = EmailTemplateInfoProvider.GetStylesheetUrl(emailTemplate.TemplateName); if (!mReadOnly) { editableRegion.HtmlAreaToolbar = toolbarSetName; } else { editableRegion.HtmlAreaToolbar = "Disabled"; } CMSHtmlEditor editor = editableRegion.HtmlEditor; editor.AddExtraPlugin("CMSPlugins"); editor.AddExtraPlugin("autogrow"); editor.AutoGrowMinHeight = height; editor.LinkDialogConfig.UseFullURL = true; editor.QuickInsertConfig.UseFullURL = true; editor.ResolverName = "NewsletterResolver"; DialogConfiguration dialogConfig = editor.MediaDialogConfig; dialogConfig.UseFullURL = true; dialogConfig.MetaFileObjectID = (issue != null) ? issue.IssueID : 0; dialogConfig.MetaFileObjectType = (issue != null) && issue.IssueIsVariant ? NewsletterObjectType.NEWSLETTERISSUEVARIANT : NewsletterObjectType.NEWSLETTERISSUE; dialogConfig.MetaFileCategory = MetaFileInfoProvider.OBJECT_CATEGORY_ISSUE; dialogConfig.HideAttachments = false; editableRegion.LoadContent(ValidationHelper.GetString(regionsContents[name.ToLowerCSafe()], string.Empty)); plcContent.Controls.Add(editableRegion); textStart = editRegEnd + 2; } } catch { } } } editRegStart = templateText.IndexOfCSafe("$$", textStart); } before = new LiteralControl(); before.Text = URLHelper.MakeLinksAbsolute(templateText.Substring(textStart)); plcContent.Controls.Add(before); }
protected IActionResult Dialog <TPostModel, T>(DialogConfiguration <TPostModel, T> index) { return(new JsonResult(new { data = HtmlContent.ToString(index.Render(default)), id = index.Identifier.Value }));