private void EnsurePageUrl() { if (string.IsNullOrEmpty(UrlSegment)) { UrlSegment = PageNameBuilder.PageNameToUrl(PageName, ParentId); } }
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); }
public string SetPageUrl(string pageName) { UrlSegment = PageNameBuilder.PageNameToUrl(pageName, ParentId); return(UrlSegment); }