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

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

on viewInBrowser (adr = nil) {
	<<Change Notes
		<<Fri, Jul 7, 2000 at 11:00:09 PM by AR
			<<Call any scripts in user.pike.commandCallbacks.viewInBrowser
			<<If one of the scripts returns true, we're done
		<<Sat, Aug 26, 2000 at 6:10:27 PM by JES
			<<Use the website framework to preview weblog pages
		<<10/02/00; 12:17:32 PM by PBS
			<<Callbacks can be addresses.
		<<11/30/00; 12:18:18 AM by JES
			<<Dereference callback addresses in a try block in case a tool's odb is not opened
		<<12/14/00; 12:18:27 AM by PBS
			<<View local, file-based outlines in the browser.
		<<12/29/00; 3:39:07 PM by JES
			<<View object database outlines in the browser.
		<<05/2501; 10:33:51 PM by JES
			<<Optimization: Don't save Manila site outlines, unless they've been modified.
	
	if adr == nil { //default to the front window
		try {adr = table.getCursorAddress ()}};
	
	bundle { //run callbacks
		on runCallbacks (adrtable) {
			local (flConsumed = false);
			if defined (adrtable^) {
				local (adrcallback);
				for adrcallback in adrtable {
					try { //11/30/00 JES
						while typeOf (adrcallback^) == addressType {
							adrcallback = adrcallback^};
						flConsumed = adrcallback^ (adr)};
					if flConsumed {
						return (true)}}};
			return (false)};
		if runCallbacks (@user.tools.commandCallbacks.viewInBrowser) {
			return (true)};
		if system.environment.isRadio {
			if defined (user.pike.commandCallbacks.viewInBrowser) {
				if runCallbacks (@user.pike.commandCallbacks.viewInBrowser) {
					return (true)}}}};
	
	local (adrType);
	bundle { //if there's a windowType that handles this command, call it
		if Frontier.tools.windowTypes.findWindowType (adradrtable:@adrtype, adrwindow:adr) {
			if defined (adrtype^.viewInBrowser) {
				if adrtype^.viewInBrowser (adr) {
					return (false)}}}};
	
	if adr != nil { //do default behavior
		local (f);
		if Frontier.tools.windowTypes.commands.saveAsHtml (adr, @f, true) {
			webBrowser.openDocument (f);
			webBrowser.bringToFront ();
			return (true)}};
	
	return (false)};

<<bundle // debugging
	<<viewInBrowser (window.frontmost ())



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.