public virtual void SaveDialogSettings(IProjectSettings settings) { if (settings == null) { throw new ArgumentNullException("settings"); } settings[SavedSettingsKeys.DbContextDialogWidthKey] = DialogWidth.ToString(CultureInfo.InvariantCulture); }
public virtual void SaveDialogSettings(IProjectSettings settings) { settings[SavedSettingsKeys.ConfigDialogWidthKey] = DialogWidth.ToString(); }
protected void ApplySettings() { EnsureChildControls(); if (!StopProcessing) { // Create controls by actual page mode switch (ViewMode) { case ViewModeEnum.Edit: case ViewModeEnum.EditDisabled: { // Edit mode if (DialogWidth > 0) { pnlEditor.Style.Add(HtmlTextWriterStyle.Width, DialogWidth.ToString() + "px;"); } // Display the region control based on the region type switch (RegionType) { case CMSEditableRegionTypeEnum.HtmlEditor: // HTML Editor if (IsDialogEdit) { htmlValue.Width = new Unit(100, UnitType.Percentage); htmlValue.Height = new Unit(100, UnitType.Percentage); htmlValue.ToolbarLocation = "out:CKToolbar"; htmlValue.Title = Title; // Maximize editor to fill entire dialog htmlValue.RemoveButtons.Add("Maximize"); if (!DeviceContext.CurrentDevice.IsMobile) { // Desktop browsers htmlValue.Config["on"] = "{ 'instanceReady' : function(e) { e.editor.execCommand( 'maximize' ); } }"; } } else { if (DialogWidth > 0) { htmlValue.Width = new Unit(DialogWidth); } if (DialogHeight > 0) { htmlValue.Height = new Unit(DialogHeight); } } // Set toolbar location if (HtmlAreaToolbarLocation != "") { // Show the toolbar if (HtmlAreaToolbarLocation.ToLowerCSafe() == "out:cktoolbar") { mShowToolbar = true; } htmlValue.ToolbarLocation = HtmlAreaToolbarLocation; } // Set the visual appearance if (HtmlAreaToolbar != "") { htmlValue.ToolbarSet = HtmlAreaToolbar; } // Get editor area css file if (HTMLEditorCssStylesheet != "") { htmlValue.EditorAreaCSS = CSSHelper.GetStylesheetUrl(HTMLEditorCssStylesheet); } else if (SiteContext.CurrentSite != null) { htmlValue.EditorAreaCSS = CssStylesheetInfoProvider.GetHtmlEditorAreaCss(SiteContext.CurrentSiteName); } // Set "Insert image or media" dialog configuration htmlValue.MediaDialogConfig.ResizeToHeight = ResizeToHeight; htmlValue.MediaDialogConfig.ResizeToWidth = ResizeToWidth; htmlValue.MediaDialogConfig.ResizeToMaxSideSize = ResizeToMaxSideSize; // Set "Insert link" dialog configuration htmlValue.LinkDialogConfig.ResizeToHeight = ResizeToHeight; htmlValue.LinkDialogConfig.ResizeToWidth = ResizeToWidth; htmlValue.LinkDialogConfig.ResizeToMaxSideSize = ResizeToMaxSideSize; // Set "Quickly insert image" configuration htmlValue.QuickInsertConfig.ResizeToHeight = ResizeToHeight; htmlValue.QuickInsertConfig.ResizeToWidth = ResizeToWidth; htmlValue.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; } } }
public override string Render() { if (Visiable) { AddAttributes(); var texts = new List <string>(); if (TextID.IsNullOrEmpty()) { TextID = "{0}_Text".FormatTo(Id); } if (!Value.IsNullOrEmpty() && !SelectType.IsNullOrEmpty()) { var page = PageBuilder.BuildPage(SelectType); if (page != null && page.Controls.Count > 0) { IFieldConverter listDs = null; page.Controls.ForEach((o) => { if (o is IListDataSourceControl) { listDs = (o as IListDataSourceControl).DataSource as IFieldConverter; return; } else if (o is ICascadeDataSourceControl) { listDs = (o as ICascadeDataSourceControl).DataSource as IFieldConverter; return; } }); if (listDs != null) { if (IsMulitle) { foreach (var v in Value.Split(',')) { texts.Add(listDs.Converter(Id, v, null).ToString()); } } else { texts.Add(listDs.Converter(Id, Value, null).ToString()); } } } } string text = string.Empty; if (texts.Count > 0) { text = string.Join(",", texts.ToArray()); } var textBox = new TextBox() { Id = TextID, Name = TextID, Value = text }; if (!Attributes.IsNullOrEmpty()) { foreach (var attr in Attributes) { textBox.Attributes[attr.Key] = attr.Value; } } textBox.Attributes["data-selector"] = SelectType; textBox.Attributes["data-showtype"] = ShowType.ToString(); textBox.Attributes["data-multiple"] = IsMulitle.ToString().ToLower(); textBox.Attributes["data-target"] = Id; textBox.Attributes["data-dialogheight"] = DialogHeight.ToString(); textBox.Attributes["data-dialogwidth"] = DialogWidth.ToString(); var hidden = new HiddenField() { Id = Id, Name = Id, Value = Value, Validator = Validator }; string result = hidden.Render() + textBox.Render(); return(ContainerTemplate.FormatTo(Id, Label, result, Description)); } return(string.Empty); }