Monday, April 04, 2011 at 1:08 AM.


on newUser () {
		<<3/15/11; 11:05:09 AM by DW
	local (pta = html.getpagetableaddress (), adrdata = radio2suite.init (), adruser, t);
	pta^.title = "New User";
	scratchpad.newuserparams = pta^;
	if not radio2Suite.securityChallenge (@adruser) {
		return ("")};
	return (radio2Suite.viewNewUser (adruser));
	<<if string.lower (nameof (adruser^)) != string.lower (adrdata^.prefs.userWhoCanCreateNewAccounts)
		<<return ("<br><h3>Sorry you're not authorized to create new users on this site.</h3>")
	<<new (tabletype, @t)
	<<t.username = ""
	<<t.message = ""
	<<if pta^.method == "POST"
		<<local (args)
		<<new (tabletype, @args)
		<<webserver.parseArgs (pta^.requestBody, @args)
		<<scratchpad.args = args; edit (@scratchpad.args)
		<<if defined (adrdata^.users.[args.username])
			<<return ("<br><h3>Can't create the account because there already is a user \"" + args.username + ".\"</h3>")
		<<radio2Suite.newUser (args.username, args.password)
		<<t.message = "New user account for \"" + args.username + "\" created."
	<<local (s = string.multiplereplaceall (string (, @t, false, "<%", "%>"))
	<<return (s)
bundle { //test code
	html.setpagetableaddress (@scratchpad.newuserparams);
	newUser ()}

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.