Add revisions feature to filemanager.

cscsteve - September 5, 2007 - 23:46
Project:Filemanager
Version:5.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

As reported by WorldFaliz in http://drupal.org/node/173269:

Would you be adverse to me posting a patch that would accept the duplicate and give it an incremental version number? I'm currently trying to cobble together a rudimentary document management system and this would be in keeping with that concept.

I think that file revisions should be added to Filemanager and of course this should be used by Attachment. In general, here's the behavior I'd like to see (note, more of a requirements doc, not implmentation specifics):

1. File revisions should be optional and per file area. Probably a new radio button set on the filemanager settings page for the file areas section. Settings should be Off, Optional, Mandatory. Also should be a way for modules that use Filemanager to set this flag, similar to how Attachment sets the private flag.
2. If revisions are off in an area, then current behavior should stay the same: a new version of the file gets uploaded to a node it replaces the existing file.
3. If turned on and Optional, then the module using filemanager can optionally (checkbox in the upload form probably, maybe a default setting needed for the node types in the setup there) either choose to replace or create a new revision. Exactly how is a UI problem for the client module; the Filemanager API should take a flag in the add function.
4. If Mandatory, the module doesn't have a choice, and a revision would always be created and the original never replaced.
5. Revisions can be tracked via a suffix code. Add a suffix+1 to the file name (sure we probably need some db table change to help track, may want to track the title and descriptions of the revisions too). So, say we've got 3 versions of file.txt in dir 0: 0/file.txt__00000, 0/file.txt__00001 and 0/file.txt__00002.
6. Filemanager should have a way to give back the most recent file, or a list of all file revisions.
7. The file downloaded should have the correct filename.
8. Listing and allowing download of the revisions should be optional (related to 6 above) and goverened by access control. Probably should have a new "Can view revisions" permission for roles. If not checked, you can only ever see the most recent file, if checked the user should be able to see multiple revisions (and perhaps history) if the module is setup to allow that. If you can upload/add, it should be assumed that revisions can be created, governed by the settings for that area.

Any more thoughts?

#1

Susurrus - September 8, 2007 - 17:27

I think file revisions sound great and I like what you've discussed.

Suggestions:
- Leave the revisioning policies to the modules that use the API. It should be their job to enable/disable the revision policy and expose it to the user if they want
- Possibly allow for boolean option in filemanager_transfer() to provide the original file name or the versioned file name. If a user can download more than one version with a module, it might make sense to provide versioned file names.
- The access control for viewing versions of files doesn't really make sense to me. I would think this permission should be controlled by any module that implements this API. Also, if you have more than one module using this API and then you allow all users to view versions, you give them access to view versions for files handled by both modules, which could be a problem.

 
 

Drupal is a registered trademark of Dries Buytaert.