Monday, November 08, 2010 at 12:05 AM.
system.verbs.builtins.radio.shortcuts.addTitledPost
on addTitledPost (adrpost, newtitle) {
<<Changes
<<4/6/02; 1:12:27 PM by DW
<<Created. The post is being created or updated. If it has a title, and the new title is different, delete the old shortcut, and create a new one.
<<If it doesn't have a title, of course, just create the shortcut.
<<If the new title is empty, don't create a shortcut.
local (adrdata = radio.weblog.init (), flchanged = false);
if adrdata^.shortcuts.prefs.flShortcutForTitledPosts {
local (adrtable = @adrdata^.shortcuts.personal);
if defined (adrpost^.title) { //if the title didn't change, nothing to do
local (title = adrpost^.title);
if title != newtitle { //changed
if defined (adrtable^.[title]) {
delete (@adrtable^.[title]);
flchanged = true}}};
if newtitle != "" {
local (url);
radio.weblog.getUrlForPost (adrpost, @url, adrdata:adrdata);
adrtable^.[newtitle] = "<a href=\"" + url + "\">" + newtitle + "</a>";
flchanged = true};
if flchanged {
radio.shortcuts.merge ()}}}
<<bundle //test code
<<addTitledPost (@weblogData.posts [sizeof (weblogData.posts)], "Nuu title")
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.