So I was reading about a great little gmail greasmonkey extension today: http://hirevito.com/greasemonkey/humanegmailautosave.html

Then I had a great idea, why not implement this in Drupal?

For all content creation pages (whether it be books, pages, etc...) to have an AJAX script autosave this data to a temporary table in Drupal. That way if the user's computer crashes, the internet goes down, whatever you may have you, data won't be loss. This would dramatically increase usability and be fairly easy to implement (minus the temporary issue: would have to determine best idea/method to store this data).

This should really be part of core, not even a module, since it really benefits everything that Drupal is about: easy & maintable content creation.

Thoughts? I'd be willing to help code/test this but am far too new to Drupal to determine the best method to do so.

Comments

Thox’s picture

I thought I'd give this topic a bump since I was reading about it on the wp-hackers mailing list (WordPress). m3avrck's post is pretty much the only mention of autosave in Drupal, although I didn't search under any other terms.

Anyone given this thought?

moshe weitzman’s picture

sounds useful. who cares iof it is core or not? just build it as contrib and then community will evaluate.

m3avrck’s picture

The problem with this feature and core, is where do you save the content?

Core nodes require many attributes. What if a user types in a body, but no topic? Can that still be saved?

For this to go into core, I think we need a new distinction as 'draft', which, IIRC correctly, would tie into the proposed workflow module/functions.

This should certainly be a requirement of that, I'll post a follow up to the devel list.

kzeng’s picture

I like this idea very much. Hope drupal will have this feature soon!

--------------------------
http://www.kzeng.info

Leeteq’s picture

This is expected/required functionality in text editing software, it is time it can be expected when using the browser as an editor too.

.
--
( Evaluating the long-term route for Drupal 7.x via BackdropCMS at https://www.CMX.zone )

jjeff’s picture

Okay, so what are we talking about here? The node would be auto-saved as unpublished until it was published by clicking on "submit"? What about editing the node, would that autosave and become public in the middle of typing a word? Would there be an autosave table? How would you get content back out of the autosave table if/when you quit your browser in the middle of typing a post?

--= Jeff Robbins | www.lullabot.com =--

Thox’s picture

The WP hackers thread on this subject might reveal some wise choices. I don't have time to look through it right now though:

http://comox.textdrive.com/pipermail/wp-hackers/2006-January/003753.html

owen barton’s picture

Becuase of the potentially heavy ajax hammering I would keep the auto-save code loop as short as possible.
Something like this should suffice:
* User clicks 'Save Draft' or the ajax auto-save is triggered
* A special /draft url handler recieves the POST
* The uid, time, url and the serialized contents of POST are added/updated to a simple drafts table

Now for the hard part - retrieving a draft:
* User's computer is hit by a meteor
* User moves to another computer and logs into the site
* A 'your drafts' block shows up
* The user clicks on a draft
* The system uses the unserialized contents of the POST to build an unpublished node and redirects the user to that nodes edit screen
* The user decides to become a full time drupal coder in thanks for having their work saved

OK, there are a lot of details missing (such as the fact that it would be great for this to work with any form, not just nodes), but I think that general schema seems the simplest to me.

Leeteq’s picture

Two situations:
1. Making a new post: Not saved yet, save as unpublished without using revisions for the subsequent automatic saves. BUT: when the user clicks submit, the default revision setting should apply, and the last autosaved draft should be deleted?

2. Editing an existing post:
Autosave saves as new revision regardless of the revision setting on that post, continues to update that one revision on subsequent autosaves, until the user Submits. Then the post's revision setting applies, and the autosaved draft is replaced with the submitted version.

Edited: Autosave should not make use of the content types' existing (Drupal's) revision policy, making new revisions every x minutes..., as that will quickly become an administrative headache - filling the database unnecessarily. Especially all the while we lack efficient tools to tidy among revisions.

.
--
( Evaluating the long-term route for Drupal 7.x via BackdropCMS at https://www.CMX.zone )

edmund.kwok’s picture

Just committed the autosave module for Drupal 5.0.

Check it out and gimme feedbacks so I can improve it further :-)

mcm’s picture

How is it suppose to work? I enabled it for Page content types and set the autosave for 1 sec, I then tried editing a page and browsing away. But when I go back to editing the content is still lost. I did download the plugin from here instead of the link you specified since it is no longer valid:

http://jquery.com/dev/svn/trunk/plugins/form/form.js?format=txt

P.S. You might as well add it to the 5.0-beta.x tag since it is now available.

edmund.kwok’s picture

Hey, thanks for for showing interest in the module!

I have change the plugin download link and have updated the module to work with the new Form plugin. I have also added a new release (5.x-1.1) and you should be able to download it from the project page. Feel free to test it out and please submit any issue in the issue queue.

mcm’s picture

Thanks for creating this. I am using drupal for a medical centre in the hope that the staff there will be self sufficient in editing their own content but after a couple of them lost hours of work they're too afraid to use it. So this is just what I was looking for, and the fact that it states that it autosaved will help them be confident.

l8a’s picture

Hello, how do you do that, store the node temporarly in a temp table or the revision table?
Whats about a javascript that periodly write the nodes content (body?) just into a session?

mcm’s picture

He saves it as a revision, and if you are editing an existing node then when it autosaves the node is set to a not published state making it inaccessible to the public. The only complaint I have so far is that it doesn't appear to detect any changes when used with FCKEditor so it doesn't autosave.

Issue filed:
http://drupal.org/node/100335

mlncn’s picture

So I take it that it would not be trivial to extend this to autosave comments? There would need to be a special table set up for unfinished comments, and a special block as mentioned so people can find their autosaved comments... anonymous users would have to fend for themselves. Or would a nodes-as-comments module for Drupal 5 make more sense?

Great module, log autosaving comments as an interest of at least one person. Not quite a strong enough interest to code it myself, yet, but definitely an interest.

~ben

People Who Give a Damn :: http://pwgd.org/ :: Building the infrastructure of a network for everyone
Agaric Design Collective :: http://AgaricDesign.com/ :: Open Source Web Development

benjamin, Agaric

mlncn’s picture