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

system.verbs.builtins.Frontier.tools.windowTypes.commands.open

on open (f=nil) {
	<<Changes:
		<<12/2/01; 7:05:42 PM by JES
			<<if user.radio.settings.flExpired is defined, and true, open the serial number page.
		<<Archive
			<<07/03/01; 8:09:16 PM by JES
				<<Migrated from builtins.pike.commands.open. Split out opml/outline file functionality into Frontier.tools.data.windowTypes.outlinerFile.open.
			<<05/15/01; 1:33:09 AM by JES
				<<Fixed a bug where irrelevant whitespace would be preserved between the <?xml?> tag and the <opml> tag. If opening a .opml file, which has no contents, treat it as an empty OPML document, instead of as an empty text file. Fixed a bug where minimally represented OPML files (files with fewer than 200 characters) could not be opened.
			<<03/5/01; 2:15:19 PM by JES
				<<When opening OPML documents, set the window's timeCreated, so that it will be preserved in the dateCreated head element of the saved OPML.
			<<02/21/01; 2:13:59 AM by JES
				<<Record the type and creator code when opening files on Macs. Record the line-ending format.
			<<02/16/01; 1:36:30 PM by JES
				<<Make sure that the window's modification time is the same as its table's lastOpened time. Prevents extraneous save-confirmation dialogs.
			<<01/23/01; 7:40:05 PM by JES
				<<Support opml documents with unix line endings. Changed logic for determining if a file is an opml document so that Radio can open files that have xml headers, style sheet declarations, or comments before the <outlineDocument> element. Store the headers and comments so they can be included when the file is saved.
			<<12/31/00; 5:30:33 PM by JES
				<<On Macs, convert opml to Mac text before converting to an outline.
			<<12/19/00; 10:36:41 PM by JES
				<<On Macs, for text files whose extension corresponds to the type of an object database object, don't open the file in an outline. Makes it possible to import objects downloaded from apache servers which aren't configured to serve Frontier files with the correct mime type, or files copied from Windows computers.
			<<12/15/00; 7:29:24 PM by PBS
				<<Open plain text files in an outline.
			<<11/30/00; 12:14:58 AM by JES
				<<Dereference callback addresses in a try block in case a tool's odb is not opened
			<<09/30/00; 12:47:45 PM by PBS
				<<Call callbacks.
			<<09/26/00; 3:46:09 PM by PBS
				<<Added explicit file type check for OPML in case the path is an 8.3 path or has a random suffix.
			<<09/16/00; 3:35:19 PM by PBS
				<<Handle .opml as well as .xml.
			<<09/15/00; 1:56:44 PM by PBS
				<<Allow an XML file of any type to be opened in the outliner. When it gets saved later, it's saved as raw XML, not as an outlineDocument.
			<<07/23/00; 8:32:39 PM by PBS
				<<Created. Open a file.
	
	if defined (user.radio.settings.flExpired) {
		if user.radio.settings.flExpired {
			radio.menuCommands.openPage (radio.data.systemurls.serialnumber);
			return (true)}};
	
	if f == nil {
		if not (file.getFileDialog ("Open a file:", @f, 0)) {
			return (false)}}; //nothing was opened
	
	on runCallbacks (adrCallback) { //call callbacks
		if defined (adrCallback^) {
			local (flConsumed = false);
			local (adrScript);
			for adrScript in adrCallback {
				try { //11/30/00 JES
					while typeOf (adrScript^) == addressType { //follow addresses
						adrScript = adrScript^};
					flConsumed = adrScript^ (f)}; //file is parameter
				if flConsumed {
					return (true)}}};
		return (false)};
	if runCallbacks (@user.tools.commandCallbacks.open) {
		return (true)};
	if system.environment.isRadio {
		if defined (user.pike.commandCallbacks) {
			if runCallbacks (@user.pike.commandCallbacks.open) {
				return (true)}}};
	bundle { //look for a windowType that handles this command
		on runTypes (adrTypes) {
			local (adrType, flConsumed=false);
			for adrType in adrTypes {
				try {
					while typeOf (adrType^) == addressType {
						adrType = adrType^};
					if defined (adrType^.open) {
						try {
							flConsumed = adrType^.open (f)};
						if flConsumed {
							return (true)}}}};
			return (false)};
		if runTypes (@user.tools.windowTypes) {
			return (true)};
		if runTypes (@Frontier.tools.data.windowTypes) {
			return (true)}};
	
	fileMenu.open (f);
	
	return (true)};

bundle { //debugging
	open ()}



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.