Sitecore CMS and everything related RSS 2.0
 Monday, April 13, 2009

Most of the data in Sitecore ends up stored and passed around as a string, hence we have quite a few helper classes to deal with string values. ListString class helps maintaining a list of strings that is serialized as a string itself. Like this:

“Fred|John|Derek”

What you see above is three strings, “Fred”, “John” and “Derek” serialized to a single string, each string being separated by the pipe ‘|’ symbol. Here’s how to use the ListString to create similar list:

ListString list = new ListString();

list.Add("Fred");
list.Add("John");
list.Add("Derek");

string result = list.ToString(); // -> "Fred|John|Derek"

Now you need to parse it somewhere else:

string rawValue = “Fred|John|Derek”;

ListString list = new ListString(rawValue);

int count = list.Count; // -> 3
string first = list[0]; // -> "Fred"

foreach(string s in list)
{
  // supports enumeration too
}

list.Add("Mary");
string result = list.ToString(); // -> "Fred|John|Derek|Mary"

Note that the class doesn’t check and escape incoming strings, so it’s your responsibility to make sure the values you pass do not contain a separator symbol.

Sitecore uses ListString alot internally, but it’s always better to use higher level API designed for each specific case, if such exists. A good example of that is MultilistField. So when else ListString can be handy? Whenever you need to pass multiple values as one, such as passing parameters, implementing a new field type that stores multiple values, etc.

Monday, April 13, 2009 4:54:23 PM (FLE Standard Time, UTC+02:00)  #    Comments [0]
Sitecore | API
 Saturday, March 28, 2009

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.


Filtered multilist

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

Saturday, March 28, 2009 6:16:04 PM (FLE Standard Time, UTC+02:00)  #    Comments [1]
Sitecore | Crestone | Open Source
 Wednesday, March 18, 2009

image I love Aero Snap in Windows 7, and I've twittered about it before.

But now Windows 7 team posted a fascinating read about designing the Aero Snap. Insightful and having some suspense: they've considered dropping the feature before coming up with the snap and resize animations I love the most.

"Vertical Maximized" state is an excellent addition, and win+arrow keys keyboard shortcuts look very useful, have to try them.

Wednesday, March 18, 2009 3:38:42 PM (FLE Standard Time, UTC+02:00)  #    Comments [1]
User Experience
 Saturday, March 14, 2009

Another new field type in the FieldTypes shared source project: introducing Text List, a field for maintaining lists of predefined items with autocomplete and drag & drop reordering. Most people should be familiar with it by now.

Selected items and adding a new item, autocomplete:

textlist autocomplete

Drag & drop reordering:

textlist reorder

Text List field should be a good fit for maintaining a list of tags, email addresses and such:

textlist tags

While looking fairly different, it is a typical Sitecore list field, storing list of selected item IDs and requiring source to prefetch a list of items to select from.

More details on FieldTypes wiki.

It took a bit of work, and some features could be missing - please report any issues.

Saturday, March 14, 2009 9:49:32 PM (FLE Standard Time, UTC+02:00)  #    Comments [3]
Sitecore | Crestone | Open Source
 Saturday, March 07, 2009

I've just commited a new field to the FieldTypes shared source project: Limited Single-line Text.

Limited Single-line Text field

Limited Single-line Text field - over the limit

A modification of Single-line Text, that allows to limit its length and that displays the amount of remaining characters. Can be configured to disallow further input once the limit is reached.

See project wiki for usage and configuration instructions.

Inspired by SDN request and twitter input box.

Saturday, March 07, 2009 4:48:30 PM (FLE Standard Time, UTC+02:00)  #    Comments [3]
Sitecore | Open Source
 Thursday, February 19, 2009

Sitecore 6 Service Release One is officially out by the name of Sitecore 6.0.1 rev.090212.

A massive list of fixed issues, props to our documentation team for providing nicely formatted change log.

I've done my share of work on it, so I'm just as excited to see it being released. Yay!

This is not a recommended release yet, as we require builds to be used in production for some time to ensure stability first. So make sure to read this notice: It is appropriate for use if it contains fixes for issues that you encounter with the recommended release.

