View Files in a Google Docs Viewer

View Files in a Google Docs Viewer

by Allan Watson -
Number of replies: 5

I'm new to moodle, and developing a mobile front end which is widely compatible with devices. What I want to achieve is a way for smart phones and tablets to view different file formats on their devices in a standard way.

Google docs viewer does a great job of converting file urls and displaying them in a viewer in your browser.

https://docs.google.com/viewer

I'm trying to find a way of altering the download link for files that appear in course resources. So instead of the url being a download link, the link gets forwaded to another page which can display the content.

I've never built a moodle plugin before, and I'm trying to stay clear of modifying any moodle core files by using javascript to manipulate the DOM.

I've been exploring the renders and lib files of the moodle/course folder, to no avail. The /course/resources.php file has given me some sort of indication about how files are presented, but not really a lot of use.

Wonder if anyone could give me some advice or direction to go with this idea. Would it be easier to try and manipulate core files or build some sort of plugin?

Average of ratings: -
In reply to Allan Watson

Re: View Files in a Google Docs Viewer

by Kris Stokking -

You may want to have a look at Google's usage policies before you embark down this road.  We are also interested in inline file display, but decided not to pursue Google Docs Viewer because the data is made public, there is no way to secure it, and it is cached on the Google servers based on the URL.  If your resources are freely available, then GDocs Viewer would be a good option for you.  If you need to be concerned about file access, I would not recommend it.  

In reply to Kris Stokking

Re: View Files in a Google Docs Viewer

by Allan Watson -

Kirs thanks for your reply. Security isn't a major issue in my project, it's for academic purposes. 

I'm now experimenting with changing the files located in moodle/mod/resource seems my best bet to be honest.

In reply to Allan Watson

Re: View Files in a Google Docs Viewer

by Kris Stokking -

I would still put caution flags up that using GDocs is not secure in case the end user assumed it was.  In any case, you may want to create a custom Moodle Filter for it.  That would be a modular way to embed files within the page, and wouldn't require you to modify core code.

In reply to Kris Stokking

Re: View Files in a Google Docs Viewer

by Doug Moody -

I am with Kris on this. I also work in a school, and security IS an issue. Why? Because much material, while freely available, is sometimes compromised by copyright issues. Someone could inadvertently put up material that is copyrighted and be sued by the creator for illegal use. At least keepnig things "in house' would protect you from discovery if copyright material should appear. You could always claim that you didn't have the material exposed to the public if you have good security.

But another issue is more serious...GDOCS URLs are discoverable through search engines, even if your front end is secure. That would mean that someone could find material you want to protect by way of the full URL path and get into your system and see even confidential files that you didn't want seen and that aren't visible to th public normally. That has happened in our school district, and we are cautioned to make all confidential docs have a password on docs themselves. If you did that for students, then eventually the docs passwords would get out to the public and you would be trying to do damage control after the fact. Better to build in better security from the start than have to do it afterwards.

In reply to Kris Stokking

Re: View Files in a Google Docs Viewer

by Allan Watson -

Thanks I will take a look at the filters and see what I can come up with there.

Security would be a big issue for a real working system. My project isn't going to be used in a real world scenario, it's all about compatibility. However I will mention the security aspects related to Google etc. in my report write up.