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

system.verbs.builtins.radio.menuCommands.publishThisMonth

local (adrblog = radio.weblog.init ());
local (ctposts = sizeOf (adrblog^.posts), ctPublishedPages = 0);
<<Changes
	<<12/16/01; 8:43:03 AM by DW
		<<Moved from the menu script.
		<<User messages like this: "Upstreaming the rendered files will take a minute or two" are scary. It's already wrong. On a reasonably fast line they will upstream in a few seconds. The problem is you won't remember to change the message when upstreaming starts working right. (Which it already has.)
		<<I added parentheses to the conditions so I don't have to remember precedence rules when reading the code.
local (mostRecentMonth = date.month (adrblog^.posts [ctposts].when));
if not dialog.yesNo ("Publish all weblog archive pages for " + date.monthToString (mostRecentMonth) + ", " + date.year (adrblog^.posts[ctposts].when) + "?") {
	return (false)};
radio.weblog.publish (adrblog);
radio.weblog.publishRss (adrblog);
local (day, month, year, hour, minute, second);
local (lastDay, lastMonth, lastYear);
local (adrpost);
for i = ctposts downTo 1 {
	adrpost = @adrblog^.posts[i];
	if date.month (adrpost^.when) != mostRecentMonth {
		break};
	date.get (adrpost^.when, @day, @month, @year, @hour, @minute, @second);
	if not ((lastDay == day) and (lastMonth == month) and (lastYear == year)) {
		radio.weblog.publish (adrblog, d:adrpost^.when);
		ctPublishedPages++}};
if ctPublishedPages > 0 {
	dialog.notify ("Your weblog pages for " + date.monthToString (date.month (adrblog^.posts[ctposts].when)) + ", " + date.year (adrblog^.posts[ctposts].when) + " have been published. Upstreaming the rendered files may take a minute or two.")}
else {
	dialog.notify ("No pages were published because your weblog does not contain any posts.")}



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.