Moodle

Develop "googledocs" plugin for Google Docs

Details

  • Type: Sub-task Sub-task
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 2.0
  • Fix Version/s: 2.0
  • Component/s: Repositories
  • Labels:
    None
  • Affected Branches:
    MOODLE_20_STABLE
  • Fixed Branches:
    MOODLE_20_STABLE

Description

I've had a quick go at creating a repository plugin:
http://git.danpoltawski.co.uk/?p=moodle.git;a=shortlog;h=refs/heads/googledocs

At the moment it can retrieve a list of files and search them.

Unfortunately it can't download to moodle yet - I think this will require sending extra headers with the get_file method.
It also doesn't do the api auth setup.

Overall I think the biggest issue is how to share between potfolio /repo api.

Issue Links

Activity

Hide
Dan Poltawski added a comment -

Hmm. Really annoyingly the google api doesn't currently support retrieving documents with the AuthSub authentication method, but they are working on it:

http://code.google.com/p/gdata-issues/issues/detail?id=35

Show
Dan Poltawski added a comment - Hmm. Really annoyingly the google api doesn't currently support retrieving documents with the AuthSub authentication method, but they are working on it: http://code.google.com/p/gdata-issues/issues/detail?id=35
Hide
Dan Poltawski added a comment - - edited

Unfortunately the state of this is the same as before

Can

  • List documents
  • Search the documents and return list (google api allows content searching too)

But rather frustratingly can't:

  • Download the documents!

The above google bug mentions that it should work with the Google clientlogin method, so I reworked the plugin to authenticate using that method, but I still haven't been able to use this method to retrieve the document.

Show
Dan Poltawski added a comment - - edited Unfortunately the state of this is the same as before Can
  • List documents
  • Search the documents and return list (google api allows content searching too)
But rather frustratingly can't:
  • Download the documents!
The above google bug mentions that it should work with the Google clientlogin method, so I reworked the plugin to authenticate using that method, but I still haven't been able to use this method to retrieve the document.
Hide
Nadav Kavalerchik added a comment -

inspired by firefox addon : "open it online" that lets you view any office document inside an online web2 service like : google docs, zoho or thinkfree projects... i made a filter that lets you do the same for "linked" office documents inside the HTML editor.

please see more info about this filter in
http://tracker.moodle.org/browse/CONTRIB-625

Show
Nadav Kavalerchik added a comment - inspired by firefox addon : "open it online" that lets you view any office document inside an online web2 service like : google docs, zoho or thinkfree projects... i made a filter that lets you do the same for "linked" office documents inside the HTML editor. please see more info about this filter in http://tracker.moodle.org/browse/CONTRIB-625
Hide
Dan Poltawski added a comment -

Thanks Nadav, I don't think this is what we are looking for here - where we need a way to retrieve docs from google by machine.

Show
Dan Poltawski added a comment - Thanks Nadav, I don't think this is what we are looking for here - where we need a way to retrieve docs from google by machine.
Hide
Nadav Kavalerchik added a comment -

it seems there has been some progress with document handling at google's labs
http://code.google.com/apis/documents/docs/1.0/developers_guide_php.html

please see if it is any good

Show
Nadav Kavalerchik added a comment - it seems there has been some progress with document handling at google's labs http://code.google.com/apis/documents/docs/1.0/developers_guide_php.html please see if it is any good
Hide
Dan Poltawski added a comment -

Yep, as announced in this blog post they've added download support: http://googledataapis.blogspot.com/2009/02/start-downloads.html

I've now updated and commited this plugin. At the moment i've hardcoded the export format which the plugin exports from google. If want to look at letting the user decide this..

Show
Dan Poltawski added a comment - Yep, as announced in this blog post they've added download support: http://googledataapis.blogspot.com/2009/02/start-downloads.html I've now updated and commited this plugin. At the moment i've hardcoded the export format which the plugin exports from google. If want to look at letting the user decide this..
Hide
Dongsheng Cai added a comment -

Worked great!

I overwrote supported_filetypes function in googledocs plugin, this will tell filepicker googledocs only contain documents, so googledocs repository won't display when launching filepicker in htmleditor.

Show
Dongsheng Cai added a comment - Worked great! I overwrote supported_filetypes function in googledocs plugin, this will tell filepicker googledocs only contain documents, so googledocs repository won't display when launching filepicker in htmleditor.
Hide
Dan Poltawski added a comment -

Thanks Dongsheng - one thing I wanted to talk to you about was the possibility of giving users the choice in what format to download it at the time they select the document.

The google API will export documents in a variety of formats: http://code.google.com/apis/documents/docs/2.0/developers_guide_protocol.html#DownloadingDocsAndPresentations (which vary with each document type), do you think it'd be possible to allow the selection at the time the user selects the file?

