Hi folks. I have recently taken over this module, and I am currently working on a cleaned up version for Drupal 7. The current code base dates from, I think, Drupal 5, and the Javascript especially is quite crufty. So this is a good opportunity to clean it up and modernize it.
At the moment I am looking to switch to a newer, more robust jQuery plugin, plus refactor the restoring process so that it should, hopefully, be more stable. There are some needed UI cleanups as well but those may go into a separate issue.
Mostly I'm putting this issue here so I have an issue number to reference in commit messages. :-) Code with be forthcoming as soon as the client project I'm working on authorizes it.
Comments
Comment #1
Branndon commentedJust wanted to say that my wife thanks you. I build the sites, and without features like this, I get in trouble. So THANKS!
Comment #2
Crell commented:-) Hopefully we'll have it released soon. I've a client funding this work and that project is paused for the moment, so as soon as it restarts this is the top of my agenda to complete. So far the new approach looks much more robust and sustainable.
Comment #3
a_c_m commentedAny chance of seeing the work in progress in a sandbox?
We are about to use this module for a D6 project and would be happy to backport the improvements you've made. Especially with the JS layer.
We have a very short sprint window for this and would look to release our updated code mid next week.
Comment #4
zhgenti commentedHello guys,
Some time ago i need this feature for one of my projects, but just porting autosave module to Drupal 7 wouldn't suite my needs, so that I've created my own module and willing to share it with you. At first i wanted to create a new project for it, called "node_autosave", as it's completely different module and no code was taken from autosave. But i think for other people interested in this functionality and users who already use autosave will be much easier if it will be one module. So if module maintainers agree to merge modules, i would be happy to commit it like 2.x branch
Feel free to test it http://drupal.org/sandbox/dzhgenti/1316894 and let me know what do you think of this.
Thanks,
Dmitry
Comment #5
Crell commentedThe port I'm working on is about 2/3 done. I'm just waiting on the project to restart. Unfortunately we can't release code until the client pays us for the work, so it will be a bit longer. :-( I'll have a look at your sandbox and see if there's any code we can leverage there. Thanks for the heads up!
Comment #6
a_c_m commentedhey Guys.
So i've been trying to backport dzhgenti's work to 6 and looking at his approach. I like several things about it (several storage engines etc). However, both modules are for traditional node forms only, one of our requirements is saving of non generic forms (for integration with multi_node_edit), we also have dreams of processing saved node forms after the fact.
I'm loathed to do this, but due to my time constraints i'm about to kill some kitties (not hacking core) but by re-writing this module yet again to support generic forms and be slightly less reliant on JS (quicksave now button).
Will likely publish in a sandbox in case its of interest.
Comment #7
tsvenson commented@Crell: Sweet, looks like my timing for looking for this kind of feature is good.
I'm looking to use it together with the Workbench suite of modules, and particularly the the combination with Workbench Moderation is interesting where work can be done on new revisions while an older is still live and published. The Media module is another one for adding and maintaining media to the content.
The D5/6 versions seems to have been pretty much only for nodes. In D7 we got entities and fields can be added on many other things as well. Is the plan to add support for autosaving on field level as well so it works for taxonomy, users, files and so on?
Comment #8
Crell commentedRight then!
I have pushed a 7.x-2.x branch to Drupal.org, and make a dev release of it. It should show up soon. It includes a new, better jquery plugin (jquery.autosave.js), and support for TinyMCE.
There are still a few bugs that I haven't figured out yet. The main one is that when restoring a form, it seems to want to try and tell you, again, that there's a form to restore, when in fact there is not and trying to do so will cause an error. I had that fixed this morning, but then it came back. :-( There's also a bug where tinymce is flipping out after a restore, but it does restore.
I'm leaving this issue open for the time being. If anyone is able to help fix the above bugs, please do so! I'm out of time to work on it myself. :-( Once those bugs are fixed I can tag a stable.
Leaving this issue open for further discussion.
Comment #9
tsvenson commented@crell: Nice, have a private project I'm working on that I will test this out for. A bit busy next couple of days, but hopefully I can give a report back during the coming week.
Thanks for taking this on, going to be a great feature to assure as little as possible is lost when browser/computer crashes.
Comment #10
liquidcms commentedlooks cool. looks as though same general concept as we had before; which i think was the right approach in general. for some reason i thought you were suggesting using revisions to store backups which i couldn't see how that could work.
one thing that you seem to have dropped or maybe missed or haven't gotten to is that when you edit a node which has a saved version; in the D6 module you were able to toggle back and forth between the saved and autosaved - which i think is necessary to be able to decide which version is the best to keep. the way the module is now you seem to only get one crack at it - once you have selected "restore" there is no changing your mind (although could simply hit Edit again).
also, once hitting restore; there is an odd popup that lets you again choose ignore/restore.. but it quickly goes away and does not come back.
i guess with an actual release now (even as -dev) should likely close this thread and start to post separate issues - likely much easier to track that way.
if i get to more testing; i'll raise separately .
thanks for getting this back on track... really is an important module.
Comment #11
liquidcms commentedhmm.. ok.. lots of issues still - perhaps too soon to start testing unless you want me to start raising issues then i could; but not really functional at the moment i don't think.
Comment #12
Crell commentedI had been considering using revisions, but on further review we concluded that would not work. So instead I replaced the client-side form repopulation with an Ajax rebuild of the form with new data, which cleaned up a whole host of stuff, I think.
I don't recall seeing a "flip back and forth" function before. Since presumably you'd only be using this module for crash protection, I don't know that it's really useful. (If you want draft capability, that's something else. Go use workbench. :-) )
The extra popup is the bug I mentioned in #8. It should get fixed. I'm not sure why it's happening at the moment.
Except for that bug, I think the module is usable. I am actually tempted to open that as a new issue and then close this one. (I unfortunately don't have much more time on this client's budget to work on it. The Ajax handling in Drupal 7 turned out to be brain-bendingly weird.)
Comment #13
liquidcms commentedyea, was curious to see what revisions idea was going to be.. :)
maybe flipback isn't needed but i don't quite get how it isn't; i'll have to play around a bit more... i don't think i can look at what was saved and then decide that isnt what i wanted - that seems pretty basic.
so quick list, but i'll raise sep tickets:
- once i pick any of the options.. autosave no longer saves anything
- doesnt work with wysiwyg; which was tricky in earlier version and i think you suggested shouldn't matter; but possibly that was when you were still thinking revs
- when you pick ignore; i think you should flush entry from table (since you have just stated you don't want that saved version) - but maybe less confusing if autosave kicks in again as it will soon wipe that entry with a new one
Comment #14
thumb commentedI'll add one more issue to @liquidcms' list.
- For those not using TinyMCE, the tinymce check in autosave.js breaks everything. Perhaps this is the same as liquidcms' second point about wysiwug compatibility.
I'm using CKeditor and hope that the "generic" wysiwug compatibility can be accomplished easily.
Comment #15
Crell commentedThe first sounds like a bug.
The second, I only tested it with tinymce, as almost never use CKEditor. But it does work with Tiny. (Using the server-side form rebuild simplified a lot.) The only catch is that you have to manually sync the textarea and the wysiwyg. That was working for me, however.
The third, I think it's fine that ignore just does nothing. As you say, it will overwrite momentarily anyway, and wipe everything on form save. But just in case you hit reload again by accident because you've got butter fingers, at least the form is still there for you. :-)
Comment #16
liquidcms commentedi am using Tiny. But it does seem to work now; will need to test more.
although, on restore, it does wipe out css in the text area:
initial edit: http://screencast.com/t/u2TaytFJV
after restore: http://screencast.com/t/xTgutsJS
and as before, from that last screen shot; not sure which option to pick to keep my lost changes? do i pick Restore again? and if i don't pick fast, i lose the popup and then AS never triggers again.
Comment #17
Crell commentedWeird.
As I said, the second ignore/restore window should not appear at all. That's a bug. If you can make it not appear, please do so, because I couldn't figure out why it was showing up in the first place. :-)
Comment #18
thumb commentedHave you tested with a basic form that doesn't have an RTE (TinyMCE, CKeditor) enabled? I disabled WYSIWUG altogether and get a JavaScript error complaining that tinymce isn't defined.
Also, are their module settings or permissions to be set? I don't see either. If so, that's great. I'm all for simplicity.
Comment #19
Crell commentedWha? I did originally without tinymce. However, the only tinymce code is inside an if(tinymce) block, which if tinymce is not defined should return false. That's very odd.
The only configuration is on the node type form where you specify if that node type should be autosaved and how frequently.
Comment #20
thumb commentedI'd suggest a more formal check.
if (typeof tinymce !=== 'undefined') {
...
}
Comment #21
Crell commentedCan you try it and if it works submit a patch?
Comment #22
thumb commentedIt definitely eliminates the error if TinyMCE is disabled, but then autosave isn't working at all. If you disable WYSIWUG and TinyMCE altogether, is autosave activating on edit forms for you?
Comment #23
brycesenz commentedI am seeing the same as #22 - if I don't have TinyMCE, then nothing at all seems to autosave. I will try to investigate further when I get the chance.
Comment #24
Crell commentedThere's now a separate issue for the tinymce problem, so let's close this issue and continue there: #1357022: Not working? Does it REQUIRE TinyMCE?