Exemplo n.º 1
0
        public static IEnumerable GetDataSourceByStlElement(PublishmentSystemInfo publishmentSystemInfo, int templateId, string elementName, string stlElement)
        {
            var     xmlDocument = StlParserUtility.GetXmlDocument(stlElement, false);
            XmlNode node        = xmlDocument.DocumentElement;

            if (node != null)
            {
                node = node.FirstChild;

                var templateInfo = TemplateManager.GetTemplateInfo(publishmentSystemInfo.PublishmentSystemId, templateId);
                var pageInfo     = new PageInfo(publishmentSystemInfo.PublishmentSystemId, 0, publishmentSystemInfo, templateInfo, null);
                var contextInfo  = new ContextInfo(pageInfo);

                if (node?.Name != null)
                {
                    if (elementName == StlChannels.ElementName)
                    {
                        var displayInfo = ContentsDisplayInfo.GetContentsDisplayInfoByXmlNode(node, pageInfo, contextInfo, EContextType.Channel);

                        return(StlChannels.GetDataSource(pageInfo, contextInfo, displayInfo));
                    }
                    else if (elementName == StlContents.ElementName)
                    {
                        var displayInfo = ContentsDisplayInfo.GetContentsDisplayInfoByXmlNode(node, pageInfo, contextInfo, EContextType.Content);

                        return(StlContents.GetDataSource(pageInfo, contextInfo, displayInfo));
                    }
                }
            }

            return(null);
        }
Exemplo n.º 2
0
        //API SearchOutput调用
        public StlPageContents(string stlPageContentsElement, PageInfo pageInfo, ContextInfo contextInfo, int pageNum, string whereString)
        {
            _pageInfo    = pageInfo;
            _contextInfo = contextInfo;
            var xmlDocument = StlParserUtility.GetXmlDocument(stlPageContentsElement, false);

            _node = xmlDocument.DocumentElement;
            if (_node != null)
            {
                _node = _node.FirstChild;

                DisplayInfo = ContentsDisplayInfo.GetContentsDisplayInfoByXmlNode(_node, pageInfo, _contextInfo, EContextType.Content);
            }
            DisplayInfo.Scope = EScopeType.All;

            _contextInfo.TitleWordNum = DisplayInfo.TitleWordNum;

            DisplayInfo.Where += whereString;
            if (pageNum > 0)
            {
                DisplayInfo.PageNum = pageNum;
            }

            var channelId = StlDataUtility.GetNodeIdByLevel(pageInfo.PublishmentSystemId, _contextInfo.ChannelID, DisplayInfo.UpLevel, DisplayInfo.TopLevel);

            channelId = StlCacheManager.NodeId.GetNodeIdByChannelIdOrChannelIndexOrChannelName(pageInfo.PublishmentSystemId, channelId, DisplayInfo.ChannelIndex, DisplayInfo.ChannelName);

            SqlString = StlDataUtility.GetPageContentsSqlString(_pageInfo.PublishmentSystemInfo, channelId, DisplayInfo.GroupContent, DisplayInfo.GroupContentNot, DisplayInfo.Tags, DisplayInfo.IsImageExists, DisplayInfo.IsImage, DisplayInfo.IsVideoExists, DisplayInfo.IsVideo, DisplayInfo.IsFileExists, DisplayInfo.IsFile, DisplayInfo.IsNoDup, DisplayInfo.StartNum, DisplayInfo.TotalNum, DisplayInfo.OrderByString, DisplayInfo.IsTopExists, DisplayInfo.IsTop, DisplayInfo.IsRecommendExists, DisplayInfo.IsRecommend, DisplayInfo.IsHotExists, DisplayInfo.IsHot, DisplayInfo.IsColorExists, DisplayInfo.IsColor, DisplayInfo.Where, DisplayInfo.Scope, DisplayInfo.GroupChannel, DisplayInfo.GroupChannelNot);
        }
Exemplo n.º 3
0
        public StlPageComments(string stlPageCommentsElement, PageInfo pageInfo, ContextInfo contextInfo, bool isXmlContent)
        {
            this.pageInfo    = pageInfo;
            this.contextInfo = contextInfo;
            var xmlDocument = StlParserUtility.GetXmlDocument(stlPageCommentsElement, isXmlContent);

            node = xmlDocument.DocumentElement;
            node = node.FirstChild;

            displayInfo = ContentsDisplayInfo.GetContentsDisplayInfoByXmlNode(node, pageInfo, this.contextInfo, EContextType.Comment);

            dataSet = StlDataUtility.GetPageCommentsDataSet(pageInfo.PublishmentSystemId, contextInfo.ChannelID, contextInfo.ContentID, null, displayInfo.StartNum, displayInfo.TotalNum, displayInfo.IsRecommend, displayInfo.OrderByString, displayInfo.Where);
        }