Thursday, February 19, 2009 3:34:20 PM (FLE Standard Time, UTC+02:00)  #    Comments [0]
Sitecore | Crestone
 Monday, January 19, 2009

Yan Sklyarenko started his Sitecore blog, which is great.

Yan is the leader of our modules team, overseeing everything concerning Sitecore module development. He's also been working on our installer, among other things, and is a generally nice guy, which is good for me, because my desk is next to his in Sitecore Ukraine office. Welcome!

Monday, January 19, 2009 12:44:01 PM (FLE Standard Time, UTC+02:00)  #    Comments [3]
Personal | Sitecore
 Wednesday, January 14, 2009

Sitecore has a number of ways to reference an item. Most common are ID and path, and most methods will accept either System.String or Sitecore.Data.ID parameter.

Item item = Context.Database.GetItem("/sitecore/content/somepath");
Item item = Context.Database.GetITem(ID.Parse("{11111111-1111-1111-1111111111111111"});

Our internal convention is that the ID can be used instead of path. You can supply the id as a string to methods that expect a path:

Item item = Context.Database.GetItem("{11111111-1111-1111-1111111111111111"}");

However you have to remember that neither path nor ID identify a piece of content in a unique way. Because Sitecore supports versions and multiple languages, a single item can have 3 versions in English and 2 in Danish. If you only use path or ID when retrieving items, you will get the latest version in the current (Sitecore.Context.Language) language.

Sometimes you need to be specific, so the GetItem() methods have overloads allowing to specify language and version:

Item item = Context.Database.GetItem("/some/path", Language.Parse("en"), Version.Parse(2));

Items can also come from different databases. Notice that I have been using the context database in the above examples, which depends on the current site and Sitecore configuration.

To identify an item, or rather a version, in a unique way, Sitecore has an ItemUri class. ItemUri is an ID or path, language, version and database name bundled together, as well as a number of convenience methods. This is how it looks like:

// get the item URI
ItemUri uri = Context.Item.Uri;

// string representation
string uriString = uri.ToString() -> "sitecore://master/{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}?lang=en&ver=1"

// parsing a string
uri = ItemUri.Parse(uriString);

// get an item by URI. Static Database.GetItem method can be used because URI includes database name.
Item item = Database.GetItem(uri);

There is a reason why paths or IDs remain most common ways to reference an item - usually it is a good thing that code adapts to current context and configuration. For some less typical Sitecore tasks, URIs can be handy.

Wednesday, January 14, 2009 1:07:50 PM (FLE Standard Time, UTC+02:00)  #    Comments [2]
Sitecore
 Thursday, December 18, 2008

Presentation Usage ReporterA new project by Alenka Caserman: Presentation Usage Reporter integrates in Content Editor and shows where your presenation components, such as renderings and sublayouts, are used.

Thursday, December 18, 2008 9:27:30 AM (FLE Standard Time, UTC+02:00)  #    Comments [0]
Sitecore | Open Source
 Tuesday, December 09, 2008

Changelog:

  1. Fixed: Installation wizard didn’t install files marked to skip if exists.

  2. Fixed: XSL renderings might fail occasionally under high server load.

  3. Fixed: Creator-Owner role might be ignored when resolving access rights.

Download.

Tuesday, December 09, 2008 6:13:12 PM (FLE Standard Time, UTC+02:00)  #    Comments [0]
Sitecore | Crestone
Archive
<April 2009>
SunMonTueWedThuFriSat
2930311234
567891011
12131415161718
19202122232425
262728293012
3456789
Blogroll
 Alex de Groot
Few words about SiteCore from Holland
 Alexander Shyba
Sitecore Support
 Anders Dreyer
Anders Dreyer on Sitecore Development
 Jakob Christensen
Sitecore Core Development
 Lars Fløe Nielsen
Lars's ramblings about development and business processes
 Ole Thrane
Sitecore API
 Runi Thomsen
Runi Thomsen Sitecore Toughts
 The Sitecore Experience
The Sitecore Experience
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2010
Alexey Rusakov
Sign In
Statistics
Total Posts: 211
This Year: 0
This Month: 0
This Week: 0
Comments: 0
Themes
Pick a theme:
All Content © 2010, Alexey Rusakov
DasBlog theme 'Business' created by Christoph De Baene (delarou)