Open-Xchange Publishing

Revision as of 11:36, 3 March 2010 by Tierlieb (talk | contribs)

Publishing Data with Open-Xchange

Open-Xchange offers to publish an increasing amount of internal data like contacts, documents, appointments. This data can be published in a way that it is machine-readable using OXMF and it can be customized in it's look and feel using common web techniques like CSS.

Open-Xchange is using the FreeMarker Template Engine to export the internal date to the published templates. Check the FreeMarker Manual on how to use it.

Open-Xchange Internal data structures to access with FreeMarker

Contacts

Within freemarker, you are given a list called contacts, which contains all contacts of the given publication. This is the central element of the publication. Freemarker enables you to access every attribute of the class Contact that has both a setter and a getter. See the JavaDoc for the class to find out about attributes or use the example template of your OX.

Examples

This is the basic loop over the list of contacts that you get:

  <#list contacts as contact>
     <div class="ox_contact">
        <span class="ox_company">$contact.company</span>
        <span class="ox_company">$contact.uRL</span>
        <span class="ox_note">$contact.note</span>
     </div>
  </#list>


Infostore

You are given a list called infostore, which contains all infostore items of the given publication. This is the central element of the publication. Freemarker enables you to access every attribute of the class Infostore that has both a setter and a getter. See the JavaDoc for the class to find out about attributes or use the example template of your OX.

Additional fields for all publications

These fields are contained within all publication templates, independent of the type.

Variable Description
publication The complete publication object.
request The http request that was sent to show this publication.
dateFormat The format of the date, usually in the java.text.SimpleDateFormat.
timeFormat Like date format, just for displaying times during the day (without the year, month or day).
privacy The privacy text meant to be published on the displayed page (*).
userContact The contact that is responsible for the publication of this page (*).

(*) Note: Several countries legally require you to publish this information. Leave it out at your own peril.


Variable Description
contacts As already mentioned: A list of contacts that are supposed to be published. Central part of the publishing process.
publication The complete publication object.
request The http request that was sent to show this publication.
dateFormat The format of the date, usually in the java.text.SimpleDateFormat.
timeFormat Like date format, just for displaying times during the day (without the year, month or day).
privacy The privacy text meant to be published on the displayed page (*).
userContact The contact that is responsible for the publication of this page (*).


Changing the default templates

The default templates of all existing items to publish can be found in the folder /opt/open-xchange/templates/ of every Open-Xchange installation, if the package open-xchange-publish-microformats is installed:

$ dpkg -L open-xchange-publish-microformats | grep templates
/opt/open-xchange/templates
/opt/open-xchange/templates/contacts_oxmf_uncensored.tmpl
/opt/open-xchange/templates/infostore.tmpl
/opt/open-xchange/templates/contacts_hcard_censored.tmpl
/opt/open-xchange/templates/contacts_oxmf_censored.tmpl
/opt/open-xchange/templates/contacts.tmpl
/opt/open-xchange/templates/contacts_hcard_uncensored.tmpl

When these files are changed, new published items in Open-Xchange will get this look and feel. Check out the online help or the user guides on how to publish using Open-Xchange.