Exemplo n.º 4
0
        public StlPageInputContents(string stlPageInputContentsElement, PageInfo pageInfo, ContextInfo contextInfo, bool isXmlContent)
        {
            this.pageInfo    = pageInfo;
            this.contextInfo = contextInfo;
            var xmlDocument = StlParserUtility.GetXmlDocument(stlPageInputContentsElement, isXmlContent);

            node = xmlDocument.DocumentElement;
            node = node.FirstChild;

            displayInfo = ContentsDisplayInfo.GetContentsDisplayInfoByXmlNode(node, pageInfo, this.contextInfo, EContextType.InputContent);

            var inputID = DataProvider.InputDao.GetInputIdAsPossible(displayInfo.OtherAttributes[Attribute_InputName], pageInfo.PublishmentSystemId);

            dataSet = StlDataUtility.GetPageInputContentsDataSet(pageInfo.PublishmentSystemId, inputID, displayInfo);
        }
Exemplo n.º 5
0
        public static string Parse(string stlElement, XmlNode node, PageInfo pageInfo, ContextInfo contextInfo)
        {
            string parsedContent;

            try
            {
                var displayInfo = ContentsDisplayInfo.GetContentsDisplayInfoByXmlNode(node, pageInfo, contextInfo, EContextType.Comment);

                parsedContent = displayInfo.IsDynamic ? StlDynamic.ParseDynamicElement(stlElement, pageInfo, contextInfo) : ParseImpl(pageInfo, contextInfo, displayInfo);
            }
            catch (Exception ex)
            {
                parsedContent = StlParserUtility.GetStlErrorMessage(ElementName, ex);
            }

            return(parsedContent);
        }
Exemplo n.º 6
0
        public StlPageSqlContents(string stlPageSqlContentsElement, PageInfo pageInfo, ContextInfo contextInfo, bool isXmlContent)
        {
            this.pageInfo    = pageInfo;
            this.contextInfo = contextInfo;
            try
            {
                var xmlDocument = StlParserUtility.GetXmlDocument(stlPageSqlContentsElement, isXmlContent);
                node = xmlDocument.DocumentElement;
                node = node.FirstChild;

                displayInfo = ContentsDisplayInfo.GetContentsDisplayInfoByXmlNode(node, pageInfo, this.contextInfo, EContextType.SqlContent);
                dataSet     = StlDataUtility.GetPageSqlContentsDataSet(displayInfo.ConnectionString, displayInfo.QueryString, displayInfo.StartNum, displayInfo.TotalNum, displayInfo.OrderByString);
            }
            catch
            {
                displayInfo = new ContentsDisplayInfo();
            }
        }
Exemplo n.º 7
0
        //public sealed class SitesItem
        //{
        //    public const string ElementName = "stl:sitesitem";               //列表项

        //    public const string Attribute_Type = "type";                        //列表项类型
        //    public const string Attribute_Selected = "selected";                //当前选定项类型
        //    public const string Attribute_SelectedValue = "selectedvalue";      //当前选定项的值

        //    public const string Type_Header = "header";                 //为项提供头部内容
        //    public const string Type_Footer = "footer";                 //为项提供底部内容
        //    public const string Type_Item = "item";                             //为项提供内容和布局
        //    public const string Type_AlternatingItem = "alternatingitem";       //为交替项提供内容和布局
        //    public const string Type_SelectedItem = "selecteditem";             //为当前选定项提供内容和布局
        //    public const string Type_Separator = "separator";                   //为各项之间的分隔符提供内容和布局

        //    public static ListDictionary AttributeList
        //    {
        //        get
        //        {
        //            ListDictionary attributes = new ListDictionary();

        //            attributes.Add(Attribute_Type, "列表项类型");
        //            attributes.Add(Attribute_Selected, "列表当前选定项类型");
        //            attributes.Add(Attribute_SelectedValue, "列表当前选定项的值");
        //            return attributes;
        //        }
        //    }
        //}

        public static string Parse(string stlElement, XmlNode node, PageInfo pageInfo, ContextInfo contextInfo)
        {
            var parsedContent = string.Empty;

            try
            {
                var displayInfo = ContentsDisplayInfo.GetContentsDisplayInfoByXmlNode(node, pageInfo, contextInfo, EContextType.Site);

                if (displayInfo.IsDynamic)
                {
                    parsedContent = StlDynamic.ParseDynamicElement(stlElement, pageInfo, contextInfo);
                }
                else
                {
                    parsedContent = ParseImpl(pageInfo, contextInfo, displayInfo);
                }
            }
            catch (Exception ex)
            {
                parsedContent = StlParserUtility.GetStlErrorMessage(ElementName, ex);
            }

            return(parsedContent);
        }
