Beispiel #1
0
        private void NewsletterFeed(string newsletterName, XmlTextWriter newsletter)
        {
            NewsletterManager nm = new NewsletterManager(Federation, TheLinkMaker);
            TopicVersionInfo info = Federation.GetTopicInfo(newsletterName);
            if (!info.Exists)
            {
                throw new Exception("Newsletter " + newsletterName + "  does not exist.");
            }
            if (!info.HasProperty("Topics"))
            {
                throw new Exception("Topic " + newsletterName + " is not a newsletter; no Topics property defined.");
            }
            string desc = info.GetProperty("Description");
            if (desc == null)
            {
                desc = "";
            }

            newsletter.WriteStartDocument();
            newsletter.WriteStartElement("rss");
            newsletter.WriteAttributeString("version", "2.0");
            newsletter.WriteStartElement("channel");
            newsletter.WriteElementString("title", newsletterName);
            newsletter.WriteElementString("description", desc);

            Uri link = new Uri(new Uri(FullRootUrl(Request)), TheLinkMaker.LinkToTopic(info.TopicRevision, true));
            newsletter.WriteElementString("link", link.AbsoluteUri);

            DateTime last = DateTime.MinValue;
            foreach (TopicName topic in nm.AllTopicsForNewsletter(info.TopicRevision))
            {
                FormatRssItem(topic, newsletter);
                TopicVersionInfo each = new TopicVersionInfo(Federation, new QualifiedTopicRevision(topic));
                DateTime lm = each.LastModified;
                if (lm > last)
                {
                    last = lm;
                }
            }

            newsletter.WriteElementString("lastBuildDate", last.ToUniversalTime().ToString("r"));

            newsletter.WriteEndElement();
            newsletter.WriteEndElement();
        }
 private void ReallyDoWork()
 {
     DaemonBasedDeliveryBoy boy = new DaemonBasedDeliveryBoy(_sendAsAttachments, Federation.Application);
     LinkMaker lm = new LinkMaker(_rootUrl);
     NewsletterManager manager = new NewsletterManager(Federation, lm, boy, _newslettersFrom, _headInsert);
     LogEvent ev = Federation.LogEventFactory.CreateAndStartEvent(null, null, null, LogEventType.NewsletterGeneration);
     try
     {
         manager.Notify();
     }
     finally
     {
         ev.Record();
     }
 }
Beispiel #3
0
		void ShowNewsletters(string ns)
		{
			Response.Write(@"<h1>Newsletters</h1>");
			
			NewsletterManager nm = new NewsletterManager(Federation, TheLinkMaker);

			Hashtable hash = new Hashtable();
			foreach (QualifiedTopicRevision newsletterName in nm.GetAllNewsletterNames(ns))
			{
				ArrayList topicsInThisNamespace = (ArrayList)hash[newsletterName.Namespace];
				if (topicsInThisNamespace == null)
				{
					topicsInThisNamespace = new ArrayList();
					hash[newsletterName.Namespace] = topicsInThisNamespace;
				}
				topicsInThisNamespace.Add(newsletterName);
			}

			ArrayList bases = new ArrayList();
			bases.AddRange(hash.Keys);
			bases.Sort();
			
			OpenTable();
			foreach (string each in bases)
			{
				NamespaceManager storeManager = Federation.NamespaceManagerForNamespace(each);
				if (ns == null)
					Response.Write(@"<tr><td colspan='2'><div class='SubscriptionNamespace'>" + EscapeHTML(storeManager.FriendlyTitle)  + "</div></td></tr>");
				foreach (QualifiedTopicRevision abs in (ArrayList)(hash[each]))
				{
					TopicVersionInfo info = Federation.GetTopicInfo(abs.ToString());
					string desc = info.GetProperty("Description");
					Response.Write(@"
<tr>
<td><a class=""standardsButton"" href='" + RootUrl(Request) + @"Rss.aspx?newsletter=" + abs.ToString() + @"'>rss</a></td>
<td><a href='" + TheLinkMaker.LinkToTopic(abs) + @"'>" + abs.LocalName + @"</a></td>
</tr>
<tr>
<td></td>
<td><span style='font-size: x-small; color: gray'>" + (desc == null ? "" : desc) + @"</span></td>
</tr>
<tr>");
				}
			}
			CloseTable();
		}