Coder Social home page Coder Social logo

moodle-fileconverter_onlyoffice's Introduction

ONLYOFFICE Document Converter

This is a tool that enables Moodle to use an ONLYOFFICE server for converting documents. For example, this is useful in assignment submissions. In combination with an ONLYOFFICE server, submitted text documents, spreadsheets, and presentations are automatically converted to PDF to simplify the grading workflow.

The plugin leverages the Conversion API offered by the ONLYOFFICE Document Server, which is free software.

EKYkLibXUAEzQHW

Setup

First, make sure that you have the ONLYOFFICE document server installed and determine its URL as seen from the local network!. For the following steps, let's assume it is located at https://documentserver.onlyoffice.local/ (replace with the actual URL!). Also, find out the URL at which you reach Moodle (locally). For now, let's assume it is at https://moodle.local/ (replace that, too).

Note that the URLs are required to be valid for server-to-server communication. Later, none of these URLs will ever be entered into the browser. They are only(!) required to make Moodle talk to the Document Server, and vice versa. In most setups, there is no difference and you can just use the normal URLs from the browser! But under some circumstances, e.g. when using a Docker container setup, you need to use the internal URLs.

  1. Copy the plugin into <MOODLE DIR>/files/converter/onlyoffice.
  2. Start the installation from the Moodle web interface.
  3. Fill in the two settings that you are presented with:
Setting name Value
internaloodsurl https://documentserver.onlyoffice.local/
internalmoodleurl https://moodle.local/

The plugin is successfully installed. Now, to test the converter, create a mod_assign that allows submission of files with any of these formats:

  • Document formats: 'doc', 'docx', 'rtf', 'odt', 'html', 'txt',
  • Spreadsheet file formats: 'xls', 'xlsx', 'ods', 'csv',
  • Presentation file formats: 'ppt', 'pptx', 'odp'.

As a student, create a submission uploading an appropriate file. Then, as a teacher, go to grading and look at the online grading interface. It might take a while until the document is converted. Afterwards, it will show up on the left-hand side. It should look similar to the screenshot at the top of this file.

Troubleshooting

  • Look into the logs of the Moodle and ONLYOFFICE servers, verifying that
    1. requests show up: Before conversion, there should be at least one request from Moodle to ONLYOFFICE (asking for conversion), and one request from ONLYOFFICE to Moodle (accessing the file).
    2. there are no error messages
  • If fewer requests are logged than expected, make sure that the URLs that you specify are both correct and reachable from the servers' internal network. For example, log on to the servers and try to fetch the URLs via CURL. Observe the error messages.

If there is a problem that you cannot deal with, please file an issue on GitHub.

moodle-fileconverter_onlyoffice's People

Contributors

dagefoerde avatar justusdieckmann avatar laur0r avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

moodle-fileconverter_onlyoffice's Issues

Moodle conversion does not work

Hi!
Moodle 3.8.3 is running (as host) in CentOS8 server. I installed the OnlyOffice Document Server on this machine with podman (docker):
https://github.com/ONLYOFFICE/DocumentServer
https://github.com/ONLYOFFICE/Docker-DocumentServer
sudo podman run -i -t -d -p 82:80 \ -v /app/onlyoffice/DocumentServer/logs:/var/log/onlyoffice \ -v /app/onlyoffice/DocumentServer/data:/var/www/onlyoffice/Data \ -v /app/onlyoffice/DocumentServer/lib:/var/lib/onlyoffice \ -v /app/onlyoffice/DocumentServer/rabbitmq:/var/lib/rabbitmq \ -v /app/onlyoffice/DocumentServer/redis:/var/lib/redis \ -v /app/onlyoffice/DocumentServer/db:/var/lib/postgresql onlyoffice/documentserver

It is running with docker, in browser it appears the OnlyOffice start page.

In Moodle I installed this plugin and settings:
internaloodsurl: http://localhost:82
internalmoodleurl: < empty >

The documents don't opened. :( I can just download them.

What do I wrong?

onlyoffice-welcome

Encoding error when grading assignments.

First I created an assignment for students to upload their results as files. When switching into the grading view, an error message says: "Die PDF-Datei kann nicht geöffnet werden. Die Datei ist beschädigt oder hat ein nicht unterstütztes Format." (The PDF file could not be opened. The file is corrupted or has an file format that is not supported.)

After setting a grade and filling the feedback field, a click on the save button results in the following error message:
Screenshot_20210307_065510b

Here is the complete stack trace:

