예제 #1
0
        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));
        }
예제 #2
0
        // 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));
        }
예제 #3
0
        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));
            }
        }
예제 #4
0
        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));
            }
        }
예제 #5
0
        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);
        }
예제 #6
0
        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);
        }
예제 #7
0
        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));
        }
예제 #8
0
        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));
        }
예제 #9
0
 public static PathData EnsureDraft(IVersionManager versions, ContentVersionRepository versionRepository, Edit.Navigator navigator, NameValueCollection request)
 {
     return(EnsureDraft(versions, versionRepository, navigator, key => request[key]));
 }
예제 #10
0
 public static ContentItem GetBelowItem(Edit.Navigator navigator, NameValueCollection request, ContentItem page)
 {
     return(GetBelowItem(navigator, key => request[key], page));
 }