URL Picker

If you've ever been in the situation where someone demands:
"I want that link to point to either another website or a page in this website or a media item or a file I can upload"
then this datatype is the answer to that very annoying demand.

User Facing

It allows the user to select where they want the URL to come from, either a
  • hand typed URL
URL.PNG
  • content node
Content.PNG
  • media node
Media.PNG
  • or a file upload
Upload-before.PNG Upload-after.PNG

Settings

The four modes are "URL, Content, Media, Upload". These modes can be allowed or disallowed in the prevalue editor:

Prevalues.PNG

Through the settings, the user can be given a very small subset of options:

Restricted.PNG

Developer facing

A URL is always returned when possible, if a node is selected then that node ID is returned also, and the user can specify a title and whether the link opens in a new window.

The data can be saved in CSV, XML or JSON format (the future!), the three looking like this respectively:

Content,False,1061,/homeorawaytest4.aspx,Home Or Away Quiz
(where the headers are "Url Picker Mode, New Window, Node ID, URL, Link Title")

<url-picker mode="Content">
        <new-window>False</new-window>
        <node-id>1061</node-id>
        <url>/homeorawaytest4.aspx</url>
        <link-title>Home Or Away Quiz</link-title>
</url-picker>

{
   "Title" : "Home Or Away Quiz",
   "Mode" : 2,
   "NodeId" : 1061,
   "Url" : "/homeorawaytest4.aspx",
   "NewWindow" : false
}

Additionally, if the URL Picker is to be used in a .NET control, you can deserialize any of the above data strings to a strongly typed object - using the static method uComponents.Core.DataTypes.UrlPicker.Dto.UrlPickerState.Deserialize (literal values for the mode are specificed at uComponents.Core.DataTypes.UrlPicker.UrlPickerMode). Nice!

Note to current users: You should be able to upgrade to this version of URL Picker without any data loss from current nodes whatsoever.

Last edited Jan 19, 2012 at 8:41 AM by diachedelic, version 26