public static string GetChannelPageFilePath(SiteInfo siteInfo, int channelId, int currentPageIndex)
        {
            var nodeInfo = ChannelManager.GetChannelInfo(siteInfo.Id, channelId);

            if (nodeInfo.ParentId == 0)
            {
                var templateInfo = TemplateManager.GetDefaultTemplateInfo(siteInfo.Id, TemplateType.IndexPageTemplate);
                return(GetIndexPageFilePath(siteInfo, templateInfo.CreatedFileFullName, siteInfo.IsRoot, currentPageIndex));
            }
            var filePath = nodeInfo.FilePath;

            if (string.IsNullOrEmpty(filePath))
            {
                filePath = ChannelFilePathRules.Parse(siteInfo, channelId);
            }

            filePath = MapPath(siteInfo, filePath);// PathUtils.Combine(sitePath, filePath);
            if (PathUtils.IsDirectoryPath(filePath))
            {
                filePath = PathUtils.Combine(filePath, channelId + ".html");
            }
            DirectoryUtils.CreateDirectoryIfNotExists(filePath);

            if (currentPageIndex != 0)
            {
                string appendix = $"_{(currentPageIndex + 1)}";
                var    fileName = PathUtils.GetFileNameWithoutExtension(filePath) + appendix + PathUtils.GetExtension(filePath);
                filePath = PathUtils.Combine(DirectoryUtils.GetDirectoryPath(filePath), fileName);
            }

            return(filePath);
        }
Beispiel #2
0
        public static string GetChannelPageFilePath(PublishmentSystemInfo publishmentSystemInfo, int nodeId, int currentPageIndex)
        {
            var nodeInfo = NodeManager.GetNodeInfo(publishmentSystemInfo.PublishmentSystemId, nodeId);

            if (nodeInfo.NodeType == ENodeType.BackgroundPublishNode)
            {
                var templateInfo = TemplateManager.GetDefaultTemplateInfo(publishmentSystemInfo.PublishmentSystemId, ETemplateType.IndexPageTemplate);
                return(GetIndexPageFilePath(publishmentSystemInfo, templateInfo.CreatedFileFullName, publishmentSystemInfo.IsHeadquarters, currentPageIndex));
            }
            var filePath = nodeInfo.FilePath;

            if (string.IsNullOrEmpty(filePath))
            {
                filePath = ChannelFilePathRules.Parse(publishmentSystemInfo, nodeId);
            }

            filePath = MapPath(publishmentSystemInfo, filePath);// PathUtils.Combine(publishmentSystemPath, filePath);
            if (PathUtils.IsDirectoryPath(filePath))
            {
                filePath = PathUtils.Combine(filePath, nodeId + ".html");
            }
            DirectoryUtils.CreateDirectoryIfNotExists(filePath);

            if (currentPageIndex != 0)
            {
                string appendix = $"_{(currentPageIndex + 1)}";
                var    fileName = PathUtils.GetFileNameWithoutExtension(filePath) + appendix + PathUtils.GetExtension(filePath);
                filePath = PathUtils.Combine(DirectoryUtils.GetDirectoryPath(filePath), fileName);
            }

            return(filePath);
        }