MultiUserTodoTable

MUTT - MultiUserTodoTableWelcome to the MUTT info page. MUTT - MultiUserTodoTable - is primarily a simple sample application for dojox.offline, which is part of the Dojo Toolkit, and features a higher level abstraction of the Google Gears offline web-application API.

So far so good - and now let me explain it a little but more concise…

1.) Preface

Google Gears enabled web-developers to add offline functionality to their apps. They provide a resource cache called LocalServer, a SQLite database and a possibility to put JS processes parallelized in the background. But their API is on a very low level to not be limited to special frameworks. Additionally Dojo provides with dojox.offline a higher level, dojo conforming higher level API for Google Gears. They add a general Event Framework which makes it easier to handle the different states of an offline application. And they also added encryption for the database and an synchronisation framework based an action objects.

Google Gears and dojox.offline are a very good base for developing offline apps. But what neither of them explains or provides a ready-to-use solution to create a modeless application. An application in which there is no button to switch between online and offline. An application where I don’t have to work arround with if/else clauses to do different things for the different states.

As creator of Mind42 offline support of course would be a huge plus for our application as well as for any other similar project. As a consequence I’ve started a research project, in which I’ve stumbled accross all these problems: How to request data online/offline in practise? How to generalize synchonisation actions? How to create the view offline? I had to find a way which worked in practise. I cam up with an implementation of a model based data switch (as google describes it). I think it’s important to see, how all these tools can be used to create “real” applications, to see how they could be combined to get something that really works, and isn’t only a theoretical minimalistic example. So I decided to share MUTT.

2.) What is MUTT

This technical demo was started as a simple todo list, but finally became a simple issue tracker. Only one list exists - it’s the same for every user. Users don’t have passwords, users just exist to identify the author of issues and comments. Issues are made up of a title, a message, a type and a status and of course of the infos who created it at what date. Comments can be added to the issues. Issues and comments can’t be edited. Only the status of an issue can be changed and an issue could be delted. Everybody is allowed to delete any issue.

So as promised, a simple application. The clou: Take your browser into offline mode or disconnect your network cable and MUTT will still work. Alle the data you’ve seen before will be available offline too! You even can create, change or delte todos offline. MUTT will try to synchronize these actions after going online again. Of course some limitations exist. E.g. MUTT can’t add a comments to issues which already have been deleted on the server while you have been offline (You’ll be informed about such incidents).

3.) What’s so special about MUTT

The describe transition between offline and online mode is MODELESS. The user doesn’t have to click an “Go offline” button or something similar. The application fills the offline datastore autmatically with everything you’ve seen while you have been online. When MUTT detects that you are offline it automatically switches to the stored offline content, and synchronizes it when you’re online again.

But MUTT is even more interesting for developers, because not only for the users the offline/online status change is transparent, but also for developers. MUTT implements a modeless dataswitch, which allows the application itself to work without nasty online/offline behaviour conditions. Just access the with MUTT’s model based modeless data switch with a line like this:

mutt.IO.access.todo.get(todoId, dojo.hitch(this, “showTodo”));

A more detailed code-walkthrough will follow…

4.) Disclaimer

This is a simple example. Neither does it make optimal usage of Dojo 0.9, nor is it really secure. And of course it’s also not bug-free and maybe there are even synchronisation logic errors. Speaking of synchronisation: As the application is so simple (not much data can be edited), the synchronisation is very easy as well. In real applications much more cases have to be thought about. Its only purpose is to demonstrate a pattern of making offline/online communication not only transparent to the user, but also to the application.


5.) Rock’n'Roll

You can check out MUTT in a Live Demo or you can download it (licensed under the APL2), and play around with the code yourself (Requires W/L/MAMP environment).

Live Demo
Download (~600kb including all needed JS dependencies)

6.) Notes

Many thanks to my company, IRIAN Solutions for approving the publication of this package.

Feedback appreciated > sschuster(at)sschuster(dot)net or stefan.schuster@irian.at > or just leave a comment somewhere…

P.S.: Don’t forget to visit Mind42 :)