Voci con l'etichetta :
Chiudi
Changelog
Chiudi
Provalo nel cloud
Centro assistenza
integrazione

About the ONLYOFFICE and Drupal integration

Drupal is an open-source content manager system used for building APIs. ONLYOFFICE offers an official module to integrate ONLYOFFICE Docs with Drupal and edit office documents in your Drupal media library. You can get the ONLYOFFICE integration module either from the official Drupal website by choosing the required version, or add it with Composer. The module is distributed under the GNU General Public License v.2.0.

Main features

  • Editing and viewing text documents, spreadsheets, and presentations.
  • Co-editing documents in real-time: two co-editing modes (Fast and Strict), the Track Changes mode, comments, and the built-in chat.
  • JWT support to secure your traffic so that no one can have access to your documents with the exception of the users with proper rights.

Supported formats

  • For editing: DOCX, XLSX, PPTX.
  • For viewing only: DJVU, DOC, DOCM, DOT, DOTM, DOTX, EPUB, FB2, FODT, HTML, MHT, ODT, OTT, OXPS, PDF, RTF, TXT, XPS, XML, CSV, FODS, ODS, OTS, XLS, XLSM, XLT, XLTM, XLTX, FODP, ODP, OTP, POT, POTM, POTX, PPS, PPSM, PPSX, PPT, PPTM.

Connecting ONLYOFFICE Docs to Drupal

Requirements

  • ONLYOFFICE Docs (Document Server) v7.1. or later.

    You need an instance of ONLYOFFICE Docs that is resolvable and connectable both from Drupal and any end clients. It must be able to POST to Drupal directly.

    Please refer to the official documentation page to learn more about installing ONLYOFFICE Docs.
  • Drupal core module.
  • The firebase/php-jwt 4.0 or 5.0 package.

Installing the ONLYOFFICE integration module for Drupal

There are two ways to install the ONLYOFFICE integration module for Drupal, either through the Drupal user interface or using Composer.

Installing through the Drupal user interface
  1. On the Admin toolbar project page on drupal.org, scroll to the Releases section at the bottom of the page. Click the View all releases link.
  2. Choose the required version from the list.
  3. Copy the address of the tar.gz link. Depending on your device and browser, you might do this by right-clicking and selecting Copy link address.
  4. In the Manage administrative menu, navigate to Extend (admin/modules). The Extend page appears.
  5. Click the Add new module button. The Add new module page appears.
    ONLYOFFICE_Drupal ONLYOFFICE_Drupal
  6. Paste the copied download link into the Add from a URL field.
    ONLYOFFICE_Drupal ONLYOFFICE_Drupal
  7. Click Install to upload and unpack the new module on the server. The files are downloaded to the modules directory.
  8. To apply the localization settings, please run the following commands:
    drush locale-check
    drush locale-update
Installing through Composer

Enter the following command at the root of your Drupal site:

composer require onlyoffice/drupal

If the installation directory is web/modules/contrib/drupal, please run the following commands to apply the localization settings:

drush locale-check
drush locale-update

Enabling the ONLYOFFICE integration module for Drupal

There are two way to enable the ONLYOFFICE integration module for Drupal, either using the Drupal user interface or via command line.

Enabling through the Drupal user interface
  1. Open the Extend page (admin/modules) via the Manage administrative menu.
  2. Locate the ONLYOFFICE Connector module and check the corresponding box.
    ONLYOFFICE_Drupal ONLYOFFICE_Drupal
  3. Click Install to enable the module.
Enabling via command line
  1. Run the following Drush command, giving the project name as a parameter:
    drush pm:enable onlyoffice
  2. Follow the instructions of the wizard.

Configuring the ONLYOFFICE integration module for Drupal

In Drupal, open the ~/config/system/onlyoffice-settings page with administrative settings for ONLYOFFICE section. Alternatively, follow these steps:

  1. Open the Extend page (admin/modules) via the Manage administrative menu.
  2. Click the arrow in the description of the ONLYOFFICE Connector module to open a drop-down list.
  3. Choose the Configure option.
  4. Enter the address into the Document Editing Service address field to connect ONLYOFFICE Document Server:
    https://documentserver/
ONLYOFFICE_Drupal ONLYOFFICE_Drupal

