CMS integration


The Daxe web application needs to be integrated into a larger system to be able to save documents, as a web application does not have the rights to save a local file. Examples of integration include the Daxe desktop application (written in Dart), WebJaxe (written in PHP) and LON-CAPA (written in Perl).

In addition to a server-side processing of a request to save documents, servers should also provide directory listings with a specific format to let Daxe display a file chooser. This file chooser can be used to let users decide where to save an unsaved document, or to upload files used in the XML, such as image files.

Launching Daxe

The daxe directory on the web server should simply be a copy of the web directory after a build. These files are static and should be cached for better performance. The daxe.html is used for debugging with Dartium, and can be removed in production. The file to launch is named daxe_js.html after a build, and is usually renamed daxe.html for simplicity.

Daxe is using the whole HTML document, using the URL to read parameters. It can be included in an iframe to fit inside a larger document.

The config directory can be purged of configurations that are not used, although they will not cause additional requests if left there. The configuration files are the ones ending in _config.xml, and they are often used with a schema file with a name ending in .xsd.

The following parameters can be passed to the HTML file, as GET parameters. Paths can be relative to the HTML file.


Saving files

When a save parameter is used to launch Daxe, a Save menu and toolbar button will appear.

Upon saving, the server receives a multipart POST request with the path of the document in the path parameter and its content in the file parameter. It replies with the text ok if no error occured, or a string starting with error\n if there was an error. An error message to display to the user can be included after error\n.

Directory listing

To enable the file chooser in Daxe, the server simply has to return directory listings when a GET request to a directory is sent by the client. The returned content should be an XML file with the following syntax:

       <directory name="current_dir">
          <file name="example.txt" size="10" modified="2015-08-07T13:49:59"/>
          <directory name="sub_dir"/>

The file size is in bytes. The modified timestamp is using ISO-8601.

To enable file uploads for the file display type, the chooser parameter should be set to true in the configuration file. For instance, the whole element display for HTML's img element would be:

      <ELEMENT_DISPLAY element="img" type="file">
        <PARAMETER name="srcAtt" value="src"/>
        <PARAMETER name="chooser" value="true"/>
        <PARAMETER name="widthAtt" value="width"/>
        <PARAMETER name="heightAtt" value="height"/>