Moodle 3.3 document converter and online text assignment now working

Moodle 3.3 document converter and online text assignment now working

by Peter Svec -
Number of replies: 9

Hi, 

we used to use unoconv without any problems in previous versions of Moodle. After upgrading to 3.3 we started to use the Google Drive converter. It works fine, but this converter is not creating pdf files in "Grading assignments". Supported conversions are "rtf, doc, xls, docx, xlsx, ppt, pptx, pdf".

How can I add "txt" or "plain text" to the list of supported formats? I don't think, that google api is unable to convert plain text to pdf file.

peter

Average of ratings: Useful (1)
In reply to Peter Svec

Re: Moodle 3.3 document converter and online text assignment now working

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

Hello. As this is a feature with assignments, I will move your post to the Assignment forum. I'm not so sure myself that Google document converter will convert txt to PDF (after a quick search online) but hopefully someone more knowledgeable will have further information. 


In reply to Mary Cooch

Re: Moodle 3.3 document converter and online text assignment now working

by Peter Svec -

Dear Mary,

thanks for moving the post. I also checked the documentation of Google API and found that the API is able convert txt to pdf. I don't want to use unoconv as AL Rachels propose , because it needs special installation and this is not possible for some clients. I use it on some of our servers... but long story short.

I edited the file

files/converter/googledrive/classes/converter.php 

and edited the converter class. I added the txt extension

private static $imports = [
        'doc' => 'application/vnd.google-apps.document',
        'docx' => 'application/vnd.google-apps.document',
        'rtf' => 'application/vnd.google-apps.document',
        'xls' => 'application/vnd.google-apps.spreadsheet',
        'xlsx' => 'application/vnd.google-apps.spreadsheet',
        'ppt' => 'application/vnd.google-apps.presentation',
        'pptx' => 'application/vnd.google-apps.presentation',
        'txt' => 'application/vnd.google-apps.document'
    ];

and also added txt in the array of get_supported_conversions(), line 269

public function get_supported_conversions() {
        return implode(', ', ['rtf', 'doc', 'xls', 'docx', 'xlsx', 'ppt', 'pptx', 'pdf', 'txt']);
    }
I disabled the unoconv plugin and tried to grade online text assignment. It works like a charm. The google converter is converting now also this type of assignment to PDF. 


I created an issue in the tracker MDL-60319

Average of ratings: Useful (4)
In reply to Peter Svec

Re: Moodle 3.3 document converter and online text assignment now working

by Peter Svec -

It seems it is not working as expected. I will try to find the reason why. If there is someone who can check it on own install, please let me know.

In reply to Peter Svec

Re: Moodle 3.3 document converter and online text assignment now working

by Peter Svec -

I added support for html and now it seems that it is working again.

private static $imports = [
        'doc' => 'application/vnd.google-apps.document',
        'docx' => 'application/vnd.google-apps.document',
        'rtf' => 'application/vnd.google-apps.document',
        'xls' => 'application/vnd.google-apps.spreadsheet',
        'xlsx' => 'application/vnd.google-apps.spreadsheet',
        'ppt' => 'application/vnd.google-apps.presentation',
        'pptx' => 'application/vnd.google-apps.presentation',
        'txt' => 'application/vnd.google-apps.document',
        'html' => 'application/vnd.google-apps.document'
    ];
    private static $exports = [
        'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
        'rtf' => 'application/rtf',
        'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
        'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
        'pdf' => 'application/pdf',
        'txt' => 'text/plain',
        'html' => 'text/html'
    ];

Average of ratings: Useful (1)
In reply to Peter Svec

Re: Moodle 3.3 document converter and online text assignment now working

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hi Peter,

If you only have the Google Drive converter enabled, "txt" or "plain text" will give you a blank white pdf. Since you had unoconv working before, just go ahead and enable it too. With both enabled, then your "txt" or "plain text" will work and you will get good pdf's. Besides, unoconv lists a lot more file types that it will handle which then gives your teachers many more options for the type of files to submit for an assignment. Comes in real handy for teachers, like myself, that use LibreOffice (free) instead of M$ Office.

Just verified that's what happened when I tested it on the server I used for the Moodle 3.3 QA Testing cycle.

Average of ratings: Useful (2)
In reply to Peter Svec

Re: Moodle 3.3 document converter and online text assignment now working

by Jake Dallimore -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Thanks for the report, Peter. 

I've been triaging some other issues in this area, and you're absolutely right. If we submit text using Atto, and with only the Google Drive converter enabled, then the results are not great - like you said, the teacher won't see the online text submission. Worse still, the teacher won't be able to see the contents of any files submitted either.

W.r.t. enabling unoconv: The Google Drive converter should be able to handle this situation, without the need to enable unoconv again. They are after all entirely independent converters. Using Atto, the submission will be HTML, so your solution looks feasible to me at a glance. I'll comment on the issue once I've tested a few more scenarios.


Average of ratings: Useful (2)
In reply to Peter Svec

Re: Moodle 3.3 document converter and online text assignment now working

by Peter Svec -
After some period of testing the proposed change is now available from the main moodle.git repository and will shortly be available on download.moodle.org. The bug is now fixed.


In reply to Peter Svec

Re: Moodle 3.3 document converter and online text assignment now working

by Jari Vilkman -

Hello,


Regarding GDPR;


https://en.wikipedia.org/wiki/General_Data_Protection_Regulation


If you are using Google Drive Converter instead of Unconv, where you can select the location of the files that is uploaded to Google (for the conversion)? 

Meaning where you can select to use European server? Can you do this in Google developer console?

In reply to Jari Vilkman

Re: Moodle 3.3 document converter and online text assignment now working

by Peter Svec -
When you use google cloud services, like Google Drive API (which is used for converting documents) you can agree with Data Processing and Security Terms and EU Model Contract Clauses. Google is a processor of data. The converter feature is not storing the data. 


From the GDPR point of view, you should not enter personal data as assignments, but this is not the topic of this post.