Monday, November 08, 2010 at 12:04 AM.


on recentlyUpdatedSites (n) {
	if not defined (radioCommunityServerSuite) { //RCS is not installed -- return the empty string
		return ("")};
	local (htmltext = "", indentlevel = 0);
	on add (s) {
		htmltext = htmltext + (string.filledString ("\t", indentlevel) + s + "\r\n");};
	bundle { //start the table
		add ("<table cellpadding=\"3\" cellspacing=\"1\" width=\"225\" bgcolor=\"black\" border=\"0\">"); indentlevel++};
	bundle { //title
		add ("<tr><td bgcolor=\"#DCDCFF\"><b>Recently Updated Sites</b></td></tr>")};
	bundle { //add the sites
		add ("<tr><td bgcolor=\"white\">"); indentlevel++;
		local (adrdata = radioCommunityServerSuite.weblogUpdates.init ());
		local (adrcategory = @adrdata^.changes.none);
		add (radioCommunityServerSuite.weblogUpdates.viewUpdatedWeblogs (adrcategory, n, true, "small"));
		<<bundle //unused code
			<<local (names, maxnamesize = 40)
			<<new (tabletype, @names)
			<<local (adrdata = radioCommunityServerSuite.weblogUpdates.init ())
			<<local (adrcategory = @adrdata^.changes.none)
			<<local (i, adr, adrchange, url, adrweblog, name, ct = 0)
			<<for i = sizeof (adrcategory^) downto 1
				<<if ct >= n
				<<adrchange = @adrcategory^ [i]
				<<url = nameof (adrchange^)
				<<adrweblog = @adrdata^.weblogs.[url]
				<<if defined (adrweblog^)
					<<name = mainresponder.neutertext (adrweblog^.name, true, false)
					<<name = searchengine.stripmarkup (name)
					<<if sizeof (name) > maxnamesize
						<<name = string.mid (name, 1, maxnamesize - 3) + "..."
					<<local (adrname = @names.[name])
					<<if not defined (adrname^) //avoid duplicates
						<<add ("<tr>"); indentlevel++
						<<add ("<td align=\"right\">" + ct++ + ".</td>")
						<<add ("<td><a href=\"" + url + "\">" + name + "</a></td>")
						<<add ("<td align=\"right\">" + date.timestring (adrchange^, false) + "</td>")
						<<add ("</tr>"); indentlevel--
						<<adrname^ = true //it's now defined
		add ("</td></tr>"); indentlevel--};
	add ("</table><br />"); indentlevel--;
	return (htmltext)}

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.