Where documentserver is the name of the server with the ONLYOFFICE Document Server installed. The address must be accessible for the user browser and from the Drupal server. The Drupal server address must also be accessible from ONLYOFFICE Document Server to ensure the correct run.

To restrict access to ONLYOFFICE Document Server and for security reasons and data integrity, the encrypted signature is used. Specify the Secret key in the Drupal administrative configuration. In the ONLYOFFICE Document Server config file specify the same secret key and enable the validation.

Enabling JWT for the ONLYOFFICE and Drupal integration

JWT or JSON Web Token is a string sent from client to server within the HTTP request to validate the authenticity of the client. JWT is saved on the client-side only so the transmission between parties is protected and digitally signed.

The token is generated using the JWT (JSON Web Tokens) standard. The tokens are signed by the server's key, so the client is able to verify that the token is legitimate.

ONLYOFFICE Docs validates the token. The data from the payload is considered valid and is used instead of the corresponding data from the main parameters. If the token is invalid, the command is not executed. To learn more, please read the API Security guide.

To protect your documents with JWT in Drupal, open the ~/config/system/onlyoffice-settings page with administrative settings for ONLYOFFICE section. Alternatively, follow these steps:

  1. Open the Extend page (admin/modules) via the Manage administrative menu.
  2. Click the arrow in the description of the ONLYOFFICE Connector module to open a drop-down list.
  3. Choose the Configure option.
  4. Enter the secret key in the Secret key field.
    ONLYOFFICE_Drupal ONLYOFFICE_Drupal
  5. In the ONLYOFFICE Document Server config file, specify the same secret key and enable the validation.

Start using ONLYOFFICE Docs within Drupal

To edit the office documents in Drupal using the ONLYOFFICE Docs, upload the files to Drupal.

Uploading files to Drupal
  1. Go to Manage -> Content.
  2. Click the Add content button.
  3. Click the required content type.
  4. Enter the title, language, body, and set the text format.
  5. In the Add a new file field click the Browse button and choose the file from your PC hard drive.
  6. Check or uncheck the Published box depending on your preferences.
  7. Click the Save button.
Viewing, editing and managing files in Drupal
  1. Go to Manage -> Content.
  2. Switch to the Media tab at the top of the screen.
  3. Find the required file in the list or use the search field at the top.
  4. Click the arrow in the Operations column to choose whether you want to Edit the file properties, Edit in ONLYOFFICE or Delete the file.
    ONLYOFFICE_Drupal ONLYOFFICE_Drupal
Adding files to posts

When creating a post, you can add the new ONLYOFFICE element.

  1. Go to Structure -> Content types -> click Manage fields next to the required content field. On the opened page, click Add field. Add a new field: General, Number, Reference or Text. Set the label and save.
    ONLYOFFICE_Drupal ONLYOFFICE_Drupal
  2. For the added File field, specify the file extensions. Go to Structure -> Content types -> Manage fields, or stay on the opened page. In the Allowed file extensions field, specify the file formats that will be shown in the editors (docx, xlsx, pptx).
    ONLYOFFICE_Drupal ONLYOFFICE_Drupal
  3. For the added Media field, click the Document checkbox.
    ONLYOFFICE_Drupal ONLYOFFICE_Drupal
  4. Go to Structure -> Media types -> Document -> open the drop-down list and choose the Manage display option.
    ONLYOFFICE_Drupal ONLYOFFICE_Drupal
  5. For the Document field, specify the ONLYOFFICE Preview format. By clicking on the gear symbol, you can specify the dimensions of the embedded editor window.
    ONLYOFFICE_Drupal ONLYOFFICE_Drupal

    When you are done with the pre-settings, you can create posts on the Content tab. Click on the Add content button and select the created content.

    ONLYOFFICE_Drupal ONLYOFFICE_Drupal
  1. Specify title and select a file (if the content contains File fields).
  2. For Media section, specify the name of the previously uploaded file.
  3. Your site visitors will also be able to view the created page (People -> Permissions -> View published content).
Download Best editors on your website Let your site users view, edit and collaborate
on all types of text, spreadsheet and presentation files
Ti potrebbe essere d'aiuto anche...
Chiudi