internal static PageIndex CreatePageIndex(int languageId) { var pageIndexItems = PageData.GetPageStructure(languageId); var pageIndex = new PageIndex(pageIndexItems) {LanguageId = languageId}; FixDatesForIndex(pageIndex); pageIndex.WriteIndexToLog(); return pageIndex; }
internal static PageIndex CreatePageIndex(int languageId) { var pageIndexItems = PageData.GetPageStructure(languageId); var pageIndex = new PageIndex(pageIndexItems) { LanguageId = languageId }; FixDatesForIndex(pageIndex); pageIndex.WriteIndexToLog(); return(pageIndex); }
// TODO: Fininsh implementation of date restriction for children (currently commented code below) private static void FixDatesForIndex(PageIndex pageIndex) { foreach (var page in pageIndex.Items) { /* bool isDeleted = false; * DateTime? parentDeleteDate = DateTime.MinValue; * DateTime? parentStartDate = DateTime.MinValue; * DateTime? parentStopDate = DateTime.MaxValue;*/ var fullPath = page.PageUrl; var currentPageId = page.ParentId; if (currentPageId != Guid.Empty) { var parentPage = pageIndex.GetPageIndexItem(currentPageId); fullPath = parentPage.PageUrl + "/" + fullPath; /* if (parentPage.DeletedDate != null) { * throw new NotImplementedException("Should not be reached!"); * isDeleted = true; * parentDeleteDate = parentPage.DeletedDate; * } * if (parentStartDate < parentPage.StartPublish) { * parentStartDate = parentPage.StartPublish; * } * if (parentPage.StopPublish != null && parentPage.StopPublish < parentStopDate) { * parentStopDate = parentPage.StopPublish; * }*/ } fullPath = fullPath.ToLower(); page.PageUrl = fullPath.Replace("//", "/") + "/"; /* * //The page startpublish is older then any parents.. obey the parent! * if (page.StartPublish < parentStartDate) { * page.StartPublish = parentStartDate; * } * * if (parentStopDate != null && page.StopPublish > parentStopDate) { * page.StopPublish = parentStopDate; * }*/ } }
// TODO: Fininsh implementation of date restriction for children (currently commented code below) private static void FixDatesForIndex(PageIndex pageIndex) { foreach (var page in pageIndex.Items) { /* bool isDeleted = false; DateTime? parentDeleteDate = DateTime.MinValue; DateTime? parentStartDate = DateTime.MinValue; DateTime? parentStopDate = DateTime.MaxValue;*/ var fullPath = page.PageUrl; var currentPageId = page.ParentId; if (currentPageId != Guid.Empty) { var parentPage = pageIndex.GetPageIndexItem(currentPageId); fullPath = parentPage.PageUrl + "/" + fullPath; /* if (parentPage.DeletedDate != null) { throw new NotImplementedException("Should not be reached!"); isDeleted = true; parentDeleteDate = parentPage.DeletedDate; } if (parentStartDate < parentPage.StartPublish) { parentStartDate = parentPage.StartPublish; } if (parentPage.StopPublish != null && parentPage.StopPublish < parentStopDate) { parentStopDate = parentPage.StopPublish; }*/ } fullPath = fullPath.ToLower(); page.PageUrl = fullPath.Replace("//", "/") + "/"; /* //The page startpublish is older then any parents.. obey the parent! if (page.StartPublish < parentStartDate) { page.StartPublish = parentStartDate; } if (parentStopDate != null && page.StopPublish > parentStopDate) { page.StopPublish = parentStopDate; }*/ } }