Hello Forum
I'm currently working on two websites, where i'm in need for a FormField that allows me to attach multiple Images/Files to a SiteTree instance. The last time i encountered this problem, i solved it like described in this post: http://www.silverstripe.com/site-builders-forum/flat/5853 (creating a folder for every page and put files in there).
However, this solution doesn't satisfy my needs and lacks a possibility to easily sort the items attached to a Page. Therefore i decided to write my own custom FormField for my needs.
I think the module (or CMS extension) has now reached a stage where i can show it to you and let you comment and test it.
Since this is my first extension to the SilverStripe CMS and i'm not yet quite familiar with all the concepts and possibilities of the framework, the code may seem rather "hackish" here and there :)
That's why i'm posting this here. To get as many feedback and testers as possible!
Please note: This is a beta release at best. Use it in a productive environment at your own risk!
Installation
- Download the filemanager.zip
- Unzip to <your_site_directory>/filemanager
- Run /db/build?flush=1
That should be all. When you enter the CMS, you'll have a new page type named "File Page". Create a new File Page. You should have two additional tabs named "Files" and "Images" in the CMS. Now you can add Files to these tabs. These items then "belong" to this Page.
Items can be sorted using Drag'n'Drop.
Have a look at the code/FilePage.php File to see an example of how to add the HasManyFileManager FormField to your own Pages.
This module has been tested in Safari3 (mac), Firefox3 (mac), IE7 (win), IE6 (win). In IE6 there's a bug when dragging items (weird offset).
And here's a screenshot how this looks in the CMS.
Any feedback is welcome. Thanks for reading.
Edit: fixed formatting...
Edit: Ouch. File attachement didn't seem to work.
Edit: Fixed some bugs. New sources to be found here: filemanager_0.2.zip