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

system.verbs.builtins.radio.html.createTheme

<<Changes
	<<6/21/02; 2:32:21 PM by JES
		<<Added a help link, which links to the How to create a Theme page.
	<<12/31/01; 3:01:25 AM by JES
		<<Created. Render a page that allows the user to turn their site into a Theme.

local (htmltext, indentlevel=0);
on add (s) {
	htmltext = htmltext + string.filledstring ("\t", indentlevel) + s + "\r"};

local (pta = html.getPageTableAddress ());
pta^.title = radio.string.getLocalizedString ("createTheme.title");
local (adrblog = radio.weblog.init ());

local (confirmMessage = "");
if pta^.method == "POST" {
	local (adrargs = @pta^.radioResponder.postArgs);
	<<scratchpad.args = adrargs^; edit (@scratchpad.args)
	if defined (adrargs^.createTheme) { //create the theme file, and save it in the Themes folder
		local (name = adrargs^.themeName);
		local (author = adrargs^.author);
		local (authorEmail = adrargs^.authorEmail);
		local (description = adrargs^.description);
		local (siteUrl = radio.weblog.getUrl ());
		if defined (adrargs^.siteUrl) {
			siteUrl = adrargs^.siteUrl};
		local (theme);
		radio.theme.create.main (@theme, name, author:author, authorEmail:authorEmail, description:description, siteurl:siteUrl);
		local (f = radio.theme.getThemeFilePath (name));
		radio.theme.exportThemeFile (f, @theme);
		local (t); new (tableType, @t);
		t.name = name;
		confirmMessage = radio.string.getlocalizedstring ("createTheme.themeCreatedConfirm", @t)}};

bundle { //render the Create Theme form
	local (helplink = radio.userInterface.helpLink ("How to create a Theme"));
	bundle { //description
		add ("<p>" + radio.string.getlocalizedstring ("createTheme.description") + " " + helplink + "</p>")};
	bundle { //confirmation message
		if sizeOf (confirmMessage) > 0 {
			add ("<font color=\"navy\">" + confirmMessage + "</font><br><br>")}};
	bundle { //the form
		add ("<form method=\"POST\">");
		add ("<table border=\"0\" cellpadding=\"5\" cellspacing=\"0\">");
		bundle { //name field
			add ("<tr><td>" + radio.string.getlocalizedstring ("createTheme.themeNamePrompt") + "</td>");
			add ("<td><input type=\"text\" name=\"themeName\" size=\"50\" maxlength=\"50\" value=\"" + adrblog^.prefs.title + "\"></td></tr>")};
		bundle { //author field
			add ("<tr><td>" + radio.string.getlocalizedstring ("createTheme.authorPrompt") + "</td>");
			add ("<td><input type=\"text\" name=\"author\" size=\"50\" maxlength=\"50\" value=\"" + user.prefs.name + "\"></td></tr>")};
		bundle { //author email field
			add ("<tr><td>" + radio.string.getlocalizedstring ("createTheme.authorEmailPrompt") + "</td>");
			add ("<td><input type=\"text\" name=\"authorEmail\" size=\"50\" maxlength=\"50\" value=\"" + user.prefs.mailAddress + "\"></td></tr>")};
		bundle { //if you're a system editor, you also get a siteUrl field
			if user.radio.prefs.flSystemEditor {
				add ("<tr><td>" + radio.string.getlocalizedstring ("createTheme.siteUrlPrompt") + "</td>");
				add ("<td><input type=\"text\" name=\"siteUrl\" size=\"50\" maxlength=\"255\" value=\"" + radio.weblog.getUrl () + "\"></td></tr>")}};
		bundle { //description textarea
			add ("<tr><td>" + radio.string.getlocalizedstring ("createTheme.descriptionPrompt") + "</td>");
			add ("<td><textarea name=\"description\" cols=\"50\" rows=\"5\"></textarea></td></tr>")};
		bundle { //create theme button
			add ("<tr><td> </td><td style=\"padding-top:14px\"><input type=\"submit\" name=\"createTheme\" value=\"" + radio.string.getlocalizedstring ("createTheme.createThemeButton") + "\"></td></tr>")};
		add ("</table>");
		add ("</form>")}};

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.