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


on createDefaultIspSite (siteName="createASiteManilaWebsite", password=nil, serverName=nil, displaySiteName=nil, tagline=nil, theme=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
	bundle { //set up ISP prefs in config.root
		if not defined ( {
			new (tableType,};
		if not defined ( {
			new (tableType,};
		if not defined ( {
			new (tableType,}; = serverName; = siteName; //"createASiteManilaWebsite"
		if not defined ( { = false};
		if not defined ( { = true}};
	if not defined (config.manila.prefs.hostingGdbName) {
		config.manila.prefs.hostingGdbName = "manilaWebsites.root"};
	local (gdbName = config.manila.prefs.hostingGdbName);
	local (gdbPath = Frontier.getSubFolder ("www") + gdbName);
	if not (defined ([gdbPath])) { //is it already open?
		if file.exists (gdbPath) { (gdbPath, true)} //it does, open it
		else { (gdbPath);
			window.hide (@[gdbPath])}};
			<< (gdbPath)
	bundle { //add hosting gdb to user.databases
		local (adrTable = @user.databases.[gdbName]);
		if not defined (adrtable^) {
			new (tableType, adrTable)};
		if not defined (adrTable^.f) {
			adrTable^.f = gdbPath};
		if not defined (adrTable^.openOnStartup) {
			adrTable^.openOnStartup = true};
		if not defined (adrTable^.runStartupScript) {
			adrTable^.runStartupScript = false};
		if not defined (adrTable^.supportsIndexing) {
			adrTable^.supportsIndexing = true};
		if not defined (adrTable^.supportsSubscribe) {
			adrTable^.supportsSubscribe = false}};
	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 =;
	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 + "/");
	if theme == nil { //default to ISP theme
		theme = "ISP"};
	local (siteInfo);
	siteInfo = manilaSuite.clone (siteName, groupName, dgName, sysopEmail, sysopPassword, sysopName, siteUrl, false, true, true, gdbName, siteName, theme, false); //JES 4/12/02: Pass in siteName instead of "createASiteManilaWebsite" for the canonicalSiteName parameter
	<<siteInfo.adrSite^.["#newsSite"].siteName = "Home"
	<<siteInfo.adrSite^.["#newsSite"].flFirstTimeVisitAfterInstall = true
	delete (@siteInfo.adrSite^.["#navigator"].structure);
	bundle { //tag line, siteName, dg access
		local (adrSite = siteInfo.adrSite);
		if displaySiteName == nil {
			displaySiteName = canonicalSiteName};
		if tagline == nil {
			tagline = ""};
		wp.newTextObject (tagline, @adrSite^.["#newsSite"].tagLine);
		adrSite^.["#newsSite"].siteName = displaySiteName;
		try {delete (@adrSite^.discuss.edit.["#members"])};
		adrSite^.discuss.["#members"] = adrSite^.["#prefs"].defaultMembershipGroup};
	<<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 (
		<<Make sure the managing editor gets the cookie in a minute.
		<<adrNewsSite^.flFirstTimeVisitAfterInstall = true
	bundle { //set up the domain for this site
		local (domainMinusPort = string.popSuffix (serverName, ':'));
		local (adrDomain =[domainMinusPort]);
		if not defined (adrDomain^) { //don't delete existing domain configurations
			new (tableType, adrDomain);
			new (tableType, @adrDomain^.siteTree);
			new (tableType, @adrDomain^;
			local (s = "<siteTree>\r\t<site address=\"" + siteName + "\"/>\r\t</siteTree>");
			wp.newTextObject (s, @adrDomain^}};
	if not defined (temp.installer) {
		new (tableType, @temp.installer)};
	temp.installer.urlToOpen = siteInfo.adrSite^.["#ftpSite"].url;
	<<temp.installer.urlToOpen = siteInfo.adrSite^.["#ftpSite"].url + "controlPanel/" //PBS 06/23/00: Open the Control Panel, not the hosting site
	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.