Google Gear integration (was Wanted: New feature ideas for GSOC projects)

Google Gear integration (was Wanted: New feature ideas for GSOC projects)

by Dongsheng Cai -
Number of replies: 25
Google Gear integration

Currently, Moodle loads a lot of javascript and css files to run, this causes many http connections, which could slow the web performance, one possible solution to solve this is using Google Gear to cache these files (including pictures) locally.

Google Gear LocalServer: http://code.google.com/apis/gears/api_localserver.html

One successful case is wordpress turbo: http://www.teckitech.com/blogging/speed-up-wordpress-with-wordpress-turbo-google-gears/

There are more things we can do using Google Gear:

1. we can create toolkits for students/teacher to store notes or useful information locally
2. when Internet connection is broken, store assignments locally, when internet is active, upload assignments automatically.
3. Even more, we can create off-line moodle (however, I think it is too much for GOSC)

Hope this will help.
Average of ratings: -
In reply to Dongsheng Cai

Re: Wanted: New feature ideas for GSOC projects

by David Horat -
I specially like this one Dongsheng. I am a user of Wordpress and I love how fast is the new control panel thanks to Google Gears (and the hard work of Wordpress developers).
In reply to Dongsheng Cai

Re: Google Gear integration (was Wanted: New feature ideas for GSOC projects)

by Abhinav Chittora -
I Really Appreciate the idea.
This Idea is going to make moodle more robust and user friendly.
In reply to Dongsheng Cai

Re: Google Gear integration (was Wanted: New feature ideas for GSOC projects)

by Alberto JV -
This sounds like a great (and ambitious) project. I use Gears quite often with Google Reader, and it makes it a lot better to keep informed even if I cannot stay online.

One more idea to the list: how about having an offline option for recent messages/announcements? and an option to always have the course syllabus available even if the user is in offline mode?

Now the questions is: what would be a realistic expectation for a single summer? After reading the threads in http://moodle.org/mod/forum/discuss.php?d=107920 I realized that there are still a few challenges (relying on external sites, AJAX, how to store the information, etc).
In reply to Alberto JV

Re: Google Gear integration (was Wanted: New feature ideas for GSOC projects)

by Dan Marsden -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators
I really like this idea, When Martin Langhoff and I were bouncing the idea around for off-line Moodle last year, Gears was still in it's early stages, and there weren't many examples of it's use around, It's getting a lot more use now and there's a lot of potential for its use in Moodle.

As Dongsheng mentions above a Google Gear integration for GSOC would have a very limited initial list of "offline items" We should focus more on building a good flexible base/architecture and allow other components to be added later!
In reply to Dan Marsden

Re: Google Gear integration (was Wanted: New feature ideas for GSOC projects)

by Siddharth Prakash Singh -
I would like to work on this project. I am applying for this project as a google summer of code developer.
In reply to Siddharth Prakash Singh

Re: Google Gear integration (was Wanted: New feature ideas for GSOC projects)

by Dan Marsden -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators
sounds great! - make sure you submit your application soon! - you only have a couple of days left before the application deadline.

see here for info:
http://docs.moodle.org/en/Applying_to_work_with_Moodle_for_GSOC

also one of the requirements is that you submit a patch for a bug in our Moodle Tracker - the sooner you get involved in doing this the better!
In reply to Dan Marsden

Re: Google Gear integration (was Wanted: New feature ideas for GSOC projects)

by Siddharth Prakash Singh -
Yeah I am working on the proposal itself. Hope to complete it today. As soon as I finish the proposal, I will start working on a bug!
In reply to Siddharth Prakash Singh

Re: Google Gear integration (was Wanted: New feature ideas for GSOC projects)

by Abhinav Chittora -

Siddharth: I am also Working for the proposal and hope will complete it till tomorrow .

In reply to Abhinav Chittora

Re: Google Gear integration (was Wanted: New feature ideas for GSOC projects)

by Dan Marsden -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators
Yes there are a few people working on a Google Gears GSOC proposal, make sure you are able to provide examples that demonstrate your skills in Javascript and PHP, and that you demonstrate your ability by suggesting a patch to fix a bug (preferably more than one!) in the Moodle tracker!
In reply to Dongsheng Cai