Exemplo n.º 8
0
        public StlPageChannels(string stlPageChannelsElement, PageInfo pageInfo, ContextInfo contextInfo, bool isXmlContent)
        {
            this.pageInfo    = pageInfo;
            this.contextInfo = contextInfo;
            var xmlDocument = StlParserUtility.GetXmlDocument(stlPageChannelsElement, isXmlContent);

            node = xmlDocument.DocumentElement;
            node = node.FirstChild;

            displayInfo = ContentsDisplayInfo.GetContentsDisplayInfoByXmlNode(node, pageInfo, this.contextInfo, EContextType.Channel);

            channelID = StlDataUtility.GetNodeIdByLevel(pageInfo.PublishmentSystemId, this.contextInfo.ChannelID, displayInfo.UpLevel, displayInfo.TopLevel);

            channelID = StlCacheManager.NodeId.GetNodeIdByChannelIdOrChannelIndexOrChannelName(pageInfo.PublishmentSystemId, channelID, displayInfo.ChannelIndex, displayInfo.ChannelName);

            var isTotal = TranslateUtils.ToBool(displayInfo.OtherAttributes[AttributeIsTotal]);

            if (TranslateUtils.ToBool(displayInfo.OtherAttributes[AttributeIsAllChildren]))
            {
                displayInfo.Scope = EScopeType.Descendant;
            }

            dataSet = StlDataUtility.GetPageChannelsDataSet(pageInfo.PublishmentSystemId, channelID, displayInfo.GroupChannel, displayInfo.GroupChannelNot, displayInfo.IsImageExists, displayInfo.IsImage, displayInfo.StartNum, displayInfo.TotalNum, displayInfo.OrderByString, displayInfo.Scope, isTotal, displayInfo.Where);
        }
Exemplo n.º 9
0
        private static string ParseImpl(PageInfo pageInfo, ContextInfo contextInfo, ContentsDisplayInfo displayInfo)
        {
            var parsedContent = string.Empty;

            contextInfo.TitleWordNum = 0;

            var siteName  = displayInfo.OtherAttributes[Attribute_SiteName];
            var directory = displayInfo.OtherAttributes[Attribute_Directory];
            var since     = displayInfo.OtherAttributes[Attribute_Since];

            if (displayInfo.Layout == ELayout.None)
            {
                var rptContents = new Repeater();

                rptContents.ItemTemplate = new RepeaterTemplate(displayInfo.ItemTemplate, displayInfo.SelectedItems, displayInfo.SelectedValues, displayInfo.SeparatorRepeatTemplate, displayInfo.SeparatorRepeat, pageInfo, EContextType.Site, contextInfo);
                if (!string.IsNullOrEmpty(displayInfo.HeaderTemplate))
                {
                    rptContents.HeaderTemplate = new SeparatorTemplate(displayInfo.HeaderTemplate);
                }
                if (!string.IsNullOrEmpty(displayInfo.FooterTemplate))
                {
                    rptContents.FooterTemplate = new SeparatorTemplate(displayInfo.FooterTemplate);
                }
                if (!string.IsNullOrEmpty(displayInfo.SeparatorTemplate))
                {
                    rptContents.SeparatorTemplate = new SeparatorTemplate(displayInfo.SeparatorTemplate);
                }
                if (!string.IsNullOrEmpty(displayInfo.AlternatingItemTemplate))
                {
                    rptContents.AlternatingItemTemplate = new RepeaterTemplate(displayInfo.AlternatingItemTemplate, displayInfo.SelectedItems, displayInfo.SelectedValues, displayInfo.SeparatorRepeatTemplate, displayInfo.SeparatorRepeat, pageInfo, EContextType.Site, contextInfo);
                }

                rptContents.DataSource = StlDataUtility.GetSitesDataSource(siteName, directory, displayInfo.StartNum, displayInfo.TotalNum, displayInfo.Where, displayInfo.Scope, displayInfo.OrderByString, since);
                rptContents.DataBind();

                if (rptContents.Items.Count > 0)
                {
                    parsedContent = ControlUtils.GetControlRenderHtml(rptContents);
                }
            }
            else
            {
                var pdlContents = new ParsedDataList();

                TemplateUtility.PutContentsDisplayInfoToMyDataList(pdlContents, displayInfo);

                pdlContents.ItemTemplate = new DataListTemplate(displayInfo.ItemTemplate, displayInfo.SelectedItems, displayInfo.SelectedValues, displayInfo.SeparatorRepeatTemplate, displayInfo.SeparatorRepeat, pageInfo, EContextType.Site, contextInfo);
                if (!string.IsNullOrEmpty(displayInfo.HeaderTemplate))
                {
                    pdlContents.HeaderTemplate = new SeparatorTemplate(displayInfo.HeaderTemplate);
                }
                if (!string.IsNullOrEmpty(displayInfo.FooterTemplate))
                {
                    pdlContents.FooterTemplate = new SeparatorTemplate(displayInfo.FooterTemplate);
                }
                if (!string.IsNullOrEmpty(displayInfo.SeparatorTemplate))
                {
                    pdlContents.SeparatorTemplate = new SeparatorTemplate(displayInfo.SeparatorTemplate);
                }
                if (!string.IsNullOrEmpty(displayInfo.AlternatingItemTemplate))
                {
                    pdlContents.AlternatingItemTemplate = new DataListTemplate(displayInfo.AlternatingItemTemplate, displayInfo.SelectedItems, displayInfo.SelectedValues, displayInfo.SeparatorRepeatTemplate, displayInfo.SeparatorRepeat, pageInfo, EContextType.Site, contextInfo);
                }

                pdlContents.DataSource = StlDataUtility.GetSitesDataSource(siteName, directory, displayInfo.StartNum, displayInfo.TotalNum, displayInfo.Where, displayInfo.Scope, displayInfo.OrderByString, since);
                pdlContents.DataBind();

                if (pdlContents.Items.Count > 0)
                {
                    parsedContent = ControlUtils.GetControlRenderHtml(pdlContents);
                }
            }

            return(parsedContent);
        }
