offline stuff

Showing 1-3 of 3 messages
offline stuff dgorissen 3/24/12 1:15 PM
Hi Guys,

Had a poke at the offline use stuff, this is just in case somebody
wants to take it forward tomorrow

* I added a basic taarifa.appcache file in the root which lists a
basic set of resources that should be cached for offline use.  Should
be easy enough to extend with other URLs  (see
http://www.html5rocks.com/en/tutorials/appcache/beginner/).  This
should take care of the css/js/html templates. It probably makes sense
to add a cache updating function as well on some pages (e.g., so the
list of reports page is kept up to date in the cache)

* next is to write a javascript handler for every form submit action.
In there you check if you are online, if so: submit as normal, if not,
generate the html string that would be posted if we had a network, but
instead of posting it you save it to the localstorage object (probably
using something like perist.js) under a key that will probably be the
submission url. Additionally you make sure you have a listener
registered that gets called whenever the online/offline status
changes. When we change to online your listener then looks at the
localstorage object, and for every entry it does the post.  Once an
entry is posted successfully it is removed from the storage object.

I think this should basically get everything working in offline mode.
The only other issue I am aware of is that the mapping widget will not
work in offline mode and this needs to be handled gracefully.  As for
the list of reports you will only see the ones that were available
when you went offline.

Cheers
Dirk

--
Web: http://www.dirkgorissen.com
Twitter: https://twitter.com/elazungu

Re: [taarifa-dev] offline stuff Mark Iliffe 3/25/12 11:02 AM
Hi Dirk, Guys!

Firstly AWESOME!

With dealing with the map, I think we can just leave that until the next version, as nice as it would be to have it included. At the moment we only want the report submission to be cached, but how would listeners be added to dynamically generated forms?

Best,

Mark

Re: [taarifa-dev] offline stuff dgorissen 3/27/12 1:28 AM
Hi Guys,

Will try to revisit this and work on it some more, do let me know if
somebody else is / will be already doing so.

Cheers
Dirk