Displaying media picker in usercontrol Options
Burla
Posted: Monday, August 25, 2008 12:07:01 PM
Rank: Devotee

Joined: 5/2/2008
Posts: 52
Location: Herning, Denmark
Hi,

Im doing a ad rotator for umbraco and are looking into different options on how to develop it. One of the ideas is to make a usercontrol and add it to the tabs in the administration area.
But one of the things i need to this admin module is the abillity to select a media node from the umbraco system. But how to do that? Is it possible to use the media picker control and render that somehow in my usercontrol?
Skiltz
Posted: Monday, August 25, 2008 12:15:59 PM

Rank: Devotee

Joined: 12/6/2007
Posts: 61
Have a look at this thread. http://forum.umbraco.org/yaf_postst1794_anybody-have-any-thoughts-on-a-banner-rotator-system.aspx - if this doesn't help please let me know.

Thanks,
Matthew


New Zealand Umbracoee
DeNY
Posted: Monday, August 25, 2008 2:30:00 PM
Rank: Enthusiast

Joined: 1/7/2008
Posts: 37
You can call media picker via javascript call in your code. Check sources of the media picker umbraco data type.
Burla
Posted: Monday, August 25, 2008 2:36:03 PM
Rank: Devotee

Joined: 5/2/2008
Posts: 52
Location: Herning, Denmark
Where in the source code/files to find the media picker source?
Burla
Posted: Monday, August 25, 2008 2:37:01 PM
Rank: Devotee

Joined: 5/2/2008
Posts: 52
Location: Herning, Denmark
By the way, i have submitted to get notifications on this post but didnt get any. My email address is the right one. Something wrong with the forum?
Dirk
Posted: Monday, August 25, 2008 3:00:17 PM

Rank: Addict

Joined: 9/27/2007
Posts: 977
Location: Belgium
Hi,

Notifications do not work as intended. Might get mutiple notifications at once, or none at all.
It's just not working as it should. Just don't rely on it! Solution to this is to watch the 'Active topics', at leats that's what I do..

Greetz,
/Dirk


level 1 certified - umbraco blog at netaddicts.be - working on an integrated forum4umbraco
Burla
Posted: Monday, August 25, 2008 3:08:56 PM
Rank: Devotee

Joined: 5/2/2008
Posts: 52
Location: Herning, Denmark
Great :)

Found the media picker control, but now i have another question :)
In the constructor it tages a IData as a parameter. What could i through after it? :)
DeNY
Posted: Monday, August 25, 2008 3:13:00 PM
Rank: Enthusiast

Joined: 1/7/2008
Posts: 37
Burla wrote:
Where in the source code/files to find the media picker source?
See file \components\editorControls\mediapicker\MediaPickerDataType.cs.
In short - you must register necessary scripts and add generated as string javascript to the usercontrol control tree.
Burla
Posted: Monday, August 25, 2008 3:22:20 PM
Rank: Devotee

Joined: 5/2/2008
Posts: 52
Location: Herning, Denmark
But i dont want to do all that javascript if i can only call the constructor for the mediaChooser (as it inherit from hiddenfield) and add it to my control. But i need to give the constructor a IData parameter but dont know what to send to it. Anyone got an idea?
DeNY
Posted: Monday, August 25, 2008 3:56:20 PM
Rank: Enthusiast

Joined: 1/7/2008
Posts: 37
mediaChooser is the editor control for the data type. IData is responsible for storing data type state. So dont sure that it can be used as the origignal user control. May be try to create some fake IData realization - but not sure.Why you cant use it as datatype?
Burla
Posted: Monday, August 25, 2008 4:27:08 PM
Rank: Devotee

Joined: 5/2/2008
Posts: 52
Location: Herning, Denmark
Because im doing a admin module that dosent use the node structure in umbraco. But i still need to be able in my admin module to choose a image from umbraco.

Quote:
May be try to create some fake IData realization


Yes is a good idea, any got an idea of what fake data i could send to the constructor?
DeNY
Posted: Monday, August 25, 2008 7:46:06 PM
Rank: Enthusiast

Joined: 1/7/2008
Posts: 37
Create simple class which implement IData interface- than add mediachooser control to yours with this class as constructor parameter. In the button handler call Save() method of the mediachooser control beforeadding your logic. Thats all - property Text will contain id of the media node. It is work for me.
Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.