Monday, November 08, 2010 at 12:05 AM.
system.verbs.builtins.radio.utilities.homeFolderTextFiles.saveAsTheme
<<Changes
<<10/30/01; 2:19:49 AM by JES
<<Open the Theme's table after reading the files.
<<10/29/01; 11:11:44 AM by JES
<<Created. Reads all of the text files in the www folder whose names begin with the # character, and saves them as a theme, in the radio.data.themes table.
if not defined (user.radio.stats.lastThemeSaved) {
user.radio.stats.lastThemeSaved = ""};
local (themeName = user.radio.stats.lastThemeSaved);
if not dialog.ask ("Enter a name for this theme:", @themeName) {
return (false)};
local (themetablename = themeName);
bundle { //set themetablename
local (i, ct = sizeOf (themetablename));
for i = 1 to ct {
if not (string.isAlpha (themetablename[i]) or string.isNumeric (themetablename[i])) {
themetablename[i] = " "}};
themetablename = string.innerCaseName (themetablename)};
local (adrtable = @radio.data.themes.[themetablename]);
new (tableType, adrtable);
new (tableType, @adrtable^.info);
adrtable^.info.name = themeName;
local (homefolder = user.radio.prefs.wwwfolder);
on savefile (f) {
local (fname = string.delete (f, 1, sizeOf (homefolder) + 1)); // + 1 for the # character
local (flOutline = (string.lower (fname) endsWith ".opml"));
fname = string.popSuffix (fname);
local (adrobject = @adrtable^.[fname]);
if flOutline {
op.xmlToOutline (string (file.readwholefile (f)), adrobject)}
else {
wp.newtextobject (string (file.readwholefile (f)), adrobject)};
setTimeCreated (adrobject, file.created (f));
setTimeModified (adrobject, file.modified (f))};
fileloop (f in homefolder) {
if file.fileFromPath (f) beginsWith "#" {
savefile (f)}};
user.radio.stats.lastThemeSaved = themeName;
edit (adrtable);
return (true)
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.