OnTime 2007 Web has a little known feature that allows you to have announcements displayed to OnTime users when they log into OnTime. Currently this feature is only available in the Web version of OnTime, but will be implemented into the Windows version as well in the near future.
With OnTime 2006 we had no easy way of letting our hosted customers know when we were planning maintenance and upgrades, other than sending an email out to each customer's main contact we had on file. With OnTime 2007 we introduced trial and single-user hosted accounts, which means the number of hosted accounts has increased tenfold, or more. We knew we needed a way of easily letting our hosted users know of any maintenance plans, so we built this 'announcements' feature into OnTime. Although we built it to help us with our hosted customers, we figured it could be a useful feature for our installed customers as well, so we made sure it's easily configurable. Note that, because we make use of this feature in the hosted environment, it is not available to hosted customers to set up their own announcements.
The way this feature works is fairly simple. You give OnTime the URL to check for announcements, and every time a user logs in, OnTime looks at that URL for any announcements and displays them to the user. OnTime expects to get an XML from that URL in a specific format as follows:
<OnTimeAnnouncements count="1">
<Announcement>
<Date>11/8/2006</Date>
<Message>This is the announcement</Message>
</Announcement>
</OnTimeAnnouncements>
So lets look at a couple of ways of doing this.
First, I'll just write a simple XML file and point OnTime to it. I've created a file called 'announcements.xml' and placed it in a virtual directory on my machine. The file contains the following XML:
<OnTimeAnnouncements count="2">
<Announcement>
<Date>2007-03-02T00:00:00</Date>
<Message>
<h1>Friendly Reminder</h1><br/>The deadline for our new super-duper <b>product</b> is approaching. Let's get it done.
</Message>
</Announcement>
<Announcement>
<Date>2007-03-06T00:00:00</Date>
<Message>
<h1>Free Lunch</h1><br/>Our new super-duper <u>product</u> is on time, so there will be free lunch this day.
</Message>
</Announcement>
</OnTimeAnnouncements>
Then I go in OnTime under Tools -> System Options and enter the URL in the 'Announcements URL' field. My URL is 'http://localhost/ontimeannouncements/announcements.xml'.

Note again that if you are a hosted customer, you will not see this option.
So now once I save these settings, log out of OnTime, then log back in, I will see the announcements (newest one first).

Another way of doing this is to write an ASP.NET page that will generate the XML. This is how we use it for our hosted accounts, since we store the announcements in the database. For this sample I create a new ASP.NET Web Application, and in the Default.aspx code behind I have the following code:
using System;
using System.Data;
using System.Configuration;
using System.Collections.Generic;
using System.IO;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml;
namespace OnTimeAnnouncements
{
public partial class _Default : System.Web.UI.Page
{
// query string keys
private const string QS_USERID = "userid";
private const string QS_DATABASE = "database";
private const string QS_KEY = "key";
// xml format:
// <OnTimeAnnouncements count="1">
// <Announcement>
// <Date>11/8/2006</Date>
// <Message>This is the announcement</Message>
// </Announcement>
// </OnTimeAnnouncements>
// xml tags
private const string XML_NODE_ROOT = "OnTimeAnnouncements";
private const string XML_ATTR_COUNT = "count";
private const string XML_NODE_ANNOUNCEMENT = "Announcement";
private const string XML_NODE_DATE = "Date";
private const string XML_NODE_MESSAGE = "Message";
protected void Page_Load(object sender, EventArgs e)
{
// create sample announcements
List<Announcement> announcements = new List<Announcement>();
announcements.Add(new Announcement(new DateTime(2007, 3, 1), "<h1>Friendly Reminder</h1><br/>The deadline for our new super-duper <b>product</b> is approaching. Let's get it done."));
announcements.Add(new Announcement(new DateTime(2007, 3, 5), "<h1>Free Lunch</h1><br/>Our new super-duper <u>product</u> is on time, so there will be free lunch this day."));
// get announcements
Response.ClearContent();
Response.ClearHeaders();
Response.ContentType = "text/xml";
Response.BinaryWrite(GetAnnouncementsXml(announcements));
}
private byte[] GetAnnouncementsXml(List<Announcement> announcements)
{
// get announcements and create XML
using (MemoryStream ms = new MemoryStream())
{
XmlTextWriter xmlWriter = new XmlTextWriter(ms, System.Text.Encoding.Default);
if (xmlWriter != null)
{
// start
xmlWriter.WriteStartDocument();
// root node
xmlWriter.WriteStartElement(XML_NODE_ROOT);
if (announcements.Count > 0)
{
// count
xmlWriter.WriteAttributeString(XML_ATTR_COUNT, announcements.Count.ToString());
// do announements
foreach (Announcement announcement in announcements)
{
// announcement
xmlWriter.WriteStartElement(XML_NODE_ANNOUNCEMENT);
// date
xmlWriter.WriteStartElement(XML_NODE_DATE);
xmlWriter.WriteValue(announcement.AnnouncementDate);
xmlWriter.WriteEndElement();
// message
xmlWriter.WriteStartElement(XML_NODE_MESSAGE);
xmlWriter.WriteValue(announcement.Message);
xmlWriter.WriteEndElement();
xmlWriter.WriteEndElement();
}
}
else
{
// no data
xmlWriter.WriteAttributeString(XML_ATTR_COUNT, "0");
}
// end root
xmlWriter.WriteEndElement();
// done
xmlWriter.Flush();
xmlWriter.Close();
}
return ms.ToArray();
}
}
public class Announcement
{
public DateTime AnnouncementDate;
public string Message;
public Announcement(DateTime dt, string msg)
{
AnnouncementDate = dt;
Message = msg;
}
}
}
}
Now I go into OnTime and change my 'Announcements URL' field to 'http://localhost/ontimeannouncements/default.aspx'. Once I log out and log back in I get the new announcements:

One thing to note is that OnTime will always display announcements if they exist in the XML. If you want the announcements to only be shown during some date range, you will need to handle that in the ASP.NET page. OnTime also passes in 3 parameters through the query string to the URL: the ID of the user logging in, the name of the database, and the OnTime Activation key (note the constants declared in the sample code above). You can use these parameters if you want to only show users an announcement one time instead of every time they log in, you just need to keep track of how many times they've view it.
As you may have noticed, the announcement message can be HTML, so you can format the messages in any way you want.