Jump to:

7911 Posts in 1354 Topics by 930 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » Preview: DataObjectManager module

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w

Go to End
Author Topic: 54230 Views
  • UncleCheese
    Avatar
    4085 Posts

    Re: Preview: DataObjectManager module Link to this post

    Interesting. What kind of files are you uploading? I can add GIFs to the allowed file types.

    Do you use SSP Director? That's one of the best apps I've ever seen. Nothing SS offers will compete with that.

  • Anonymous user
    Avatar
    Community Member
    1 Post

    Re: Preview: DataObjectManager module Link to this post

    The best thing, imho, would be to just allow the normal setAllowedFileTypes() to override what files can be uploaded, so I could set eg. ('jpg', 'png', 'flv'). The image preview for those videos would then, of course, be broken, but maybe one can fix that by some mime-type inspection.

    SSP Director is really impressive, however, my galleries are mostly showcasing a bunch of images for products, in the traditional "slideshow" way, and I manage those products from SS. Maybe at some point I will upload my SlideShowPage module as a simple alternative to the existing SSP gallery, depending on how much I like it once it's finished.

  • UncleCheese
    Avatar
    4085 Posts

    Re: Preview: DataObjectManager module Link to this post

    Yeah, the ImageDataObjectManager expects file types that qualify for image resampling (JPG and GIF). A FileDataObjectManager is more tolerant, and knows to skip all of that stuff if the file isn't an image. If the ImageDataObjectManager could take normal files (i.e. FLV), imagine imagine all the distorted Flash icons that would appear when one dragged the slider to its max.

  • Anonymous user
    Avatar
    Community Member
    1 Post

    Re: Preview: DataObjectManager module Link to this post

    Sorry for bothering you again, but it seems like I'm too stupid to get this to work correctly:

    When I have two pages using the manager, they both always display all existing managed items, no matter to which of the two an item actually belongs.
    If I add a filter clause to select only the items already belonging to the current page, I am no longer able to add new items.

  • UncleCheese
    Avatar
    4085 Posts

    Re: Preview: DataObjectManager module Link to this post

    Hmm... Would you mind posting your code?

  • Anonymous user
    Avatar
    Community Member
    1 Post

    Re: Preview: DataObjectManager module Link to this post

    Here it is. I just noticed this is happening not with those page types themselves, but with subclasses of them! Ie. in the example posted, every CatalogItem page sees all the SlideShowFile objects.

    This is the page:

    <?php

    class SlideShowPage extends Page
    {

    ...

    static $has_many = array(
    'Files' => 'SlideShowFile',
    ...
    );

    ...

    function getCMSFields()
    {
    $filesField = new FileDataObjectManager(
    $this,
    'Files',
    'SlideShowFile',
    'File',
    array(
    'Title' => 'Title',
    'Link' => 'Link',
    'Target' => 'Target',
    'Pause' => 'Pause'
    )
    );
    $filesField->setAllowedFileTypes(self::$allowed_files);
    $filesField->setGridLabelField('Title');
    $filesField->setPluralTitle('Files');

    ...

    }
    }

    ?>

    This is the object:

    <?php

    class SlideShowFile extends DataObject
    {

    ...

    static $has_one = array(
    'File' => 'Image',
    ...
    );

    ...

    }

    ?>

    The error occurs in subclassed pages:

    <?php

    class CatalogItem extends SlideShowPage
    {

    ...

    }
    ?>

  • UncleCheese
    Avatar
    4085 Posts

    Re: Preview: DataObjectManager module Link to this post

    If I had to guess, I'd say this happens on ComplexTableFields, too. I didn't modify the method that retrieves the records for the table -- only those that change the parameters for that method (sort, page size, filter, etc).

    It's an unusual scenario, but nonetheless one that needs to be addressed. I'll try to duplicate what you have and see what I can come up with. I'm sure it has something to do with the joining of parent class to child class -- using an incorrect or ambiguous ID field or something.

  • Bo_Einzeller
    Avatar
    Community Member
    18 Posts

    Re: Preview: DataObjectManager module Link to this post

    I've teste your new files and if both managers are in list-view it works without a problem. I you use two FileDataObjectManager and the first is in grid-view, the second manager still can't be sorted.
    There's an HTML error (the Comment should be '<!-- LIST VIEW -->', not '<! -- LIST VIEW -->'), but that's not the cause for it.
    It's realy strange, when you switch the view of the first manager with sorting enabled of the second manager, sorting works without turning it off and on again...

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