|
From: creecode <icr...@us...> - 2006-03-13 21:12:04
|
Update of /cvsroot/frontierkernel/odbs/frontierRoot/system/startup In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24747 Modified Files: startupScript Log Message: install DLLs added init of user.callbacks.fileSetModified on first root run upon first root run alert user that Frontier is going to use web browser to complete install, first time users may find it confusing to launch Frontier then have it immediately disappear on them. script formatting tweaks minor tweaks to startup.license window formatting code Index: startupScript =================================================================== RCS file: /cvsroot/frontierkernel/odbs/frontierRoot/system/startup/startupScript,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** startupScript 15 Feb 2006 05:18:22 -0000 1.19 --- startupScript 13 Mar 2006 21:11:48 -0000 1.20 *************** *** 1,3 **** ! FrontierVcsFile:1:scpt:system.startup.startupScript ! ÇChanges Ç2/14/06; 9:03:23 PM by TAC Çmoved tools.startup to after html.init Çuse improved Frontier.installApp to open prefs.root Çwhen opening databases make copy of user.databases in case startup scripts add entries to it, that way we don't lose track of what were opening Çmove webBrowser.init before html.init so html.init can call webBrowser.getDefaultBrowser without error Çwhen opening all databases, check if already open, prevents error on Windows Çwork around relative path issue on Windows Çon set up of quickscript window on windows, use Frontier.showApplication, Frontier.bringToFront alone doesn't do the trick Ç2/6/06; 12:04:50 PM by TAC Çbring frontier to front before setting quickscript text for first root run Ç2/5/06; 9:45:01 AM by TAC Çremoved prefs.root startup script code when doing a first root run, no need to run it there as it is run later in the script Ç2/1/06; 1:27:51 PM by TAC Çdeleted some unneeded commented code Ç1/20/06; 1:54:05 PM by TAC Çdisable agents for all startups, not just for first root run Çthere was a problem with Tools starting up and its agent manipulating menus at the same time and causing a crash Ç12/24/05; 12:33:32 PM by TAC Çprefs.root now has a #startup script, deal with it Ç11/10/05; 4:24:48 PM by TAC Çmoved system.temp.Frontier/starting up after first if firstRootRun check was causing startup problem Ç11/5/05; 12:00:32 PM by TAC Çmoved system.temp.Frontier check back to top of script Ç10/9/05; 3:39:07 PM by TAC Çwhen storing prefs.root path, store realative path Çuse table.copyUndefinedContents to copy some item Çmove some of the user prefs initializations into Frontier.data.userPrefs Çrearrange script so that some initializations can happen outside of the first root run, this should make it easier to add new items and not have them get missed because the first root run had already been run once Ç10/4/05; 7:26:36 PM by TAC Çupon check for presence of Psapi.dll, don't use hard coded application name Ç9/26/05; 4:30:14 PM by TAC Çadded user.prefs.flReplaceDialogExpertMode Ç8/23/05; 7:22:18 PM by TAC Çadded user.prefs.flCompactModalMenus Ç7/14/05; 10:35:39 AM by TAC Çsystem.menus.data.currentMenuType set to nil so agent will update modal menu properly upon relaunch Ç7/6/05; 12:21:38 PM by TAC Çchanged user.callbacks.sendmail to user.callbacks.tcpSendMail Çadded user.prefs.mailHostPort Ç6/15/05; 6:52:11 PM by TAC Çrewrite for Open Source release, bring in code from startup.startupScript, userland.firstRootRun, userland.finishInstall, and userland.cleanRoot ÇOld code Çstartup.startupScript <http://cvs.sourceforge.net/viewcvs.py/frontierkernel/odbs/frontierRoot/system/startup/startupScript?rev=1.1> Çuserland.firstRootRun <http://cvs.sourceforge.net/viewcvs.py/frontierkernel/odbs/frontierRoot/system/verbs/builtins/userland/Attic/firstRootRun?rev=1.1> Çuserland.finishInstall <http://cvs.sourceforge.net/viewcvs.py/frontierkernel/odbs/frontierRoot/system/verbs/builtins/userland/Attic/finishInstall?rev=1.1> Çuserland.cleanRoot <http://cvs.sourceforge.net/viewcvs.py/frontierkernel/odbs/frontierRoot/system/verbs/builtins/userland/Attic/cleanRoot?rev=1.1> Ç06/08/01; 11:24:35 PM by JES ÇWhen opening databases defined at user.databases, skip objects which aren't tables. This avoids the condition where startup wouldn't complete, if there's an item #1 in the user.databases table. Ç06/02/01; 8:34:20 PM by PBS ÇDo the web-based install and open the Control Panel if this is the first root run. Ç04/28/01; 7:48:46 PM by JES ÇCall Frontier.tools.startup in a try block, so that the startup process will finish even if Tools installation fails. Ç04/20/01; 4:49:05 PM by JES ÇCall tools.startup to install Tools at startup. Ç10/7/99; 4:20:26 PM by PBS ÇOnly run the #startup script in a guest database if runStartupScript exists and is true. Previously, it would be run whether runStartupScript was true or false. Çhttp://frontier.userland.com/stories/storyReader$1760 Ç10/6/99; 10:21:35 PM by PBS ÇOnly set the taskTime for the overnight task if it's in the past. This fixes a bug when the taskTime was before midnight, but it was being set for the next day, so the overnight task wouldn't run. Çhttp://frontier.userland.com/stories/storyReader$1761 Ç8/19/99; 6:44:48 AM by DW ÇMake sure that taskTimes in user.scheduler.tasks are in the future. ÇWe do this much more quickly than scheduler.monitor would. Çhttp://discuss.userland.com/msgReader$9658 ÇThis script runs when Frontier opens the Frontier.root file. if defined (system.temp.Frontier) { // only run the startup script once return}; local (flEnableAgents = true, flOpenDatabases = true, flEnableHttpServer = true); // can be set by the external startup script local (flFirstRootRun = true); bundle { // miscellaneous initializations, checks, and etc., phase 1 of 2 Frontier.enableAgents (false); // try to keep agents from reporting errors and causing problems Frontier.pathString = file.folderFromPath (Frontier.getFilePath ()); if defined (user.prefs.firstRootRun) { flFirstRootRun = user.prefs.firstRootRun}}; if flFirstRootRun { while window.frontmost () != "" { // open windows can mess things up later on window.hide (window.frontmost ())}; Çreturn (false) // enable for testing new (tableType, @system.temp); new (tableType, @root.user)}; bundle { // system.temp.Frontier, we are starting up new (tableType, @system.temp.Frontier); system.temp.Frontier.startupTime = clock.now (); system.temp.Frontier.startingUp = true}; backups.init (); batchExporter.init (); export.init (); rootUpdates.init (); // set up user.rootUpdates, even though root updates uses tcp, its ok to set up here as no tcp calls are made at this time webEdit.init (); bundle { // set up user.prefs if flFirstRootRun { new (tableType, @user.prefs); bundle { // set up user.prefs.commonStyles case sys.os () { "MacOS" { if system.environment.isCarbon { user.prefs.commonStyles = Frontier.data.commonStylesMacCarbon} else { user.prefs.commonStyles = Frontier.data.commonStylesMac}}; "Win95"; "WinNT" { user.prefs.commonStyles = Frontier.data.commonStylesWin}}}}; table.copyUndefinedContents (@Frontier.data.userPrefs, @user.prefs); bundle { // set up user.prefs.dialogs if flFirstRootRun { new (tableType, @user.prefs.dialogs)}; table.copyUndefinedContents (@Frontier.data.userPrefs.dialogs, @user.prefs.dialogs)}; bundle { // set up user.prefs.search if flFirstRootRun { new (tableType, @user.prefs.search)}; table.copyUndefinedContents (@Frontier.data.userPrefs.search, @user.prefs.search); if not (defined (user.prefs.search.replaceWith)) { user.prefs.search.replaceWith = Frontier.version ()}}; Frontier.setupUserPrefsFonts ()}; if flFirstRootRun { bundle { // set up the quick script window if system.environment.isWindows { Frontier.showApplication ()}; Frontier.bringToFront (); clipboard.putvalue ("dialog.notify (\"Hello World!\")"); window.quickScript (); editmenu.selectAll (); editmenu.paste (); window.close ("Quick Script")}; bundle { // set up root window local (w = "root"); window.open (w); window.setPosition (w, 0, 0); editMenu.setFont (user.prefs.fonts.tableFont); editMenu.setFontSize (user.prefs.fonts.tableFontSize); window.zoom (w)}; bundle { // set up user.callbacks new (tableType, @user.callbacks); new (tableType, @user.callbacks.closeWindow); new (tableType, @user.callbacks.cmd2click); new (tableType, @user.callbacks.compileChangedScript); new (tableType, @user.callbacks.control2click); new (tableType, @user.callbacks.fileWriteWholeFile); new (tableType, @user.callbacks.opCollapse); new (tableType, @user.callbacks.opCursorMoved); new (tableType, @user.callbacks.openWindow); new (tableType, @user.callbacks.opExpand); new (tableType, @user.callbacks.opInsert); new (tableType, @user.callbacks.opReturnKey); new (tableType, @user.callbacks.opRightClick); new (tableType, @user.callbacks.opStruct2Click); new (tableType, @user.callbacks.option2click); new (tableType, @user.callbacks.resume); new (tableType, @user.callbacks.saveWindow); new (tableType, @user.callbacks.shutdown); new (tableType, @user.callbacks.startup); new (tableType, @user.callbacks.statusMessage); new (tableType, @user.callbacks.suspend); new (tableType, @user.callbacks.systemTrayIcon2Click); new (tableType, @user.callbacks.systemTrayIconRightClick); new (tableType, @user.callbacks.tcpSendMail)}; bundle { // clear applications paths in system.verbs.apps local (adrAppsTable = @system.verbs.apps, i); for i = 1 to sizeof (adrAppsTable^) { local (adrAppInfo = @adrAppsTable^ [i].appInfo); if defined (adrAppInfo^) { adrAppInfo^.path = ""}}}; bundle { // set up Frontier.tools.thread Frontier.tools.thread.ct = 0; Frontier.tools.thread.enabled = true}; bundle { // set up workspace new (tableType, @root.workspace); new (outlineType, @workspace.notepad)}; bundle { // miscellaneous new (tableType, @root.scratchpad); new (tableType, @system.deskscripts); new (tableType, @user.databases); new (tableType, @user.protocols)}}; Çnew (tableType, @websites.["#data"]) bundle { // set up user.menus if flFirstRootRun { new (tableType, @user.menus)}; Çuser.menus.bookmarkMenu = userland.virginBookmarkMenu if not (defined (user.menus.customMenu)) { user.menus.customMenu = Frontier.data.virginCustomMenu}}; if flFirstRootRun { Çwe don't run startup scripts at this time because they are run later in the open all databases section of the scrpt Frontier.installApp ("mainResponder.root", false); // open mainResponder.root, hidden and add to user.databases Frontier.installApp ("prefs.root", false, "www"); // open prefs.root, hidden and add to user.databases }; Çbundle // open prefs.root, hidden and add to user.databases Çlocal (f = file.getPathChar () + ((Frontier.getSubFolder ("www") + "prefs.root") - Frontier.pathString), s = f) Ç Çif system.environment.isWindows Çif s [1] == '\\' Çdelete (@s [1]) Ç Çif not (defined ([string (fileSpec (s))])) ÇfileMenu.open (f, true); //open hidden Ç ÇAdd an entry to the user.databases table. Çlocal (adrTable = @user.databases.["prefs.root"]) Ç Çnew (tableType, adrTable) Ç ÇadrTable^.f = f ÇadrTable^.openOnStartup = true ÇadrTable^.runStartupScript = true ÇadrTable^.supportsSubscribe = false Çbundle //initialize responders Çuser.webserver.responders.websiteFramework.data.docTree.samples = @websites.samples Çtry Çdelete (@user.webserver.responders.websiteFramework.data.docTree.allSites) Çtry Çdelete (@user.webserver.responders.websiteFramework.data.docTree.contents) Ç Çif defined (user.webserver.responders.manilaEdit) Çdelete (@user.webserver.responders.manilaEdit) ÇfileMenu.save () bundle { // miscellaneous variable initializations and checks, phase 2 of 2 system.menus.data.currentsuite = ""; system.menus.data.currentMenuType = nil; system.menus.data.currentmenu = 0; bundle { // check for presence of Psapi.dll if sys.os () == "WinNT" { if not (sys.appIsRunning (file.fileFromPath (Frontier.getProgramPath ()))) { // 11/27/04; 12:14:40 PM by TAC - would it be possible for Frontier to install this on its own? dialog.alert ("You need to run the Frontier Psapi Installer for certain Frontier verbs to work properly.")}}}}; bundle { //open the about window if the pref says we should Çadded 12/16/98; 6:47:28 PM by DW if not defined (user.prefs.openAboutWindow) { user.prefs.openAboutWindow = true}; if user.prefs.openAboutWindow { window.about ()}}; bundle { //initialize the log, next bit of code could add a log item Çadded 12/16/98; 6:52:40 PM by DW if defined (log.startup) { log.startup ()}}; bundle { //run the external startup script local (fname = "frontierStartupCommands.txt"); local (f = file.folderFromPath (Frontier.getProgramPath ()) + fname); if file.exists (f) { try { evaluate (string (file.readWholeFile (f)))} else { log.add ("Error running " + fname + ": \"" + tryError + "\"", "startupError", flwptext:true)}}}; bundle { // tcp based services webserver.init (); // needs to load first betty.init (); // needs to load second soap.init ()}; bundle { // people based services people.init (); // needs to load first custody.init (); webEditServer.init ()}; bundle { //open all the databases that have openOnStartup true Çadded 12/16/98; 6:23:16 PM by DW if defined (user.databases) { if flOpenDatabases { local (i, flMsg = false, t = user.databases); for i = 1 to sizeOf (t) { if typeOf (t [i]) == tableType { //06/08/01 JES: avert item #1 errors with t [i] { local (flOpened = false, s); try { if openOnStartup { msg (this + ": Opening " + file.fileFromPath (f)); flMsg = true; s = f; if system.environment.isWindows { if s [1] == '\\' { delete (@s [1])}}; s = string (fileSpec (s)); if not (defined ([s])) { fileMenu.open (f, hidden:true)}; flOpened = true}} else { log.add ("Startup error opening guest database " + nameof (t [i]) + ": \"" + tryError + "\"", "startupError", flwptext:true)}; if flOpened { if defined (runStartupScript) { if runStartupScript { //PBS 10/7/99: check the value of runStartupScript: only run the script if the boolean is true local (adrScript = @[s].["#startup"]); if defined (adrScript^) { try { adrScript^ ()} else { log.add ("Error running #startup script in guest database " + nameOf (t [i]) + ": \"" + tryError + "\"", "startupError", flwptext: true)}}}}}}}}; if flMsg { msg ("")}}}}; scheduler.init (); bundle { // webBrowser webBrowser.init (); if system.environment.isMac { try {new (tableType, @user.odbEditors.data.openFiles)}}}; //Empty out the list of externally-edited files. Çif system.environment.isWindows Çuser.webBrowser.winDefaultBrowserApp = file.findApplication ("htm") html.init (); try { //04/28/2001 JES: prevent startup from failing if Tool installation fails. Frontier.tools.startup ()}; if flFirstRootRun { bundle { // set up websites table and related with websites.["#ftpSite"] { folder = file.folderFromPath (Frontier.getProgramPath ()) + "Websites" + file.getPathChar (); Çfile.sureFolder (folder) url = file.fileToURL (folder); isLocal = true}; user.html.sites.default = websites.["#ftpSite"]}; bundle { // personalize this copy of Frontier, configure network settings, and complete the installation local (flWebBasedInstall = true); if flWebBasedInstall { Ç11/29/04; 11:17:45 AM by TAC - the following seems like it should be done as part of mainRepsonder startup, init. IIRC, members.root is a feature of mainResponder bundle { //create the Admin membership group if needed local (adrRoot = @[system.temp.mainResponder.membersRootFile]); local (adrGroup = @adrRoot^.admin); if not defined (adrGroup^) { new (tableType, adrGroup)}; if not defined (adrGroup^.callbacks) { new (tableType, @adrGroup^.callbacks)}; if not defined (adrGroup^.cookieDomain) { adrGroup^.cookieDomain = ""}; if not defined (adrGroup^.cookieExpires) { adrGroup^.cookieExpires = "Mon, 01 Apr 2030 07:00:00 GMT"}; if not defined (adrGroup^.cookieName) { adrGroup^.cookieName = "Admin"}; if not defined (adrGroup^.mailReturnAddress) { adrGroup^.mailReturnAddress = user.prefs.mailAddress}; if not defined (adrGroup^.mailSubject) { adrGroup^.mailSubject = "Admin"}; if not defined (adrGroup^.mailTemplate) { wp.newTextObject ("", @adrGroup^.mailTemplate)}; if not defined (adrGroup^.openToPublic) { adrGroup^.openToPublic = false}; if not defined (adrGroup^.users) { new (tableType, @adrGroup^.users)}}; bundle { // prep for web based install via mainResponder admin website local (portString = ""); if user.inetd.config.http2.port != 80 { portString = ":" + user.inetd.config.http2.port}; if not defined (system.temp.Frontier.setupFrontier) { new (tableType, @system.temp.Frontier.setupFrontier)}; system.temp.Frontier.setupFrontier.flAllowLocalAccessToSetupPage = true; local (setupUrl = "http://127.0.0.1" + portString + "/setupFrontier"); if not defined (system.temp.installer) { new (tableType, @system.temp.installer)}; system.temp.installer.urlToOpen = setupUrl}} else { on infoDialog () { //prompt the user for name, org and initials on kernelCall (adrName, adrInitials, adrOrg, adrEmail) { kernel (dialog.getUserInfo)}; local (name, initials, organization, email); case sys.os () { "Win95"; "WinNT" { if not (kernelCall (@name, @initials, @organization, @email)) { return (false)}; if initials == "" { dialog.alert ("You must specify your initials."); infoDialog ()}; user.prefs.name = name; user.prefs.initials = initials; user.prefs.organization = organization; user.prefs.mailAddress = email}; "MacOS" { bundle { //initialize user.prefs.name etc using info from Internet Config try { name = ic.geticpreference (ic.eventinfo.realName)}; try { organization = ic.geticpreference (ic.eventinfo.organization)}; try { email = ic.geticpreferece (ic.eventinfo.emailAddress)}; user.prefs.name = name; user.prefs.organization = organization; if name != "" { local (i); user.prefs.initials = name [1]; for i = 3 to sizeof (name) { if name [i] == ' ' { user.prefs.initials = user.prefs.initials + name [i+1]}}}}; card.run (@system.cards.userInfoDialog)}}; return (true)}; infoDialog ()}}; //AR 09/27/04 : personalize install ÇrootUpdates.getCurrent ("Frontier") // 11/29/04; 6:57:54 PM by TAC - if we get a root update then we'll need to use rootUpdates.update bundle { // about window local (w); window.about (); w = window.frontMost (); window.zoom (w); menus.scripts.styleCommand ("medium"); window.setPosition (w, 25, 75)}; Çwindow.close (s) bundle { // license edit (@system.startup.license); // 12/4/04; 9:26:35 PM by TAC - i rather do this near the beginning of phase 1 firstRootRun but had a problem with this window and setting up the quick script window wp.setSelect (0, 0)}}; system.callbacks.startup (); //call user's startup scripts bundle { // build menu bar system.menus.buildMenuBar (); system.menus.buildSuitesSubmenu ()}; //5.0 Frontier.enableAgents (flEnableAgents); if flEnableHttpServer { //6.0, daemons don't start up until all the startup code has run new (tableType, @user.inetd.listens); inetd.start ()}; //start up all daemons with startup set true if flFirstRootRun { if defined (system.temp.installer.urlToOpen) { Çwindow.update ("About Frontier") webBrowser.openUrl (system.temp.installer.urlToOpen); webBrowser.bringToFront ()}; user.prefs.firstRootRun = false}; system.temp.Frontier.startingUp = false; //signal to all who care, let the hits begin! msg (""); fileMenu.save () \ No newline at end of file --- 1,508 ---- ! FrontierVcsFile:2:scpt:system.startup.startupScript ! «Changes ! «3/13/06; 12:38:30 PM by TAC ! «install DLLs ! «added init of user.callbacks.fileSetModified on first root run ! «upon first root run alert user that Frontier is going to use web browser to complete install, first time users may find it confusing to launch Frontier then have it immediately disappear on them. ! «script formatting tweaks ! «minor tweaks to startup.license window formatting code ! «2/14/06; 9:03:23 PM by TAC ! «moved tools.startup to after html.init ! «use improved Frontier.installApp to open prefs.root ! «when opening databases make copy of user.databases in case startup scripts add entries to it, that way we don't lose track of what were opening ! «move webBrowser.init before html.init so html.init can call webBrowser.getDefaultBrowser without error ! «when opening all databases, check if already open, prevents error on Windows ! «work around relative path issue on Windows ! «on set up of quickscript window on windows, use Frontier.showApplication, Frontier.bringToFront alone doesn't do the trick ! «2/8/06: 12:00:00 AM by SSL ! «use of mainResponder.root and prefs.root are new optional ! «upon first root run, set flWebBasedInstall from defined (system.temp.mainResponder) ! «got rid of some of the tests around mainResponder.root; they are already in Frontier.installApp ! «upon first root run set up root and startup.license windows in the background ! «2/6/06; 12:04:50 PM by TAC ! «bring frontier to front before setting quickscript text for first root run ! «2/5/06; 9:45:01 AM by TAC ! «removed prefs.root startup script code when doing a first root run, no need to run it there as it is run later in the script ! «2/1/06; 1:27:51 PM by TAC ! «deleted some unneeded commented code ! «1/20/06; 1:54:05 PM by TAC ! «disable agents for all startups, not just for first root run ! «there was a problem with Tools starting up and its agent manipulating menus at the same time and causing a crash ! «12/24/05; 12:33:32 PM by TAC ! «prefs.root now has a #startup script, deal with it ! «11/10/05; 4:24:48 PM by TAC ! «moved system.temp.Frontier/starting up after first if firstRootRun check was causing startup problem ! «11/5/05; 12:00:32 PM by TAC ! «moved system.temp.Frontier check back to top of script ! «10/9/05; 3:39:07 PM by TAC ! «when storing prefs.root path, store realative path ! «use table.copyUndefinedContents to copy some item ! «move some of the user prefs initializations into Frontier.data.userPrefs ! «rearrange script so that some initializations can happen outside of the first root run, this should make it easier to add new items and not have them get missed because the first root run had already been run once ! «10/4/05; 7:26:36 PM by TAC ! «upon check for presence of Psapi.dll, don't use hard coded application name ! «9/26/05; 4:30:14 PM by TAC ! «added user.prefs.flReplaceDialogExpertMode ! «8/23/05; 7:22:18 PM by TAC ! «added user.prefs.flCompactModalMenus ! «7/14/05; 10:35:39 AM by TAC ! «system.menus.data.currentMenuType set to nil so agent will update modal menu properly upon relaunch ! «7/6/05; 12:21:38 PM by TAC ! «changed user.callbacks.sendmail to user.callbacks.tcpSendMail ! «added user.prefs.mailHostPort ! «6/15/05; 6:52:11 PM by TAC ! «rewrite for Open Source release, bring in code from startup.startupScript, userland.firstRootRun, userland.finishInstall, and userland.cleanRoot ! «Old code ! «startup.startupScript <http://cvs.sourceforge.net/viewcvs.py/frontierkernel/odbs/frontierRoot/system/startup/startupScript?rev=1.1> ! «userland.firstRootRun <http://cvs.sourceforge.net/viewcvs.py/frontierkernel/odbs/frontierRoot/system/verbs/builtins/userland/Attic/firstRootRun?rev=1.1> ! «userland.finishInstall <http://cvs.sourceforge.net/viewcvs.py/frontierkernel/odbs/frontierRoot/system/verbs/builtins/userland/Attic/finishInstall?rev=1.1> ! «userland.cleanRoot <http://cvs.sourceforge.net/viewcvs.py/frontierkernel/odbs/frontierRoot/system/verbs/builtins/userland/Attic/cleanRoot?rev=1.1> ! «06/08/01; 11:24:35 PM by JES ! «When opening databases defined at user.databases, skip objects which aren't tables. This avoids the condition where startup wouldn't complete, if there's an item #1 in the user.databases table. ! «06/02/01; 8:34:20 PM by PBS ! «Do the web-based install and open the Control Panel if this is the first root run. ! «04/28/01; 7:48:46 PM by JES ! «Call Frontier.tools.startup in a try block, so that the startup process will finish even if Tools installation fails. ! «04/20/01; 4:49:05 PM by JES ! «Call tools.startup to install Tools at startup. ! «10/7/99; 4:20:26 PM by PBS ! «Only run the #startup script in a guest database if runStartupScript exists and is true. Previously, it would be run whether runStartupScript was true or false. ! «http://frontier.userland.com/stories/storyReader$1760 ! «10/6/99; 10:21:35 PM by PBS ! «Only set the taskTime for the overnight task if it's in the past. This fixes a bug when the taskTime was before midnight, but it was being set for the next day, so the overnight task wouldn't run. ! «http://frontier.userland.com/stories/storyReader$1761 ! «8/19/99; 6:44:48 AM by DW ! «Make sure that taskTimes in user.scheduler.tasks are in the future. ! «We do this much more quickly than scheduler.monitor would. ! «http://discuss.userland.com/msgReader$9658 ! «This script runs when Frontier opens the Frontier.root file. ! ! if defined (system.temp.Frontier) { // only run the startup script once ! return}; ! ! local (flEnableAgents = true, flOpenDatabases = true, flEnableHttpServer = true); // can be set by the external startup script ! local (flFirstRootRun = true); ! ! bundle { // miscellaneous initializations, checks, and etc., phase 1 of 2 ! Frontier.enableAgents (false); // try to keep agents from reporting errors and causing problems ! ! Frontier.pathString = file.folderFromPath (Frontier.getFilePath ()); ! ! if defined (user.prefs.firstRootRun) { ! flFirstRootRun = user.prefs.firstRootRun}}; ! ! if flFirstRootRun { ! ! while window.frontmost () != "" { // open windows can mess things up later on ! window.hide (window.frontmost ())}; ! ! «return (false) // enable for testing ! ! new (tableType, @system.temp); ! new (tableType, @root.user)}; ! ! bundle { // system.temp.Frontier, we are starting up ! new (tableType, @system.temp.Frontier); ! system.temp.Frontier.startupTime = clock.now (); ! system.temp.Frontier.startingUp = true}; ! ! backups.init (); ! batchExporter.init (); ! export.init (); ! rootUpdates.init (); // set up user.rootUpdates, even though root updates uses tcp, its ok to set up here as no tcp calls are made at this time ! webEdit.init (); ! ! bundle { // set up user.prefs ! if flFirstRootRun { ! new (tableType, @user.prefs); ! ! bundle { // set up user.prefs.commonStyles ! case sys.os () { ! "MacOS" { ! if system.environment.isCarbon { ! user.prefs.commonStyles = Frontier.data.commonStylesMacCarbon} ! else { ! user.prefs.commonStyles = Frontier.data.commonStylesMac}}; ! "Win95"; ! "WinNT" { ! user.prefs.commonStyles = Frontier.data.commonStylesWin}}}}; ! ! table.copyUndefinedContents (@Frontier.data.userPrefs, @user.prefs); ! ! bundle { // set up user.prefs.dialogs ! if flFirstRootRun { ! new (tableType, @user.prefs.dialogs)}; ! ! table.copyUndefinedContents (@Frontier.data.userPrefs.dialogs, @user.prefs.dialogs)}; ! ! bundle { // set up user.prefs.search ! if flFirstRootRun { ! new (tableType, @user.prefs.search)}; ! ! table.copyUndefinedContents (@Frontier.data.userPrefs.search, @user.prefs.search); ! ! if not (defined (user.prefs.search.replaceWith)) { ! user.prefs.search.replaceWith = Frontier.version ()}}; ! ! Frontier.setupUserPrefsFonts ()}; ! ! if flFirstRootRun { ! bundle { // set up the quick script window ! if system.environment.isWindows { ! Frontier.showApplication ()}; ! Frontier.bringToFront (); ! clipboard.putvalue ("dialog.notify (\"Hello World!\")"); ! window.quickScript (); ! editmenu.selectAll (); ! editmenu.paste (); ! window.close ("Quick Script")}; ! ! bundle { // set up root window ! local (w = "root"); ! target.set (w); ! window.setPosition (w, 0, 0); ! editMenu.setFont (user.prefs.fonts.tableFont); ! editMenu.setFontSize (user.prefs.fonts.tableFontSize); ! window.zoom (w); ! window.open (w)}; ! ! bundle { // set up user.callbacks ! new (tableType, @user.callbacks); ! new (tableType, @user.callbacks.closeWindow); ! new (tableType, @user.callbacks.cmd2click); ! new (tableType, @user.callbacks.compileChangedScript); ! new (tableType, @user.callbacks.control2click); ! new (tableType, @user.callbacks.fileSetModified); ! new (tableType, @user.callbacks.fileWriteWholeFile); ! new (tableType, @user.callbacks.opCollapse); ! new (tableType, @user.callbacks.opCursorMoved); ! new (tableType, @user.callbacks.openWindow); ! new (tableType, @user.callbacks.opExpand); ! new (tableType, @user.callbacks.opInsert); ! new (tableType, @user.callbacks.opReturnKey); ! new (tableType, @user.callbacks.opRightClick); ! new (tableType, @user.callbacks.opStruct2Click); ! new (tableType, @user.callbacks.option2click); ! new (tableType, @user.callbacks.resume); ! new (tableType, @user.callbacks.saveWindow); ! new (tableType, @user.callbacks.shutdown); ! new (tableType, @user.callbacks.startup); ! new (tableType, @user.callbacks.statusMessage); ! new (tableType, @user.callbacks.suspend); ! new (tableType, @user.callbacks.systemTrayIcon2Click); ! new (tableType, @user.callbacks.systemTrayIconRightClick); ! new (tableType, @user.callbacks.tcpSendMail)}; ! ! bundle { // clear applications paths in system.verbs.apps ! local (adrAppsTable = @system.verbs.apps, i); ! for i = 1 to sizeof (adrAppsTable^) { ! local (adrAppInfo = @adrAppsTable^ [i].appInfo); ! if defined (adrAppInfo^) { ! adrAppInfo^.path = ""}}}; ! ! bundle { // set up Frontier.tools.thread ! Frontier.tools.thread.ct = 0; ! Frontier.tools.thread.enabled = true}; ! ! bundle { // set up workspace ! new (tableType, @root.workspace); ! new (outlineType, @workspace.notepad)}; ! ! bundle { // miscellaneous ! new (tableType, @root.scratchpad); ! new (tableType, @system.deskscripts); ! new (tableType, @user.databases); ! new (tableType, @user.protocols)}}; ! «new (tableType, @websites.["#data"]) ! ! Frontier.data.DLLs.install (); ! ! bundle { // set up user.menus ! if flFirstRootRun { ! new (tableType, @user.menus)}; ! ! «user.menus.bookmarkMenu = userland.virginBookmarkMenu ! if not (defined (user.menus.customMenu)) { ! user.menus.customMenu = Frontier.data.virginCustomMenu}}; ! ! if flFirstRootRun { ! «we don't run startup scripts at this time because they are run later in the open all databases section of the scrpt ! Frontier.installApp ("mainResponder.root", false); // open mainResponder.root, hidden and add to user.databases ! Frontier.installApp ("prefs.root", false, "www"); // open prefs.root, hidden and add to user.databases ! }; ! «bundle // open prefs.root, hidden and add to user.databases ! «local (f = file.getPathChar () + ((Frontier.getSubFolder ("www") + "prefs.root") - Frontier.pathString), s = f) ! « ! «if system.environment.isWindows ! «if s [1] == '\\' ! «delete (@s [1]) ! « ! «if not (defined ([string (fileSpec (s))])) ! «fileMenu.open (f, true); //open hidden ! « ! «Add an entry to the user.databases table. ! «local (adrTable = @user.databases.["prefs.root"]) ! « ! «new (tableType, adrTable) ! « ! «adrTable^.f = f ! «adrTable^.openOnStartup = true ! «adrTable^.runStartupScript = true ! «adrTable^.supportsSubscribe = false ! ! «bundle //initialize responders ! «user.webserver.responders.websiteFramework.data.docTree.samples = @websites.samples ! «try ! «delete (@user.webserver.responders.websiteFramework.data.docTree.allSites) ! «try ! «delete (@user.webserver.responders.websiteFramework.data.docTree.contents) ! « ! «if defined (user.webserver.responders.manilaEdit) ! «delete (@user.webserver.responders.manilaEdit) ! ! «fileMenu.save () ! ! bundle { // miscellaneous variable initializations and checks, phase 2 of 2 ! system.menus.data.currentsuite = ""; ! system.menus.data.currentMenuType = nil; ! system.menus.data.currentmenu = 0; ! ! bundle { // check for presence of Psapi.dll ! if sys.os () == "WinNT" { ! if not (sys.appIsRunning (file.fileFromPath (Frontier.getProgramPath ()))) { // 11/27/04; 12:14:40 PM by TAC - would it be possible for Frontier to install this on its own? ! dialog.alert ("You need to run the Frontier Psapi Installer for certain Frontier verbs to work properly.")}}}}; ! ! bundle { //open the about window if the pref says we should ! «added 12/16/98; 6:47:28 PM by DW ! if not defined (user.prefs.openAboutWindow) { ! user.prefs.openAboutWindow = true}; ! if user.prefs.openAboutWindow { ! window.about ()}}; ! ! bundle { //initialize the log, next bit of code could add a log item ! «added 12/16/98; 6:52:40 PM by DW ! if defined (log.startup) { ! log.startup ()}}; ! ! bundle { //run the external startup script ! local (fname = "frontierStartupCommands.txt"); ! local (f = file.folderFromPath (Frontier.getProgramPath ()) + fname); ! if file.exists (f) { ! try { ! evaluate (string (file.readWholeFile (f)))} ! else { ! log.add ("Error running " + fname + ": \"" + tryError + "\"", "startupError", flwptext:true)}}}; ! ! bundle { // tcp based services ! webserver.init (); // needs to load first ! betty.init (); // needs to load second ! soap.init ()}; ! ! bundle { // people based services ! people.init (); // needs to load first ! custody.init (); ! webEditServer.init ()}; ! ! bundle { //open all the databases that have openOnStartup true ! «added 12/16/98; 6:23:16 PM by DW ! if defined (user.databases) { ! if flOpenDatabases { ! local (i, flMsg = false, t = user.databases); ! ! for i = 1 to sizeOf (t) { ! if typeOf (t [i]) == tableType { //06/08/01 JES: avert item #1 errors ! with t [i] { ! local (flOpened = false, s); ! ! try { ! if openOnStartup { ! msg (this + ": Opening " + file.fileFromPath (f)); ! ! flMsg = true; ! s = f; ! ! if system.environment.isWindows { ! if s [1] == '\\' { ! delete (@s [1])}}; ! ! s = string (fileSpec (s)); ! ! if not (defined ([s])) { ! fileMenu.open (f, hidden:true)}; ! ! flOpened = true}} ! else { ! log.add ("Startup error opening guest database " + nameof (t [i]) + ": \"" + tryError + "\"", "startupError", flwptext:true)}; ! ! if flOpened { ! if defined (runStartupScript) { ! if runStartupScript { //PBS 10/7/99: check the value of runStartupScript: only run the script if the boolean is true ! local (adrScript = @[s].["#startup"]); ! ! if defined (adrScript^) { ! try { ! adrScript^ ()} ! else { ! log.add ("Error running #startup script in guest database " + nameOf (t [i]) + ": \"" + tryError + "\"", "startupError", flwptext: true)}}}}}}}}; ! ! if flMsg { ! msg ("")}}}}; ! ! scheduler.init (); ! ! bundle { // webBrowser ! webBrowser.init (); ! ! if system.environment.isMac { ! try {new (tableType, @user.odbEditors.data.openFiles)}}}; //Empty out the list of externally-edited files. ! «if system.environment.isWindows ! «user.webBrowser.winDefaultBrowserApp = file.findApplication ("htm") ! ! html.init (); ! ! try { //04/28/2001 JES: prevent startup from failing if Tool installation fails. ! Frontier.tools.startup ()}; ! ! if flFirstRootRun { ! bundle { // set up websites table and related ! with websites.["#ftpSite"] { ! folder = file.folderFromPath (Frontier.getProgramPath ()) + "Websites" + file.getPathChar (); ! «file.sureFolder (folder) ! url = file.fileToURL (folder); ! isLocal = true}; ! user.html.sites.default = websites.["#ftpSite"]}; ! ! bundle { // personalize this copy of Frontier, configure network settings, and complete the installation ! local (flWebBasedInstall = defined (system.temp.mainResponder)); ! ! if flWebBasedInstall { ! ! «11/29/04; 11:17:45 AM by TAC - the following seems like it should be done as part of mainRepsonder startup, init. IIRC, members.root is a feature of mainResponder ! bundle { //create the Admin membership group if needed ! local (adrRoot = @[system.temp.mainResponder.membersRootFile]); ! local (adrGroup = @adrRoot^.admin); ! ! if not defined (adrGroup^) { ! new (tableType, adrGroup)}; ! if not defined (adrGroup^.callbacks) { ! new (tableType, @adrGroup^.callbacks)}; ! if not defined (adrGroup^.cookieDomain) { ! adrGroup^.cookieDomain = ""}; ! if not defined (adrGroup^.cookieExpires) { ! adrGroup^.cookieExpires = "Mon, 01 Apr 2030 07:00:00 GMT"}; ! if not defined (adrGroup^.cookieName) { ! adrGroup^.cookieName = "Admin"}; ! if not defined (adrGroup^.mailReturnAddress) { ! adrGroup^.mailReturnAddress = user.prefs.mailAddress}; ! if not defined (adrGroup^.mailSubject) { ! adrGroup^.mailSubject = "Admin"}; ! if not defined (adrGroup^.mailTemplate) { ! wp.newTextObject ("", @adrGroup^.mailTemplate)}; ! if not defined (adrGroup^.openToPublic) { ! adrGroup^.openToPublic = false}; ! if not defined (adrGroup^.users) { ! new (tableType, @adrGroup^.users)}}; ! ! bundle { // prep for web based install via mainResponder admin website ! local (portString = ""); ! ! if user.inetd.config.http2.port != 80 { ! portString = ":" + user.inetd.config.http2.port}; ! ! if not defined (system.temp.Frontier.setupFrontier) { ! new (tableType, @system.temp.Frontier.setupFrontier)}; ! ! system.temp.Frontier.setupFrontier.flAllowLocalAccessToSetupPage = true; ! ! local (setupUrl = "http://127.0.0.1" + portString + "/setupFrontier"); ! ! if not defined (system.temp.installer) { ! new (tableType, @system.temp.installer)}; ! system.temp.installer.urlToOpen = setupUrl}} ! else { ! on infoDialog () { //prompt the user for name, org and initials ! on kernelCall (adrName, adrInitials, adrOrg, adrEmail) { ! kernel (dialog.getUserInfo)}; ! ! local (name, initials, organization, email); ! ! case sys.os () { ! "Win95"; ! "WinNT" { ! if not (kernelCall (@name, @initials, @organization, @email)) { ! return (false)}; ! if initials == "" { ! dialog.alert ("You must specify your initials."); ! infoDialog ()}; ! user.prefs.name = name; ! user.prefs.initials = initials; ! user.prefs.organization = organization; ! user.prefs.mailAddress = email}; ! "MacOS" { ! bundle { //initialize user.prefs.name etc using info from Internet Config ! try { ! name = ic.geticpreference (ic.eventinfo.realName)}; ! try { ! organization = ic.geticpreference (ic.eventinfo.organization)}; ! try { ! email = ic.geticpreferece (ic.eventinfo.emailAddress)}; ! ! user.prefs.name = name; ! user.prefs.organization = organization; ! if name != "" { ! local (i); ! user.prefs.initials = name [1]; ! for i = 3 to sizeof (name) { ! if name [i] == ' ' { ! user.prefs.initials = user.prefs.initials + name [i+1]}}}}; ! card.run (@system.cards.userInfoDialog)}}; ! return (true)}; ! infoDialog ()}}; //AR 09/27/04 : personalize install ! ! «rootUpdates.getCurrent ("Frontier") // 11/29/04; 6:57:54 PM by TAC - if we get a root update then we'll need to use rootUpdates.update ! ! bundle { // about window ! local (w); ! ! window.about (); ! w = window.frontMost (); ! window.zoom (w); ! menus.scripts.styleCommand ("medium"); ! window.setPosition (w, 25, 75)}; ! «window.close (s) ! ! bundle { // license ! local (adrWindow = @system.startup.license); ! target.set (adrWindow); ! window.setPosition (adrWindow, 50, 100); ! window.setSize (adrWindow, infinity, infinity); ! window.zoom (adrWindow); ! wp.setSelect (0, 0); ! edit (adrWindow)}}; // 12/4/04; 9:26:35 PM by TAC - i rather do this near the beginning of phase 1 firstRootRun but had a problem with this window and setting up the quick script window ! ! system.callbacks.startup (); //call user's startup scripts ! ! bundle { // build menu bar ! system.menus.buildMenuBar (); ! system.menus.buildSuitesSubmenu ()}; //5.0 ! ! Frontier.enableAgents (flEnableAgents); ! ! if flEnableHttpServer { //6.0, daemons don't start up until all the startup code has run ! new (tableType, @user.inetd.listens); ! inetd.start ()}; //start up all daemons with startup set true ! ! if flFirstRootRun { ! if defined (system.temp.installer.urlToOpen) { ! dialog.alert ("Frontier is going to use your web browser to complete its installation."); ! webBrowser.openUrl (system.temp.installer.urlToOpen); ! webBrowser.bringToFront ()}; ! ! user.prefs.firstRootRun = false}; ! ! system.temp.Frontier.startingUp = false; //signal to all who care, let the hits begin! ! ! msg (""); ! ! fileMenu.save () \ No newline at end of file |