示例#1
0
        private static string ParseImpl(PageInfo pageInfo, ContextInfo contextInfo, string inputTemplateString)
        {
            var parsedContent = string.Empty;

            pageInfo.AddPageScriptsIfNotExists(PageInfo.Components.Jquery);
            pageInfo.AddPageScriptsIfNotExists(PageInfo.JQuery.BjTemplates);
            pageInfo.AddPageScriptsIfNotExists(PageInfo.JQuery.BShowLoading);
            pageInfo.AddPageScriptsIfNotExists(PageInfo.JQuery.BValidate);

            pageInfo.AddPageScriptsIfNotExists("SiteServer.CMS.Parser.StlElement",
                                               $@"<link href=""{SiteFilesAssets.Vote.GetStyleUrl(pageInfo.ApiUrl)}"" type=""text/css"" rel=""stylesheet"" />
");

            var contentInfo = contextInfo.ContentInfo as VoteContentInfo;

            if (contentInfo == null && contextInfo.ContentId > 0)
            {
                contentInfo = DataProvider.VoteContentDao.GetContentInfo(pageInfo.PublishmentSystemInfo, contextInfo.ContentId);
            }

            if (contentInfo != null)
            {
                var voteTemplate   = new VoteTemplate(pageInfo.PublishmentSystemInfo, contentInfo.NodeId, contentInfo);
                var contentBuilder = new StringBuilder(voteTemplate.GetTemplate(inputTemplateString));

                StlParserManager.ParseTemplateContent(contentBuilder, pageInfo, contextInfo);
                parsedContent = contentBuilder.ToString();
            }

            return(parsedContent);
        }
示例#2
0
        private static string ParseImpl(PageInfo pageInfo, ContextInfo contextInfo, string theme, string inputTemplateString)
        {
            var parsedContent = string.Empty;

            var contentInfo = contextInfo.ContentInfo as VoteContentInfo;

            if (contentInfo == null && contextInfo.ContentID > 0)
            {
                contentInfo = DataProvider.VoteContentDao.GetContentInfo(pageInfo.PublishmentSystemInfo, contextInfo.ContentID);
            }

            if (contentInfo != null)
            {
                var voteTemplate   = new VoteTemplate(pageInfo.PublishmentSystemInfo, contentInfo.NodeId, contentInfo);
                var contentBuilder = new StringBuilder(voteTemplate.GetTemplate(inputTemplateString));

                StlParserManager.ParseTemplateContent(contentBuilder, pageInfo, contextInfo);
                parsedContent = contentBuilder.ToString();
            }

            return(parsedContent);
        }