This page will discuss creating web pages that look like Leo outlines. It's a good place to post code.

Introduction

It is important in these discussions to recognize that Ajax does one thing only.

It allows a script in a web page to request the contents of another web page as if the script were a browser and receive the page as a browser would receive it, except in the form of a string.

The string received may be the contents of a static web page (html, xml) or a dynamically generated page from php, asp, cgi etc. or in a pickled data format such as JSON produced by a server script (or as plain text).

People sometimes use 'AJAX' to mean 'dhtml', which is fine as long as we are aware of the distinction. 'dhtml' is perhaps more appropriate for referring to the combination of html, javascript, css, AJAX, server scripting, etc which make up a modern dynamic web page.

List of 'use cases'

Unfortunately, plumloco.co.uk is no longer present. Part or all of the work is present in the leo_to_html.py plugin included in the Leo trunk. - thyrsus

There are range of what can loosely call 'use cases'. Let's try to make a list of them from simplest to most esoteric. Here is a start:

(It might be better if long comments were put in a separate section and only a short note with a link placed in this list.)

  • Static XHTML/HTML (sample1)

    This is a straight forward conversion of an outline to an xhtml list that can be displayed as a web page. XHTML is perhaps better as it allows xml tools such as XSLT to post precess the page.

  • Dhtml page that allows the outline to be collapsed/expanded.

    This still essentially only shows the page as it would be seen in the browser. AjaxWrite.leo is an example. Also see Leo2DHTML.

  • Dhtml page that interprets bodyString (sample2).

    This would allow leo to become a web authoring tool. The bodyString of a leo node could contain Wiki markup or raw html and then displayed as html. @url nodes, when clicked could display the page indicated. Markup could be used to include forms in the page.

  • Web page as GUI (thin client).

    It might be possible to use a webpage as a thin client, collecting keystrokes to feed to a leo running on localhost or a remote server and receiving instructions as to how to update the view.

  • Web page as GUI (thick client).

    Allow javascript to do most of the editing and only report back to the server to store the results or run python code.

  • Implement Leo in Javascript.

    Not impossible, but a lot of work ...

  • Create a Firefox plugin.

    And have a complete javascript Leo operating out of firefox. Actually this could apply to some of the above as well.

Plumloco's experiments

I (Plumloco) have an experimental plugin leo_to_dhtml where I will be exploring some of the easier aspects of this topic.

Stephen Schaefer's experiment

I (thyrsus) have a large outline that I can't download in its entirety to the browser. The leo file AjaxWrite.leo contains code for a button that creates a set of files in $HOME/public_html/leo/$LeoFileName?. It is intended that a web server make those files available, and the javascript they contain incrementally downloads them as the web view gets expanded. The button hasn't been tested outside a Linux/Apache/mod_userdir environment, however, the web pages generated are visible via both Firefox and Internet Explorer. If you've already got a $HOME/public_html/leo directory, you'll need to manually update the leoScript.js file which resides there.

AjaxWrite.leo