The OpenForum Wiki can be extended using javascript that is run on the server as opposed to the client (web browser). This means the javascript has access to the OpenForum Wiki engine, the wiki file system and other remote web services. This is achieved by calling methods made available by OpenForum as simple APIs.

The platform can be extended at several points by adding specific server side javascripts. These all have the .sjs extension. Below is a list of the javascript files that can be found in OpenForum and the APIs that are available to the script.



get.sjs

Any page can be transformed into a dynamic page by adding an attachment named get.sjs. When a page is requested (ie. by a Web Browser), if a get.sjs attachment is found, the script is run and can return dynamic content. All of the optional parameters passed to the page and the HTTP header are made available though a transaction API


Available APIs


post.sjs

Any page can be made to process HTTP POST requests like those made when a form is submitted by a Web Browser. This is achieved by adding an attachment to the page named post.sjs. All of the values posted to the page and the HTTP header are made available though a transaction API


Available APIs


renderer.sjs

OpenForum's Wiki Markup is expendable. All extensions must be added to the /OpenForum/Extensions page. The page name is also the name of the Markup tag, and has an attachment, renderer.sjs, that converts the tag to HTML. For example, the extension to add Help links is defined on a page /OpenForum/Extensions/Help. The renderer.sjs script takes the attributes page and toolTip and returns the HTML to be placed on the page. An extension is inserted into the wiki content when editing in the form:

[{Help page="page name" toolTip="tip text"}]


Available APIs


initialise.sjs

OpenForum's functionality can be extended via Java. The Java is deployed as Java Archive (jar) files attached to child pages of /OpenForum/JarManager. Each page can have a Javascript that is run when the Java is initialised. This is defined in an attachment initialise.sjs


Available APIs


trigger.sjs

OpenForum has two built in triggers, a time trigger that is triggered every 10 seconds and a page trigger that is triggered whenever a page is created, changed or deleted. The pages that define these triggers contain a list of pages that are called by the trigger. When a page is called the Javascript in the pages attachment names trigger.sjs is run.


Available APIs