Liferay ONLYOFFICE connector

This plugin enables users to edit office documents from Liferay using ONLYOFFICE Docs.

  • Currently the following document formats can be opened and edited with this plugin: DOCX, XLSX, PPTX.
  • The following formats are available for viewing only: ODT, ODS, ODP, DOC, XLS, PPT.
  • The plugin will create a new ONLYOFFICE Edit/View menu option within the Documents and Media section for Office documents. This allows multiple users to collaborate in real time and to save back those changes to Liferay.

You will need an instance of ONLYOFFICE Docs (Document Server) that is resolvable and connectable both from Liferay and any end clients. If that is not the case, use the official ONLYOFFICE Docs documentation page. ONLYOFFICE Docs must also be able to POST to Liferay directly.

The easiest way to start an instance of ONLYOFFICE Docs is to use Docker.

Either install it from Liferay Marketplace or if you are building the connector by yourself simply put compiled .jar file from build\libs folder to /opt/liferay/deploy. Liferay will install it automatically.

In order to configure connector you must navigate to System Settings (Control Panel -> Configuration -> System Settings). In Platform section click the Connectors category and select ONLYOFFICE.

Simply run gradle build. Output .jar will be placed inside the build/libs directory.

  1. User navigates to the Documents and Media section within Liferay and selects the Edit in ONLYOFFICE action.
  2. Liferay prepares a JSON object for the Document Server with the following properties:

    • url: the URL that ONLYOFFICE Docs uses to download the document,
    • callbackUrl: the URL that ONLYOFFICE Docs informs about status of the document editing;
    • key: the fileVersionId to instruct ONLYOFFICE Docs whether to download the document again or not;
    • title: the document title (name).
  3. The client browser makes a request to the JavaScript library from ONLYOFFICE Docs and sends ONLYOFFICE Docs the DocEditor configuration with the above properties.
  4. Then ONLYOFFICE Docs downloads the document from Liferay and the user begins editing.
  5. ONLYOFFICE Docs sends a POST request to the callback URL to inform Liferay that a user is editing the document.
  6. Liferay locks the document, but still allows other users with write access to collaborate in real time with ONLYOFFICE Docs by leaving the Action present.
  7. When all users and client browsers are done with editing, they close the editing window.
  8. After 10 seconds of inactivity, ONLYOFFICE Docs sends a POST to the callback URL letting Liferay know that the clients have finished editing the document and closed it.
  9. Liferay downloads a new version of the document, replacing the old one.

Download the Liferay ONLYOFFICE connector here.