public static ContentItem GetBelowItem(Edit.Navigator navigator, NameValueCollection request, ContentItem page) { ContentItem item = page.FindDescendantByVersionKey(request["belowVersionKey"]); if (item != null) { return(item); } var parent = navigator.Navigate(request["below"]); return(parent == null ? null : page.FindPartVersion(parent)); }
// locate an item by VersionKey on a page (used for DRAFTs) public static ContentItem GetBeforeItem(Edit.Navigator navigator, NameValueCollection request, ContentItem page) { ContentItem item = page.FindDescendantByVersionKey(request["beforeVersionKey"]); if (item != null) { return(item); } ContentItem beforeItem = navigator.Navigate(request["before"]); return(beforeItem == null ? null : page.FindPartVersion(beforeItem)); }
public static ContentItem GetBelowItem(Edit.Navigator navigator, System.Collections.Specialized.NameValueCollection request, ContentItem page) { string below = request["below"]; string belowVersionKey = request["belowVersionKey"]; if (!string.IsNullOrEmpty(belowVersionKey)) { return(page.FindDescendantByVersionKey(belowVersionKey)); } else { var parent = navigator.Navigate(below); return(page.FindPartVersion(parent)); } }
public static ContentItem GetBelowItem(Edit.Navigator navigator, Func <string, string> requestValueAccessor, ContentItem page) { string below = requestValueAccessor("below"); string belowVersionKey = requestValueAccessor("belowVersionKey"); if (!string.IsNullOrEmpty(belowVersionKey)) { return(page.FindDescendantByVersionKey(belowVersionKey)); } else { var parent = navigator.Navigate(below); return(page.FindPartVersion(parent)); } }
public static ContentItem GetBeforeItem(Edit.Navigator navigator, System.Collections.Specialized.NameValueCollection request, ContentItem page) { string before = request["before"]; string beforeVersionKey = request["beforeVersionKey"]; if (!string.IsNullOrEmpty(before)) { ContentItem beforeItem = navigator.Navigate(before); return(page.FindPartVersion(beforeItem)); } else if (!string.IsNullOrEmpty(beforeVersionKey)) { return(page.FindDescendantByVersionKey(beforeVersionKey)); } return(null); }
public static ContentItem GetBeforeItem(Edit.Navigator navigator, Func <string, string> requestValueAccessor, ContentItem page) { string before = requestValueAccessor("before"); string beforeVersionKey = requestValueAccessor("beforeVersionKey"); if (!string.IsNullOrEmpty(beforeVersionKey)) { ContentItem beforeItem = page.FindDescendantByVersionKey(beforeVersionKey); if (beforeItem != null) { return(beforeItem); } } if (!string.IsNullOrEmpty(before)) { ContentItem beforeItem = navigator.Navigate(before); return(page.FindPartVersion(beforeItem)); } return(null); }
public static PathData EnsureDraft(IVersionManager versions, ContentVersionRepository versionRepository, Edit.Navigator navigator, NameValueCollection request) { var item = navigator.Navigate(request["item"]); item = versionRepository.ParseVersion(request[PathData.VersionIndexQueryKey], request["versionKey"], item) ?? item; var page = Find.ClosestPage(item); if (!page.VersionOf.HasValue) { page = versions.AddVersion(page, asPreviousVersion: false); item = page.FindPartVersion(item); } return(new PathData(page, item)); }
public static PathData EnsureDraft(IVersionManager versions, ContentVersionRepository versionRepository, Edit.Navigator navigator, Func <string, string> requestValueAccessor) { var item = navigator.Navigate(requestValueAccessor(PathData.ItemQueryKey)); return(EnsureDraft(versions, versionRepository, requestValueAccessor(PathData.VersionIndexQueryKey), requestValueAccessor(PathData.VersionKeyQueryKey), item)); }
public static PathData EnsureDraft(IVersionManager versions, ContentVersionRepository versionRepository, Edit.Navigator navigator, NameValueCollection request) { return(EnsureDraft(versions, versionRepository, navigator, key => request[key])); }
public static ContentItem GetBelowItem(Edit.Navigator navigator, NameValueCollection request, ContentItem page) { return(GetBelowItem(navigator, key => request[key], page)); }