コード例 #1
0
ファイル: StlTree.cs プロジェクト: yankaics/cms-1
        private static string ParseImplNotAjax(PageInfo pageInfo, ContextInfo contextInfo, string channelIndex, string channelName, int upLevel, int topLevel, string groupChannel, string groupChannelNot, string title, bool isShowContentNum, bool isShowTreeLine, string currentFormatString)
        {
            var channelID = StlDataUtility.GetNodeIdByLevel(pageInfo.PublishmentSystemId, contextInfo.ChannelID, upLevel, topLevel);

            channelID = StlCacheManager.NodeId.GetNodeIdByChannelIdOrChannelIndexOrChannelName(pageInfo.PublishmentSystemId, channelID, channelIndex, channelName);

            var channel = NodeManager.GetNodeInfo(pageInfo.PublishmentSystemId, channelID);

            var target = "";

            var htmlBuilder = new StringBuilder();

            htmlBuilder.Append(@"<table border=""0"" cellpadding=""0"" cellspacing=""0"" style=""width:100%;"">");

            var theNodeIdList   = DataProvider.NodeDao.GetNodeIdListByScopeType(channel, EScopeType.All, groupChannel, groupChannelNot);
            var isLastNodeArray = new bool[theNodeIdList.Count];
            var nodeIDArrayList = new List <int>();

            var currentNodeInfo = NodeManager.GetNodeInfo(pageInfo.PublishmentSystemId, pageInfo.PageNodeId);

            if (currentNodeInfo != null)
            {
                nodeIDArrayList = TranslateUtils.StringCollectionToIntList(currentNodeInfo.ParentsPath);
                nodeIDArrayList.Add(currentNodeInfo.NodeId);
            }

            foreach (int theNodeID in theNodeIdList)
            {
                var theNodeInfo = NodeManager.GetNodeInfo(pageInfo.PublishmentSystemId, theNodeID);
                var nodeInfo    = new NodeInfo(theNodeInfo);
                if (theNodeID == pageInfo.PublishmentSystemId && !string.IsNullOrEmpty(title))
                {
                    nodeInfo.NodeName = title;
                }
                var isDisplay = nodeIDArrayList.Contains(theNodeID);
                if (!isDisplay)
                {
                    isDisplay = (nodeInfo.ParentId == channelID || nodeIDArrayList.Contains(nodeInfo.ParentId));
                }

                var selected = (theNodeID == channelID);
                if (!selected && nodeIDArrayList.Contains(nodeInfo.NodeId))
                {
                    selected = true;
                }
                var hasChildren = (nodeInfo.ChildrenCount != 0);

                var linkUrl = PageUtility.GetChannelUrl(pageInfo.PublishmentSystemInfo, theNodeInfo);
                var level   = theNodeInfo.ParentsCount - channel.ParentsCount;
                var item    = new StlTreeItemNotAjax(isDisplay, selected, pageInfo, nodeInfo, hasChildren, linkUrl, target, isShowTreeLine, isShowContentNum, isLastNodeArray, currentFormatString, channelID, level);

                htmlBuilder.Append(item.GetTrHtml());
            }

            htmlBuilder.Append("</table>");

            pageInfo.AddPageScriptsIfNotExists(PageInfo.JsAgStlTreeNotAjax, StlTreeItemNotAjax.GetNodeTreeScript(pageInfo));

            return(htmlBuilder.ToString());
        }
コード例 #2
0
ファイル: StlTree.cs プロジェクト: zhouwybetter/cms
        private static string ParseImplNotAjax(PageInfo pageInfo, ContextInfo contextInfo, string channelIndex, string channelName, int upLevel, int topLevel, string groupChannel, string groupChannelNot, string title, bool isShowContentNum, bool isShowTreeLine, string currentFormatString)
        {
            var channelId = StlDataUtility.GetChannelIdByLevel(pageInfo.SiteId, contextInfo.ChannelId, upLevel, topLevel);

            channelId = StlDataUtility.GetChannelIdByChannelIdOrChannelIndexOrChannelName(pageInfo.SiteId, channelId, channelIndex, channelName);

            var channel = ChannelManager.GetChannelInfo(pageInfo.SiteId, channelId);

            var target = "";

            var htmlBuilder = new StringBuilder();

            htmlBuilder.Append(@"<table border=""0"" cellpadding=""0"" cellspacing=""0"" style=""width:100%;"">");

            //var theChannelIdList = DataProvider.ChannelDao.GetIdListByScopeType(channel.ChannelId, channel.ChildrenCount, EScopeType.All, groupChannel, groupChannelNot);
            var theChannelIdList = ChannelManager.GetChannelIdList(channel, EScopeType.All, groupChannel, groupChannelNot, string.Empty);
            var isLastNodeArray  = new bool[theChannelIdList.Count];
            var channelIdList    = new List <int>();

            var currentChannelInfo = ChannelManager.GetChannelInfo(pageInfo.SiteId, pageInfo.PageChannelId);

            if (currentChannelInfo != null)
            {
                channelIdList = TranslateUtils.StringCollectionToIntList(currentChannelInfo.ParentsPath);
                channelIdList.Add(currentChannelInfo.Id);
            }

            foreach (var theChannelId in theChannelIdList)
            {
                var theChannelInfo = ChannelManager.GetChannelInfo(pageInfo.SiteId, theChannelId);
                var nodeInfo       = new ChannelInfo(theChannelInfo);
                if (theChannelId == pageInfo.SiteId && !string.IsNullOrEmpty(title))
                {
                    nodeInfo.ChannelName = title;
                }
                var isDisplay = channelIdList.Contains(theChannelId);
                if (!isDisplay)
                {
                    isDisplay = nodeInfo.ParentId == channelId || channelIdList.Contains(nodeInfo.ParentId);
                }

                var selected = theChannelId == channelId;
                if (!selected && channelIdList.Contains(nodeInfo.Id))
                {
                    selected = true;
                }
                var hasChildren = nodeInfo.ChildrenCount != 0;

                var linkUrl = PageUtility.GetChannelUrl(pageInfo.SiteInfo, theChannelInfo, pageInfo.IsLocal);
                var level   = theChannelInfo.ParentsCount - channel.ParentsCount;
                var item    = new StlTreeItemNotAjax(isDisplay, selected, pageInfo, nodeInfo, hasChildren, linkUrl, target, isShowTreeLine, isShowContentNum, isLastNodeArray, currentFormatString, channelId, level);

                htmlBuilder.Append(item.GetTrHtml());
            }

            htmlBuilder.Append("</table>");

            if (!pageInfo.BodyCodes.ContainsKey(PageInfo.Const.JsAgStlTreeNotAjax))
            {
                pageInfo.BodyCodes.Add(PageInfo.Const.JsAgStlTreeNotAjax, StlTreeItemNotAjax.GetNodeTreeScript(pageInfo));
            }

            return(htmlBuilder.ToString());
        }