Esempio n. 1
0
        public ActionResult Item(SyndicationFeedPageType currentPage, int?contentId)
        {
            if (!contentId.HasValue)
            {
                return(HttpNotFound("No content Id specified"));
            }

            var contentReference = ContentReference.Parse(contentId.Value.ToString());

            var referencedContent = _feedContentResolver.GetContentReferences(currentPage);

            if (!referencedContent.Contains(contentReference))
            {
                return(HttpNotFound("Content Id not exposed in this feed"));
            }

            var contentArea = new ContentArea();
            var item        = new ContentAreaItem {
                ContentLink = contentReference
            };

            contentArea.Items.Add(item);

            var contentItem = _contentLoader.Get <IContent>(contentReference);

            var model = new ContentHolderModel {
                Tag = currentPage.BlockRenderingTag, ContentArea = contentArea, Content = contentItem
            };

            return(View("~/modules/Chief2moro.SyndicationFeeds/Views/Item.cshtml", model));
        }
Esempio n. 2
0
        /// <summary>
        /// Gets a list of populated syndication items created from the dependent content references on the gived SyndicationFeedPage.
        /// </summary>
        /// <returns></returns>
        public IEnumerable <SyndicationItem> GetSyndicationItems()
        {
            var dependentContentItems = FeedContentResolver.GetContentReferences(FeedPage);
            var syndicationItems      = dependentContentItems.Select(CreateItemFromReference).ToList();

            return(syndicationItems.OrderByDescending(c => c.LastUpdatedTime).Take(FeedPage.MaximumItems));
        }
Esempio n. 3
0
 public IEnumerable <SyndicationItem> GetSyndicationItems()
 {
     return(_feedContentResolver.GetContentReferences(_feedPage)
            .Select(CreateItemFromReference)
            .Where(i => i != null)
            .Where(i => _feedPage.IncludeItemsWithoutSummary || !string.IsNullOrEmpty(i.Summary.Text))
            .OrderByDescending(c => c.PublishDate)
            .Take(_feedPage.MaximumItems)
            .ToList());
 }
Esempio n. 4
0
        /// <summary>
        /// Gets a list of populated syndication items created from the dependent content references on the gived SyndicationFeedPage.
        /// </summary>
        /// <returns></returns>
        public IEnumerable <SyndicationItem> GetSyndicationItems()
        {
            var contentReferences = FeedContentResolver.GetContentReferences(FeedContext);
            var contentItems      = ContentLoader.GetItems(contentReferences, new LoaderOptions {
                LanguageLoaderOption.Fallback()
            });
            var filteredItems    = FeedFilterer.FilterSyndicationContent(contentItems, FeedContext);
            var syndicationItems = filteredItems.Select(CreateSyndicationItem).ToList();

            return(syndicationItems.OrderByDescending(c => c.LastUpdatedTime).Take(FeedContext.FeedPageType.MaximumItems));
        }