On a related note, I think the way that the file stuff works means that we really need to ensure the user seects the correct file extension?

Show
Dan Poltawski added a comment - Thanks Dongsheng - one thing I wanted to talk to you about was the possibility of giving users the choice in what format to download it at the time they select the document. The google API will export documents in a variety of formats: http://code.google.com/apis/documents/docs/2.0/developers_guide_protocol.html#DownloadingDocsAndPresentations (which vary with each document type), do you think it'd be possible to allow the selection at the time the user selects the file? On a related note, I think the way that the file stuff works means that we really need to ensure the user seects the correct file extension?
Hide
Dongsheng Cai added a comment -

Yes, it is possible, here is my solution:
1. User clicks file icon, goes into file renaming page
2. User renames the file name to *.pdf or *.doc
3. rewrite repository::get_file, if the file name ends with 'pdf' export pdf document, ends with 'doc', export ms office document

We can add a select element in renaming page

> On a related note, I think the way that the file stuff works means that we really need to ensure the user seects the correct file extension?
Yes, I think so, in lib/file/file_types.mm, I defined a file extension list, it is a freemind file, you can open it by freemind, changes will reflect in repository api.

Show
Dongsheng Cai added a comment - Yes, it is possible, here is my solution: 1. User clicks file icon, goes into file renaming page 2. User renames the file name to *.pdf or *.doc 3. rewrite repository::get_file, if the file name ends with 'pdf' export pdf document, ends with 'doc', export ms office document We can add a select element in renaming page > On a related note, I think the way that the file stuff works means that we really need to ensure the user seects the correct file extension? Yes, I think so, in lib/file/file_types.mm, I defined a file extension list, it is a freemind file, you can open it by freemind, changes will reflect in repository api.
Hide
Dongsheng Cai added a comment -

Dan, I created repository::prepare_file which can help you make temp file for downloading

Show
Dongsheng Cai added a comment - Dan, I created repository::prepare_file which can help you make temp file for downloading
Hide
Dan Poltawski added a comment -

Dongsheng, thats for prepare_file() - I just saw the duplication everywhere and disapaired

I consdered the .pdf/.doc extension idea, however my thoughts were:

1) It'd be nice to add some contextual help telling the user what formats they could export a document in
2) We'd need to deal with incorrect extensions (and that could be even more complicated because for example if you uplaod a .jpg to google docs it ends up inside a document, often named by .jpg)

Regarding the file types there is an interesting example with googledocs export of presentations - it can be both .ppt/.pdf as a document but will allow export of presentations as .swfs (which I could see being very useful format for moodle use). So would need a good way to deal with that.

Show
Dan Poltawski added a comment - Dongsheng, thats for prepare_file() - I just saw the duplication everywhere and disapaired I consdered the .pdf/.doc extension idea, however my thoughts were: 1) It'd be nice to add some contextual help telling the user what formats they could export a document in 2) We'd need to deal with incorrect extensions (and that could be even more complicated because for example if you uplaod a .jpg to google docs it ends up inside a document, often named by .jpg) Regarding the file types there is an interesting example with googledocs export of presentations - it can be both .ppt/.pdf as a document but will allow export of presentations as .swfs (which I could see being very useful format for moodle use). So would need a good way to deal with that.
Hide
Helen Foster added a comment -

Dan and Dongsheng, I've just enabled the Google Docs repository plugin and tried adding a file from Google Docs to a forum post.

Everything works perfectly - it's fabulous! Thanks a lot for your work

Show
Helen Foster added a comment - Dan and Dongsheng, I've just enabled the Google Docs repository plugin and tried adding a file from Google Docs to a forum post. Everything works perfectly - it's fabulous! Thanks a lot for your work
Hide
Nadav Kavalerchik added a comment -

if i may... i would like to quote those who came before me:

"Dan and Dongsheng, I've just enabled the Google Docs repository plugin and tried adding a file from Google Docs to a forum post.
Everything works perfectly - it's fabulous! Thanks a lot for your work "

thank you

Show
Nadav Kavalerchik added a comment - if i may... i would like to quote those who came before me:
"Dan and Dongsheng, I've just enabled the Google Docs repository plugin and tried adding a file from Google Docs to a forum post. Everything works perfectly - it's fabulous! Thanks a lot for your work "
thank you
Hide
Helen Foster added a comment -

Thanks again Dan - the Google Docs repository plugin is great!

Show
Helen Foster added a comment - Thanks again Dan - the Google Docs repository plugin is great!

People

Vote (3)
Watch (7)

Dates

  • Created:
    Updated:
    Resolved: