[Server-devel] Offline moodle notes in moodle.org

Martin Langhoff martin.langhoff at gmail.com
Fri Oct 10 05:18:05 EDT 2008


Posted on moodle.org http://moodle.org/mod/forum/discuss.php?d=107920

Hi all! I have been away for a while working on other olpc stuff, but
now my attention is returning to Moodle, and offline moodle is
definitely in my roadmap.

In the AU and NZ moot I had good chances to talk with Dan and MartinD
about a cunning plan to get a Gears-based offline moodle going.

When we disscussed architecture for the current moodle-on-a-stick
(MoaS) based we also talked quite a bit about a Gears-based approach.
At the time, it looked huge and risky. Google had just released GG,
and was talking about upgrading Reader to use it.

So there many things stacked against it: Noone had seen Reader doing
the offline thing yet, Gears had a somewhat restrictive license, and
it seemed that we'd have to implement a significant chunk of Moodle as
an AJAX application.

Things have changed between then and now. Google has made things much
simpler now with a BSD license and Reader shows it can make the
offline thing work very well.

Reimplementing Moodle as an AJAX app was still a big monster in my
head until recently. But a volunteer approached me recently saying he
could take a stab at it, and I thought "what would be the simplest
thing that could possibly work?"

The answer was suprisingly simple: store the damn HTML, CSS and JS in
the sqlite DB that Gears provides.

So from the course page, we can "go offline" by

- Storing the html+css in sqlite -
- Requesting a special 'manifest of resources that are ok to use
offline' - published by the course-format page...
- Retrieving those offline resources. Initially, just mod/resource
contents. Later we can extend this support to work with other modules.
- When we use the course homepage later while offline, we'll walk the
DOM to show CSS blocks 'disabled' (by graying them out) and we will
disable links to resources we cannot support offline.
- As the user browses the content we do have offline, the JS code
keeps track of resources visited. Upon reconnection to the moodle
site, we push back the collected logs to mdl_log(*)
- Other modules (mod/forum for example) can be supported with ob magic
and/or more explicit/AJAXy use of JS.

* - we'll need to review the log handling code. So far we've never had
"out-of-sequence" log entries, and this will introduce them for the
first time. I'm sure there'll be a few gotchas there.

Hearing this, MartinD suggested that - as long as we go the "store
html" way (supported with output buffering tricks if needed) then we
can add the ability to produce a plain old zipfile with a course
homepage + static resources. I think it's a good secondary goal to
have -- though I'm not sure what limits we'll have with this.

Tony Anderson - the volunteer who sparked this - has been working on a
proof-of-concept implementation. It currently uses Gears and
GreaseMonkey, and requires a few manual tweaks. Unfortunately, I don't
think that code can be merged directly - we will want to refine the
approach to avoid GreaseMonkey and other inconveniences. My take is
that we can either adapt it, or use it as a reference for a more
moodlish implentation -- Tony is not a moodle dev, so he's not
necessarily familiar with our odd style smile ).

Tony's code is here
http://lists.laptop.org/pipermail/server-devel/2008-September/002101.html
together with some discussion around it.

I also hear noises from Barcelona -- Ludo and Ruben may be able to get
involved. This could start getting interesting.

Getting this from a PoC to something shippable will take a bit of
work. Right now I still have a ton of work to do on other aspects of
Moodle that are more urgent for OLPC, but I will find the time to work
on this working with Tony, Ludo and Ruben. Sleeping is optional,
right? wink

Once the urgent infrastructure stuff for olpc is sorted, I'll be keen
on bringing this to completion -- at least of an initial stage.

-- 
 martin.langhoff at gmail.com
 martin at laptop.org -- School Server Architect
 - ask interesting questions
 - don't get distracted with shiny stuff  - working code first
 - http://wiki.laptop.org/go/User:Martinlanghoff


More information about the Server-devel mailing list