7936 Posts in 1537 Topics by 944 members
|Go to End||Next >|
25 March 2009 at 7:14am
UncleCheese: Thank you! I am aware of the function: allowUploadFolderSelection(). However unless I misunderstand, this allows the user to select the upload directory. I was asking for a way to programaticaly set the upload directory, and in my case base it on the page name. If it isn't possible then maybe a feature request
Thanks again! I am happy to help with support whenever I can, the documentation is very nice, and I should point people to it more often. I did mention it in the IRC channel a few times.
Please let me know about the setting of the upload folder programaticaly, and forgive me if I misunderstand allowUploadFolderSelection().
25 March 2009 at 8:07am
Understood, Drye... The functionality you're speaking to is actually contained in the Upload class, and is completely external to the DataObjectManager or any other form field that allows uploading. You'll notice that a plain FileField, FileIFrameField, or ImageField will always upload to assets/Uploads by default, and that's because the property $upload_dir (something like that) in the Upload class is set to "Uploads" by default.
That said, anything is possible. I think a setUploadFolder() function would be very easy to implement. That could be very useful for things like $my_manager->setUploadFolder($this->URLSegment);
I see what you mean..
26 March 2009 at 5:03pm
UncleCheese, I added a few lines of code to FileDataObjectManager that allows me to set the upload folder. Would you like these additions? If so, should I just attach it here to a post? Something else that would be nice is if I delete an image from the page it would also delete the image (or file) from the server. Of course this isn't always the desired behavior so it should have three settable states: leave, delete, or prompt. Prompt would ask the user if they want to remove from the page or remove and delete from the server. Of course there are other things to consider like the _resampled images associated with the deleted images. Another thing my code doesn't support, if you change the name of the page it would be nice if the image directory name changed and all the DB references to it.
Back to work...
26 March 2009 at 11:08pm
UncleCheese, for me too this is an extremely useful module as it enhances the core functionality for a very common task.
just a note on this:
you might consider removing the demo classes 'ResourcePage' and 'TestimonialPage' from the module code, or find some other means of distributing them. they splatter the 'create' dropdown when installing the module.
thanks for all that great work!
27 March 2009 at 3:44am Last edited: 27 March 2009 3:44am
@ drye - Please send me the code and I'll ratify it and check it into the SVN. Thanks for that. I've been meaning to get around to that request.
@schellmax - I know, I know.. I've painted myself into a corner on this one. I did at one time remove the example code from the SVN and people went nuts because they had all build sites that relied on those classes. I need to come up with a carefully planned "exit strategy" for that example code.
28 March 2009 at 5:14am
Hello, DataObjectManager users!
Let me first say that this has been a very rewarding project to have worked on, and all of your positive feedback and encouragement is very much appreciated. I'm really glad so many of you have found a use for the module. It's been far more popular than I ever expected.
That said, I'd like to throttle the energy behind the project as much as I can and get to the point that it is a powerful and robust solution for all kinds of content management in Silverstripe. Can everyone start contributing their feature requests and bug reports so I have a nice list to work off of for the next version? Here's what I have on the map right now, ordered by priority:
- Add default upload folder selection (already completed by Drye, but needs to be integrated)
- Images should display as thumbnails of their content, rather than an icon.
- Figure out what's going on with Linux vs. SWFUploadField.
- Add pagination to popup
- Integrate with Files & Images section to replace AssetTableField.
- Integrate with ModelAdmin. (I have very limited experience with ModelAdmin, so anyone who can contribute to this end, please do).
- Add validation to popup (not likely any time soon).
28 March 2009 at 8:03am
I updated straight from subversion and then merged my changes. I've tested with my setup and it works great, but that doesn't mean its perfect.
See attached file.
28 March 2009 at 8:25am
Perfect. Just checked it in. One more thing off the list!
Only thing i changed was giving $uploadFolder a default value of "Uploads". The Upload class expects the $path to be either a string or false. Since we're passing it in no matter what, seemed appropriate to define the string so it never comes in null or empty.
Nice job, Drye!
|Go to Top||Next >|