Monday, November 08, 2010 at 12:03 AM.
system.verbs.builtins.html.commands.newSite
<<Changes
<<2/3/10; 6:46:09 PM by DW
<<In the OPML Editor, the main root file is called opml.root. If we're in that database, use the same logic as would apply for frontier.root.
if dialog.ask ("Name of new website table?", @user.prefs.dialogs.lastNewSite) {
local (name = user.prefs.dialogs.lastNewSite);
local (adrSite);
bundle { //5.1.5 -- more complex logic to allow for guest databases
local (filepath = Frontier.getFilePath (), adrSitesTable);
local (fname = string.lower (file.fileFromPath (filepath)));
if (fname == "frontier.root") or (fname == "opml.root") {
adrSitesTable = @websites}
else {
adrSitesTable = @[filepath]}; //don't create a websites table: PBS 1/15/99
if not defined (adrSitesTable^) {
new (tabletype, adrSitesTable)};
adrSite = @adrSitesTable^.[name]};
if defined (adrSite^) {
if not dialog.confirm ("Replace existing website table named \"" + name + "\"?") {
return}};
if defined (user.html.newSiteTemplate) { //user-defined new site template
adrSite^ = user.html.newSiteTemplate}
else { //use default new site template
adrSite^ = html.data.newSiteTemplate;
bundle { //set font and font size of new site according to user's prefs
<<Wednesday, January 21, 1998 at 4:23:41 PM by PBS
local (oldTarget = target.set (adrSite));
editMenu.setFont (user.prefs.fonts.tableFont);
editMenu.setFontSize (user.prefs.fonts.tableFontSize);
target.set (oldTarget)};
case sys.os () { //set addLineFeeds pref if on Windows
"Win95";
"WinNT" {
adrSite^.["#prefs"].addLinefeeds = true}};
bundle { //set the #ftpSite table, as a local site, contained within the parent site, or the Websites folder
with adrSite^.["#ftpSite"] {
local (pc = file.getPathChar ());
folder = file.folderFromPath (Frontier.getProgramPath ()) + "Websites" + pc + name + pc;
url = file.fileToURL (folder);
url = url + "/"}};
bundle { //create the default home page
local (defaultFileName = "index");
try {defaultFileName = user.html.prefs.defaultFileName};
if defaultFileName != "index" {
table.rename (@adrSite^.index, defaultFileName)};
local (oldTarget = target.set (@adrSite^.[defaultFileName]));
editMenu.selectAll ();
editMenu.setFont (user.prefs.fonts.wpTextFont);
editMenu.setFontSize (user.prefs.fonts.wpTextFontSize);
wp.setSelect (infinity, infinity);
target.set (oldTarget)}};
window.zoom (adrSite);
fileMenu.save ();
edit (adrSite);
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.