Stack trace:
Error code: codingerror

  • line 73 of /files/converter/onlyoffice/classes/documentserver_client.php: coding_exception thrown
  • line 233 of /files/converter/onlyoffice/classes/converter.php: call to fileconverter_onlyoffice\documentserver_client->request_conversion()
  • line 116 of /files/classes/converter.php: call to fileconverter_onlyoffice\converter->poll_conversion_status()
  • line 96 of /files/classes/converter.php: call to core_files\converter->poll_conversion()
  • line 251 of /mod/assign/feedback/editpdf/classes/document_services.php: call to core_files\converter->start_conversion()
  • line 319 of /mod/assign/feedback/editpdf/classes/document_services.php: call to assignfeedback_editpdf\document_services::list_compatible_submission_files_for_attempt()
  • line 336 of /mod/assign/feedback/editpdf/classes/document_services.php: call to assignfeedback_editpdf\document_services::get_combined_document_for_attempt()
  • line 383 of /mod/assign/feedback/editpdf/classes/document_services.php: call to assignfeedback_editpdf\document_services::get_combined_pdf_for_attempt()
  • line 271 of /mod/assign/feedback/editpdf/locallib.php: call to assignfeedback_editpdf\document_services::page_number_for_attempt()
  • line 8388 of /mod/assign/locallib.php: call to assign_feedback_editpdf->is_feedback_modified()
  • line 8557 of /mod/assign/locallib.php: call to assign->apply_grade_to_user()
  • line 1588 of /mod/assign/externallib.php: call to assign->save_grade()
  • line 261 of /lib/externallib.php: call to mod_assign_external::submit_grading_form()
  • line 81 of /lib/ajax/service.php: call to external_api::call_external_function()

The error happens not every time and with every file but regularly. If I download a concerned file it is a valid file and can be opened with e.g. LibreOffice without errors.

Is this a problem with the plugin, the Moodle instance or with the OnlyOffice instance?

remove test file (or add some tests to it)

It would be better to remove the tests directory rather than leaving an empty test class in place because this gives people the impression that your plugin implements tests when it doesn't quite yet! :-)

missing privacy api

Moodle implements a privacy api - it would be nice if you could implement this in your plugin. Sites that use continuous integration processes will not be able to use your plugin as Moodle includes unit tests to check that all installed plugins contain appropriate privacy classes.

you might be able to copy a chunk of the librelambda one which implements the external_link stuff as the null provider probably isn't quite right here:
https://github.com/catalyst/moodle-fileconverter_librelambda/blob/master/classes/privacy/provider.php

more information on the privacy api is here:
https://docs.moodle.org/dev/Privacy_API

please note - this is not a blocker for approval in the plugins db but would be nice to add at some point.

consider adding travis-ci support

Some of the tests run by the Moodle.org plugins db can be run via travis-ci on each commit in your github repo. Enabling Travis integration helps you to make sure future changes to your plugin will continue to follow the guidelines.

More information on this is here:
https://moodle.org/mod/forum/discuss.php?d=323384

but the short version:
grab this file:
https://github.com/moodlerooms/moodle-plugin-ci/blob/master/.travis.dist.yml
rename it as .travis.yml and put in the root of your github directory.
Go to:
https://travis-ci.org/profile/YOUR_GITHUB_USERNAME
Flick the switch for this repo.

then on every commit you make to github it will fire off a request to travis to run the tests in .travis.yml and will give you traffic lights beside each commit and generate a report.

something else you might want to change:
in .travis.yml the default file has this line:

env:
global:

MOODLE_BRANCH=MOODLE_35_STABLE
you might want to add other branches to that list - so you might want to change it something like:

env:
global:
MOODLE_BRANCH=MOODLE_35_STABLE
MOODLE_BRANCH=MOODLE_36_STABLE
MOODLE_BRANCH=MOODLE_37_STABLE

First Certificate Error

I see the following error in /var/log/onlyoffice/documentserver/converter
[2020-04-17T09:42:19.874] [ERROR] nodeJS - error downloadFile:url=https://moodle.legacyknights.org/pluginfile.php/1/fileconverter_onlyoffice/ori$
Error: unable to verify the first certificate
at TLSSocket.onConnectSecure (_tls_wrap.js:1058:34)
at TLSSocket.emit (events.js:198:13)
at TLSSocket._finishInit (_tls_wrap.js:636:8)

The grading preview in Moodle failes with a "PDF is corrupt" error.

Both servers are local with a split DNS. So the URL above points to the local server IP onsite. I setup OnlyOffice on an Ubuntu Server 16.04 VM.

Wrong exception thrown in documentserver_client.php

Hello!

Me and my team recently discovered that the incorrect exception is triggered when a CURL error occurs in the documentserver_client.php file.

When calling the poll_conversion_status and start_document_conversion functions in the converter.php file, both functions use a try-catch code block when calling the request_conversion function. The try-catch code block listens for an OnlyOfficeException, but the request_conversion function throws a coding_exception in case of an error, which is not caught by the try-catch code blocks. This causes scheduled tasks to hang with status set to 1 if anything goes wrong with the conversion process.

I will address this issue in a linked PR.

Best regards,
Nejc

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.