Filtering publication templates according to their purpose

Summary: This article tells you how to make sure that only those templates that are meant for a module show up in the publication dialog.


OX uses the FreeMarker templating engine to render publications. See Open-Xchange Publishing how to do this. There you will find that these templates are specific to the module type of the content that is published: A template for the infostore (read that as "files" if you are using AppSuite) will not work for contacts.

You do not want to display templates for listing contacts when trying to publish an infostore. Here is how to make sure of that:

In order to filter the list of available templates, it must be known for which module a template can be used. This is done by adding tags to describe a template file. For their own templates, users can do that on their own. But for the templates a user begins with, the ones delivered by the server, a new .properties file is required.


Consider you want to describe a template "contacts.tmpl", which resides in /opt/openexchange/templates/contacts.tmpl. You would then create a property file /opt/openexchange/templates/ with an entry for the template:

  contacts.tmpl = publish, contacts

denoting that this template is useful for publishing contact data. Currently the known tags are:

  • publish - Used for all publication templates
  • printing - Used for all templates that are used to render print views
  • contacts - Used for all templates that can process contacts
  • infostore - Used for all templates that can process files
  • calendar - Used for all templates that can process appointments
  • oxupdater - Used for all templates used to drive the OX Updater Windows Installer

If you want to describe a template in the OXMF infostore folder add the above tags as categories.

Note: A template that is not listed here will be shown for all publications. That means without a .properties file, everything will be like it was before.

Note: The template name has to start with the module it should support. E. g. if you would like to create a template for publications of infostore content, the name has to start with 'infostore' and could be 'infostore_gallery.tmpl'. In that case the value would be 'infostore, publish'.

As an administrator of OX, what do I have to do?

If you introduced custom templates for your users, you have to create a .properties file in the templating directory and mark up the templates with one or more of the above tags.

New .properties files have been added to the packages open-xchange-publish-microformats, open-xchange-calendar-printing, open-xchange-mobile-configuration-generator and the updater packages.

Securing templates

As of 7.4.0, you can limit the use of templating. A new property com.openexchange.templating.trusted is used to enable the administrator to define trust for templates. This will give trusted templates more possibilities, for example they might not be filtered.

The property should have one of the following values:

  • true: all templates will be handled as trusted
  • false: no template will be handled as trusted
  • server: only server templates will be handled as trusted
  • user: only client templates will be handled as trusted