Exemplo n.º 10
0
        private static string ParseImpl(PageInfo pageInfo, ContextInfo contextInfo, ContentsDisplayInfo displayInfo)
        {
            var parsedContent = string.Empty;

            var titleWordNum = contextInfo.TitleWordNum;

            contextInfo.TitleWordNum = displayInfo.TitleWordNum;

            var dataSource = GetDataSource(pageInfo, contextInfo, displayInfo);

            if (displayInfo.Layout == ELayout.None)
            {
                var rptContents = new Repeater();

                rptContents.ItemTemplate = new RepeaterTemplate(displayInfo.ItemTemplate, displayInfo.SelectedItems, displayInfo.SelectedValues, displayInfo.SeparatorRepeatTemplate, displayInfo.SeparatorRepeat, pageInfo, EContextType.Content, contextInfo);
                if (!string.IsNullOrEmpty(displayInfo.HeaderTemplate))
                {
                    rptContents.HeaderTemplate = new SeparatorTemplate(displayInfo.HeaderTemplate);
                }
                if (!string.IsNullOrEmpty(displayInfo.FooterTemplate))
                {
                    rptContents.FooterTemplate = new SeparatorTemplate(displayInfo.FooterTemplate);
                }
                if (!string.IsNullOrEmpty(displayInfo.SeparatorTemplate))
                {
                    rptContents.SeparatorTemplate = new SeparatorTemplate(displayInfo.SeparatorTemplate);
                }
                if (!string.IsNullOrEmpty(displayInfo.AlternatingItemTemplate))
                {
                    rptContents.AlternatingItemTemplate = new RepeaterTemplate(displayInfo.AlternatingItemTemplate, displayInfo.SelectedItems, displayInfo.SelectedValues, displayInfo.SeparatorRepeatTemplate, displayInfo.SeparatorRepeat, pageInfo, EContextType.Content, contextInfo);
                }

                rptContents.DataSource = dataSource;
                rptContents.DataBind();

                if (rptContents.Items.Count > 0)
                {
                    parsedContent = ControlUtils.GetControlRenderHtml(rptContents);
                }
            }
            else
            {
                var pdlContents = new ParsedDataList();

                TemplateUtility.PutContentsDisplayInfoToMyDataList(pdlContents, displayInfo);

                pdlContents.ItemTemplate = new DataListTemplate(displayInfo.ItemTemplate, displayInfo.SelectedItems, displayInfo.SelectedValues, displayInfo.SeparatorRepeatTemplate, displayInfo.SeparatorRepeat, pageInfo, EContextType.Content, contextInfo);
                if (!string.IsNullOrEmpty(displayInfo.HeaderTemplate))
                {
                    pdlContents.HeaderTemplate = new SeparatorTemplate(displayInfo.HeaderTemplate);
                }
                if (!string.IsNullOrEmpty(displayInfo.FooterTemplate))
                {
                    pdlContents.FooterTemplate = new SeparatorTemplate(displayInfo.FooterTemplate);
                }
                if (!string.IsNullOrEmpty(displayInfo.SeparatorTemplate))
                {
                    pdlContents.SeparatorTemplate = new SeparatorTemplate(displayInfo.SeparatorTemplate);
                }
                if (!string.IsNullOrEmpty(displayInfo.AlternatingItemTemplate))
                {
                    pdlContents.AlternatingItemTemplate = new DataListTemplate(displayInfo.AlternatingItemTemplate, displayInfo.SelectedItems, displayInfo.SelectedValues, displayInfo.SeparatorRepeatTemplate, displayInfo.SeparatorRepeat, pageInfo, EContextType.Content, contextInfo);
                }

                pdlContents.DataSource   = dataSource;
                pdlContents.DataKeyField = ContentAttribute.Id;
                pdlContents.DataBind();

                if (pdlContents.Items.Count > 0)
                {
                    parsedContent = ControlUtils.GetControlRenderHtml(pdlContents);
                }
            }

            contextInfo.TitleWordNum = titleWordNum;

            return(parsedContent);
        }
