7912 Posts in 1355 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: | 54248 Views |
-
Re: Preview: DataObjectManager module

18 April 2009 at 1:19am
I had some problems with ->allowUploadFolderSelection(). When i selected a folder, i received an error after uploading some Files. The problem is, the folderpath in the database (Silverstripe 2.3.1) had an '/' in the end. So i've added the following line in FileDataObjectManager.php on Line 495:
if(substr($path,-1)=="/") $path = substr($path,0, -1);
UncleCheese, thanks for adding a lang-Folder to the module. I attach my german-translations.
Cheers
-
Re: Preview: DataObjectManager module

18 April 2009 at 1:44am
Thanks, Bo! I love when people report and fix bugs in the same post!
Thanks for the German. Adding it now.
-
Re: Preview: DataObjectManager module

20 April 2009 at 9:49pm
i just had a little issue using filedataobjectmanager to upload mixed media files (jpg as well as flv).
as i have to set the $has_one relation to 'File' for this purpose, i didn't get thumbnails of the images in the cms, but an 'image file' icon, which doesn't help much.
so i changed the 'FileIcon' method in 'FileDataObjectManager.php' to the following:public function FileIcon()
{
$field = $this->parent->fileFieldName."ID";
$file = DataObject::get_by_id($this->parent->fileClassName, $this->item->$field);
if($file && $file->ID) {
if($file instanceof Image) {
$img = $file;
} else {
$ext = $file->Extension;
$imgExts = array('jpg','jpeg','gif');
if(in_array($ext, $imgExts)) {
$img = new Image_Cached($file->Filename);
$img->ID = $file->ID; //image resize functions require an id
}
}
return (isset($img)) ? $img->CroppedImage(50,50)->URL : $file->Icon();
}
else return "{$this->item->$field}";
}
this works great for me, but might not be the most elegant solution.
i was looking for some sort of 'casting' the original file object to an Image object but didn't get far (oop primer).
maybe you got some better solution and want to integrate it in the module code for others too -
Re: Preview: DataObjectManager module

21 April 2009 at 3:50am
This is a pretty good fix. I think I'll check it in. Just to give you some background, the main struggle with this issue is that the FileDataObjectManager will display the actual images as icons if the file is of the Image class. So it seems logical that one could "sniff out" an image on upload based on its extension (the assets manager does this), and store it as an Image object rather than a File object if everything checks out. The problem is, that may work 99% of the time, but if someone is using an image subclass, we've now shorted that object of any custom methods and/or properties of its subclass. So as you can see, it gets a little complicated.
I like the idea of handing it right on the template, though. That's a good workaround for now. Thanks for your contribution!
-
Re: Preview: DataObjectManager module

21 April 2009 at 5:14pm
Hi,
I'm using DataObjectManager with dataobject that has about 800 records. The live search is quite slow and search starts before the user has typed in the full search.
I cann't see any code where I could turn off the live search ? Does anyone have any ideas ?
Cheers
Robin
-
Re: Preview: DataObjectManager module

22 April 2009 at 12:06am
Hey Everyone,
I'm using ManyManyDataObjectManager, it works fine. But i have not been able to figure out a way to limit the objects shown in the grid to only the objects associated with the page, currently it shows everything then adds a check mark to the object if it is associated with the page. I can't use the filter clause, because it's a many to many relationship. I am guessing i will have to use a join clause, but still not sure of how to go about it.
Please any hints will be much appreciated.
Awesome Module - Great Job UncleCheese and everyone who has contributed !
Thanks!
-
Re: Preview: DataObjectManager module

22 April 2009 at 1:25am
@robinp: look at dataobject_manager/javascript/dataobject_manager.js line 105
// Search
var request = false;
$container.find('#srch_fld').focus(function() {
if($j(this).attr('value') == "Search") $j(this).attr('value','').css({'color' : '#333'});
}).unbind('blur').blur(function() {
if($j(this).attr('value') == '') $j(this).attr('value','Search').css({'color' : '#666'});
}).unbind('keyup').keyup(function(e) {
if(request) window.clearTimeout(request);
$input = $j(this);
request = window.setTimeout(function() {
url = $j(container_id).attr('href').replace(/\[search\]=(.)*?&/, '[search]='+$input.attr('value')+'&');
refresh($container, url);
},200)
e.stopPropagation();
}); -
Re: Preview: DataObjectManager module

22 April 2009 at 1:34am
@cmswarrior- The search is throttled to a quarter second of no character entry. If you think it needs to be cranked up a bit, I can do that. I suppose not everyone types as fast as I do.
@robinnp - What you're looking to do with a MMDOM is simply not what it was built to do. If you look at the way a MMCTF works, you'll see the same thing. The idea is to give the user a global view of all available DataObjects and allow single-click association of those DataObjects to the page. The objects that are associated with the page should show an activated checkbox and a differently colored row. If the MMDOM were to filter out all the unassociated objects, how would one associate more existing objects at another time? It occurs to me that MMDOM and MMCTF are not the solutions you may be looking for?
| 54248 Views | ||
| Go to Top | Next > |