Re: Google Gear integration (was Wanted: New feature ideas for GSOC projects)

by Alberto JV -
How do you all imagine the integration of Google Gears to be? I will be working on this project during the summer as a GSoC student and all your feedback, comments, and suggestions are welcome!

The initial specification for the project is posted, but it is subject to many changes along the way as we make more progress:
http://docs.moodle.org/en/Development:Google_Gears_integration

The main idea remains the same: adapt Moodle to work offline and improve performance using Google Gears. The details are based on the documentation available and on suggestions based on conversations with my mentors Dongsheng Cai, Dan Marsden and Martin Langhoff. I will start with the homepage and course page, and then include the resource module so that later on we can add other modules such as assignment, choice, database, lesson (time permitting), and so on. Please read it and let us know if you have any ideas.
Average of ratings: Useful (1)
In reply to Alberto JV

Re: Google Gear integration (was Wanted: New feature ideas for GSOC projects)

by Mihai Sucan -
Hello Alberto!

Congratulations for your project! It will certainly be an awesome way to use Moodle offline.

I'd like to ask you why do you want to store HTML and CSS files in the SQLite DB?

Google Gears provides the LocalServer API for storing static files:

http://code.google.com/intl/fr/apis/gears/api_localserver.html
In reply to Mihai Sucan

Re: Google Gear integration (was Wanted: New feature ideas for GSOC projects)

by Alberto JV -
Hello Mihai! Thanks for responding to my post and also congratulations on your paint tool project. The idea of storing HTML and CSS files in the database comes from an older thread, OLPC and GG-based offline-moodle. As I understand it, this would be the simplest way to make Moodle work offline, without the need of an AJAX implementation. At this moment I'm still reading more about the best ways to integrate Gears with Moodle, so I'm not entirely sure about storing static files in the database and if it will be worth trying both ways, the LocalServer and the SQLite DB. The point you raised is very valid and I would appreciate seeing the answer of a more knowledgable developer, especially if I'm missing something important (i.e. changes in Gears since last year or characteristics of Moodle's architecture).
In reply to Alberto JV

Re: Google Gear integration (was Wanted: New feature ideas for GSOC projects)

by Martín Langhoff -
I think Mihai's suggestion is good! If we can use "native" HTML5/Gears caching tricks for caching resources that are their own URL, fantastic.

We'll still need the sqlite side for storing content snippets that go in the various parts of the page, and in general everything that isn't a self-standing resource with its own URL smile
In reply to Alberto JV

Re: Google Gear integration (was Wanted: New feature ideas for GSOC projects)

by Mihai Sucan -
Thanks!

This is a really interesting project you are working on. If I would have time, I would really like to help. ;) Unfortunately I will not really have time, since there's lots of work to be done for my project as well.

The forum post does not go into gory technical details about why Moodle must become an AJAX web app, and how storing HTML and CSS in the database solves the problem.

Anyhow, I wish you good luck!
In reply to Dongsheng Cai

Re: Google Gear integration (was Wanted: New feature ideas for GSOC projects)

by Alberto JV -
I have been working on the offline caching implementation during the last months. Here are some of the features:

- A WorkerPool script to cache all the static files in the background. This helps to speed up Moodle similar to the turbo version of Wordpress.
- A progress bar to indicate the percentage of files cached.
- An option to "go offline", provided the user is logged in. The site page and the course pages are cached, as well as each module's main page and all forums. In offline mode, all the unavailable links are disabled through JavaScript.
- An indicator of the connection availabiliity. Currently this is used to generate warnings, but in the future we could use it to go automatically offline or online.
- Synchronization between the local and the remote databases. At this point, only logs are recorded in the local database and updated when switching online.

You can find my repository at http://github.com/ajv/Offline-Caching and it may be cloned or downloaded as a tarball. I also generated a patch and posted it to the tracker. Most of the files can be treated as a plugin, but there is some code that needs to be included in core. Dongsheng updated some screenshots at http://docs.moodle.org/en/Development:Google_Gears_integration