Exemplo n.º 11
0
        public static IEnumerable GetDataSource(PageInfo pageInfo, ContextInfo contextInfo, ContentsDisplayInfo displayInfo)
        {
            var channelID = StlDataUtility.GetNodeIdByLevel(pageInfo.PublishmentSystemId, contextInfo.ChannelID, displayInfo.UpLevel, displayInfo.TopLevel);

            channelID = StlCacheManager.NodeId.GetNodeIdByChannelIdOrChannelIndexOrChannelName(pageInfo.PublishmentSystemId, channelID, displayInfo.ChannelIndex, displayInfo.ChannelName);

            return(StlDataUtility.GetContentsDataSource(pageInfo.PublishmentSystemInfo, channelID, contextInfo.ContentID, displayInfo.GroupContent, displayInfo.GroupContentNot, displayInfo.Tags, displayInfo.IsImageExists, displayInfo.IsImage, displayInfo.IsVideoExists, displayInfo.IsVideo, displayInfo.IsFileExists, displayInfo.IsFile, displayInfo.IsNoDup, displayInfo.IsRelatedContents, displayInfo.StartNum, displayInfo.TotalNum, displayInfo.OrderByString, displayInfo.IsTopExists, displayInfo.IsTop, displayInfo.IsRecommendExists, displayInfo.IsRecommend, displayInfo.IsHotExists, displayInfo.IsHot, displayInfo.IsColorExists, displayInfo.IsColor, displayInfo.Where, displayInfo.Scope, displayInfo.GroupChannel, displayInfo.GroupChannelNot, displayInfo.OtherAttributes));
        }
Exemplo n.º 12
0
        private static string ParseImpl(PageInfo pageInfo, ContextInfo contextInfo, ContentsDisplayInfo displayInfo)
        {
            var parsedContent = string.Empty;

            contextInfo.TitleWordNum = 0;
            var inputID = DataProvider.InputDao.GetInputIdAsPossible(displayInfo.OtherAttributes[Attribute_InputName], pageInfo.PublishmentSystemId);

            if (displayInfo.Layout == ELayout.None)
            {
                var rptContents = new Repeater();

                rptContents.ItemTemplate = new RepeaterTemplate(displayInfo.ItemTemplate, null, null, displayInfo.SeparatorRepeatTemplate, displayInfo.SeparatorRepeat, pageInfo, EContextType.InputContent, contextInfo);
                if (!string.IsNullOrEmpty(displayInfo.HeaderTemplate))
                {
                    rptContents.HeaderTemplate = new SeparatorTemplate(displayInfo.HeaderTemplate);
                }
                if (!string.IsNullOrEmpty(displayInfo.FooterTemplate))
                {
                    rptContents.FooterTemplate = new SeparatorTemplate(displayInfo.FooterTemplate);
                }
                if (!string.IsNullOrEmpty(displayInfo.SeparatorTemplate))
                {
                    rptContents.SeparatorTemplate = new SeparatorTemplate(displayInfo.SeparatorTemplate);
                }
                if (!string.IsNullOrEmpty(displayInfo.AlternatingItemTemplate))
                {
                    rptContents.AlternatingItemTemplate = new RepeaterTemplate(displayInfo.AlternatingItemTemplate, null, null, displayInfo.SeparatorRepeatTemplate, displayInfo.SeparatorRepeat, pageInfo, EContextType.InputContent, contextInfo);
                }

                rptContents.DataSource = StlDataUtility.GetInputContentsDataSource(pageInfo.PublishmentSystemId, inputID, displayInfo);
                rptContents.DataBind();

                if (rptContents.Items.Count > 0)
                {
                    parsedContent = ControlUtils.GetControlRenderHtml(rptContents);
                }
            }
            else
            {
                var pdlContents = new ParsedDataList();

                TemplateUtility.PutContentsDisplayInfoToMyDataList(pdlContents, displayInfo);

                pdlContents.ItemTemplate = new DataListTemplate(displayInfo.ItemTemplate, null, null, displayInfo.SeparatorRepeatTemplate, displayInfo.SeparatorRepeat, pageInfo, EContextType.InputContent, contextInfo);
                if (!string.IsNullOrEmpty(displayInfo.HeaderTemplate))
                {
                    pdlContents.HeaderTemplate = new SeparatorTemplate(displayInfo.HeaderTemplate);
                }
                if (!string.IsNullOrEmpty(displayInfo.FooterTemplate))
                {
                    pdlContents.FooterTemplate = new SeparatorTemplate(displayInfo.FooterTemplate);
                }
                if (!string.IsNullOrEmpty(displayInfo.SeparatorTemplate))
                {
                    pdlContents.SeparatorTemplate = new SeparatorTemplate(displayInfo.SeparatorTemplate);
                }
                if (!string.IsNullOrEmpty(displayInfo.AlternatingItemTemplate))
                {
                    pdlContents.AlternatingItemTemplate = new DataListTemplate(displayInfo.AlternatingItemTemplate, null, null, displayInfo.SeparatorRepeatTemplate, displayInfo.SeparatorRepeat, pageInfo, EContextType.InputContent, contextInfo);
                }

                pdlContents.DataSource = StlDataUtility.GetInputContentsDataSource(pageInfo.PublishmentSystemId, inputID, displayInfo);
                pdlContents.DataBind();

                if (pdlContents.Items.Count > 0)
                {
                    parsedContent = ControlUtils.GetControlRenderHtml(pdlContents);
                }
            }

            return(parsedContent);
        }
