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

on weblogArchiveCalendar (adrdata=radio.weblog.init ()) {
		<<10/28/01; 3:56:15 PM by JES
			<<Changed the text on the Publish Archive button to "Publish Entire Archive".
		<<9/18/01; 11:35:09 PM by JES
			<<Added the publish this month button. Cleaned up HTML table rendering in the Archive Calendar section.
		<<9/4/01; 1:10:49 AM by JES
			<<When publishing archive pages, call radio.weblog.publishStaticArchivePages, in its own thread.
	local (pta = html.getPageTableAddress ());
	local (htmltext = "\r", indentlevel = 0);
	on add (s) {
		htmltext = htmltext + string.filledstring ("\t", indentlevel) + s + "\r\n"};
	local (basehelpurl = "/system/help/weblog#");
	on separator (s, helpSection="") {
		local (helpUrl = "");
		if helpSection != "" {
			helpUrl = baseHelpUrl + helpSection};
		add (radio.html.prefsElement.separator (s, colspan:3, helpUrl:helpUrl))};
	local (d = (), flArchivePage = false, dateArg); //PBS 02/22/01: archive page support
	bundle { //process GET args
		local (adrargs = @pta^.radioResponder.getArgs);
		if defined (adrargs^) {
			if defined (adrargs^.d) { //PBS 02/22/01: archive page, possibly
				flArchivePage = true;
				local (year = string.nthField (adrargs^.d, '/', 1));
				local (month = string.nthField (adrargs^.d, '/', 2));
				local (day = string.nthField (adrargs^.d, '/', 3));
				d = date.set (day, month, year, 0, 0, 0);
				dateArg = year + "/" + string.padWithZeros (month, 2) + "/" + string.padWithZeros (day, 2);
				bundle { //check d against midnight of the day with the last post
					local (midnightMostRecentDay);
					local (adrLastPost = @adrdata^.posts [sizeOf (adrdata^.posts)]);
					local (day, month, year, hour, minute, second);
					date.get (adrLastPost^.when, @day, @month, @year, @hour, @minute, @second);
					midnightMostRecentDay = date.set (day, month, year, 0, 0, 0);
					if d >= midnightMostRecentDay {
						flArchivePage = false}}}}};
	if pta^.method == "POST" {
		<< = pta^; edit (
		if defined (pta^.radioResponder.postArgs.publishArchive) { //PBS 02/22/01: publish all archive pages
			thread.callScript (@radio.weblog.publishStaticArchivePages, {adrdata});
			thread.callScript (@radio.weblog.publishStaticHomePage, {adrdata, true, false})};
		if defined (pta^.radioResponder.postArgs.publishThisMonth) { //PBS 02/22/01: publish all archive pages
			local (year = date.year (d));
			local (month = date.month (d));
			local (minDate = date.set (1, month, year, 0, 0, 0));
			if month > 12 {
				month = 1;
			local (maxDate = date.yesterday (date.set (1, month, year, 23, 59, 59)));
			thread.callScript (@radio.weblog.publishStaticArchivePages, {adrdata, minDate, maxDate})}};
			<<thread.callScript (@radio.weblog.publishStaticHomePage, {adrdata, true, false})
	add ("<form method=\"POST\">"); indentlevel++;
	if flArchivePage {
		add ("<input type=\"hidden\" name=\"d\" value=\"" + dateArg + "\">")};
	add ("<table border=\"0\" cellspacing=\"1\" cellpadding=\"2\">"); indentlevel++;
	bundle { //archive pages
		if adrdata^.prefs.flArchiveSection { //PBS 03/01/01: new pref, default off, for displaying the archive section
			separator ("Weblog archive pages...", "weblogArchivePages"); //PBS 02/24/01: help link
			add ("<tr>"); indentlevel++;
			add ("<td align=\"left\" colspan=\"2\">"); indentlevel++;
			add ("<table cellpadding=\"5\" cellspacing=\"0\" border=\"0\">"); indentlevel++;
			add ("<tr>");
			add ("<td>You can view and edit old posts using the calendar.<br>Click on a day in the calendar to view posts for that day.</td>");
			add ("<td rowspan=\"4\" align=\"center\" style=\"padding-left:30\">" + radio.weblog.drawCalendar (adrdata, d) + "</td>");
			add ("</tr>");
			<<add ("<td valign=\"bottom\"><table cellpadding=\"5\" cellspacing=\"0\" border=\"0\">")
			add ("<tr><td style=\"padding-bottom:10\">Click the Publish Entire Archive button to publish the entire archive. Click the Publish This Month button to publish the archive pages for " + date.monthToString (date.month (d)) + ", " + date.year (d) + ".</td></tr>");
			add ("<tr><td><input type=\"submit\" value=\"Publish Entire Archive\" name=\"publishArchive\"></td></tr>");
			add ("<tr><td><input type=\"submit\" value=\"Publish This Month\" name=\"publishThisMonth\"></td></tr>");
			<<add ("</table></td>")
			add ("</tr></table>"); indentlevel--;
			add ("</td>"); indentlevel--;
			add ("</tr>"); indentlevel--}};
	add ("</table>"); indentlevel--;
	add ("</form>"); 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.