This material describes problem in general:
http://greenash.net.au/thoughts/2006/05/an-undo-button-for-drupal/
As far as I'm familiar with Drupal, there's no way one could possibly create this functionality using an external module. It must be implemented in core (somewhere in db_query() function ) so it must be a patch.
Being also a desktop/flash developer I'm familiar with techniques used to provide undo/redo subsystem to these kinds of platforms.
As most of you know widely used are Command objects:
http://en.wikipedia.org/wiki/Command_pattern
As for Drupal websites there's no simple method to implement this that way. However I'm certain it can be done in quite similar fashion:
Assumptions:
1. There's more that one Undo/Redo list ( one for each admin-role user )
2. RUL (Redo/Undo List) is NOT unlimited
3. It can be turned off easily
Definitions:
Let's call each undo-able operation (INSERT, DELETE, UPDATE) a Command.
Where to begin ?
For me there's perfect place called db_query(). Every nice query will go through it.
Procedure of creating RUL could be similar to this:
(in db_query call)
- Check if passed query is a Command
- Extract Command Object from the query
- Calculate execute() query with db_query()
- Calculate unExecute() query with similar handler
- Write the object for given user to the RUL table
- Execute Command->execute() query
Undo handling (if possible)
(in undo handler)
- Fetch the last saved Command Object for current user
- Execute unExecute() procedure
- Remove object from DB
Additional branching, redo and Commands removal will have to be made.
It can be tedious but definitely worth it.
Comments
Comment #1
dddave CreditAttribution: dddave commentedThis sounds like a massive change and those only can made to the currently developed version (D8 because D7 is in bugfix only mode).
Comment #2
GrzegorzNowak CreditAttribution: GrzegorzNowak commentedOkay,
BUT most of (mine) up to date sites runs D6.x:
Even if we make it work in D8.x branch there will certainly be a need for a good back-ports to D6.x and D7.x.
Comment #3
Soundean CreditAttribution: Soundean commentedI agree this would be a great addition (3+ years later). For those of us who are not programmers, one wrong move sometimes crashes the entire site. I have had this happen to me multiple times. An undo button would be invaluable to me!