Exemplo n.º 13
0
        public static DataSet GetPageInputContentsDataSet(int publishmentSystemId, int inputId, ContentsDisplayInfo displayInfo)
        {
            var isReplyExists = displayInfo.OtherAttributes[StlInputContents.Attribute_IsReply] != null;
            var isReply       = TranslateUtils.ToBool(displayInfo.OtherAttributes[StlInputContents.Attribute_IsReply]);
            var sqlString     = DataProvider.InputContentDao.GetSelectSqlStringWithChecked(publishmentSystemId, inputId, isReplyExists, isReply, displayInfo.StartNum, displayInfo.TotalNum, displayInfo.Where, displayInfo.OrderByString, displayInfo.OtherAttributes);

            return(BaiRongDataProvider.DatabaseDao.GetDataSet(sqlString));
        }
Exemplo n.º 14
0
        public static void PutContentsDisplayInfoToMyDataList(ParsedDataList myDataList, ContentsDisplayInfo displayInfo)
        {
            myDataList.RepeatColumns   = displayInfo.Columns;
            myDataList.RepeatDirection = displayInfo.Direction;
            myDataList.Height          = displayInfo.Height;
            myDataList.Width           = displayInfo.Width;
            if (!string.IsNullOrEmpty(displayInfo.Align))
            {
                myDataList.HorizontalAlign = Converter.ToHorizontalAlign(displayInfo.Align);
            }
            myDataList.ItemStyle.Height          = displayInfo.ItemHeight;
            myDataList.ItemStyle.Width           = displayInfo.ItemWidth;
            myDataList.ItemStyle.HorizontalAlign = HorizontalAlign.Left;
            if (!string.IsNullOrEmpty(displayInfo.ItemAlign))
            {
                myDataList.ItemStyle.HorizontalAlign = Converter.ToHorizontalAlign(displayInfo.ItemAlign);
            }
            myDataList.ItemStyle.VerticalAlign = VerticalAlign.Top;
            if (!string.IsNullOrEmpty(displayInfo.ItemVerticalAlign))
            {
                myDataList.ItemStyle.VerticalAlign = Converter.ToVerticalAlign(displayInfo.ItemVerticalAlign);
            }
            if (!string.IsNullOrEmpty(displayInfo.ItemClass))
            {
                myDataList.ItemStyle.CssClass = displayInfo.ItemClass;
            }

            if (displayInfo.Layout == ELayout.Table)
            {
                myDataList.RepeatLayout = RepeatLayout.Table;
            }
            else if (displayInfo.Layout == ELayout.Flow)
            {
                myDataList.RepeatLayout = RepeatLayout.Flow;
            }

            foreach (string attributeName in displayInfo.OtherAttributes)
            {
                myDataList.AddAttribute(attributeName, displayInfo.OtherAttributes[attributeName]);
            }
        }
