Beispiel #1
0
        public HtmlString GetRSSFeed(string feedType)
        {
            SiteData.RSSFeedInclude FeedType = SiteData.RSSFeedInclude.BlogAndPages;

            if (!String.IsNullOrEmpty(feedType))
            {
                FeedType = (SiteData.RSSFeedInclude)Enum.Parse(typeof(SiteData.RSSFeedInclude), feedType, true);
            }

            string sRSSXML = SiteData.CurrentSite.GetRSSFeed(FeedType);

            return(new HtmlString(sRSSXML));
        }
        public static MvcHtmlString RssTextLink(SiteData.RSSFeedInclude mode, string linkText = "RSS", object linkAttributes = null)
        {
            var anchorBuilder = new TagBuilder("a");

            anchorBuilder.MergeAttribute("href", String.Format("{0}?type={1}", CarrotCakeHtml.RssUri, mode));

            var lnkAttribs = (IDictionary <string, object>)HtmlHelper.AnonymousObjectToHtmlAttributes(linkAttributes);

            anchorBuilder.MergeAttributes(lnkAttribs);

            anchorBuilder.InnerHtml = linkText;

            return(MvcHtmlString.Create(anchorBuilder.ToString()));
        }
Beispiel #3
0
        public void RenderRSSFeed(HttpContext context)
        {
            SiteData.RSSFeedInclude FeedType = SiteData.RSSFeedInclude.BlogAndPages;

            if (!String.IsNullOrEmpty(context.Request.QueryString["type"]))
            {
                string feedType = context.Request.QueryString["type"].ToString();

                FeedType = (SiteData.RSSFeedInclude)Enum.Parse(typeof(SiteData.RSSFeedInclude), feedType, true);
            }

            string sRSSXML = SiteData.CurrentSite.GetRSSFeed(FeedType);

            context.Response.ContentType = SiteData.RssDocType;

            context.Response.Write(sRSSXML);

            context.Response.StatusCode        = 200;
            context.Response.StatusDescription = "OK";
        }
        public static MvcHtmlString RssLink(SiteData.RSSFeedInclude mode,
                                            string imagePath       = "",
                                            string imageAltText    = "RSS",
                                            object imageAttributes = null,
                                            object linkAttributes  = null)
        {
            var url = new UrlHelper(Html.ViewContext.RequestContext);

            var anchorBuilder = new TagBuilder("a");

            anchorBuilder.MergeAttribute("href", String.Format("{0}?type={1}", CarrotCakeHtml.RssUri, mode));

            var lnkAttribs = (IDictionary <string, object>)HtmlHelper.AnonymousObjectToHtmlAttributes(linkAttributes);

            anchorBuilder.MergeAttributes(lnkAttribs);

            if (String.IsNullOrEmpty(imagePath))
            {
                imagePath = ControlUtilities.GetWebResourceUrl("Carrotware.CMS.UI.Components.feed.png");
            }

            var imgBuilder = new TagBuilder("img");

            imgBuilder.MergeAttribute("src", url.Content(imagePath));
            imgBuilder.MergeAttribute("alt", imageAltText);
            imgBuilder.MergeAttribute("title", imageAltText);

            var imgAttribs = (IDictionary <string, object>)HtmlHelper.AnonymousObjectToHtmlAttributes(imageAttributes);

            imgBuilder.MergeAttributes(imgAttribs);

            string imgHtml = imgBuilder.ToString(TagRenderMode.SelfClosing);

            anchorBuilder.InnerHtml = imgHtml;

            return(MvcHtmlString.Create(anchorBuilder.ToString()));
        }
 public static HtmlString Rss(SiteData.RSSFeedInclude mode)
 {
     return(new HtmlString(String.Format("<!-- RSS Header Feed --> <link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS Feed\" href=\"{0}?type={1}\" /> ", CarrotCakeHtml.RssUri, mode)));
 }