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

system.verbs.builtins.radio.weblog.oldStuff.main

on main () {
	<<Changes:
		<<Archive:
			<<1/18/01; 11:25:59 AM by DW
				<<Added support for Blog-It! button. If idStory is passed, we set the initial text in the edit box from the story.
			<<1/20/01; 10:28:15 PM by DW
				<<Add categories.
			<<1/21/01; 9:21:50 PM by DW
				<<Lots of little cleanups, fixes, prefs, etc.
			<<1/22/01; 12:49:35 PM by DW
				<<Support for sources.
			<<1/24/01; 4:06:19 PM by DW
				<<When a post came from the home page, redirect back there when the post is complete.
				<<Again, when the post came from the home page, as it is being posted, link the story it came from to the blog post. This enables us to add a checkmark next to the EDIT button on the home page, making it easy to spot items that have been posted. Since it's an address we could use it for other things.
			<<1/26/01; 12:36:09 AM by JES
				<<Added preferences for mirroring to a Manila site.
			<<2/1/01; 1:07:28 PM by JES
				<<If defined, delete adrblog^.prefs.manila.siteName when Manila mirroring prefs are submitted. Fixes a bug where the siteName was incorrect after changing which Manila site your Blog is mirrored to.
			<<2/3/01; 7:41:34 PM by DW
				<<Add support for themes.
			<<2/7/01; 2:16:11 AM by JES
				<<Make checkmarks appear to the right of edit links, instead of below them.
			<<2/12/01; 10:57:26 AM by PBS
				<<Use three dots for ellipses. Align the Edit With Radio button under the template textareas, instead of floating underneath and to the right.
			<<2/14/01; 11:09:56 AM by PBS
				<<URLs and email addresses in templates in the textarea were made hot, but they should not be. Fixed.
			<<2/16/01; 5:20:13 PM by PBS
				<<In the story textarea, convert text to entities.
			<<2/17/01; 7:49:01 PM by JES
				<<Links to the HTML rendering and generated RSS file changed to link to the FTP, Manila, or upstreamed files.
			<<2/19/01; 12:48:11 PM by PBS
				<<Terminology: weblog, not blog.
			<<2/21/01; 6:53:32 PM by PBS
				<<When publishing the home page, publish the most recent archive page also.
			<<2/22/01; 11:29:39 PM by JES
				<<If this is a Mac, convert item text to Mac text when posting.
				<<Fixed logic error in removing an edited item from categories, where categories' RSS wouldn't be rebuilt.
				<<Fixed logic error when deleting posts, which prevented categories' RSS from being rebuilt.
			<<2/24/01; 1:17:23 AM by JES
				<<Render the Themes popup with displayNames when defined. Remember the last selected theme, and make it the default in the Themes popup.
			<<2/24/01; 2:14:56 AM by JES
				<<Changed link to Categories page from veiwCategories.wsf to categories.wsf.
			<<2/24/01; 3:39:15 PM by PBS
				<<Help icons link to help text for the Weblog page.
			<<2/24/01; 6:10:41 PM by JES
				<<Tweaked the formatting of the editing form, category checks, and link icons so the help icon could be placed correctly.
			<<2/24/01; 6:39:40 PM by JES
				<<Update myUserLandData.themes.[name].displayName if the copy of the theme at myUserLandSuite.utilities.virginData.themes defines a displayName.
			<<2/25/01; 5:16:08 PM by PBS
				<<When viewing an archive page, there was no help link in the list of posts for that day. Fixed.
				<<When viewing an archive page that's the most recent day with posts, it should be viewed as today, and display the most recent posts.
			<<2/26/01; 12:05:02 AM by JES
				<<Fixed formatting problem with the text area help link on Windows.
			<<2/26/01; 3:14:38 PM by JES
				<<Minor formatting tweak to inprove placement of the help icon for the text area.
			<<2/26/01; 5:08:51 PM by JES
				<<Posting a repeat of the last story is an error. Minor formatting tweak to make error messages more visible.
			<<2/27/01; 6:43:14 PM by PBS
				<<Fixed bug in duplicate-checking code. It causes a "no item 0" error when there haven't been any posts yet.
			<<2/28/01; 4:33:54 PM by JES
				<<If a Manila site URL doesn't start with http:// or end with /, add them. If the URL for FTP upstreaming doesn't start with http:// or end with /, add them.
			<<3/1/01; 7:42:30 AM by DW
				<<Add Mail-to-Blog feature.
			<<3/1/01; 1:13:00 PM by JES
				<<Fixed logic for not enaling FTP mirroring if there were problems with the password.
			<<3/1/01; 3:22:37 PM by PBS
				<<Display the archive pages section only if the pref is set. Newbies, after all, don't need this.
			<<3/3/01; 11:22:31 AM by PBS
				<<Don't display the Edit With Radio buttons if accessing remotely.
			<<3/10/01; 11:59:28 AM by DW
				<<Do publishing via radio.weblog.publishInThread so the user doesn't have to wait for FTPing before getting back to work.
			<<3/13/01; 9:46:07 PM by DW
				<<Add a link to the source of a POST in the initialtext for the textarea. Search for "viatext" in the body to locate the code.
		<<8/12/01; 11:38:05 PM by JES
			<<Commented out the prefs form at the bottom of the page. This is now handled by the weblog prefs page at /system/pages/prefsWeblog.
		<<8/14/01; 12:55:07 PM by JES
			<<Added the globe icon, which links to the source website, to the source display above the editing area.
		<<8/14/01; 6:45:38 PM by JES
			<<When posting edited items, call through radio.weblog.post, which bottlenecks the posting code. radio.weblog.post does Mac text and line-ending conversions if necessary.
	local (adrblog = radio.weblog.init ());
	local (pta = html.getpagetableaddress ());
	local (flsamemachine = pta^.radioresponder.flsamemachine);
	local (ctcolstextareas = 60);
	local (initialenclosureurl = "http://");
	local (editbuttonimg = radio.images.systemImageRef ("icons/editbutton"));
	local (globeimg = radio.images.systemImageRef ("qbullet/remote"));
	local (xmlimg = radio.images.systemImageRef ("icons/xml"));
	local (mediaimg = radio.images.systemImageRef ("qbullet/sound"));
	local (checkmarkimg = radio.images.systemImageRef ("icons/checkmark"));
	local (htmltext = "\r", indentlevel = 0);
	local (d = clock.now (), flArchivePage = false, dateArg); //PBS 02/22/01: archive page support
	on add (s) {
		htmltext = htmltext + string.filledstring ("\t", indentlevel) + s + "\r\n"};
	pta^.title = "Weblog";
	<<add ("<h2>" + adrblog^.prefs.title + "</h2>")
	<<add ("<i>" + adrblog^.prefs.authorname + "</i><br>")
	
	local (baseHelpUrl = "/system/help/weblog#");
	on separator (s, helpSection="") {
		local (helpUrl = "");
		if helpSection != "" {
			helpUrl = baseHelpUrl + helpSection};
		add (radio.html.prefsElement.separator (s, colspan:3, helpUrl:helpUrl))};
	
	local (args);
	bundle { //get args
		if pta^.method == "POST" {
			new (tabletype, @args);
			webserver.parseargs (pta^.requestBody, @args)};
		if pta^.method == "GET" {
			new (tabletype, @args);
			webserver.parseargs (pta^.searchargs, @args)};
		try {delete (@args.align)};
		try {delete (@args.color)};
		try {delete (@args.font)};
		try {delete (@args.format)};
		if defined (args.d) { //PBS 02/22/01: archive page, possibly
			flArchivePage = true;
			local (year = string.nthField (args.d, '/', 1));
			local (month = string.nthField (args.d, '/', 2));
			local (day = string.nthField (args.d, '/', 3));
			d = date.set (day, month, year, 0, 0, 0);
			dateArg = year + "/" + string.padWithZeros (month, 2) + "/" + string.padWithZeros (day, 2);
			<<bundle //check d against midnight today
				<<local (midnightToday)
				<<local (day, month, year, hour, minute, second)
				<<date.get (clock.now (), @day, @month, @year, @hour, @minute, @second)
				<<midnightToday = date.set (day, month, year, 0, 0, 0)
				<<if midnightToday == d
					<<flArchivePage = false
			bundle { //check d against midnight of the day with the last post
				local (midnightMostRecentDay);
				local (adrLastPost = @adrblog^.posts [sizeOf (adrblog^.posts)]);
				local (day, month, year, hour, minute, second);
				date.get (adrLastPost^.when, @day, @month, @year, @hour, @minute, @second);
				midnightMostRecentDay = date.set (day, month, year, 0, 0, 0);
				if d >= midnightMostRecentDay {
					flArchivePage = false}}}};
	local (adrPostToEdit); //point at the post that we're editing, nil if it's a new post
	bundle { //set adrPostToEdit
		if defined (args.itemToEdit) {
			adrPostToEdit = @adrblog^.posts.[string.padwithzeros (args.itemToEdit, 8)]}
		else {
			adrPostToEdit = nil;
			if flArchivePage { //edit an old post
				local (day, month, year, hour, minute, second);
				date.get (d, @day, @month, @year, @hour, @minute, @second);
				local (lastOfDay = date.set (day, month, year, 23, 59, 59)); //last second in the day
				local (adrPost);
				if not (radio.weblog.getLastPostBeforeDate (adrblog, lastOfDay, @adrPostToEdit)) {
					adrPostToEdit = @adrblog^.posts [sizeOf (adrblog^.posts)]}}}};
	bundle { //add the editing box form
		local (initialtext = "", postErrorString = "");
		if pta^.method == "POST" {
			local (enclosure = nil, flEnclosureError = false);
			<<scratchpad.args = args; edit (@scratchpad.args)
			if defined (args.enclosureUrl) {
				if sizeof (args.enclosureUrl) > sizeof (initialenclosureurl) {
					new (tabletype, @enclosure);
					xml.aggregator.getEnclosureData (args.enclosureUrl, @enclosure);
					if defined (enclosure.error) { //make sure they see the error
						flEnclosureError = true}}};
			local (flpost = defined (args.post) or defined (args.postAndPublish));
			local (flpublish = defined (args.postAndPublish) or defined (args.publish));
			local (flfreshblogbox = flpost or flpublish);
			local (adrpost);
			if flpost {
				on getLastItemText () {
					local (adrposts = @adrblog^.posts);
					local (ixlastpost = sizeOf (adrposts^));
					if ixlastpost < 1 { //PBS 02/27/01: no posts may have been made yet
						return ("")};
					local (s = string (adrposts^[ixlastpost].text) );
					if system.environment.isMac {
						s = latinToMac.macToLatin (s)};
					return (s)};
				on addCatsTo (adrpost) {
					local (adrarg, name, adrcats = @adrpost^.categories);
					if defined (adrcats^) {
						local (adr);
						local (id = number (nameof (adrpost^)));
						for adr in @adrblog^.categories {
							if adr^.storyList contains id {
								adr^.storyList = adr^.storyList - {id};
								adr^.flDirty = true}};
						delete (adrcats)};
					for adrarg in @args {
						name = nameof (adrarg^);
						if name beginswith "cat:" {
							local (catname = string.nthfield (name, ":", 2));
							if not defined (adrcats^) {
								new (tabletype, adrcats)};
							adrcats^.[catname] = true}};
					bundle { //see which RSS files need to be rebuilt
						local (adr);
						for adr in @adrblog^.categories {
							local (fldirty = false);
							local (id = number (nameof (adrpost^)));
							if defined (adrcats^.[nameof (adr^)]) { //it's part of the category
								if not (adr^.storyList contains id) {
									adr^.storyList = adr^.storyList + {id};
									fldirty = true}}
							else { //it's not part of the category
								if adr^.storyList contains id {
									adr^.storyList = adr^.storyList - {id};
									fldirty = true}};
							if fldirty { //don't clear it here
								adr^.flDirty = true;
								system.temp.radio.flPublishCategoryRss = true}}}};
				if adrPostToEdit == nil { //new post
					if args.itemtext != "" {
						if args.itemtext != getLastItemText () {
							adrpost = radio.weblog.post (args.itemtext);
							addCatsTo (adrpost);
							if defined (args.sourceName) {
								adrpost^.sourceName = args.sourceName};
							if defined (args.sourceUrl) {
								adrpost^.sourceUrl = args.sourceUrl};
							if defined (args.sourceTime) {
								adrpost^.sourceTime = args.sourceTime};
							if defined (args.idSourceStory) { //link the story to this post
								local (adrstory = radio.aggregator.getStoryAddress (args.idSourceStory));
								adrstory^.adrBlogPost = adrpost;
								xml.aggregator.clearCache ()}; //won't see the checkmark if we don't do this
							if enclosure != nil {
								adrpost^.enclosure = enclosure};
							if flEnclosureError { //don't move off this item, want user to see error msg
								adrPostToEdit = adrpost;
								args.itemToEdit = number (nameof (adrpost^));
								flfreshblogbox = false}}
						else { //it's a duplicate, display an error
							postErrorString = "Can't post because this is a duplicate of the previous post.";
							flfreshblogbox = false}}}
				else {
					<<bundle //old post code
						<<if system.environment.isMac //02/22/2001 JES: convert to Mac text
							<<wp.newtextobject (string.replaceAll (latinToMac.convert (args.itemtext), "\r\n", "\r"), @adrPostToEdit^.text)
						<<else //don't convert
							<<wp.newtextobject (string.replaceAll (args.itemtext, "\r\n", "\r"), @adrPostToEdit^.text)
					radio.weblog.post (args.itemtext, adrpost:adrPostToEdit);
					addCatsTo (adrPostToEdit);
					if enclosure != nil {
						adrPostToEdit^.enclosure = enclosure}}};
			if flpublish {
				try {
					local (d = adrblog^.posts [sizeOf (adrblog^.posts)].when); //date of most recent archive page
					thread.callscript (@radio.weblog.publishInThread, {adrblog, d});
					}
					<<radio.weblog.publish (adrblog)
					<<radio.weblog.publish (adrblog, d:d) //publish most recent archive page
					<<radio.weblog.publishRss (adrblog)
				else {
					if adrPostToEdit == nil { //don't move off this item
						adrPostToEdit = adrpost;
						args.itemToEdit = number (nameof (adrpost^));
						postErrorString = tryError;
						flfreshblogbox = false}}};
			if flfreshblogbox { //a successful post gets you a fresh edit box (or back to the referer)
				if defined (args.referer) {
					radio.webServer.redirect (args.referer)}
				else {
					radio.webServer.redirect (pta^.uri)};
				return ("")}};
		add ("<form method=\"POST\">"); indentlevel++;
		local (adraggregatordata = xml.aggregator.init ());
		local (globeimg = radio.images.systemImageRef ("qbullet/remote", flFileUrl:flSameMachine));
		local (globe = "");
		if adrPostToEdit != nil {
			initialtext = string (adrPostToEdit^.text);
			if defined (adrPostToEdit^.sourceName) {
				bundle { //link the globe to the HTML rendering of the channel
					local (adrsource = @adraggregatordata^.services.[adrPostToEdit^.sourceUrl]);
					if defined (adrsource^) {
						with adrsource^.compilation {
							globe = "<a href=\"" + channellink + "\" title=\"" + radio.html.translateToEntities (channeldescription) + "\">" + globeimg + "</a>"}}};
				add (globe + " <i>Source: " + adrPostToEdit^.sourceName + "; " + adrPostToEdit^.sourceTime + ".</i><br><br>")};
			add (initialtext + "<br><br>")}
		else {
			if defined (args.idstory) {
				local (adrstory = radio.aggregator.getStoryAddress (args.idstory));
				local (adrsource = @adraggregatordata^.services.[adrstory^.url]);
				local (viatext = " [<a href=\"" + adrsource^.compilation.channellink + "\">" + adrstory^.channeltitle + "</a>]");
				initialtext = adrstory^.storytext + viatext;
				bundle { //link the globe to the HTML rendering of the channel
					with adrsource^.compilation {
						msg (adrsource);
						globe = "<a href=\"" + channellink + "\" title=\"" + radio.html.translateToEntities (channeldescription) + "\">" + globeimg + "</a>"}};
				add (globe + " <i>Source: " + adrstory^.channeltitle + "; " + adrstory^.time + ".</i><br><br>");
				add (adrstory^.storytext + "<br><br>");
				add ("<input name=\"sourceName\" type=\"hidden\" value=\"" + adrstory^.channeltitle + "\">");
				add ("<input name=\"sourceTime\" type=\"hidden\" value=\"" + adrstory^.time + "\">");
				add ("<input name=\"sourceUrl\" type=\"hidden\" value=\"" + adrstory^.url + "\">");
				add ("<input name=\"referer\" type=\"hidden\" value=\"" + args.referer + "\">");
				add ("<input name=\"idSourceStory\" type=\"hidden\" value=\"" + args.idstory + "\">")}};
				<<edit (adrstory)
		add ("<table border=\"0\">"); indentlevel++;
		
		add ("<tr>"); indentlevel++;
		<<add (html.editor.get (initialtext, "itemtext", 9))
		bundle { //add the text editor box
			add ("<td>"); indentlevel++;
			local (editorText);
			bundle { //massage text for the editor
				initialtext = radio.html.translateToEntities (initialtext); //PBS 02/16/01: convert to entities
				initialtext = string.replaceAll (initialtext, "\r\n", "\r")};
			<<bundle //preventing URLs and email addresses from getting hot
				<<5/19/01; 6:47:13 AM by DW -- I commented both these lines out. In the 7.0 environment, for some reason, these were needed. In the new environment, their presence adds backslashes to the text the user sees. I left these here in case for some reason at some point we need to turn them back on.
				<<initialtext = string.replaceAll (initialtext, "//", "\\//") //PBS 02/16/01: prevent URLs from getting hot
				<<initialtext = string.replaceAll (initialtext, "@", "\\@") //PBS 02/16/01: prevent email address from getting hot
			if defined (html.editor.get) {
				editorText = html.editor.get (initialtext, "itemtext", 9)};
			if editorText != "" {
				add (editorText)}
			else { //add a regular textarea
				add ("<textarea name=\"itemtext\" rows=\"9\" cols=\"70\" wrap=\"soft\">" + initialtext + "</textarea>")};
			add ("</td>"); indentlevel--};
		bundle { //add the column of links with icons
			add ("<td valign=\"top\" height=\"100%\">"); indentlevel++;
			
			add ("<table border=\"0\" height=\"100%\"><tr><td valign=\"top\" align=\"center\">");
			<<local (url = adrblog^.prefs.rssFilePath)
			<<if not (url beginswith "/")
				<<url = "/" + url
			url = radio.weblog.getRssUrl (adrblog); //JES 02/17/01: get URL of RSS file
			add ("<a href=\"" + url + "\" title=\"Click here to see the RSS version of your blog.\">" + xmlimg + "</a>");
			<<url = adrblog^.prefs.homePageFilePath
			<<if not (url beginswith "/")
				<<url = "/" + url
			url = radio.weblog.getUrl (adrblog); //JES 02/17/01: get URL of weblog
			add ("<p><a href=\"" + url + "\" title=\"Click here to see the HTML rendering of your blog.\">" + globeimg + "</a></p>");
			add ("</td></tr>");
			
			add ("<tr><td valign=\"bottom\" align=\"center\">");
			add ("<p>" + radio.html.prefsElement.helpLink (baseHelpUrl + "editor", "center") + "</p>"); //PBS 02/24/01: help link
			add ("</td></tr></table>");
			
			add ("</td>"); indentlevel--};
		add ("</tr>"); indentlevel--;
		
		add ("<tr>"); indentlevel++;
		add ("<td colspan=\"2\"><br>"); indentlevel++;
		if postErrorString != "" {
			add ("<font color=\"red\">Error. " + postErrorString + "</font><br><br>")};
		bundle { //add the category checkboxes
			if adrblog^.prefs.flCategoryCheckboxes {
				add ("<table border=\"0\" cellspacing=\"3\" cellpadding=\"0\">"); indentlevel++;
				<<add (radio.html.prefsElement.separator ("Category checkboxes:", colspan:4, flverticalspace:false))
				add (radio.html.addCategoryCheckboxes (adrPostToEdit));
				add ("</table></center><br>"); indentlevel--}};
		bundle { //add the enclosure box
			local (initialvalue = initialenclosureurl, error = "");
			if defined (adrPostToEdit^.enclosure) {
				initialvalue = adrPostToEdit^.enclosure.url;
				if defined (adrPostToEdit^.enclosure.error) { //make sure they see the error
					error = "<font color=\"red\">Error. " + adrPostToEdit^.enclosure.error + "</font><br><br>"}
				else {
					error = "<font size=\"-1\">Size: " + string.megabytestring (adrPostToEdit^.enclosure.length) + ", type: " + adrPostToEdit^.enclosure.type + ".</font><br><br>"}};
			add ("<table><tr><td valign=\"top\">Enclosure: </td><td valign=\"top\"><input type=\"" + "text" + "\" name=\"" + "enclosureUrl" + "\" size=\"" + 65 + "\" maxlength=\"" + 512 + "\" value=\"" + initialvalue + "\"></td></tr><tr><td> </td><td>" + error + "</td></tr></table>")};
		bundle { //add the buttons
			add ("<input type=\"submit\" name=\"post\" value=\"   Post   \">");
			add ("  ");
			add ("<input type=\"submit\" name=\"publish\" value=\"   Publish   \">");
			add ("  ");
			add ("<input type=\"submit\" name=\"postAndPublish\" value=\"Post & Publish\">")};
		if defined (args.itemToEdit) {
			add ("<input name=\"itemToEdit\" type=\"hidden\" value=\"" + args.itemToEdit + "\">")};
		add ("</td>"); indentlevel--;
		add ("</tr>"); indentlevel--;
		
		add ("</table>"); indentlevel--;
		add ("</form>"); indentlevel--};
	bundle { //new code for the archive and calendar
		local (ftperror = "", manilaerror = "", mailtoblogerror = "");
		if pta^.method == "POST" {
			if defined (args.deletePosts) {
				delete (@args.deletePosts);
				local (adr, adrpost);
				for adr in @args {
					adrpost = @adrblog^.posts.[string.padwithzeros (nameof (adr^), 8)];
					if defined (adrpost^) {
						local (adrcats = @adrpost^.categories);
						if defined (adrcats^) {
							local (adr);
							local (id = number (nameof (adrpost^)));
							for adr in @adrblog^.categories {
								if adr^.storyList contains id {
									adr^.storyList = adr^.storyList - {id};
									adr^.flDirty = true}};
							delete (adrcats)};
						delete (adrpost)}}};
			if defined (args.publishArchive) { //PBS 02/22/01: publish all archive pages
				radio.weblog.publishArchivePages (adrBlog)}};
		bundle { //add the posts
			local (ctposts = sizeof (adrblog^.posts));
			if ctposts > 0 {
				add ("<br>");
				add ("<form method=\"POST\">"); indentlevel++;
				if flArchivePage {
					add ("<input type=\"hidden\" name=\"d\" value=\"" + dateArg + "\">")};
				add ("<table cellspacing=\"0\" cellpadding=\"0\"><tr bgcolor=\"" + radio.data.htmlColors.framecolor + "\"><td>"); indentlevel++;
				add ("<table border=\"0\" cellspacing=\"1\" cellpadding=\"5\">"); indentlevel++;
				if flArchivePage {
					add (radio.html.prefsElement.separator ("Posts for " + date.shortString (d) + "...", false, 4, baseHelpUrl + "previousPosts"))} //PBS 02/25/01: Help link
				else {
					add (radio.html.prefsElement.separator ("Previous " + adrblog^.prefs.viewing.ctPosts + " posts...", false, 4, baseHelpUrl + "previousPosts"))}; //PBS 02/24/01: help link
				case adrblog^.prefs.viewing.mode {
					"byPosts" {
						local (i, adrpost, editurl, bgcolor);
						local (lastitemnum = ctposts - adrblog^.prefs.viewing.ctPosts + 1);
						if lastitemnum < 1 {
							lastitemnum = 1};
						local (start = ctposts, end = lastitemnum);
						if flArchivePage {
							local (day, month, year, hour, minute, second);
							date.get (d, @day, @month, @year, @hour, @minute, @second);
							local (adrFirstPost);
							local (firstOfDay = date.set (day, month, year, 0, 0, 0));
							radio.weblog.getNextPostAfterDate (adrblog, firstOfDay, @adrFirstPost);
							end = indexOf (adrFirstPost^); //reverse chronological order
							local (adrLastPost);
							local (lastOfDay = date.set (day, month, year, 23, 59, 59));
							radio.weblog.getLastPostBeforeDate (adrblog, lastOfDay, @adrLastPost);
							start = indexOf (adrLastPost^)};
						for i = start downto end {
							adrpost = @adrblog^.posts [i];
							if adrpost == adrPostToEdit {
								bgcolor = radio.data.htmlColors.highlightColor}
							else {
								bgcolor = radio.data.htmlColors.cellbgcolor};
							add ("<tr bgcolor=\"" + bgcolor + "\">"); indentlevel++;
							bundle { //add checkbox
								local (name = number (nameof (adrpost^)));
								local (checkboxval = "xxx ");
								if false {
									checkboxval = checkboxval + "checked"};
								add ("<td valign=\"top\"><input type=\"checkbox\" name=\"" + name + "\" value=" + checkboxval + "></td>")};
							add ("<td valign=\"top\">" + string (adrpost^.text) + "</td>");
							add ("<td valign=\"top\" nowrap><font size=\"-1\">" + radio.string.getDateString (adrpost^.when) + "</font></td>");
							bundle { //add little icons
								add ("<td valign=\"top\" nowrap>"); indentlevel++;
								bundle { //EDIT button, checkmark, enclosure icons
									local (args);
									new (tabletype, @args);
									args.itemToEdit = number (nameof (adrpost^));
									if flArchivePage {
										args.d = dateArg};
									editurl = pta^.uri + "?" + webserver.encodeargs (@args);
									editurl = string.replaceAll (editurl, "%2F", "/");
									local (checkmark = "");
									bundle { //an item has a checkmark if it's in at least one category
										if defined (adrpost^.categories) {
											local (adr);
											for adr in @adrpost^.categories {
												if adr^ {
													checkmark = " <a title=\"" + radio.data.strings.checkmarktooltip + "\">" + checkmarkimg + "</a>";
													break}}}};
									local (encl = "");
									bundle { //if it has an enclosure add a media link
										if defined (adrpost^.enclosure) {
											if not defined (adrpost^.enclosure.error) {
												encl = "<br><a href=\"" + adrpost^.enclosure.url + "\">" + mediaimg + "</a>"}}};
									add ("<a href=\"" + editurl + "\">" + editbuttonimg + "</a>" + checkmark + encl)};
								add ("</td>"); indentlevel--};
							add ("</tr>"); indentlevel--}}};
				add ("</table>"); indentlevel--;
				add ("</td></tr></table>"); indentlevel--;
				add ("<p><input type=\"submit\" name=\"deletePosts\" value=\"Delete\"></p>");
				add ("</form>"); indentlevel--}};
		add ("<form method=\"POST\">"); indentlevel++;
		if flArchivePage {
			add ("<input type=\"hidden\" name=\"d\" value=\"" + dateArg + "\">")};
		add ("<table border=\"0\" cellspacing=\"1\" cellpadding=\"5\">"); indentlevel++;
		bundle { //archive pages
			if adrblog^.prefs.flArchiveSection { //PBS 03/01/01: new pref, default off, for displaying the archive section
				separator ("Weblog archive pages...", "weblogArchivePages"); //PBS 02/24/01: help link
				<<add (radio.html.prefsElement.separator ("Weblog archive pages...", colspan:3))
				add ("<tr>"); indentlevel++;
				add ("<td align=\"left\" colspan=\"3\">"); indentlevel++;
				add ("<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr>"); indentlevel++;
				
				add ("<tr>");
				add ("<td>You can view and edit old posts using the calendar.<br>Click on a day in the calendar to view posts for that day.</td>");
				add ("<td rowspan=\"2\" align=\"center\" style=\"padding-left:30\">" + radio.weblog.drawCalendar (adrblog, d) + "</td>");
				add ("</tr>");
				
				add ("<td valign=\"bottom\"><table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">");
				add ("<tr><td style=\"padding-bottom:10\">Click the Publish Archive button to publish the entire archive.</td></tr>");
				add ("<tr><td><input type=\"submit\" value=\"Publish Archive\" name=\"publishArchive\"></td></tr>");
				add ("</table></td>");
				
				add ("</tr></table>"); indentlevel--;
				add ("</td>"); indentlevel--;
				add ("</tr>"); indentlevel--}};
		add ("</table>"); indentlevel--;
		add ("</form>"); indentlevel--};
	<<bundle //old code for the archive, calendar and preferences form
		<<bundle //add the archive and preferences form
			<<local (ftperror = "", manilaerror = "", mailtoblogerror = "")
			<<if pta^.method == "POST"
				<<if defined (args.setPrefs)
					<<try {adrblog^.prefs.ctDaysToDisplay = number (args.blogCtDaysToDisplay)}
					<<adrblog^.prefs.title = args.blogTitle
					<<wp.newtextobject (args.blogDescription, @adrblog^.prefs.description)
					<<adrblog^.prefs.authorName = args.blogAuthorName
					<<adrblog^.prefs.authorMailAddress = args.blogAuthorMailAddress
					<<adrblog^.prefs.homePageFilePath = args.blogHomePageFilePath
					<<adrblog^.prefs.rssFilePath = args.blogRssFilePath
					<<try {adrblog^.prefs.viewing.ctPosts = number (args.blogCtPostsOnBlogPage)}
					<<adrblog^.prefs.flPublicBlog = defined (args.notifyUserLand)
					<<adrblog^.prefs.flArchiveSection = defined (args.archiveSection) //PBS 03/01/01: turn on/off archive pages section
					<<bundle //do category checkboxes, if they changed, redirect back to show the result of the pref change
						<<local (origval = adrblog^.prefs.flCategoryCheckboxes)
						<<local (newval = defined (args.categoryCheckboxes))
						<<if origval != newval
							<<adrblog^.prefs.flCategoryCheckboxes = newval
							<<radio.webServer.redirect (pta^.uri)
							<<return ("")
					<<scratchpad.args = args; edit (@scratchpad.args)
				<<if defined (args.setFtp)
					<<adrblog^.prefs.ftp.server = args.ftpServer
					<<adrblog^.prefs.ftp.path = args.ftpPath
					<<if not (args.ftpUrl endsWith "/")
						<<args.ftpUrl = args.ftpUrl + "/"
					<<if not (string.lower (args.ftpUrl) beginsWith "http://")
						<<args.ftpUrl = "http://" + args.ftpUrl
					<<adrblog^.prefs.ftp.url = args.ftpUrl
					<<adrblog^.prefs.ftp.username = args.ftpUserName
					<<if args.ftpPassword != ""
						<<if args.ftpPassword == args.ftpPasswordRepeat
							<<adrblog^.prefs.ftp.password = binary (args.ftpPassword)
						<<else
							<<adrblog^.prefs.ftp.enabled = false
							<<ftperror = "Can't set your FTP password because the two passwords you entered weren't identical."
					<<adrblog^.prefs.ftp.enabled = defined (args.ftpEnabled) //01/17/01 JES
					<<if sizeOf (adrblog^.prefs.ftp.password) == 0
						<<adrblog^.prefs.ftp.enabled = false
				<<if defined (args.setMailToBlog)
					<<scratchpad.args = args; edit (@scratchpad.args)
					<<adrblog^.prefs.mailPosting.server = args.mailToBlogServer
					<<adrblog^.prefs.mailPosting.account = args.mailToBlogAccount
					<<adrblog^.prefs.mailPosting.secretSubject = args.mailToBlogSecretSubject
					<<if args.mailToBlogPassword != ""
						<<if args.mailToBlogPassword == args.mailToBlogPasswordRepeat
							<<adrblog^.prefs.mailPosting.password = binary (args.mailToBlogPassword)
						<<else
							<<mailtoblogerror = "Can't set your Mail-to-Weblog password because the two passwords you entered weren't identical."
					<<adrblog^.prefs.mailPosting.enabled = defined (args.mailToBlogEnabled)
				<<if defined (args.setManilaMirroring)
					<<adrblog^.prefs.manila.enabled = false //01/17/01 JES: in case there's a password mismatch
					<<if not (args.manilaSiteUrl endsWith "/")
						<<args.manilaSiteUrl = args.manilaSiteUrl + "/"
					<<if not (string.lower (args.manilaSiteUrl) beginsWith "http://")
						<<args.manilaSiteUrl = "http://" + args.manilaSiteUrl
					<<adrblog^.prefs.manila.url = args.manilaSiteUrl
					<<adrblog^.prefs.manila.username = args.manilaSiteUserName
					<<if args.manilaSitePassword != ""
						<<if args.manilaSitePassword == args.manilaSitePasswordRepeat
							<<adrblog^.prefs.manila.password = binary (args.manilaSitePassword)
						<<else
							<<manilaError = "Can't set your Manila site password because the two passwords you entered weren't identical."
					<<adrblog^.prefs.manila.enabled = defined (args.manilaMirroringEnabled)
					<<if defined (adrblog^.prefs.manila.siteName)
						<<delete (@adrblog^.prefs.manila.siteName)
				<<if defined (args.setMainTemplate)
					<<op.newoutlineobject (args.blogTemplate, @adrblog^.prefs.template)
				<<if defined (args.setItemTemplate)
					<<op.newoutlineobject (args.blogItemTemplate, @adrblog^.prefs.itemTemplate)
				<<if defined (args.setDayTemplate)
					<<op.newoutlineobject (args.blogDayTemplate, @adrblog^.prefs.dayTemplate)
				<<if defined (args.setTheme)
					<<local (adrtheme = @radio.data.themes.[args.themeChoice])
					<<scratchpad.args = args; edit (@scratchpad.args)
					<<adrblog^.prefs.template = adrtheme^.template
					<<adrblog^.prefs.dayTemplate = adrtheme^.dayTemplate
					<<adrblog^.prefs.itemTemplate = adrtheme^.itemTemplate
					<<adrblog^.prefs.lastThemeApplied = args.themeChoice
				<<if defined (args.deletePosts)
					<<delete (@args.deletePosts)
					<<local (adr, adrpost)
					<<for adr in @args
						<<adrpost = @adrblog^.posts.[string.padwithzeros (nameof (adr^), 8)]
						<<if defined (adrpost^)
							<<local (adrcats = @adrpost^.categories)
							<<if defined (adrcats^)
								<<local (adr)
								<<local (id = number (nameof (adrpost^)))
								<<for adr in @adrblog^.categories
									<<if adr^.storyList contains id
										<<adr^.storyList = adr^.storyList - {id}
										<<adr^.flDirty = true
								<<delete (adrcats)
							<<delete (adrpost)
				<<if defined (args.publishArchive) //PBS 02/22/01: publish all archive pages
					<<radio.weblog.publishArchivePages (adrBlog)
			<<bundle //add the posts
				<<local (ctposts = sizeof (adrblog^.posts))
				<<if ctposts > 0
					<<add ("<br>")
					<<add ("<form method=\"POST\">"); indentlevel++
					<<if flArchivePage
						<<add ("<input type=\"hidden\" name=\"d\" value=\"" + dateArg + "\">")
					<<add ("<table cellspacing=\"0\" cellpadding=\"0\"><tr bgcolor=\"" + radio.data.htmlColors.framecolor + "\"><td>"); indentlevel++
					<<add ("<table border=\"0\" cellspacing=\"1\" cellpadding=\"5\">"); indentlevel++
					<<if flArchivePage
						<<add (radio.html.prefsElement.separator ("Posts for " + date.shortString (d) + "...", false, 4, baseHelpUrl + "previousPosts")) //PBS 02/25/01: Help link
					<<else
						<<add (radio.html.prefsElement.separator ("Previous " + adrblog^.prefs.viewing.ctPosts + " posts...", false, 4, baseHelpUrl + "previousPosts")) //PBS 02/24/01: help link
					<<case adrblog^.prefs.viewing.mode
						<<"byPosts"
							<<local (i, adrpost, editurl, bgcolor)
							<<local (lastitemnum = ctposts - adrblog^.prefs.viewing.ctPosts + 1)
							<<if lastitemnum < 1
								<<lastitemnum = 1
							<<local (start = ctposts, end = lastitemnum)
							<<if flArchivePage
								<<local (day, month, year, hour, minute, second)
								<<date.get (d, @day, @month, @year, @hour, @minute, @second)
								<<local (adrFirstPost)
								<<local (firstOfDay = date.set (day, month, year, 0, 0, 0))
								<<radio.weblog.getNextPostAfterDate (adrblog, firstOfDay, @adrFirstPost)
								<<end = indexOf (adrFirstPost^) //reverse chronological order
								<<local (adrLastPost)
								<<local (lastOfDay = date.set (day, month, year, 23, 59, 59))
								<<radio.weblog.getLastPostBeforeDate (adrblog, lastOfDay, @adrLastPost)
								<<start = indexOf (adrLastPost^)
							<<for i = start downto end
								<<adrpost = @adrblog^.posts [i]
								<<if adrpost == adrPostToEdit
									<<bgcolor = radio.data.htmlColors.highlightColor
								<<else
									<<bgcolor = radio.data.htmlColors.cellbgcolor
								<<add ("<tr bgcolor=\"" + bgcolor + "\">"); indentlevel++
								<<bundle //add checkbox
									<<local (name = number (nameof (adrpost^)))
									<<local (checkboxval = "xxx ")
									<<if false
										<<checkboxval = checkboxval + "checked"
									<<add ("<td valign=\"top\"><input type=\"checkbox\" name=\"" + name + "\" value=" + checkboxval + "></td>")
								<<add ("<td valign=\"top\">" + string (adrpost^.text) + "</td>")
								<<add ("<td valign=\"top\" nowrap><font size=\"-1\">" + radio.string.getDateString (adrpost^.when) + "</font></td>")
								<<bundle //add little icons
									<<add ("<td valign=\"top\" nowrap>"); indentlevel++
									<<bundle //EDIT button, checkmark, enclosure icons
										<<local (args)
										<<new (tabletype, @args)
										<<args.itemToEdit = number (nameof (adrpost^))
										<<if flArchivePage
											<<args.d = dateArg
										<<editurl = pta^.uri + "?" + webserver.encodeargs (@args)
										<<editurl = string.replaceAll (editurl, "%2F", "/")
										<<local (checkmark = "")
										<<bundle //an item has a checkmark if it's in at least one category
											<<if defined (adrpost^.categories)
												<<local (adr)
												<<for adr in @adrpost^.categories
													<<if adr^
														<<checkmark = " <a title=\"" + radio.data.strings.checkmarktooltip + "\">" + checkmarkimg + "</a>"
														<<break
										<<local (encl = "")
										<<bundle //if it has an enclosure add a media link
											<<if defined (adrpost^.enclosure)
												<<if not defined (adrpost^.enclosure.error)
													<<encl = "<br><a href=\"" + adrpost^.enclosure.url + "\">" + mediaimg + "</a>"
										<<add ("<a href=\"" + editurl + "\">" + editbuttonimg + "</a>" + checkmark + encl)
									<<add ("</td>"); indentlevel--
								<<add ("</tr>"); indentlevel--
					<<add ("</table>"); indentlevel--
					<<add ("</td></tr></table>"); indentlevel--
					<<add ("<p><input type=\"submit\" name=\"deletePosts\" value=\"Delete\"></p>")
					<<add ("</form>"); indentlevel--
			<<add ("<form method=\"POST\">"); indentlevel++
			<<if flArchivePage
				<<add ("<input type=\"hidden\" name=\"d\" value=\"" + dateArg + "\">")
			<<add ("<table border=\"0\" cellspacing=\"1\" cellpadding=\"5\">"); indentlevel++
			<<bundle //archive pages
				<<if adrblog^.prefs.flArchiveSection //PBS 03/01/01: new pref, default off, for displaying the archive section
					<<separator ("Weblog archive pages...", "weblogArchivePages") //PBS 02/24/01: help link
					<<add (radio.html.prefsElement.separator ("Weblog archive pages...", colspan:3))
					<<add ("<tr>"); indentlevel++
					<<add ("<td align=\"left\" colspan=\"3\">"); indentlevel++
					<<add ("<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr>"); indentlevel++
					<<
					<<add ("<tr>")
					<<add ("<td>You can view and edit old posts using the calendar.<br>Click on a day in the calendar to view posts for that day.</td>")
					<<add ("<td rowspan=\"2\" align=\"center\" style=\"padding-left:30\">" + radio.weblog.drawCalendar (adrblog, d) + "</td>")
					<<add ("</tr>")
					<<
					<<add ("<td valign=\"bottom\"><table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">")
					<<add ("<tr><td style=\"padding-bottom:10\">Click the Publish Archive button to publish the entire archive.</td></tr>")
					<<add ("<tr><td><input type=\"submit\" value=\"Publish Archive\" name=\"publishArchive\"></td></tr>")
					<<add ("</table></td>")
					<<
					<<add ("</tr></table>"); indentlevel--
					<<add ("</td>"); indentlevel--
					<<add ("</tr>"); indentlevel--
			<<bundle //add preferences form
				<<bundle //basic info
					<<separator ("Basic info about your weblog...", "basicInfoAboutYourWeblog") //PBS 02/24/01: help link
					<<add (radio.html.prefsElement.separator ("Basic info about your weblog...", colspan:3)) //PBS 02/19/01: terminology: weblog, not blog
					<<add (radio.html.prefsElement.textitem ("Title", "blogTitle", 50, 100, adrblog^.prefs.title, colspan:2))
					<<add (radio.html.prefsElement.textArea ("Description", "blogDescription", 3, ctcolstextareas, string (adrblog^.prefs.description), colspan:2))
					<<add (radio.html.prefsElement.textitem ("Your name", "blogAuthorName", 50, 100, adrblog^.prefs.authorName, colspan:2))
					<<add (radio.html.prefsElement.textitem ("Mail address", "blogAuthorMailAddress", 50, 100, adrblog^.prefs.authorMailAddress, colspan:2))
					<<add (radio.html.prefsElement.textitem ("Home page path", "blogHomePageFilePath", 50, 100, adrblog^.prefs.homePageFilePath, colspan:2))
					<<add (radio.html.prefsElement.textitem ("RSS file path", "blogRssFilePath", 50, 100, adrblog^.prefs.rssFilePath, colspan:2))
					<<add (radio.html.prefsElement.textitem ("Show", "blogCtDaysToDisplay", 2, 5, adrblog^.prefs.ctDaysToDisplay, textToRight:" days on the home page.", colspan:2))
					<<add (radio.html.prefsElement.textitem ("Show", "blogCtPostsOnBlogPage", 2, 5, adrblog^.prefs.viewing.ctPosts, textToRight:" posts on this page (above).", colspan:2))
					<<add ("<tr>" + radio.html.prefsElement.checkbox ("Check this box if you'd like your weblog to listed on the UserLand <a href=\"http://www.userland.com/updates\">updates page</a> when you Publish it.", "notifyUserLand", adrblog^.prefs.flPublicBlog, colspan:3) + "</tr>") //PBS 02/19/01: weblog, not blog
					<<add ("<tr>" + radio.html.prefsElement.checkbox ("Check this box if you'd like your <a href=\"categories.wsf\">categories</a> listed at the top of the page with checkboxes allowing you to route posts through XML.", "categoryCheckboxes", adrblog^.prefs.flCategoryCheckboxes, colspan:3) + "</tr>")
					<<add ("<tr>" + radio.html.prefsElement.checkbox ("Check this box if you'd like a calendar interface for viewing and editing archived posts.", "archiveSection", adrblog^.prefs.flArchiveSection, colspan:3) + "</tr>")
					<<add ("<tr><td> </td><td><input type=\"submit\" name=\"setPrefs\" value=\"Submit\"></td><td> </td></tr>")
				<<bundle //FTP info
					<<separator ("Mirroring via FTP...", "mirroringViaFtp") //PBS 02/24/01: help link
					<<add (radio.html.prefsElement.separator ("Mirroring via FTP...", colspan:3))
					<<if ftperror != ""
						<<add ("<tr><td colspan=\"3\"><font color=\"red\">" + ftperror + "</font></td></tr>")
					<<add ("<tr>" + radio.html.prefsElement.checkbox ("Check this box if you'd like your weblog to be mirrored on an FTP site.", "ftpEnabled", adrblog^.prefs.ftp.enabled, colspan:3) + "</tr>") //PBS 02/19/01: weblog, not blog
					<<add (radio.html.prefsElement.textitem ("Server", "ftpServer", 50, 100, adrblog^.prefs.ftp.server, colspan:2))
					<<add (radio.html.prefsElement.textitem ("Path", "ftpPath", 50, 100, adrblog^.prefs.ftp.path, colspan:2))
					<<add (radio.html.prefsElement.textitem ("URL", "ftpUrl", 50, 100, adrblog^.prefs.ftp.url, colspan:2))
					<<add (radio.html.prefsElement.textitem ("Username", "ftpUserName", 50, 100, adrblog^.prefs.ftp.username, colspan:2))
					<<add (radio.html.prefsElement.textitem ("Password", "ftpPassword", 50, 100, "", type:"password", colspan:2))
					<<add (radio.html.prefsElement.textitem ("Repeat", "ftpPasswordRepeat", 50, 100, "", type:"password", colspan:2))
					<<add ("<tr><td> </td><td><input type=\"submit\" name=\"setFtp\" value=\"Submit\"></td><td> </td></tr>")
				<<bundle //Manila mirring info
					<<separator ("Mirroring to a Manila site...", "mirroringToAManilaSite") //PBS 02/24/01: help link
					<<add (radio.html.prefsElement.separator ("Mirroring to a Manila site...", colspan:3))
					<<if manilaerror != ""
						<<add ("<tr><td colspan=\"3\"><font color=\"red\">" + manilaerror + "</font></td></tr>")
					<<add ("<tr>" + radio.html.prefsElement.checkbox ("Check this box if you'd like your weblog to be mirrored on a Manila site.", "manilaMirroringEnabled", adrblog^.prefs.manila.enabled, colspan:3) + "</tr>") //PBS 02/19/01: weblog, not blog
					<<add (radio.html.prefsElement.textitem ("URL", "manilaSiteUrl", 50, 100, adrblog^.prefs.manila.url, colspan:2))
					<<add (radio.html.prefsElement.textitem ("Username", "manilaSiteUserName", 50, 100, adrblog^.prefs.manila.username, colspan:2))
					<<add (radio.html.prefsElement.textitem ("Password", "manilaSitePassword", 50, 100, "", type:"password", colspan:2))
					<<add (radio.html.prefsElement.textitem ("Repeat", "manilaSitePasswordRepeat", 50, 100, "", type:"password", colspan:2))
					<<add ("<tr><td> </td><td><input type=\"submit\" name=\"setManilaMirroring\" value=\"Submit\"></td><td> </td></tr>")
				<<bundle //Mail-to-Blog configuration
					<<separator ("Mail-to-Weblog...", "mailToWeblog")
					<<if mailtoblogerror != ""
						<<add ("<tr><td colspan=\"3\"><font color=\"red\">" + mailtoblogerror + "</font></td></tr>")
					<<add ("<tr>" + radio.html.prefsElement.checkbox ("Check this box if you'd like be able to post to your weblog via email.", "mailToBlogEnabled", adrblog^.prefs.mailPosting.enabled, colspan:3) + "</tr>") 
					<<add (radio.html.prefsElement.textitem ("Server", "mailToBlogServer", 50, 100, adrblog^.prefs.mailPosting.server, colspan:2))
					<<add (radio.html.prefsElement.textitem ("Account", "mailToBlogAccount", 50, 100, adrblog^.prefs.mailPosting.account, colspan:2))
					<<add (radio.html.prefsElement.textitem ("Password", "mailToBlogPassword", 50, 100, "", type:"password", colspan:2))
					<<add (radio.html.prefsElement.textitem ("Repeat", "mailToBlogPasswordRepeat", 50, 100, "", type:"password", colspan:2))
					<<add (radio.html.prefsElement.textitem ("Secret subject", "mailToBlogSecretSubject", 50, 100, adrblog^.prefs.mailPosting.secretSubject, colspan:2))
					<<add ("<tr><td> </td><td><input type=\"submit\" name=\"setMailToBlog\" value=\"Submit\"></td><td> </td></tr>")
				<<bundle //themes
					<<separator ("Themes...", "themes") //PBS 02/24/01: help link
					<<add (radio.html.prefsElement.separator ("Themes...", colspan:3))
					<<local (itemlist = {}, namelist = {}, adr)
					<<for adr in @radio.data.themes
						<<itemlist = itemlist + {nameof (adr^)}
						<<if defined (adr^.displayName)
							<<namelist = namelist + adr^.displayName
						<<else
							<<local (name = nameOf (adr^))
							<<if defined (radio.data.themes.[name])
								<<if defined (radio.data.themes.[name].displayName)
									<<name = radio.data.themes.[name].displayName
									<<adr^.displayName = name
							<<namelist = namelist + (string.upper (name[1]) + string.mid (name, 2, infinity))
					<<if defined (adrblog^.prefs.lastThemeApplied)
						<<add (radio.html.prefsElement.popup ("Choose one", "themeChoice", itemlist, adrblog^.prefs.lastThemeApplied, namelist))
					<<else
						<<add (radio.html.prefsElement.popup ("Choose one", "themeChoice", itemlist, "default", namelist))
					<<add ("<tr><td> </td><td><input type=\"submit\" name=\"setTheme\" value=\"Submit\"></td><td> </td></tr>")
				<<bundle //templates
					<<on exportOutline (adr) //PBS 03/14/01: get template ready to go in textarea
						<<local (s = string (adr^))
						<<s = radio.html.translateToEntities (s)
						<<s = string.replaceAll (s, "//", "\\//") //no active URLs
						<<s = string.replaceAll (s, "@", "\\@") //no active email addresses
						<<return (s)
					<<separator ("Templates...", "templates") //PBS 02/24/01: help link
					<<add (radio.html.prefsElement.separator ("Templates...", colspan:3))
					<<bundle //main template
						<<add (radio.html.prefsElement.textArea ("Main template", "blogTemplate", 25, ctcolstextareas, exportOutline (@adrblog^.prefs.template), colspan:2))
						<<add ("<tr>"); indentlevel++
						<<add ("<td> </td>")
						<<add ("<td width=\"210\"><input type=\"submit\" name=\"setMainTemplate\" value=\"Submit\"></td>")
						<<if flsamemachine //PBS 03/03/01: check for same machine
							<<add ("<td align=\"left\">" + radio.html.editWithRadioBadge (@adrblog^.prefs.template) + "</td>")
						<<else
							<<add ("<td> </td>")
						<<add ("</tr>"); indentlevel--
					<<bundle //day template
						<<add (radio.html.prefsElement.textArea ("Day template", "blogDayTemplate", 10, ctcolstextareas, exportOutline (@adrblog^.prefs.daytemplate), colspan:2))
						<<add ("<tr>"); indentlevel++
						<<add ("<td> </td>")
						<<add ("<td><input type=\"submit\" name=\"setDayTemplate\" value=\"Submit\"></td>")
						<<if flsamemachine //PBS 03/03/01: check for same machine
							<<add ("<td align=\"left\">" + radio.html.editWithRadioBadge (@adrblog^.prefs.daytemplate) + "</td>")
						<<else
							<<add ("<td> </td>")
						<<add ("</tr>"); indentlevel--
					<<bundle //item template
						<<add (radio.html.prefsElement.textArea ("Item template", "blogItemTemplate", 10, ctcolstextareas, exportOutline (@adrblog^.prefs.itemTemplate), colspan:2))
						<<add ("<tr><td> </td><td>" + radio.html.editWithRadioBadge (@adrblog^.prefs.itemTemplate) + "</td></tr>")
						<<add ("<tr>"); indentlevel++
						<<add ("<td> </td>")
						<<add ("<td><input type=\"submit\" name=\"setItemTemplate\" value=\"Submit\"></td>")
						<<if flsamemachine //PBS 03/03/01: check for same machine
							<<add ("<td align=\"left\">" + radio.html.editWithRadioBadge (@adrblog^.prefs.itemTemplate) + "</td>")
						<<else
							<<add ("<td> </td>")
						<<add ("</tr>"); indentlevel--
			<<bundle //commented stuff
				<<add (radio.html.prefsElement.popup ("Nobody's right if everybody's wrong", "testPopup", {"one", "two", "three"}, "two"))
			<<add ("</table>"); indentlevel--
			<<add ("</form>"); indentlevel--
	return (htmltext)};
bundle { //test code
	html.setpagetableaddress (@scratchpad.params);
	main ()}



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.