Exemplo n.º 15
0
        private static string ParseImpl(PageInfo pageInfo, XmlNode node, ContextInfo contextInfo, ContentsDisplayInfo displayInfo)
        {
            var parsedContent = string.Empty;

            var type = displayInfo.OtherAttributes[Attribute_Type];

            if (string.IsNullOrEmpty(type))
            {
                type = BackgroundContentAttribute.ImageUrl;
            }
            var value     = displayInfo.OtherAttributes[Attribute_Value];
            var onPreLoad = displayInfo.OtherAttributes[Attribute_OnPreLoad];
            var onLoaded  = displayInfo.OtherAttributes[Attribute_OnLoaded];

            var         contextType = EContextType.Each;
            IEnumerable dataSource  = null;

            if (StringUtils.EqualsIgnoreCase(type, Type_Photo))
            {
                contextType = EContextType.Photo;
                dataSource  = StlDataUtility.GetPhotosDataSource(pageInfo.PublishmentSystemInfo, contextInfo.ContentID, displayInfo.StartNum, displayInfo.TotalNum);
            }
            else if (StringUtils.EqualsIgnoreCase(type, Type_Property))
            {
                if (contextInfo.ContextType == EContextType.Undefined)
                {
                    contextInfo.ContextType = EContextType.Content;
                }
                contextType = contextInfo.ContextType;
                dataSource  = StlDataUtility.GetPropertysDataSource(pageInfo.PublishmentSystemInfo, contextInfo.ContentInfo, contextType, value, displayInfo.StartNum, displayInfo.TotalNum);
            }
            else if (StringUtils.EqualsIgnoreCase(type, Type_Template))
            {
                var builder = new StringBuilder(node.InnerXml);
                StlParserManager.ParseInnerContent(builder, pageInfo, contextInfo);

                return($@"
<%for(i = 0; i < {value}.length; i ++) {{
    item = {value}[i]; %>
    {builder}
<%}}%>
");
            }
            else
            {
                var contentInfo = contextInfo.ContentInfo;
                if (contentInfo != null)
                {
                    var eachList = new List <string>();

                    if (!string.IsNullOrEmpty(contentInfo.GetExtendedAttribute(type)))
                    {
                        eachList.Add(contentInfo.GetExtendedAttribute(type));
                    }

                    var extendAttributeName = ContentAttribute.GetExtendAttributeName(type);
                    var extendValues        = contentInfo.GetExtendedAttribute(extendAttributeName);
                    if (!string.IsNullOrEmpty(extendValues))
                    {
                        foreach (string extendValue in TranslateUtils.StringCollectionToStringList(extendValues))
                        {
                            eachList.Add(extendValue);
                        }
                    }

                    if (displayInfo.StartNum > 1 || displayInfo.TotalNum > 0)
                    {
                        if (displayInfo.StartNum > 1)
                        {
                            var count = displayInfo.StartNum - 1;
                            if (count > eachList.Count)
                            {
                                count = eachList.Count;
                            }
                            eachList.RemoveRange(0, count);
                        }

                        if (displayInfo.TotalNum > 0)
                        {
                            if (displayInfo.TotalNum < eachList.Count)
                            {
                                eachList.RemoveRange(displayInfo.TotalNum, eachList.Count - displayInfo.TotalNum);
                            }
                        }
                    }

                    dataSource = eachList;
                }
            }

            if (displayInfo.Layout == ELayout.None)
            {
                var rptContents = new Repeater();

                rptContents.ItemTemplate = new RepeaterTemplate(displayInfo.ItemTemplate, displayInfo.SelectedItems, displayInfo.SelectedValues, displayInfo.SeparatorRepeatTemplate, displayInfo.SeparatorRepeat, pageInfo, contextType, contextInfo);
                if (!string.IsNullOrEmpty(displayInfo.HeaderTemplate))
                {
                    rptContents.HeaderTemplate = new SeparatorTemplate(displayInfo.HeaderTemplate);
                }
                if (!string.IsNullOrEmpty(displayInfo.FooterTemplate))
                {
                    rptContents.FooterTemplate = new SeparatorTemplate(displayInfo.FooterTemplate);
                }
                if (!string.IsNullOrEmpty(displayInfo.SeparatorTemplate))
                {
                    rptContents.SeparatorTemplate = new SeparatorTemplate(displayInfo.SeparatorTemplate);
                }
                if (!string.IsNullOrEmpty(displayInfo.AlternatingItemTemplate))
                {
                    rptContents.AlternatingItemTemplate = new RepeaterTemplate(displayInfo.AlternatingItemTemplate, displayInfo.SelectedItems, displayInfo.SelectedValues, displayInfo.SeparatorRepeatTemplate, displayInfo.SeparatorRepeat, pageInfo, contextType, contextInfo);
                }

                rptContents.DataSource = dataSource;

                rptContents.DataBind();

                if (rptContents.Items.Count > 0)
                {
                    parsedContent = ControlUtils.GetControlRenderHtml(rptContents);
                }
            }
            else
            {
                var pdlContents = new ParsedDataList();

                TemplateUtility.PutContentsDisplayInfoToMyDataList(pdlContents, displayInfo);

                pdlContents.ItemTemplate = new DataListTemplate(displayInfo.ItemTemplate, displayInfo.SelectedItems, displayInfo.SelectedValues, displayInfo.SeparatorRepeatTemplate, displayInfo.SeparatorRepeat, pageInfo, contextType, contextInfo);
                if (!string.IsNullOrEmpty(displayInfo.HeaderTemplate))
                {
                    pdlContents.HeaderTemplate = new SeparatorTemplate(displayInfo.HeaderTemplate);
                }
                if (!string.IsNullOrEmpty(displayInfo.FooterTemplate))
                {
                    pdlContents.FooterTemplate = new SeparatorTemplate(displayInfo.FooterTemplate);
                }
                if (!string.IsNullOrEmpty(displayInfo.SeparatorTemplate))
                {
                    pdlContents.SeparatorTemplate = new SeparatorTemplate(displayInfo.SeparatorTemplate);
                }
                if (!string.IsNullOrEmpty(displayInfo.AlternatingItemTemplate))
                {
                    pdlContents.AlternatingItemTemplate = new DataListTemplate(displayInfo.AlternatingItemTemplate, displayInfo.SelectedItems, displayInfo.SelectedValues, displayInfo.SeparatorRepeatTemplate, displayInfo.SeparatorRepeat, pageInfo, contextType, contextInfo);
                }

                pdlContents.DataSource = dataSource;

                pdlContents.DataBind();

                if (pdlContents.Items.Count > 0)
                {
                    parsedContent = ControlUtils.GetControlRenderHtml(pdlContents);
                }
            }

            return(parsedContent);
        }
Exemplo n.º 16
0
        private static string ParseImpl(PageInfo pageInfo, ContextInfo contextInfo, ContentsDisplayInfo displayInfo)
        {
            var parsedContent = string.Empty;

            if (displayInfo.Layout == ELayout.None)
            {
                var rptContents = new Repeater();

                if (!string.IsNullOrEmpty(displayInfo.HeaderTemplate))
                {
                    rptContents.HeaderTemplate = new SeparatorTemplate(displayInfo.HeaderTemplate);
                }
                if (!string.IsNullOrEmpty(displayInfo.FooterTemplate))
                {
                    rptContents.FooterTemplate = new SeparatorTemplate(displayInfo.FooterTemplate);
                }
                if (!string.IsNullOrEmpty(displayInfo.SeparatorTemplate))
                {
                    rptContents.SeparatorTemplate = new SeparatorTemplate(displayInfo.SeparatorTemplate);
                }
                if (!string.IsNullOrEmpty(displayInfo.AlternatingItemTemplate))
                {
                    rptContents.AlternatingItemTemplate = new RepeaterTemplate(displayInfo.AlternatingItemTemplate, null, null, displayInfo.SeparatorRepeatTemplate, displayInfo.SeparatorRepeat, pageInfo, EContextType.Comment, contextInfo);
                }

                rptContents.ItemTemplate = new RepeaterTemplate(displayInfo.ItemTemplate, null, null, displayInfo.SeparatorRepeatTemplate, displayInfo.SeparatorRepeat, pageInfo, EContextType.Comment, contextInfo);

                rptContents.DataSource = StlDataUtility.GetCommentsDataSource(pageInfo.PublishmentSystemId, contextInfo.ChannelID, contextInfo.ContentID, contextInfo.ItemContainer, displayInfo.StartNum, displayInfo.TotalNum, displayInfo.IsRecommend, displayInfo.OrderByString, displayInfo.Where);

                rptContents.DataBind();

                if (rptContents.Items.Count > 0)
                {
                    parsedContent = ControlUtils.GetControlRenderHtml(rptContents);
                }
            }
            else
            {
                var pdlContents = new ParsedDataList();

                TemplateUtility.PutContentsDisplayInfoToMyDataList(pdlContents, displayInfo);

                pdlContents.ItemTemplate = new DataListTemplate(displayInfo.ItemTemplate, null, null, displayInfo.SeparatorRepeatTemplate, displayInfo.SeparatorRepeat, pageInfo, EContextType.Comment, contextInfo);
                if (!string.IsNullOrEmpty(displayInfo.HeaderTemplate))
                {
                    pdlContents.HeaderTemplate = new SeparatorTemplate(displayInfo.HeaderTemplate);
                }
                if (!string.IsNullOrEmpty(displayInfo.FooterTemplate))
                {
                    pdlContents.FooterTemplate = new SeparatorTemplate(displayInfo.FooterTemplate);
                }
                if (!string.IsNullOrEmpty(displayInfo.SeparatorTemplate))
                {
                    pdlContents.SeparatorTemplate = new SeparatorTemplate(displayInfo.SeparatorTemplate);
                }
                if (!string.IsNullOrEmpty(displayInfo.AlternatingItemTemplate))
                {
                    pdlContents.AlternatingItemTemplate = new DataListTemplate(displayInfo.AlternatingItemTemplate, null, null, displayInfo.SeparatorRepeatTemplate, displayInfo.SeparatorRepeat, pageInfo, EContextType.Comment, contextInfo);
                }

                pdlContents.DataSource = StlDataUtility.GetCommentsDataSource(pageInfo.PublishmentSystemId, contextInfo.ChannelID, contextInfo.ContentID, contextInfo.ItemContainer, displayInfo.StartNum, displayInfo.TotalNum, displayInfo.IsRecommend, displayInfo.OrderByString, displayInfo.Where);
                pdlContents.DataBind();

                if (pdlContents.Items.Count > 0)
                {
                    parsedContent = ControlUtils.GetControlRenderHtml(pdlContents);
                }
            }

            return(parsedContent);
        }
Exemplo n.º 17
0
        public static IEnumerable GetDataSource(PageInfo pageInfo, ContextInfo contextInfo, ContentsDisplayInfo displayInfo)
        {
            var channelId = StlDataUtility.GetNodeIdByLevel(pageInfo.PublishmentSystemId, contextInfo.ChannelID, displayInfo.UpLevel, displayInfo.TopLevel);

            channelId = StlCacheManager.NodeId.GetNodeIdByChannelIdOrChannelIndexOrChannelName(pageInfo.PublishmentSystemId, channelId, displayInfo.ChannelIndex, displayInfo.ChannelName);

            var isTotal = TranslateUtils.ToBool(displayInfo.OtherAttributes[AttributeIsTotal]);

            if (TranslateUtils.ToBool(displayInfo.OtherAttributes[AttributeIsAllChildren]))
            {
                displayInfo.Scope = EScopeType.Descendant;
            }

            return(StlDataUtility.GetChannelsDataSource(pageInfo.PublishmentSystemId, channelId, displayInfo.GroupChannel, displayInfo.GroupChannelNot, displayInfo.IsImageExists, displayInfo.IsImage, displayInfo.StartNum, displayInfo.TotalNum, displayInfo.OrderByString, displayInfo.Scope, isTotal, displayInfo.Where));
        }