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

system.verbs.builtins.radio.userInterface.weblogThemePopup

on weblogThemePopup (adrblog=nil, default=nil) {
	<<Changes:
		<<10/28/01; 3:41:31 AM by JES
			<<If default is not passed in, and adrblog^.prefs.lastThemeApplied is undefined, the default is "default".
		<<10/28/01; 1:24:39 AM by JES
			<<Changed the name of the <select> element to "weblogTheme".
		<<8/3/01; 6:16:40 PM by JES
			<<Render a popup menu form element for choosing a weblog Theme to apply.
	local (htmltext = "", indentlevel = 0);
	on add (s) {
		htmltext = htmltext + string.filledString ("\t", indentlevel) + s + "\r"};
	
	if adrblog == nil {
		adrblog = radio.weblog.init ()};
	if default == nil { //default to the first password in user.radio.prefs.passwords
		if defined (adrblog^.prefs.lastThemeApplied) {
			default = adrblog^.prefs.lastThemeApplied}
		else {
			default = "default"}};
	
	add ("<select name=\"weblogTheme\">");
	local (adrtheme);
	for adrtheme in @radio.data.themes {
		local (name = nameOf (adrtheme^), selectedtext = "");
		local (displayName = name); //default to the name of the table
		if defined (adrtheme^.info) {
			if defined (adrtheme^.info.name) {
				displayName = adrtheme^.info.name}};
		if string.lower (name) == string.lower (default) {
			selectedtext = " selected"};
		add ("<option value=\"" + name + "\"" + selectedtext + ">" + displayName + "</option>")};
	add ("</select>");
	
	return (htmltext)}
<<bundle //testing
	<<weblogThemePopup ()



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.