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

on upstreamSettings (folder, adrErrorFlag, pta) {
	<<8/3/01; 2:58:38 AM by JES
		<<Implement upstreaming prefs for the folder viewer.
		<<9/6/01; 3:10:54 AM by JES
			<<If the form is submitted without error (the user was able to register), then turn upstreaming on.
	local (type = "xmlStorageSystem"); //the default
	local (adrfolder);
	radio.file.getFileAttributes (folder, @adrfolder);
	local (adrspec);
	if file.exists (folder + {
		if radio.upstream.getUpstreamSpec (adrfolder, @adrspec) { //get the type from #upstream.xml
			type = adrspec^.type}};
	bundle { //get the type if specified in the POST args
		if pta^.method == "POST" {
			if defined (pta^.radioResponder.postArgs) {
				if defined (pta^.radioResponder.postArgs.upstreamDriver) {
					type = pta^.radioResponder.postArgs.upstreamDriver;
					delete (@pta^.radioResponder.postArgs.upstreamDriver)}}}}; //so it won't confuse the prefsBrowser
	local (adrdriver);
	radio.upstream.findDriver (type, @adrdriver);
	if defined (adrdriver^.configPage) {
		try { //trap errors
			adrErrorFlag^ = false; = true;
			return (adrdriver^.configPage (adrfolder, adrspec))}
		else { //show the error to the user
			adrErrorFlag^ = true;
			return ("<font color=\"red\">Can't edit the upstream settings because the driver reported an error: " + tryError + "</font>")}}
	else { //this driver doesn't know how to edit settings in the browser
		adrErrorFlag^ = true;
		return ("<font color=\"red\">Can't edit upstream settings because the '" + type + "' driver doesn't have a 'configPage' script.</font>")}}
<<bundle //testing
	<<local (flError = false)
	<<html.setPageTableAddress (
	<<upstreamSettings ("Backup:Radio UserLand:www:system:upstream:", @flError,
	<<html.deletePageTableAddress ()

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.