Archive for the ‘Sitecore Blogs’ Category
Latest updates for version 6 and 5.3
How to completely disable Lucene index
Consulting and Supporting Sitecore Developer Community
090317 is out
Looking through the change log, this one doesn’t appear to be critically important. Unless of course, you are experiencing one of the issues that were fixed.
On a more humourous note; a new feature arrived in this release. It reads: “A new MaxItemNameLength web.config setting was introduced, making it possible to change the maximum length of item names. The default value is 100 characters.”.
If I have ever publicly stated that Sitecore never listens, I hereby withdraw my statement. I blogged about this oddity only 3 years ago…
And in case anybody is in doubt, I am entirely kidding
What I failed to realise when I blogged about this issue one spring morning back in 2006 is, that item names with more than 100 characters probably don’t make much sense from a usability perspective. Why Sitecore decided to implement this as configurable NOW, I don’t really know.
Edit: On reading through the original post, I came across a comment from Krystle dated 13 August 2008, which mentions the MaxItemNameLength setting in web.config. Now if Krystle knew this in August, did everyone else just happen to forget about it until today where Sitecore publishes this as a “new feature” as of 24 March 2009.
Lol.
I am probably overworked
Into the core
Accessibility and Web Content Management
Background
Accessibility is a hot topic for governments all around the world. As eGovernment initiatives become more sophisticated, it is now common to access government related information and services on the web. Governments in turn must make sure that the information and services are available to citizens of all abilities and disabilities. In many countries this has been codified in one way or another, making it mandatory for government departments to adhere to accessibility guidelines when developing new websites.
This article will explain how accessibility on the web is defined, what guidelines exist and how governments can achieve fully accessible websites through the application of the right processes and tools.
Web Accessibility
Just like government buildings offer ramps to be accessible by people in wheelchairs, government websites should be implemented in a way so that they are accessible by people who are for example vision impaired or have other kinds of limiting disabilities. This is what we call web accessibility. There are a number of measures a website operator can take to make information universally accessible, e.g. providing alternate texts for non-textual elements such as images or videos, making links not only accessible by a mouse click but also by providing access keys (shortcuts) or adhering to a colour contrast minimum. These measures are parts of accessibility guidelines like the Web Content Accessibility Guidelines (WCAG) or Section 508.
According to Wikipedia, “Web accessibility refers to the practice of making websites usable by people of all abilities and disabilities. When sites are correctly designed, developed and edited, all users can have equal access to information and functionality”.
This definition basically encapsulates what has been described before and outlines a 3-step model for website creation:
- Design
- Development
- Content Editing
While these three steps can all be executed by the same entity (e.g. department), in most cases they are spread across at least two separate entities. One entity is designing and developing the website framework, which is like an empty shell of the website, containing the logo, header, footer, navigation and other functional elements like forms, but doesn’t contain any content. The second entity (the website owner) is in charge of adding and editing the actual content.
Most government departments work with an IT solution provider of some sorts, may it be another government department or an external implementation partner. This solution provider is usually in charge of designing and developing the initial website, called the framework. Solution providers are usually experts in accessibility and have the knowledge on how to create fully accessible website frameworks. Most of the time the finished framework is then integrated with a web content management system (WCMS) to allow the government department to update the website content themselves.
Once the empty website has been finished, it is up to the content provider (e.g. the government department) to fill the website with content. If a WCMS is used, the content editors log into the backend and start adding content to the website. This is the point at which most previously accessible websites become non-accessible. If the WCMS doesn’t force the content author to adhere to certain accessibility guidelines (e.g. enter alternate texts for images), the authors will most likely not spend the extra effort to make the content accessible. Thus the WCMS must have inbuilt facilities to make the creation of accessible content effortless and seamlessly integrate it into the organisations workflows.
Sitecore and Accessibility
Modern WCMS like Sitecore offer features to support the creation of accessible content. Whilst Sitecore is not the only WCMS to offer content validation features, the unique integration into the content editing process stands out.
Let’s take the creation of a new page with a title, abstract and an image as an example. Using the Sitecore Content Editor, the content author adds the page and starts editing it. The system has been set up to make the title field mandatory and validate the image and abstract texts against accessibility guidelines.
The content author will immediately see that his content item has validation errors. The invalid fields are marked with a red bar to the left of them and an overview of validation errors can be found on the right side of the editor. Once a field’s content is fixed, it is automatically revalidated and the error will disappear. In certain cases (e.g. the abstract field in our example), Sitecore offers the option to automatically fix the content. This is especially useful it the content author is not an expert in web accessibility.
If the content author decides to not fix the content, but approve the page anyways, the system will throw a validation warning and tell the content author that items with validation errors cannot be approved.
By using tools like Sitecore, government departments can make sure that their websites stay accessible, even if edited by content authors with little knowledge of web content accessibility guidelines.
Sitecore comes with a set of standard validation rules, including accessibility validation. Should website owners need more customised validation, they can of course create their own validators, as explained in Alexey Rusakov’s article series "Sitecore 6 Validation".
Video Demonstration
I have prepared a video of the content editing process above which can be viewed here:


