Monday, November 08, 2010 at 12:05 AM.
system.verbs.builtins.radio.macros.statusCenter
on statusCenter () {
<<Changes
<<7/23/04; 1:00:24 PM by SK
<<Removed tables and replaced with paragraph tags in prep for better theme support.
<<1/3/03; 4:16:29 PM by JES
<<If the serial number will expire in 30 days or less, put a message in the Status Center.
<<7/20/02; 5:12:34 PM by JES
<<Get the store URL for the trial version link from radio.data.cloudUrls.store, instead of using a hard-coded URL.
<<3/3/02; 7:07:30 PM by JES
<<When adding the message of the day for any server other than radio.xmlstoragesystem.com, don't enclose it in quote characters.
<<3/1/02; 9:18:43 PM by JES
<<When adding the message of the day, only add "UserLand Says: " if user.radio.prefs.defaultCloud.server is radio.xmlstoragesystem.com.
<<1/30/02; 3:47:26 PM by DW
<<The links to the tools used to look like this: http://127.0.0.1:5335/toolname/. No need to be so specific. Now they're /toolname/, works just as well, and works when the user is accessing Radio remotely. Thanks to Dave Seidel for the suggestion.
<<1/25/02; 10:11:01 AM by DW
<<New Cloud Status section with a message like: 57% of 10.0MB is free and pointing to the Weather Report help page.
<<1/23/02; 12:31:16 PM by JES
<<Changed the store URL in the trial version notice to http://radio.userland.com/store.
<<1/2/02; 9:09:53 PM by JES
<<Add a link to the serial number page, in the Trial Version status area.
<<12/16/01; 4:08:42 AM by JES
<<When adding Tool status messages, use the name of the Tool as defined in its info table, if defined, and if different from the default.
<<12/5/01; 10:46:04 PM by JES
<<When getting the message of the day, ping the cloud in a try block, to avoid a macro error on the home page.
<<12/4/01; 6:32:53 PM by DW
<<Add Trial version section.
<<12/4/01; 1:33:12 PM by JES
<<Loop over installed Tools, and try to call toolSuite.statusCenterMessage. If we successfully get back a string, we add it, along with a link to the Tool's website, to the bottom of the Status Center. Add the usernum at the end of the status center text.
<<11/30/01; 6:55:07 PM by DW
<<If the hotlist hasn't yet been loaded, load it.
<<11/22/01; 7:45:57 PM by DW
<<Display the UserLand message of the day if it's changed in the last 24 hours.
<<11/14/01; 5:55:29 PM by DW
<<Link to the help system.
<<11/11/01; 8:02:56 PM by DW
<<Update to use the static location of the status message for Weblogs.Com.
<<11/10/01; 2:00:56 PM by DW
<<Add a link to the Hotlist page.
<<11/7/01; 7:18:14 PM by DW
<<Rewrite the portion that displays News Aggregator status.
<<11/1/01; 10:49:50 AM by DW
<<Use elements of radio.data.systemUrls instead of hard-coded URLs.
<<10/29/01; 11:42:09 AM by DW
<<Link to the subscriptions page from the News status section.
<<10/28/01; 3:14:17 PM by DW
<<Only show News status if system.temp.aggregator.status is defined.
<<10/28/01; 11:36:04 AM by DW
<<Only show Weblogs status if system.temp.weblogsCom.status is defined.
<<10/25/01; 1:48:12 PM by DW
<<Created.
<<A status box for the aggregator.
<<Last scan completed at 8:03PM Pacific. 27 new items. Click here to see the rest of them.
<<A similar box for Weblogs.Com. 37 of your favorite blogs updated in the last hour. Click here to see them.
<<An error box. There was an error uploading one of your files. Click here for details.
bundle { //if static rendering, return the empty string
local (pta = html.getpagetableaddress ());
if pta^.radioResponder.flStaticRendering {
return ("")}};
local (now = clock.now ());
local (htmltext = "\r", indentlevel = 0);
on add (s) {
htmltext = htmltext + string.filledstring ("\t", indentlevel) + s + "\r\n";};
on addrow (s) {
<<add ("<tr><td><div class=\"small\">" + s + "</div></td></tr>");
<<//7/23/04; 11:39:58 AM by SK--commented out to remove tables
add ("<p>" + s + "</p>");};
<<add ("<div class=\"small\"><b>" + radio.string.getlocalizedstring ("statusCenter.title") + ":</b> " + radio.userinterface.helplink ("Status Center") + "<br></div>")
<<//7/23/04; 11:39:58 AM by SK--commented out to remove tables
add ("<b>" + radio.string.getlocalizedstring ("statusCenter.title") + ":</b> " + radio.userinterface.helplink ("Status Center"));
<<add ("<table cellpadding=\"0\" cellspacing=\"5\">"); indentlevel++
<<//7/23/04; 11:39:58 AM by SK--commented out to remove tables
addrow (date.shortstring (now) + "; " + date.timestring (now));
if user.radio.settings.flTrialVersion { //Trial version status
local (t);
new (tabletype, @t);
t.storeurl = radio.data.cloudUrls.store;
t.ctdays = 30 - (number (now) - number (user.radio.settings.whenInstalled)) / (24 * 60 * 60);
t.serialNumberUrl = "http://127.0.0.1:5335" + radio.data.systemUrls.serialNumber;
addrow (radio.string.getlocalizedstring ("statusCenter.trialVersion", @t));
};
if defined (user.radio.settings.whenSNExpires) {
local (whenExpires = date (user.radio.settings.whenSNExpires));
local (daysRemaining = (number (whenExpires) - number (now)) / (24 * 60 * 60));
if daysRemaining < 31 and daysRemaining > -1 {
local (t);
new (tableType, @t);
t.ctdays = daysRemaining;
t.renewLicenseUrl = "http://127.0.0.1:5335" + radio.data.systemUrls.renewLicense;
t.purchaseRenewalUrl = string.replace (radio.data.cloudUrls.renew, "<%serialNumber%>", user.radio.prefs.serialNumber);
addrow (radio.string.getlocalizedstring ("statusCenter.renewLicense", @t))}};
try { //add UserLand message of the day
bundle { //be sure the data is there
if not defined (user.radio.prefs.defaultCloudData) {
system.temp.radio.misc.lastPingTime = date (0); //force a ping
radio.thread.agents.pingCloud ()}};
local (flshow = false);
if user.radio.prefs.defaultCloudData.messageOfTheDay != user.radio.settings.statusCenter.messageOfTheDay {
user.radio.settings.statusCenter.messageOfTheDay = user.radio.prefs.defaultCloudData.messageOfTheDay;
user.radio.settings.statusCenter.whenMessageOfTheDayChanged = now};
if user.radio.settings.statusCenter.whenMessageOfTheDayChanged > date.yesterday (now) {
if sizeof (user.radio.settings.statusCenter.messageOfTheDay) > 0 {
flshow = true}};
if flshow {
if user.radio.prefs.defaultCloud.server == "radio.xmlstoragesystem.com" {
addrow (radio.string.getlocalizedstring ("statusCenter.userLandSays") + ": \"" + user.radio.settings.statusCenter.messageOfTheDay + "\"")}
else {
addrow (user.radio.settings.statusCenter.messageOfTheDay)}}};
bundle { //add cloud status
<<Why it's in a try -- 1/25/02; 10:11:31 AM by DW
<<I put this within a try because I am not confident that everyone has all the data they need for the computation. I'd rather have error reports be "I don't see it" instead of "The home page is broken." If we don't get error reports of this nature, let's take it out of the try.
try {
local (percentfree, spaceavail);
bundle { //set percentused, spaceavail
local (adrserverinfo = @user.radio.prefs.upstream.servers.[user.radio.prefs.defaultCloud.server]);
local (adrcapabilities = @adrserverinfo^.serverCapabilities);
spaceavail = adrcapabilities^.maxBytesPerUser;
percentfree = 100 - number (string.percent (user.radio.prefs.defaultCloudData.ctBytesInUse, spaceavail, 0))};
local (t);
new (tabletype, @t);
t.weatherReportUrl = "/system/pages/help?page=12.2";
t.percentfree = percentfree;
t.spaceAvail = string.megabytestring (spaceavail);
addrow (radio.string.getlocalizedstring ("statusCenter.cloudStatus", @t))}};
bundle { //add News Aggregator status
local (adrdata = xml.aggregator.init ());
local (whenComplete = adrdata^.stats.lastRun.whenComplete);
if whenComplete != date (0) {
local (t);
new (tabletype, @t);
t.newaggregatorurl = radio.data.systemUrls.newsAggregator;
t.time = date.timestring (whenComplete, false);
t.date = date.shortstring (whenComplete);
t.ctstories = adrdata^.stats.lastRun.ctNewStories;
t.subscriptionsurl = radio.data.systemUrls.subscriptionsList;
t.ctsubscriptions = sizeof (adrdata^.services);
addrow (radio.string.getlocalizedstring ("statusCenter.aggregatorStatus", @t))}};
bundle { //add hotlist status
local (adrdata = radio.hotlist.init ());
if adrdata^.prefs.dateLastRead == date (0) {
radio.hotlist.reload ()};
addrow ("<a href=\"" + radio.data.systemUrls.hotlist + "\">Hotlist</a>: " + radio.string.getlocalizedstring ("statusCenter.hotList") + radio.string.getDateString (adrdata^.prefs.dateLastRead) + ".")};
bundle { //add weblogs status
local (adrdata = weblogsCom.init ());
addrow ("<a href=\"" + radio.data.systemUrls.weblogsCom + "\">Weblogs</a>: " + adrdata^.settings.statusMessage)};
bundle { //add server status
local (adrlog = log.getGuestSubTable ("webServer"));
local (ct = 0);
for adrhour in adrlog {
ct = ct + sizeof (adrhour^)};
addrow ("<a href=\"" + radio.data.systemUrls.webServerLog + "\">Web server</a>: " + ct + radio.string.getlocalizedstring ("statusCenter.hitsSinceMidnight"))};
bundle { //add events status
local (adrlog = log.getGuestSubTable (radio.data.strings.radioLogName), adrhour);
local (ct = 0);
for adrhour in adrlog {
ct = ct + sizeof (adrhour^)};
addrow ("<a href=\"" + radio.data.systemUrls.eventsLog + "\">Events</a>: " + ct + radio.string.getlocalizedstring ("statusCenter.sinceMidnight"))};
bundle { //add tools status
local (adr);
for adr in @user.tools.databases {
try { //Tools aren't allowed to break the status center
if adr^.flInstalled {
local (adrtool = @[adr^.path]);
if defined (adrtool^) { //is the database opened?
local (toolname = Frontier.tools.cleanToolName (file.fileFromPath (adr^.path)));
local (adrsuite = @adrtool^.[toolname + "Suite"]);
if defined (adrsuite^) { //tools aren't required to have a suite sub-table
if defined (adrsuite^.statusCenterMessage) {
local (displayname = toolname + " Tool");
bundle { //get displayname
local (adrinfo = @adrtool^.[toolname + "Info"]);
if defined (adrinfo^) {
if defined (adrinfo^.name) {
if sizeOf (adrinfo^.name) > 0 {
if adrinfo^.name != toolname {
displayname = adrinfo^.name}}}}};
local (s);
s = adrsuite^.statusCenterMessage ();
local (toollink = displayname);
if defined (adrtool^.[toolname + "Website"]) {
toollink = html.getLink (toollink, "/" + toolname + "/")};
addrow (toollink + ": " + s)}}}}}}};
if defined (user.radio.prefs.usernum) { //add the usernum
addrow ("Usernum: " + user.radio.prefs.usernum + ".")};
<<add ("</table>"); indentlevel--
<<//7/23/04; 11:39:58 AM by SK--commented out to remove tables
return (htmltext)}
<<bundle //test code
<<html.setpagetableaddress (@scratchpad.params)
<<statusCenter ()
This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.