Monday, March 31, 2008

Convert unversioned media to versioned

This tool is intended to make a work with media be smoothly. By default Sitecore uploads media as unversioned data. In order to have different media data for different languages we need to upload media as versioned. Otherwise you won't be able to have different data for the same media item. Even if you change unversioned template to versioned.
After installing the package a "Make versioned" button will be available on Media tab.


You can convert media item as well as the whole media folder.

You can download sitecore package from here.

Monday, March 3, 2008

Cross Database TreeList Field

Sometimes we would like to have an opportunity to get data from another database in sitecore field. Since we already have source code of TreeList field on SDN, I decided to adjust it a little bit to have such opportunity.
To allow cross db usage I had to add one parameter to the source query of TreeList field.
It's SourceDatabaseName parameter.
Here is example how to get users from security database in TreeList field.
DataSource=/sitecore/users&SourceDatabaseName=security

Here is the way it looks:


To get rid of broken links in this field I had to MultilistCrossDbField which is intended to validate links correctly in LinkDatabase. So, don't forget to add the line below into /App_Config/FieldTypes.config file:

<configuration>
............
<!-- Custom fields -->
<fieldtype name="tree list cross db" type="Custom.Data.Fields.MultilistCrossDbField,TreeListCrossDB">
</fieldtype>
</configuration>

I added support for "query:" definition into this field. Now you can use either "/sitecore/content" or "query:/sitecore/content/*" as a data source for the field.

Here is Sitecore Package for the field.
Here is source code.