private string GetAttributesHtml(NameValueCollection formCollection) { if (formCollection == null) { formCollection = Request.Form.Count > 0 ? Request.Form : new NameValueCollection(); } var pageScripts = new NameValueCollection(); if (_styleInfoList == null) { return(string.Empty); } var attributes = new AttributesImpl(formCollection); var builder = new StringBuilder(); foreach (var styleInfo in _styleInfoList) { string extra; var value = BackgroundInputTypeParser.Parse(SiteInfo, 0, styleInfo, attributes, pageScripts, out extra); if (string.IsNullOrEmpty(value) && string.IsNullOrEmpty(extra)) { continue; } if (InputTypeUtils.Equals(styleInfo.InputType, InputType.TextEditor)) { var commands = WebUtils.GetTextEditorCommands(SiteInfo, styleInfo.AttributeName); builder.Append($@" <div class=""form-group""> <label class=""control-label"">{styleInfo.DisplayName}</label> {commands} <hr /> {value} {extra} </div>"); } else { builder.Append($@" <div class=""form-group""> <label class=""control-label"">{styleInfo.DisplayName}</label> {value} {extra} </div>"); } } foreach (string key in pageScripts.Keys) { builder.Append(pageScripts[key]); } return(builder.ToString()); }
protected override void Render(HtmlTextWriter output) { if (Attributes == null) { return; } var relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(SiteInfo.Id, ChannelId); var styleInfoList = TableStyleManager.GetTableStyleInfoList(DataProvider.ChannelDao.TableName, relatedIdentities); if (styleInfoList == null) { return; } var builder = new StringBuilder(); var pageScripts = new NameValueCollection(); foreach (var styleInfo in styleInfoList) { string extra; var value = BackgroundInputTypeParser.Parse(SiteInfo, ChannelId, styleInfo, Attributes, pageScripts, out extra); if (string.IsNullOrEmpty(value) && string.IsNullOrEmpty(extra)) { continue; } if (InputTypeUtils.Equals(styleInfo.InputType, InputType.TextEditor)) { builder.Append($@" <div class=""form-group form-row""> <label class=""col-sm-2 col-form-label text-right"">{styleInfo.DisplayName}</label> <div class=""col-sm-9""> {value} </div> <div class=""col-sm-1""> {extra} </div> </div>"); } else { builder.Append($@" <div class=""form-group form-row""> <label class=""col-sm-2 col-form-label text-right"">{styleInfo.DisplayName}</label> <div class=""col-sm-4""> {value} </div> <div class=""col-sm-6""> {extra} </div> </div>"); } } output.Write(builder.ToString()); foreach (string key in pageScripts.Keys) { output.Write(pageScripts[key]); } }