コード例 #1
0
        public string GetFileFailureTemplate()
        {
            var retval = FileUtils.ReadText(SiteFilesAssets.GetPath("govinteractapply/failureTemplate.html"), ECharset.utf_8);

            return(retval.Replace("[nodeID]", _nodeId.ToString()));
        }
コード例 #2
0
 public string GetFileFailureTemplate()
 {
     return(FileUtils.ReadText(SiteFilesAssets.GetPath("govinteractquery/failureTemplate.html"), ECharset.utf_8));
 }
コード例 #3
0
        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, styleInfo, styleInfo.AttributeName, pageScripts);

                    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()));
        }
コード例 #4
0
        public string GetFileSuccessTemplate()
        {
            var content = FileUtils.ReadText(SiteFilesAssets.GetPath("govinteractquery/successTemplate.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);
            }

            var builder       = new StringBuilder();
            var styleInfoList = TableStyleManager.GetTableStyleInfoList(ETableStyle.GovInteractContent, _publishmentSystemInfo.AuxiliaryTableForGovInteract, RelatedIdentities.GetChannelRelatedIdentities(_publishmentSystemInfo.PublishmentSystemId, _nodeId));

            var isPreviousSingleLine = true;
            var isPreviousLeftColumn = false;

            foreach (var styleInfo in styleInfoList)
            {
                if (styleInfo.IsVisible)
                {
                    if (StringUtils.EqualsIgnoreCase(GovInteractContentAttribute.IsPublic, styleInfo.AttributeName) || StringUtils.EqualsIgnoreCase(GovInteractContentAttribute.DepartmentId, styleInfo.AttributeName) || StringUtils.EqualsIgnoreCase(GovInteractContentAttribute.TypeId, styleInfo.AttributeName))
                    {
                        continue;
                    }
                    string value = $"{{$T.{styleInfo.AttributeName.ToLower()}}}";

                    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);
        }