ONLYOFFICE Alfresco module package

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

The plugin is available in the official Alfresco Add-ons directory.

  • Currently the following document formats can be opened and edited with this plugin: DOCX, XLSX, PPTX.
  • The plugin will create a new Edit in ONLYOFFICE menu option within the document library for Office documents.

    Edit in OnlyOffice

    This allows multiple users to collaborate in real time and to save back those changes to Alfresco.

  • To convert ODT, ODP, ODS, DOC, XLS, PPT files into their OOXML counterparts, select the Convert using ONLYOFFICE option. Resulting files will be placed in the same folder. You can also configure rules for a folder, that will automatically convert files on upload or on change. Details you can find here.
  • To create a new document, choose the context menu Create new... option within document library. Create new...

You will need an instance of ONLYOFFICE Docs (Document Server) that is resolvable and connectable both from Alfresco and any end clients (version 3.0 and later are supported for use with the plugin). If that is not the case, use the official ONLYOFFICE Docs documentation page. ONLYOFFICE Docs must also be able to POST to Alfresco directly.

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

To start using ONLYOFFICE Docs with Alfresco, the following steps must be performed for Ubuntu 14.04:

  1. Upload the compiled *.jar packages to directories accordingly for your Alfresco installation:
    • from onlyoffice-alfresco/repo/target/ to /webapps/alfresco/WEB-INF/lib/ for Alfresco repository,
    • from onlyoffice-alfresco/share/target/ to /webapps/share/WEB-INF/lib/ for Share.
    You can download the already compiled package files here and place them to the respective directories.
  2. Make sure that Document Server will be able to POST to Alfresco.

    You may need to change these lines in alfresco-global.properties or you can set it using configuration page:

    alfresco.host=<hostname> alfresco.port=443 alfresco.protocol=https share.host=<hostname> share.port=443 share.protocol=https
    Probably located here /usr/local/tomcat/shared/classes/alfresco-global.properties
  3. Restart Alfresco: sudo ./alfresco.sh stop sudo ./alfresco.sh start

The module can be checked in administrator tools at /share/page/console/admin-console/module-package in Alfresco.

Module configuration can be found inside Alfresco Administration Console or by simply navigating to http://<alfrescohost>/alfresco/s/onlyoffice/onlyoffice-config.

You can also add onlyoffice.url to alfresco-global.properties. Configuration made via settings page will override alfresco-global.properties.

JWT can be configured via configuration page or by adding onlyoffice.jwtsecret to alfresco-global.properties.

The JWT configuration on the Document Server side can be found here.

If you plan to compile the ONLYOFFICE Alfresco module package yourself (e.g. edit the source code and compile it afterwards), follow these steps:

  1. The latest stable Oracle Java version is necessary for the successful build. If you do not have it installed, use the following commands to install Oracle Java 8: sudo apt-get update sudo apt-get install openjdk-8-jdk
  2. Install the latest Maven. Installation process is described here.
  3. Download the ONLYOFFICE Alfresco module package source code: git clone https://github.com/ONLYOFFICE/onlyoffice-alfresco.git
  4. Get a submodule: git submodule update --init --recursive
  5. Compile packages in the repo and share directories: cd onlyoffice-alfresco/ mvn clean install

Another way to build ONLYOFFICE Alfresco module package is using docker-compose file.

Use this command from project directory:

docker-compose up
  1. User navigates to a document within Alfresco Share and selects the Edit in ONLYOFFICE menu option.
  2. Alfresco Share makes a request to the repo end (URL of the form: /parashift/onlyoffice/prepare?nodeRef={nodeRef}).
  3. Alfresco Repo end prepares a JSON object for the Share with the following properties:

    • url - the URL that ONLYOFFICE Docs uses to download the document (includes the alf_ticket of the current user);
    • callbackUrl - the URL that ONLYOFFICE Docs informs about status of the document editing;
    • onlyofficeUrl - the URL that the client needs to respond to ONLYOFFICE Docs (provided by the onlyoffice.url property);
    • key - the UUID+Modified Timestamp to instruct ONLYOFFICE Docs whether to download the document again or not;
    • title - the document title (name).
  4. Alfresco Share takes this object and constructs a page from a freemarker template, filling in all of those values so that the client browser can load up the editor.
  5. The client browser makes a request to the JavaScript library from ONLYOFFICE Docs and sends ONLYOFFICE Docs the DocEditor configuration with the above properties.
  6. Then ONLYOFFICE Docs downloads the document from Alfresco and the user begins editing.
  7. ONLYOFFICE Docs sends a POST request to the callback URL to inform Alfresco that a user is editing the document.
  8. Alfresco locks the document, but still allows other users with write access to collaborate in real time with ONLYOFFICE Docs by leaving the Action present.
  9. When all users and client browsers are done with editing, they close the editing window.
  10. After 10 seconds of inactivity, ONLYOFFICE Docs sends a POST to the callback URL letting Alfresco know that the clients have finished editing the document and closed it.
  11. Alfresco downloads a new version of the document, replacing the old one.

Download the ONLYOFFICE Alfresco module package here.