Philipp Heltewig
Sitecore Membership Providers Documentation Published
Sitecore published a document that describes how to implement ASP.NET Membership Providers. I have updated my post that provides links to the best Sitecore documentation.


John West Blogs about Sitecore
Sitecore Dynamic Links Documentation Published
Sitecore published a document that describes how to work with Dynamic Links. I have updated my post that provides links to the best Sitecore documentation.


John West Blogs about Sitecore
Sitecore FieldTypes Update - New Field, Bugfixes
Another update to Sitecore FieldTypes
shared source project, featuring a new Filtered Multilist field and important
bugfixes for other fields.
I’ve dropped the beta and decided to add sequential release numbers. This one is Drop-2.
Filtered Multilist
Filtered Multilist is a modification of standard Sitecore multilist field, with inline
search for values in the left panel. Handy if you have multilist with a large amount
of selectable values.
This is a simple drop-in replacement, you can change field type of existing multilist
fields to filtered multilist to benefit from the filter, without loosing any values.
The field is contributed by Alexander Doroshenko from Sitecore Ukraine Solution Department
Bugfixes
* Fixed external javascript references. If you saw javascript errors like “Sitecore.FieldTypes.TextList
is null or not an object” (or similar in other fields), this release fixes that.
* A few improvements to Text List
Alexey Rusakov on Sitecore development
AD some speed
Consulting and Supporting Sitecore Developer Community
YouTube Integration with Sitecore 6.0
We’ve been thinking about different approaches and have chosen Sitecore Data Provider approach. We decided to have items in CMS that would represent YouTube videos. One of the challenges was to integrate YouTube videos on the fly when an editor wants to add videos from one or other YouTube author.
This data provider works in read-only mode. If you want to extend this solution, you’re welcome to do so.
So let’s begin….
Templates
I created two templates that will represent root item for YouTube videos and YouTube video item itself. First one is called “YouTube branch” and the other one is “YouTube video”.
YouTube branch is going to be a folder for YouTube video items. Unlike usual folders it has a field that determinates videos of what YouTube author to show beneath it.
YouTube video template extends Flash media template and adds two additional fields: Url and Preview. Url is obviously intended for a YouTube video url. Preview is an iframe field that will show us the preview of YouTube video.
Implementation
There is a required list of methods you must implement to get data provider working. Here are those methods:
- GetItemDefinition
- GetItemFields
- GetChildIDs
- GetParentID
- GetItemVersions
I’m not going to describe what they are for. You can find a detailed explanation on SDN.
One method is missing in this list. It’s “GetTemplates” method. We can avoid implementing this method if required templates already exist in our data source.
I’m going to use master database as a source for YouTube video items. I created a couple of templates for this approach so that we can skip implementation of the “GetTemplates” method.
Also I made this data provider publish its items by implementing one publishing method:
- GetPublishQueue
This is how constructor looks for the data provider:
public YouTubeDataProvider(string rootTID, string resourceTID, string videoOwnerField, string contentDB)
{
prefix = ToString();
rootTemplateID = rootTID;
resourceTemplateID = resourceTID;
contentDatabase = contentDB;
videoOwnerFieldName = videoOwnerField;
_items = new Hashtable();
}
rootTemplateID contains an ID of YouTube branch template
resourceTemplateID contains an ID of YouTube video template
contentDatabase is a source database for our YouTube provider (it’s master database)
videoOwnerFieldName is a field name of YouTube branch template where you specify an owner of YouTube videos.
_items is a temporary cache for our YouTube videos.
Since we need to use some sort of mapping between YouTube videos and Sitecore items, I’m going to use existing functionality of IDTable. That’s what we need “prefix” variable for.
Now let’s look at implementation of first method:
public override ItemDefinition GetItemDefinition(ID itemId, CallContext context)
{
ItemDefinition itemDef = null;
string itemName = string.Empty;
if (CanProcessYouTubeItem(itemId, context))
{
// method body
}
return itemDef;
}
The first thing we need to think of is how to determine if the item we are getting from data provider is our YouTube item. That’s what CanProcessYouTubeItem method for. This method uses IDTable API to find out if an item comes from YouTube rather than SQL database. Here is the code for the method:
bool CanProcessYouTubeItem(ID id, CallContext context)
{
if (IDTable.GetKeys(prefix, id).Length > 0)
{
return true;
}
return false;
}
The same technic is used for GetItemFields, GetParentID and GetItemVersions methods. For GetChildIDs we had to use different code because we had to work with parent item. Here is a code for the method:
public override Sitecore.Collections.IDList GetChildIDs(ItemDefinition itemDefinition, CallContext context)
{
if (CanProcessParent(itemDefinition.ID, context))
{
// method body
}
return null;
}
CanProcessParent method checks if the item is our YouTube branch item. If it indicates that it is then we start processing our child items that are YouTube videos.
This is the code of the method:
bool CanProcessParent(ID id, CallContext context)
{
Item item = ContentDB.Items[id];
bool canProduce = false;
if (item != null && (ID.Parse(rootTemplateID) == item.TemplateID))
{
canProduce = true;
}
return canProduce;
}
After we get our items, we have to fill out their fields to finish our integration process. Information from YouTube video is mapped in GetItemFields method. This is the code:
public override FieldList GetItemFields(ItemDefinition itemDefinition, VersionUri versionUri, CallContext context)
{
FieldList fields = new FieldList();
if (CanProcessYouTubeItem(itemDefinition.ID, context))
{
string originalID = GetOriginalRecordID(itemDefinition.ID);
TemplateItem templateItem = ContentDB.Templates[resourceTemplateID];
if (templateItem != null)
{
YTItemInfo ytItemInfo = GetYTItemInfo(itemDefinition.ID);
if (ytItemInfo != null)
{
foreach (var field in templateItem.Fields)
{
fields.Add(field.ID, GetFieldValue(field, ytItemInfo));
}
}
}
}
return fields;
}
As you can see it’s simply iterates through template fields and maps data from YouTube Entry to Sitecore YouTube video item.
We got YouTube video items in our content tree. But we cannot do anything with them on front-end. One option is to add our data provider to web database to get it working on front-end. But what if we make main data provider know about our items and just publish them as a real items. All I need to do is to get list of IDs of our items in GetPublishQueue method.
This is how the code looks:
public override IDList GetPublishQueue(DateTime from, DateTime to, CallContext context)
{
IDList list = new IDList();
foreach (var item in _items)
{
YTItemInfo ytItemInfo = (YTItemInfo) item;
list.Add(ytItemInfo.ItemID);
}
return list;
}
Since I did not use a publish queue table, YouTube items are going to be published every time to run publish operation on them. You can avoid this if you implement AddToPublishQueue and CleanupPublishQueue methods.
Here is a screen dump the way YouTube item looks in Sitecore media library:
This is a sitecore package that will install data provider on your Sitecore 6.0 CMS. I do not described provider configuration in this article. You can find it in /App_Config/Include folder after installing the package.
NOTE: if installation fails, that means that you run into a known issue. Reinstalling the package should solve it.
