Jump to:

7936 Posts in 1537 Topics by 944 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » Preview: DataObjectManager module

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
Go to End
Author Topic: 60259 Views
  • drye
    Avatar
    Community Member
    49 Posts

    Re: Preview: DataObjectManager module Link to this post

    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().

  • UncleCheese
    Avatar
    4085 Posts

    Re: Preview: DataObjectManager module Link to this post

    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..

  • drye
    Avatar
    Community Member
    49 Posts

    Re: Preview: DataObjectManager module Link to this post

    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...

  • schellmax
    Avatar
    Community Member
    126 Posts

    Re: Preview: DataObjectManager module Link to this post

    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!

  • UncleCheese
    Avatar
    4085 Posts

    Re: Preview: DataObjectManager module Link to this post

    @ 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.

  • UncleCheese
    Avatar
    4085 Posts

    Re: Preview: DataObjectManager module Link to this post

    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)
    - Get a comprehensive look at all the javascript bugs that are tripping up the popup window.
    - 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).

    Anything else?

  • drye
    Avatar
    Community Member
    49 Posts

    Re: Preview: DataObjectManager module Link to this post

    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.

    Attached Files
  • UncleCheese
    Avatar
    4085 Posts

    Re: Preview: DataObjectManager module Link to this post

    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!

    60259 Views
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.