Wednesday, March 16, 2011 at 3:29 PM.
scripting2Suite.init
on init () {
<<Changes
<<3/16/11; 12:12:06 PM by DW
<<Init adrdata^.prefs.staticText.
<<8/18/10; 3:52:55 PM by DW
<<Comment code that inits the realtime server-side. We were validating the password through our code and thus breaking the instant outliner that had its own password validator in the realtime callback chain.
<<7/13/10; 7:11:28 AM by DW
<<Pull the editor init code into a separate script.
<<7/10/10; 3:47:25 PM by DW
<<Init the URL of the live-blog.
<<7/8/10; 5:39:47 PM by DW
<<Set a flag for the editor indicating that the password has not been validated. Until it has, there's no point automatically opening the workspace.
<<7/7/10; 7:27:53 AM by DW
<<When the workspace is created, set a flag that says it's new.
<<6/29/10; 11:36:26 AM by DW
<<Init domains table on server.
<<6/23/10; 8:14:58 PM by DW
<<Init system.temp.scripting2.editor.posts.
<<6/23/10; 10:22:04 AM by DW
<<Add opInsert callback.
<<6/12/10; 7:33:16 AM by DW
<<Add system.temp.editor table.
<<5/29/10; 7:59:18 AM by DW
<<Created.
local (adrdata = frontier.opendatafile ("scripting2Data", flCheckWindowOpen:false));
<<local (adrdata = @config.scripting2)
if not defined (adrdata^) {
new (tabletype, adrdata)};
bundle { //prefs
if not defined (adrdata^.prefs) {
new (tabletype, @adrdata^.prefs)};
if not defined (adrdata^.prefs.basefolder) {
adrdata^.prefs.basefolder = frontier.pathstring + "scripting2" + file.getpathchar ()};
if not defined (adrdata^.prefs.baseUrl) {
adrdata^.prefs.baseUrl = "http://scripting.com/scripting2/"};
if not defined (adrdata^.prefs.maxFileNameLength) {
adrdata^.prefs.maxFileNameLength = 31};
if not defined (adrdata^.prefs.htmlFileExtension) {
adrdata^.prefs.htmlFileExtension = ".html"};
bundle { //ftp
if not defined (adrdata^.prefs.ftp) {
new (tabletype, @adrdata^.prefs.ftp)};
if not defined (adrdata^.prefs.ftp.enabled) {
adrdata^.prefs.ftp.enabled = false};
if not defined (adrdata^.prefs.ftp.server) {
adrdata^.prefs.ftp.server = ""};
if not defined (adrdata^.prefs.ftp.username) {
adrdata^.prefs.ftp.username = ""};
if not defined (adrdata^.prefs.ftp.password) {
adrdata^.prefs.ftp.password = binary ("")};
if not defined (adrdata^.prefs.ftp.path) {
adrdata^.prefs.ftp.path = ""};
if not defined (adrdata^.prefs.ftp.indexFileName) {
adrdata^.prefs.ftp.indexFileName = "default.html"};
if not defined (adrdata^.prefs.ftp.rssFileName) {
adrdata^.prefs.ftp.rssFileName = "rss.xml"};
if not defined (adrdata^.prefs.ftp.baseUrl) {
adrdata^.prefs.ftp.baseUrl = ""}};
bundle { //staticText -- 3/16/11 by DW
staticText.init (@adrdata^.prefs.staticText)}};
bundle { //stats
if not defined (adrdata^.stats) {
new (tabletype, @adrdata^.stats)};
if not defined (adrdata^.stats.ctThreadLoops) {
adrdata^.stats.ctThreadLoops = 0};
if not defined (adrdata^.stats.ctTicksRealtimeCollection) {
adrdata^.stats.ctTicksRealtimeCollection = 0}};
bundle { //server
if not defined (adrdata^.server) {
new (tabletype, @adrdata^.server)};
if not defined (adrdata^.server.users) {
new (tabletype, @adrdata^.server.users)};
if not defined (adrdata^.server.domains) { //6/29/10 by DW
new (tabletype, @adrdata^.server.domains)};
bundle { //prefs
if not defined (adrdata^.server.prefs) {
new (tabletype, @adrdata^.server.prefs)};
if not defined (adrdata^.server.prefs.enabled) {
adrdata^.server.prefs.enabled = false};
if not defined (adrdata^.server.prefs.ctSecsRealtimeTimeout) {
adrdata^.server.prefs.ctSecsRealtimeTimeout = 60}}};
<<bundle //realtime, 7/20/10 by DW
<<if not defined (system.verbs.builtins.realtime)
<<system.verbs.builtins.realtime = scripting2Suite.data.code.realtime
<<local (adrrealtime = realtime.init ())
<<adrrealtime^.server.callbacks.validatePassword.scripting2 = @scripting2Suite.server.validatePassword
<<bundle //editor
<<if not defined (adrdata^.editor)
<<new (tabletype, @adrdata^.editor)
<<bundle //workspace
<<if defined (adrdata^.editor.workspace) //convert from outline to table -- 7/3/10 by DW
<<if typeof (adrdata^.editor.workspace) == outlinetype
<<local (lo = adrdata^.editor.workspace)
<<delete (@adrdata^.editor.workspace)
<<new (tabletype, @adrdata^.editor.workspace)
<<adrdata^.editor.workspace.outline = lo
<<else
<<new (tabletype, @adrdata^.editor.workspace)
<<new (outlinetype, @adrdata^.editor.workspace.outline)
<<adrdata^.editor.workspace.flnew = true //7/7/10 by DW
<<if not defined (adrdata^.editor.workspace.flnew)
<<adrdata^.editor.workspace.flnew = false
<<bundle //prefs
<<if not defined (adrdata^.editor.prefs)
<<new (tabletype, @adrdata^.editor.prefs)
<<if not defined (adrdata^.editor.prefs.username)
<<adrdata^.editor.prefs.username = ""
<<if not defined (adrdata^.editor.prefs.password)
<<adrdata^.editor.prefs.password = ""
<<if not defined (adrdata^.editor.prefs.server) //6/26/10 by DW
<<adrdata^.editor.prefs.server = "xmlrpc://edit.scripting2.com/RPC2"
<<bundle //"folder" changes to "backupFolder", 7/1/10 by DW
<<if defined (adrdata^.editor.prefs.folder)
<<adrdata^.editor.prefs.backupFolder = adrdata^.editor.prefs.folder
<<delete (@adrdata^.editor.prefs.folder)
<<if not defined (adrdata^.editor.prefs.backupFolder)
<<local (pc = file.getpathchar ())
<<adrdata^.editor.prefs.backupFolder = frontier.pathstring + "Scripting2" + pc + "backups" + pc
<<if not defined (adrdata^.editor.prefs.imagesFolder)
<<local (pc = file.getpathchar ())
<<adrdata^.editor.prefs.imagesFolder = frontier.pathstring + "Scripting2" + pc + "images" + pc
<<bundle //watchedFolder prefs, 7/1/10 by DW
<<if not defined (adrdata^.editor.prefs.watchedFolder)
<<new (tabletype, @adrdata^.editor.prefs.watchedFolder)
<<if not defined (adrdata^.editor.prefs.watchedFolder.enabled)
<<adrdata^.editor.prefs.watchedFolder.enabled = true
<<if not defined (adrdata^.editor.prefs.watchedFolder.folder)
<<local (pc = file.getpathchar ())
<<adrdata^.editor.prefs.watchedFolder.folder = frontier.pathstring + "Scripting2" + pc + "images" + pc
<<file.surefilepath (adrdata^.editor.prefs.watchedFolder.folder + "xxx")
<<if not defined (adrdata^.editor.prefs.watchedFolder.ctUploads)
<<adrdata^.editor.prefs.watchedFolder.ctUploads = 0
<<if not defined (adrdata^.editor.prefs.watchedFolder.ctChecks)
<<adrdata^.editor.prefs.watchedFolder.ctChecks = 0
<<if not defined (adrdata^.editor.prefs.watchedFolder.clipboardTemplate)
<<adrdata^.editor.prefs.watchedFolder.clipboardTemplate = scripting2Suite.data.html.clipboardTemplate
<<if not defined (adrdata^.editor.prefs.flOpenWorkspaceOnLaunch)
<<adrdata^.editor.prefs.flOpenWorkspaceOnLaunch = false
<<bundle //stats
<<if not defined (adrdata^.editor.stats)
<<new (tabletype, @adrdata^.editor.stats)
<<if not defined (adrdata^.editor.stats.pgfSerialnum) //6/23/10 by DW
<<adrdata^.editor.stats.pgfSerialnum = 1
<<if not defined (adrdata^.editor.stats.flPasswordValid) //7/8/10 by DW
<<adrdata^.editor.stats.flPasswordValid = false
<<if not defined (adrdata^.editor.stats.urlLiveBlog) //7/10/10 by DW
<<adrdata^.editor.stats.urlLiveBlog = ""
<<bundle //serverPrefs, have to set this up in case username/password fail on Prefs page
<<if not defined (adrdata^.editor.serverPrefs)
<<new (tabletype, @adrdata^.editor.serverPrefs)
<<if not defined (adrdata^.editor.serverPrefs.ownerName)
<<adrdata^.editor.serverPrefs.ownerName = ""
<<if not defined (adrdata^.editor.serverPrefs.ownerEmail)
<<adrdata^.editor.serverPrefs.ownerEmail = ""
<<if not defined (adrdata^.editor.serverPrefs.weblogName)
<<adrdata^.editor.serverPrefs.weblogName = ""
<<if not defined (adrdata^.editor.serverPrefs.tagline)
<<adrdata^.editor.serverPrefs.tagline = ""
<<if not defined (adrdata^.editor.serverPrefs.timeZone)
<<adrdata^.editor.serverPrefs.timeZone = 0
<<if not defined (adrdata^.editor.serverPrefs.timeZoneName)
<<adrdata^.editor.serverPrefs.timeZoneName = "GMT"
<<if not defined (adrdata^.editor.serverPrefs.flDisqusComments)
<<adrdata^.editor.serverPrefs.flDisqusComments = false
<<if not defined (adrdata^.editor.serverPrefs.disqusShortname)
<<adrdata^.editor.serverPrefs.disqusShortname = ""
scripting2suite.editor.init (adrdata); //7/13/10 by DW
bundle { //system.temp sub-table
if not defined (system.temp.scripting2) {
new (tabletype, @system.temp.scripting2)};
bundle { //editor
if not defined (system.temp.scripting2.editor) { //6/12/10 by DW
new (tabletype, @system.temp.scripting2.editor)};
if not defined (system.temp.scripting2.editor.posts) { //6/23/10 by DW
new (tabletype, @system.temp.scripting2.editor.posts)}};
bundle { //server
if not defined (system.temp.scripting2.server) { //7/14/10 by DW
new (tabletype, @system.temp.scripting2.server)};
if not defined (system.temp.scripting2.server.users) { //7/14/10 by DW
new (tabletype, @system.temp.scripting2.server.users)}}};
bundle { //general
if not defined (user.scheduler2.everyminute.scripting2) {
user.scheduler2.everyminute.scripting2 = @scripting2Suite.everyMinute};
if not defined (user.callbacks.opInsert.scripting2) {
user.callbacks.opinsert.scripting2 = @scripting2Suite.editor.opInsertCallback};
if not defined (user.callbacks.opRightClick.scripting2) {
user.callbacks.opRightClick.scripting2 = @scripting2Suite.editor.opRightClickCallback};
if not defined (user.callbacks.addBookmark.scripting2) { //6/29/10 by DW
user.callbacks.addBookmark.scripting2 = @scripting2Suite.editor.addBookmarkCallback}};
return (adrdata)};
bundle { //test code
local (tc = clock.ticks ());
for i = 1 to 1000 {
init ()};
dialog.alert (clock.ticks () - tc)}
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.