public async Task <NavigationItem> GetTreeNodeToNavAsync(Guid linkPageIdentifier) { var DocQuery = DocumentHelper.GetDocuments() .WhereEquals("NodeGuid", linkPageIdentifier) .Culture(_repoContext.CurrentCulture()) .CombineWithDefaultCulture() .CombineWithAnyCulture() .OnCurrentSite() .Columns(nameof(TreeNode.DocumentName), nameof(TreeNode.ClassName), nameof(TreeNode.DocumentCulture), nameof(TreeNode.NodeID), nameof(TreeNode.DocumentID), nameof(TreeNode.DocumentGUID), nameof(TreeNode.NodeGUID), nameof(TreeNode.NodeAliasPath)); if (!_repoContext.PreviewEnabled()) { DocQuery.Published(); } else { DocQuery.LatestVersion(true); DocQuery.Published(false); } var TreeItem = DocQuery.FirstOrDefault(); if (TreeItem == null) { return(null); } return(_Mapper.Map <NavigationItem>(TreeItem)); }
public DocumentQuery GetDocumentQuery(string Path, SiteMapOptions Options, string ClassName = null) { var DocumentQuery = (string.IsNullOrWhiteSpace(ClassName) ? new DocumentQuery() : new DocumentQuery(ClassName)); DocumentQuery .Path(Path, PathTypeEnum.Section) .Culture(DataHelper.GetNotEmpty(Options.CultureCode, _repoContext.CurrentCulture())) .OnSite(Options.SiteName) .Published(Options.SelectOnlyPublished); if (Options.CheckDocumentPermissions.HasValue) { DocumentQuery.CheckPermissions(Options.CheckDocumentPermissions.Value); } if (Options.CombineWithDefaultCulture.HasValue) { DocumentQuery.CombineWithDefaultCulture(Options.CombineWithDefaultCulture.Value); } if (Options.MaxRelativeLevel > -1) { // Get the nesting level of the give path IKenticoSiteMapRepositoryHelper _CachableSelfHelper = (IKenticoSiteMapRepositoryHelper)_serviceProvider.GetService(typeof(IKenticoNavigationRepositoryHelper)); DocumentQuery.NestingLevel(Options.MaxRelativeLevel + _CachableSelfHelper.GetNodeLevel(Path, Options.SiteName)); } if (!string.IsNullOrWhiteSpace(Options.WhereCondition)) { DocumentQuery.Where(Options.WhereCondition); } return(DocumentQuery); }
public async Task <TreeNode> GetBreadcrumbNodeAsync(int NodeID) { return(DocumentHelper.GetDocuments() .WhereEquals("NodeID", NodeID) .Culture(_repoContext.CurrentCulture()) .CombineWithDefaultCulture() .CombineWithAnyCulture() .Published(!_repoContext.PreviewEnabled()) .LatestVersion(_repoContext.PreviewEnabled()) .FirstOrDefault()); }
public IEnumerable <ITreeNode> GetDocumentsByPath(string SinglePath, PathSelectionEnum PathType, string OrderBy = null, string WhereCondition = null, int MaxLevel = -1, int TopNumber = -1, string[] Columns = null, string[] PageTypes = null, bool IncludeCoupledColumns = false, string Culture = null) { return(GetDocumentsByPathInternal(SinglePath, siteService.CurrentSite.SiteName, PathType, OrderBy, WhereCondition, MaxLevel, TopNumber, Columns, PageTypes, IncludeCoupledColumns, (!string.IsNullOrWhiteSpace(Culture) ? Culture : _repoContext.CurrentCulture()))); }