This is some of the future work that I have in mind: more modules, HTML 5 offline caching implementation, and backward compatibility. I am currently working on moodleforms and I am also planning to build a more flexible API for database storage synchronization.

There are more details in my blog. As always, all comments and suggestions are more than welcome.

In reply to Alberto JV

Re: Google Gear integration (was Wanted: New feature ideas for GSOC projects)

by Alberto JV -
I added basic functionality for moodle forms (saving data offline, synchronizing when online... no offline file uploads for now). I also added one more module: Assignment.

To test it, use git and type the following commands

git clone git://github.com/ajv/Offline-Caching.git moodle/offline
cd moodle/offline

Once cloned and with your server configuration previously working for Moodle 2.0, open your Moodle site. If you are logged in, an option to "Go offline" will appear on the top right corner. Click there, wait for the progress bar to complete and you will be able to navigate through an offline Moodle. Test the modules available (Forums and Assignments) and even make changes on forms, save, and expect to see the changes after you "Go online". Also make sure the logs of your offline activity are recorded properly. Let me know if you have any questions.
In reply to Alberto JV

Re: Google Gear integration (was Wanted: New feature ideas for GSOC projects)

by Martín Langhoff -
Hi Alberto!

That's sounding really good. Is there a demo site where I can see it in action?

What webbrowsers are you testing it with?
In reply to Martín Langhoff

Re: Google Gear integration (was Wanted: New feature ideas for GSOC projects)

by Alberto JV -
I tested it with Firefox 3.5 and Safari 4 with no problems. Dongsheng helped me last week creating a test site: http://test.moodle.org/offline

However, the patch I gave him had some synchronization issues and I need him to fix it with the new patch before further testing can be done in the demo site. I will let you know when the demo site is ready. Attached is the latest patch (against head).
In reply to Dongsheng Cai

Re: Google Gear integration (was Wanted: New feature ideas for GSOC projects)

by Henry Happ -
I am interested in testing this out, so I have tried logging into the test site and clicking the "Go offline" link. However, I keep getting "Error: Download of 'http://test.moodle.org/offline/lib/offline/failed, status code 403."

Am I missing something?

Also, as a question, can course materials (such as pdf's that have been uploaded to the course and referenced in the course activities) be downloaded when going offline?

Thanks,
Henry
In reply to Henry Happ

Re: Google Gear integration (was Wanted: New feature ideas for GSOC projects)

by Alberto JV -
Hello Henry,

I haven't updated the offline module lately. The reason why it may not work all the time is because of the 2.0 development which is not 100% stable and any new features/changes have an impact on the offline module. If you are interested in helping, you can download the source code here. It seems to me that the module requires some debugging related to the manifest file creation. I hope to fix it soon.

And answering your question, yes, I just tried adding a PDF file as a resource to be cached by Google Gears and it was indeed available offline without any errors. Thanks for asking. This means that almost any static file will work offline. As for dynamic files (such as PHP scripts), they will be made static before caching (for example, just plain HTML output).


Average of ratings: Useful (1)
In reply to Alberto JV

Re: Google Gear integration (was Wanted: New feature ideas for GSOC projects)

by Henry Happ -
Hi Alberto,

Thanks for taking the time to answer my questions. I realized a while after I posted my original comment, that the test site hadn't been updated recently. blush

I have downloaded your code from github and put it up on a test site to play with it a little more. I haven't had the same issue going offline, but have been running into other issues, which I think are related to 2.0. That is, I can't save any resource or activity added to a sample course. After clicking either of the Save buttons, I get a blank screen and nothing has been saved.

I'm not a very proficient php programmer, so I don't know whether I would be adding much value to the group already working on this. However, I am very interested in the future of this for our ministry. A number of our students have very limited access to the internet and having the ability to go offline and take what's needed in a course with them on a USB drive so that they can continue working on their courses at home would be of immense benefit to them.

Thanks for your work on this!!!

- Henry
In reply to Alberto JV

Re: Google Gear integration (was Wanted: New feature ideas for GSOC projects)

by Tammy Belgarde -
Hello Alberto,

I was wondering if there is any further development of this offline module? Is it working? I am in need of such a module and was hoping this is a viable option.