private static string GetAttributesHtml(NameValueCollection pageScripts, PublishmentSystemInfo publishmentSystemInfo, List <TableStyleInfo> styleInfoList) { if (styleInfoList == null) { return(string.Empty); } var output = new StringBuilder(); foreach (var styleInfo in styleInfoList) { if (styleInfo.IsVisible == false) { continue; } var helpHtml = styleInfo.DisplayName + ":"; var inputHtml = InputTypeParser.Parse(publishmentSystemInfo, styleInfo, styleInfo.AttributeName, pageScripts); output.Append($@" <div> {helpHtml} {inputHtml} </div> "); } return(output.ToString()); }
protected string GetAttributesHtml(NameValueCollection pageScripts, PublishmentSystemInfo publishmentSystemInfo, List <TableStyleInfo> styleInfoList) { if (styleInfoList == null) { return(string.Empty); } var output = new StringBuilder(); foreach (var styleInfo in styleInfoList) { if (styleInfo.IsVisible == false) { continue; } var helpHtml = styleInfo.DisplayName + ":"; var formCollection = new NameValueCollection { [styleInfo.AttributeName] = string.Empty }; var inputHtml = InputTypeParser.Parse(publishmentSystemInfo, 0, styleInfo, ETableStyle.InputContent, styleInfo.AttributeName, formCollection, false, false, GetInnerAdditionalAttributes(styleInfo), pageScripts, true); output.Append($@" <tr> <td style=""padding: 5px; width: 80px;"">{helpHtml}</td> <td style=""padding: 5px;"">{inputHtml}</td> </tr> "); } return(output.ToString()); }
public string GetFileInputTemplate() { var content = FileUtils.ReadText(SiteFilesAssets.GetPath("govinteractapply/inputTemplate.html"), ECharset.utf_8); var regex = "<!--parameters:(?<params>[^\"]*)-->"; var paramstring = RegexUtils.GetContent("params", regex, content); var parameters = TranslateUtils.ToNameValueCollection(paramstring); var tdNameClass = parameters["tdNameClass"]; var tdInputClass = parameters["tdInputClass"]; if (parameters.Count > 0) { content = content.Replace($"<!--parameters:{paramstring}-->\r\n", string.Empty); } content = $@"<link href=""{SiteFilesAssets.GovInteractApply.GetStyleUrl(_publishmentSystemInfo.Additional.ApiUrl)}"" type=""text/css"" rel=""stylesheet"" /> " + content; var builder = new StringBuilder(); var styleInfoList = RelatedIdentities.GetTableStyleInfoList(_publishmentSystemInfo, ETableStyle.GovInteractContent, _nodeId); var pageScripts = new NameValueCollection(); var isPreviousSingleLine = true; var isPreviousLeftColumn = false; foreach (var styleInfo in styleInfoList) { if (styleInfo.IsVisible) { var value = InputTypeParser.Parse(_publishmentSystemInfo, _nodeId, styleInfo, ETableStyle.GovInteractContent, styleInfo.AttributeName, null, false, false, null, pageScripts, styleInfo.Additional.IsValidate); if (builder.Length > 0) { if (isPreviousSingleLine) { builder.Append("</tr>"); } else { if (!isPreviousLeftColumn) { builder.Append("</tr>"); } else if (styleInfo.IsSingleLine) { builder.Append( $@"<td class=""{tdNameClass}""></td><td class=""{tdInputClass}""></td></tr>"); } } } //this line if (styleInfo.IsSingleLine || isPreviousSingleLine || !isPreviousLeftColumn) { builder.Append("<tr>"); } builder.Append( $@"<td class=""{tdNameClass}"">{styleInfo.DisplayName}</td><td {(styleInfo.IsSingleLine ? @"colspan=""3""" : string.Empty)} class=""{tdInputClass}"">{value}</td>"); if (styleInfo.IsSingleLine) { isPreviousSingleLine = true; isPreviousLeftColumn = false; } else { isPreviousSingleLine = false; isPreviousLeftColumn = !isPreviousLeftColumn; } } } if (builder.Length > 0) { if (isPreviousSingleLine || !isPreviousLeftColumn) { builder.Append("</tr>"); } else { builder.Append($@"<td class=""{tdNameClass}""></td><td class=""{tdInputClass}""></td></tr>"); } } if (content.Contains("<!--提交表单循环-->")) { content = content.Replace("<!--提交表单循环-->", builder.ToString()); } return(content.Replace("[nodeID]", _nodeId.ToString())); }