private DataTable GetEntriesTable() { DataTable entriesTable = FeedCache.GetRssFeedEntries( ModuleId, ModuleGuid, entryCacheTimeout, maxDaysOld, maxEntriesPerFeed, EnableSelectivePublishing); return(entriesTable); }
private DataView GetEntriesTable() { DataTable entriesTable = null; entriesTable = FeedCache.GetRssFeedEntries( ModuleId, module.ModuleGuid, entryCacheTimeout, maxDaysOld, maxEntriesPerFeed, EnableSelectivePublishing); return(entriesTable.DefaultView); }
private void btnUpdate_Click(object sender, EventArgs e) { Page.Validate("feeds"); if (!Page.IsValid) { return; } RssFeed feed = new RssFeed(ModuleId, ItemId); feed.ModuleId = ModuleId; feed.Author = txtAuthor.Text; feed.Url = txtWebSite.Text; feed.RssUrl = txtRssUrl.Text; feed.ImageUrl = txtImageUrl.Text; int sortRank = 500; int.TryParse(txtSortRank.Text, out sortRank); feed.SortRank = sortRank; SiteUser siteUser = SiteUtils.GetCurrentSiteUser(); if (siteUser == null) { return; } Module module = new Module(ModuleId); feed.ModuleGuid = module.ModuleGuid; feed.UserId = siteUser.UserId; feed.UserGuid = siteUser.UserGuid; feed.LastModUserGuid = siteUser.UserGuid; feed.PublishByDefault = chkPublishByDefault.Checked; if (feed.Save()) { CurrentPage.UpdateLastModifiedTime(); FeedCache.RefreshFeed( feed, ModuleId, module.ModuleGuid, _maxDaysOld, _maxEntriesPerFeed, EnableSelectivePublishing); String rssFriendlyUrl = "aggregator" + ModuleId.ToString(CultureInfo.InvariantCulture) + "rss.aspx"; if (!FriendlyUrl.Exists(siteSettings.SiteId, rssFriendlyUrl)) { FriendlyUrl friendlyUrl = new FriendlyUrl(); friendlyUrl.SiteId = siteSettings.SiteId; friendlyUrl.SiteGuid = siteSettings.SiteGuid; friendlyUrl.Url = rssFriendlyUrl; friendlyUrl.RealUrl = "~/FeedManager/FeedAggregate.aspx?mid=" + ModuleId.ToString(CultureInfo.InvariantCulture); friendlyUrl.Save(); } if (hdnReturnUrl.Value.Length > 0) { WebUtils.SetupRedirect(this, hdnReturnUrl.Value); return; } WebUtils.SetupRedirect(this, SiteUtils.GetCurrentPageUrl()); } }
private void RenderRss(int moduleId) { Response.ContentType = "text/xml"; Response.ContentEncoding = System.Text.Encoding.UTF8; //Cynthia.Business.RssFeed feed = new Cynthia.Business.RssFeed(moduleId); Module module = GetModule(); Hashtable moduleSettings = ModuleSettings.GetModuleSettings(moduleId); feedListCacheTimeout = WebUtils.ParseInt32FromHashtable( moduleSettings, "RSSFeedFeedListCacheTimeoutSetting", 3660); entryCacheTimeout = WebUtils.ParseInt32FromHashtable( moduleSettings, "RSSFeedEntryCacheTimeoutSetting", 3620); maxDaysOld = WebUtils.ParseInt32FromHashtable( moduleSettings, "RSSFeedMaxDayCountSetting", 90); maxEntriesPerFeed = WebUtils.ParseInt32FromHashtable( moduleSettings, "RSSFeedMaxPostsPerFeedSetting", 90); EnableSelectivePublishing = WebUtils.ParseBoolFromHashtable( moduleSettings, "EnableSelectivePublishing", EnableSelectivePublishing); DataView dv = FeedCache.GetRssFeedEntries( module.ModuleId, module.ModuleGuid, entryCacheTimeout, maxDaysOld, maxEntriesPerFeed, EnableSelectivePublishing).DefaultView; dv.Sort = "PubDate DESC"; //if (EnableSelectivePublishing) //{ // dv.RowFilter = "Confirmed = true"; //} RssChannel channel = new RssChannel(); object value = GetModule(); Module m; if (value != null) { m = (Module)value; channel.Title = m.ModuleTitle; channel.Description = m.ModuleTitle; channel.LastBuildDate = channel.Items.LatestPubDate(); channel.Link = new System.Uri(SiteUtils.GetCurrentPageUrl()); } else { // this prevents an error: Can't close RssWriter without first writing a channel. channel.Title = "Not Found"; channel.Description = "Not Found"; channel.LastBuildDate = DateTime.UtcNow; //channel.Link = new System.Uri(SiteUtils.GetCurrentPageUrl()); } foreach (DataRowView row in dv) { bool confirmed = Convert.ToBoolean(row["Confirmed"]); if (!EnableSelectivePublishing) { confirmed = true; } if (confirmed) { RssItem item = new RssItem(); item.Title = row["Title"].ToString(); item.Description = row["Description"].ToString(); item.PubDate = Convert.ToDateTime(row["PubDate"]); item.Link = new System.Uri(row["Link"].ToString()); Trace.Write(item.Link.ToString()); item.Author = row["Author"].ToString(); channel.Items.Add(item); } } Rss.RssFeed rss = new Rss.RssFeed(); rss.Encoding = System.Text.Encoding.UTF8; rss.Channels.Add(channel); rss.Write(Response.OutputStream); //Response.End(); }