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

system.verbs.builtins.radio.menuCommands.outlinePostToBlog

<<11/12/01; 9:01:26 AM by DW
	<<The frontmost window contains an outline. The bar cursor line contains a post for the user's Radio blog. If it's a new post, create a new post and get back a post ID, and attach it to the headline as an attribute. If it already has such an attribute, send an edit the existing post.

local (adroutline = address (window.frontmost ()));
if typeof (adroutline^) != outlinetype {
	scriptError ("This command only works with outline windows.")};
local (atts, flEdit = false, postId = nil);
if op.attributes.getall (@atts) {
	try {
		if atts.type == "Radio Blog Post" {
			if defined (atts.postId) {
				postId = atts.postId;
				flEdit = true}}}};
if flEdit {
	local (adrdata = radio.weblog.init ());
	local (adrpost = @adrdata^.posts.[postId]);
	radio.weblog.post (op.getlinetext (), adrpost:adrpost)}
else {
	local (adrpost = radio.weblog.post (op.getlinetext ()), atts);
	new (tabletype, @atts);
	atts.type = "Radio Blog Post";
	atts.postId = nameof (adrpost^);
	op.attributes.addgroup (@atts)};

radio.weblog.publish ()



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.