Example #1
0
        public static void RenderRss(IEnumerable <RssItem> rssItems = null, string rssTitle = "", string rssDescription = "", string rssLink = "")
        {
            if (rssItems == null)
            {
                rssItems = MediaDetailsMapper.GetRssItems(MediaDetailsMapper.GetAllChildMediaDetails(FrameworkSettings.Current.CurrentMedia.ID, FrameworkSettings.Current.CurrentLanguage.ID).Where(i => i.CanRender && i.MediaType.ShowInSiteTree).OrderByDescending(i => i.PublishDate));
            }

            if (rssLink == "")
            {
                if (FrameworkSettings.Current.CurrentMediaDetail != null)
                {
                    rssLink = URIHelper.ConvertToAbsUrl(FrameworkSettings.Current.CurrentMediaDetail.VirtualPath);
                }
                else
                {
                    rssLink = URIHelper.ConvertToAbsUrl(URIHelper.GetCurrentVirtualPath());
                }
            }

            if (rssTitle == "")
            {
                rssTitle = FrameworkSettings.Current.CurrentMediaDetail.Title;
            }

            if (rssDescription == "")
            {
                rssDescription = FrameworkSettings.Current.CurrentMediaDetail.GetMetaDescription();
            }

            Rss rss = new Rss(rssTitle, rssLink, rssDescription);

            rss.Items = rssItems;

            var Response = HttpContext.Current.Response;

            Response.ContentEncoding = System.Text.Encoding.UTF8;
            Response.ContentType     = "text/xml";

            RssHelper.WriteRss(rss, Response.OutputStream);

            Response.Flush();
            Response.End();
        }
 public void SetParentItem(IMediaDetail mediaDetail)
 {
     SetItems(MediaDetailsMapper.GetAllChildMediaDetails(mediaDetail.MediaID, BasePage.CurrentLanguage.ID));
 }
Example #3
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            if (renderParentNav)
            {
                Media parentMedia = null;

                if (this.BasePage.CurrentMedia.ParentMediaID != null)
                {
                    parentMedia = MediasMapper.GetByID((long)this.BasePage.CurrentMedia.ParentMediaID);
                }

                if (parentMedia == null)
                {
                    return;
                }

                var children = MediaDetailsMapper.FilterByMediaTypeShowInMenuStatus(MediaDetailsMapper.FilterByShowInMenuStatus(MediaDetailsMapper.FilterByCanRenderStatus(MediaDetailsMapper.GetAllChildMediaDetails(parentMedia.ID, this.BasePage.CurrentLanguage.ID), true), true), true);

                if (children.Count() > 0)
                {
                    GenerateNav.RootMedia = parentMedia;
                }
                else
                {
                    if (parentMedia.ParentMediaID == null)
                    {
                        return;
                    }

                    parentMedia = MediasMapper.GetByID((long)parentMedia.ParentMediaID);

                    //if ((parentMedia != null) && (parentMedia.ID != FrameworkSettings.RootMedia.ID))
                    if (parentMedia != null)
                    {
                        GenerateNav.RootMedia = parentMedia;
                    }
                }
            }
            else
            {
                GenerateNav.RootMedia = this.BasePage.CurrentMedia;
            }
        }