예제 #1
0
 private void EnsurePageUrl()
 {
     if (string.IsNullOrEmpty(UrlSegment))
     {
         UrlSegment = PageNameBuilder.PageNameToUrl(PageName, ParentId);
     }
 }
예제 #2
0
        internal void MovePage(Guid pageId, Guid targetId, int position)
        {
            var changedItems = new List <PageIndexItem>();

            for (var i = 0; i < _pageIndex.Count; i++)
            {
                var pageIndexItem = _pageIndex[i];

                if (pageIndexItem.PageId != pageId)
                {
                    continue;
                }

                if (pageIndexItem.ParentId == targetId)
                {
                    return;
                }

                RedirectManager.StorePageLinks(new CmsPage(pageIndexItem, LanguageId));

                if (pageIndexItem.ParentId == Guid.Empty)
                {
                    i = DetachPageFromRoot(i, pageIndexItem);
                }
                else
                {
                    DetachPage(pageIndexItem, i);
                }

                if (targetId == Guid.Empty)
                {
                    pageIndexItem.UrlSegment     = PageNameBuilder.GetUniqueUrl(targetId, pageIndexItem.UrlSegment);
                    pageIndexItem.UrlSegmentHash = pageIndexItem.UrlSegment.GetHashCode();
                    pageIndexItem.ParentId       = targetId;
                    var firstSibling = _pageIndex[0];
                    pageIndexItem.NextPage = firstSibling.NextPage;
                    firstSibling.NextPage  = i;

                    UpdateNodeAfterMove(changedItems, "", pageId, 0, pageIndexItem);
                }
                else
                {
                    var targetPage = GetPageIndexItem(targetId);
                    pageIndexItem.UrlSegment     = PageNameBuilder.GetUniqueUrl(targetPage.PageId, pageIndexItem.UrlSegment);
                    pageIndexItem.UrlSegmentHash = pageIndexItem.UrlSegment.GetHashCode();
                    pageIndexItem.ParentId       = targetId;
                    pageIndexItem.NextPage       = targetPage.FirstChild;
                    targetPage.FirstChild        = i;

                    UpdateNodeAfterMove(changedItems, targetPage.PageUrl, targetPage.RootId, targetPage.TreeLevel, pageIndexItem);
                }

                break;
            }

            PageData.UpdateStructure(changedItems);
        }
예제 #3
0
 public string SetPageUrl(string pageName)
 {
     UrlSegment = PageNameBuilder.PageNameToUrl(pageName, ParentId);
     return(UrlSegment);
 }