Item Selector Custom URL eXtension
The Item Selector Custom URL eXtension is a SDL Tridion 2011 SP1 custom URL, which allows you to select an item URI from a SDL Tridion tree view. This tree view can come in handy to select item URIs which need to be stored in (Component or Item Metadata) Text Fields without having to know the actual item URI. The user can just open the tree view and browse to the item it wants to select and click it.
Item Selector Custom URL eXtension uses the 2011 SP1 Core Service to access the Content Manager Server, as such this eXtension is a good showcase of how to use the 2011 SP1 Core Service and what it can do. The Item Selector only reads information from the 2011 SP1 Core Service, but update and create functionality also exists.
The Item Selector is installed as a web application under the SDL Tridion 2011 SP1 Explorer website. This means it is automatically accessed using the same user account that is logged into the SDL Tridion 2011 SP1 CMS. In the download package there is a "Release" folder which contains all the files needed to create the web application (the "Source" folder contains the entire Visual Studio solution which was used to create this).
To install the web application you need to create an "Extensions" folder under your SDL Tridion 2011 SP1 Explorer website (usually in C:\Program Files\Tridion\web). In there you can create a folder called "ItemSelector" in which you copy all the files from the "Release" folder. Then in the IIS manager interface you can convert the ItemSelector folder under Extensions into an application (right click and select Convert to Application). Then in the Add Application dialog, select the same Application Pool which is used by the SDL Tridion 2011 SP1 website (ensuring the same user credentials will be used).
After installation the Item Selector has to be configured using the Web.config, in here you need to specify the URL of the SDL Tridion 2011 SP1 Explorer website so that it can reuse the icons from the CME website. This needs to be done under the appSettings as shown in the image below:
The Custom URL can be used in a Schema by linking to the /InstalledWebLocation/ItemSelector/ItemSelectorPopup.htm file.
On this URL you can specify the following parameters to configure the Item Selector tree view:
start - URI indicating where the navigation tree should start (tcm:0-0-0 will show the entire tree, tcm:0-1-1 will start from Publication 1 etc.)
types - the Item Type(s) which can be selected
idonly - for returning IDs in stead of TCMURIs
When not specifying the start parameter and opened as a Custom URL, the publication id of the item from which the popup is opened will be used as a start value.
Item Types which are not part of the types value will not be shown unless it is a organizational item. Use 0 to allow all Item Types to be shown and selected or combine multiple Item Types by their number, for example to select Folders and Components, use 2 + 16 = 18 (.../ItemSelectorPopup.htm?types=18). Accepted Item Types are:
- Publication = 1
- Folder = 2
- StructureGroup = 4
- Schema = 8
- Component = 16
- ComponentTemplate = 32
- Page = 64
- PageTemplate = 128
- TargetGroup = 256
- Category = 512
- Keyword = 1024
- TemplateBuildingBlock = 2048
- VirtualFolder = 8192
Version 1.1 update
This update is done on 2011 SP1 making use of the net.tcp Core Service endpoint, which simplifies the configuration and increases the speed of the extension (it does require it to be installed directly on the Tridion CMS server only, but that was already a requirement anyways). Also added is an option to return IDs rather than TCMURIs, this can be specified on the querystring using the "idonly" parameter. So for example you can now use the following Custom URL examples in your Schema fields:
(select a Page from Publication 7 and return its ID)
Or something like:
(select a Component from the current Publication and return its TCMURI)
(select a Folder or Component from any of the available Publications and return its ID)
The ItemSelector also works in 2013, but since the Core Service endpoints have been updated, this requires a small change in the code. I've released a small update for this in the open source project on Google Code. The change is that the Core Service endpoint address is now configurable in the web.config. It contains an example for both the 2011 and 2013 endpoint. If the ItemSelector is compiled with the 2011 Core Service Client DLL and that is also provided in the bin directory or available in teh GAC, then on 2013 the old 2011 endpoint can still be used.