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 | Next > | |
| Author | Topic: | 54230 Views |
-
Re: Preview: DataObjectManager module

22 February 2009 at 3:34pm
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.
-
Re: Preview: DataObjectManager module

22 February 2009 at 3:43pm
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.
-
Re: Preview: DataObjectManager module

22 February 2009 at 4:25pm
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.
-
Re: Preview: DataObjectManager module

23 February 2009 at 7:09am Last edited: 23 February 2009 7:10am
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. -
Re: Preview: DataObjectManager module

23 February 2009 at 7:19am
Hmm... Would you mind posting your code?
-
Re: Preview: DataObjectManager module

23 February 2009 at 7:32am Last edited: 23 February 2009 7:35am
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
{...
}
?> -
Re: Preview: DataObjectManager module

23 February 2009 at 12:19pm
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.
-
Re: Preview: DataObjectManager module

24 February 2009 at 11:22pm
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 | Next > |


