Web UI

HOWTO: Customize Default Rendition in Web UI

Updated: October 30, 2024

Web UI leverages the Default Rendition service for two Web UI features.

Bulk Download

The rendition used for bulk downloading documents is defined by rendition-download-contrib.xml. You can override this contribution to change the behavior. For example, the following contribution will use the main blob (from the file:file property) only if the user is bob, the xmlExport otherwise.

<component name="my.org.rendition.download.contrib">

  <require>org.nuxeo.ecm.platform.rendition.download.contrib</require>

  <extension target="org.nuxeo.ecm.platform.rendition.service.RenditionService"
    point="defaultRendition">
    <defaultRendition reason="download">
      <script language="JavaScript">
        function run() {
          if (CurrentUser.getName() != "bob") {
            if (Document.hasSchema("file")) {
              return 'mainBlob';
            }
          }
          return 'xmlExport';
        }
      </script>
    </defaultRendition>
  </extension>

</component>

Publishing

The rendition used when publishing the default rendition is defined by rendition-publish-contrib.xml. In the same way than the above bulk download, you can change the default behavior by overriding this contribution:

<component name="my.org.rendition.publish.contrib">

  <require>org.nuxeo.ecm.platform.rendition.publish.contrib</require>

  <extension target="org.nuxeo.ecm.platform.rendition.service.RenditionService"
    point="defaultRendition">
    <defaultRendition reason="publish">
      <script language="JavaScript">
        function run() {
          if (CurrentUser.getName() != "bob") {
            if (Document.hasSchema("file")) {
              return 'mainBlob';
            }
          }
          return 'xmlExport';
        }
      </script>
    </defaultRendition>
  </extension>

</component>