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

system.verbs.builtins.userland.createDefaultManilaSite

on createDefaultManilaSite (siteName="defaultManilaWebsite", password=nil, serverName=nil) {
	<<Create the default Manila site if it doesn't already exist.
		<<Return true if it gets created, return false if it already exists and thus doesn't get created.
		<<This is a wrapper for manilaSuite.clone. It's called from userland.finishInstall, when the user has elected to turn on the webserver.
		<<10/26/99; 6:22:28 PM by PBS
	
	if file.exists (Frontier.getSubFolder ("www") + siteName + ".root") { //does the file exist?
		return (false)}; //the file exists
	
	local (dgName = siteName + "Discuss");
	local (groupName = siteName + "Members");
	local (sysopName = user.prefs.name);
	local (sysopEmail = user.prefs.mailAddress);
	local (sysopPassword);
	
	if password == nil { //create a new password
		local (i);
		for i = 1 to 12 {
			sysopPassword = sysopPassword + char (random ('A', 'Z'))}}
	else {
		sysopPassword = password};
	
	if serverName == nil { //figure out the server name
		serverName = tcp.dns.getMyDomainName ();
		if not (serverName contains ".") {
			serverName = tcp.myDottedId ()}};
	
	local (siteUrl = "http://" + serverName + "/" + siteName + "/");
	
	local (siteInfo);
	siteInfo = manilaSuite.clone (siteName + "ManilaWebsite", groupName, dgName, sysopEmail, sysopPassword, sysopName, siteUrl, false, true);
	
	bundle { //set up an It Worked! message
		local (adrSite = siteInfo.adrSite);
		local (adrNewsSite = @adrSite^.["#newsSite"]);
		local (dgName = adrSite^.["#prefs"].discussionRoot);
		local (homePageMsgNum = adrNewsSite^.discussLinks.homePageMsgNum);
		local (adrRoot = [system.temp.mainResponder.discussRootFile].[dgName]);
		
		<<Home page.
		local (adrMsgTable = mainResponder.discuss.getMessageTable (homePageMsgNum, adrRoot:adrRoot));
		adrMsgTable^.subject = userland.defaultPages.homeTitle;
		adrMsgTable^.body = string (userland.defaultPages.home);
		
		<<FAQ page.
		local (faqMsgNum = adrNewsSite^.discussLinks.faqMsgNum);
		adrMsgTable = mainResponder.discuss.getMessageTable (faqMsgNum, adrRoot:adrRoot);
		adrMsgTable^.subject = userland.defaultPages.faqTitle;
		adrMsgTable^.body = string (userland.defaultPages.faq);
		
		<<Feedback page.
		local (emailMsgNum = adrNewsSite^.discussLinks.emailMsgNum);
		adrMsgTable = mainResponder.discuss.getMessageTable (emailMsgNum, adrRoot:adrRoot);
		adrMsgTable^.subject = userland.defaultPages.feedbackTitle;
		adrMsgTable^.body = string (userland.defaultPages.feedback);
		
		<<Make sure the managing editor gets the cookie in a minute.
		adrNewsSite^.flFirstTimeVisitAfterInstall = true};
	
	if not defined (temp.installer) {
		new (tableType, @temp.installer)};
	temp.installer.urlToOpen = siteInfo.adrSite^.["#ftpSite"].url;
	
	return (true)}



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.