Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
1 Introduction ....................................................................................................................3
5 Useful Links..................................................................................................................12
In order to connect the Universal Media Picker to these services, and for ease of plugability, a
provider model is used.
The only requirement on the provider class, is that it must extend and implement all of the abstract
members of the base class
TheOutfield.UmbExt.UniversalMediaPicker.Providers.AbstractProvider.
Example:
1. import TheOutfield.UmbExt.UniversalMediaPicker.Providers;
2.
3. public class MyServiceProvider : AbstractProvider
4. {
5. ...
6. }
Aswell as these abstract members, the AbstractProvider class also exposes the following non-
abstract base members:
Member Type Description
Config Property A string representation of the providers configuration data
as saved via the providers ConfigControl..
Example:
1. import TheOutfield.UmbExt.UniversalMediaPicker.Controls;
2.
3. public class MyServiceConfigControl : AbstractConfigControl
4. {
5. ...
6. }
Aswell as these abstract members, the AbstractConfigControl class also exposes the following
non-abstract base members:
Member Type Description
Control Property A reference to itself, used to add the config control to the
Universal Media Pickers prevalue editor dynamically.
Beyond these members, you can implement any of the standard .NET control methods in order to
construct and populate your form to retrieve and display the providers configuration.
In addition to the fields you define, Universal Media Picker will also append a Cache Duration
configuration field to your config control automatically. You do not need to handle this field in
anyway, as Universal Media Picker will automatically save its value, and will also take care of the
caching of your provider, therefore reducing the amount of API calls made.
Example:
1. import TheOutfield.UmbExt.UniversalMediaPicker.Controls;
2.
3. public class MyServiceCreateControl : AbstractCreateControl
4. {
5. ...
6. }
Aswell as these abstract members, the AbstractCreateControl class also exposes the following
non-abstract base members:
Member Type Description
Control Property A reference to itself, used to add the create control to the
Universal Media Pickers dynamically.
OnInit Method Overrides the default OnInit method to ensure child
controls are created by calling the EnsureChildControls
method.
Beyond these members, you can implement any of the standard .NET control methods in order to
construct your create control to retrieve the information required by your API.
As not all services provide an API for creating new content, or if you decide a create control is
unnecessary, the use of a create control is entirely optional. If you do not create a create control,
you should simply throw a NotImplementedException within the CreateControl property of your
provider.
3.3.2 GetMediaItems
The GetMediaItems method is called multiple times during the construction of the Universal
Media Picker app tree. To save on initial load times, the method is called for each level of the
tree, as and when requested. During each request, a single string parentId parameter is passed in
to allow developers to identify which child nodes to load. The call to GetMediaItems for the root
nodes will pass in the parentId of “-1”.
3.3.3 GetMediaItemById
The GetMediaItemById method is called whenever the Universal Media Picker datatypes parent
document type is loaded in order the retrieve the friendly title for the selected MediaItem.
Example:
1. <value dtdid=”1234”> <![CDATA[SelectedMediaItemId]]></value>
If you do create an XSLT extension library, it is recommended that you extend the base class
TheOutfield.UmbExt.UniversalMediaPicker.Xslt.AbstractXsltExtension.
Example:
1. import TheOutfield.UmbExt.UniversalMediaPicker.Xslt;
2.
3. public class MyServiceXsltExtension : AbstractXsltExtension
4. {
5. ...
6. }
Beyond this member, you can implement any other methods you see fit to assist developer with
implement your provider. Ie, XML representation of your item for use in XSLT, or a pre configured
HTML embed code for easy embedding.
4.1 JSON
Whilst the Universal Media Picker deals mostly with string values, the idea is that provider
developers will create more complex entities, but implement them in such a way to allow the
serialization of that entity to a simple string. To help with this, the Universal Media Picker
exposes a number of JSON extension methods.
In order to use these extension methods, you must import the namespace
TheOutfield.UmbExt.UniversalMediaPicker.Extensions.
Example:
1. import TheOutfield.UmbExt.UniversalMediaPicker.Extensions;
4.2 Forms
For both the config control, and the create control, it is expected that these will mostly take the
form of a regular input form. To ensure these forms stay consistent with the Umbraco interface, it
is advised that provider developers make use of following form extension methods.
In order to use these extension methods, you must import the namespace
TheOutfield.UmbExt.UniversalMediaPicker.Extensions.
Example:
1. import TheOutfield.UmbExt.UniversalMediaPicker.Extensions;
In order to use these extension methods, you must import the namespace
TheOutfield.UmbExt.UniversalMediaPicker.Extensions.
Example:
2. import TheOutfield.UmbExt.UniversalMediaPicker.Extensions;
Blog
http://blog.mattbrailsford.com