// find item (and optional version) from request values (compare WebExtension.GetEditableWrapper) public static ContentItem FindItem(IVersionManager versions, ContentVersionRepository versionRepository, Navigator navigator, NameValueCollection request) { var item = navigator.Navigate(request[PathData.ItemQueryKey]); return(versionRepository.ParseVersion(request[PathData.VersionIndexQueryKey], request[PathData.VersionKeyQueryKey], item) ?? item); }
public static PathData EnsureDraft(IVersionManager versions, ContentVersionRepository versionRepository, string versionIndex, string versionKey, ContentItem item) { item = versionRepository.ParseVersion(versionIndex, versionKey, item) ?? item; var page = Find.ClosestPage(item); if (!page.VersionOf.HasValue) { page = versions.GetOrCreateDraft(page); item = page.FindPartVersion(item); } return(new PathData(page, item)); }
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)); }