Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

ImageDataObjectManager as a selector


Reply


5 Posts   1101 Views

Avatar
davidfsmith

Community Member, 5 Posts

1 June 2010 at 3:49am

Ok, so I'm trying to use the ImageDataObjectManager or some such to select an image from images already uploaded through the CMS.

Each page in my site can have a different background image and I'd like to enable the site admins to be able to choose the image for the page, the images have been uploaded into a separate dir using file / image upload within the CMS, so now I'd like to extend each page to have one imageID. In the CMS I'd use ImageDataObjectManager to show the images from the background directory and allow the user to select and save the image.

So I've got the ImageDataObjectManager showing, and I can add images, either from the directory, or by uploading, but can't work out how I can disable the add button, and just show images from a directory, and then allow the user to select an image to be the background, any pointers or help appreciated.

Avatar
UncleCheese

4086 Posts

1 June 2010 at 11:39am

Well you can add a "canCreate()" function that returns false for the dataobject you're using. Or just use setPermissions() on your DOM and pass an array of only the permissions you want enabled, e.g. $my_dom->setPermissions(array('edit','delete'));

Sounds to me, however, that if you want only one image associated with the page, your best best is HasOneFileDataObjectManager, not ImageDataObjectManager.

Avatar
davidfsmith

Community Member, 5 Posts

2 June 2010 at 9:09am

Thanks for the quick response, is there not a way you can just select an image from the gallery and have that stored ?

Also any doco for HasOneFileDataObjectManager ?

Avatar
UncleCheese

4086 Posts

2 June 2010 at 9:20am

Why not just use a TreeDropdownField?

new TreeDropdownField('MyImageID','','Image');

Avatar
davidfsmith

Community Member, 5 Posts

2 June 2010 at 9:27am

No reason not to use a dropdown, just figure that for the end user being able to see the images and easily select the image they want for the background makes sense, after all a picture paints a thousand words.

;-)