Friday, July 30, 2010

Sitecore Fetch Squad

Automated crawler fetching websites and blogs from Sitecore content

Archive for the ‘Sitecore Blogs’ Category

CMIS, my vision

Posted by admin On March - 24 - 2009

Today I represent (as usual) my personal vision. I tell this once again, just to be sure that my personal vision won’t become Sitecore’s public vision :).

This morning while I was running through my task list I decided to share this on my twitter account:
Thinking about my CMIS proposal for product management: can WCM really benefit from an ECM(mostly DM) standard?!

I see it as one of my primary responsibilities inside Sitecore to inform product management about changes in our world of content management. Most of the time they’ve already added something similar on the roadmap, but it’s good to have my input. I talk on daily base with our implementation partners and customers, they do not always get that chance.

After a while, a couple of reactions showed up. John Newton, one of the founders of Alfresco replied to me and so did some others. It shows how constructive a tool like Twitter can be, but more important, how hot this topic is.

JBoye just posted a blogpost(also a reaction) about what they think customers should do an not do at this moment. I agree with them to some level, but only if you include the reactions in your vision.

But let’s get back… What is CMIS? It is a standard for communicating between different ECM installations. There’s a big need for the possibility to interexchange documents including metadata between these systems. These documents often have a lot of metadata and also their folder structure tells a lot about their semantics. As every vendor has its own idea about how to store this data, it is very important to have an common format for communication otherwise exchange of documents becomes impossible or very expensive.

(This is of course a simplified view on CMIS. It does include the state where a document is in and lots of other features. Some more or less important.)

The evolution of having such a ‘protocol’ and to see the different vendors talking about these things is a very good step. As vendors ECM, DM and WCM have to deal with all kinds of different standard. Most of them are very technical, take for example Web services, RSS, Atom, WebDAV, etc. Most of them are also not intended to become a standard in our particular space of issue solving. Which means that they are too general or too domain specific to integrate tight with a system like Sitecore.

The question is now what value CMIS brings to WCM. WCM is not document minded and often it does not focus at all on storing document. Looking at today’s Web pages, you often see that companies try not to deliver to many documents on their websites. Which is a good move, as it improves usability. But CMIS is not just about PDFs or Word documents. It does include movies, illustrating images and results of collaborated documents as well.

As soon as the standard will reach its public stages, we as Sitecore, but all the purely WCM vendors should definitely start supporting this standard. But not as a content producer. ECM and DM will continue to focus on creating documents. Although WCM can deliver this, their main target is a markup languages. WCM is very good in producing (X)HTML, XML and image manipulation. Its strength is definitely not creating PDFs or so. Most WCM vendors are capable of doing it technically, but they cannot facilitate the quality process steps ECM can.

Therefore it doesn’t make a lot of sense to integrate the whole standard a producer. But as a consumer it does. Often documents get published out of intranets and other collaboration environments. It does make sense to be able to consume these documents and use them on all kind of web pages.

In some way WCM should support the production side as well. WCM has a real strong relation minded structure. This means that content tagging, inter-content-relations and other ways of categorizing are available out of the box. Why not use this data back to feed the ECM again? Looking at the world of web 2.0, you often see the end consumer(also known as website visitor) does tag/rate content. This information is highly interesting for the content producer.

On the other hand that’s also the challenge for WCM. Because of our nature in linking data to each other, you can harder define a single asset. That’s a pity as you have to define, in my suggestion above, if user generated content is a property of a certain asset or not.

As you have seen above, I see a lot of value in CMIS for WCM. But we should keep in mind that the standard is still a draft. When the final version is there Sitecore and all the other WCM should start to support it as a data consumer(once again: my opinion). It will decrease the investment for companies to get their back office to communicate to the front-end. Which is always a great step. Beside of that it can decrease the time to market for certain information and allows team to gather feedback from the web(depending on the implementation and the product visions of both vendors: ECM & WCM).
It also shows how separated WCM can be from ECM. This discussion wasn’t ongoing when ECM had incorporated WCM totally.

The acceptance of the standard can highly benefit from a toolset developed for the different platforms. I would highly support the idea of having Microsoft (.NET) and Sun (Java) writing the communication layer as a library. The specific implementation can be completed by every individual vendor. But this communication part shouldn’t take to much time from every individual vendor, reinventing the wheel.
It doesn’t matter if it are Microsoft and Sun or if it becomes an open source project. As long a the biggest vendors doe support this open source solution as well and give an indication of it’s quality.

This whole CMIS standard, all the attention and discussion around it will hopefully open the discussion for standardizing WCM solutions as well. Similar to DM I think that it would be good to come to an exchange format which allows WCMS’s to exchange data but in a more specific way than RSS and Atom do these day. A big lack of these formats are internal linking and once again document support. Also, you’re strictly bounded to a set of predefined data.

But that’s a total different discussion. Hopefully this posting explains a lot to you. I’m sure I haven’t covered all parts of CMIS and also haven’t spoken about all the business opportunities WCM can get out of it. But I’ll leave that up to the imagination of you, my reader and commenter.
It’s time now to get this in more in-depth and slightly more technical to product management :).

.Sitecore

Windows 7 Aero Snap

Posted by admin On March - 24 - 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.

Alexey Rusakov on Sitecore development

Performing Updates with the DataTransferObjectManager

Posted by admin On March - 23 - 2009

In a previous post we took a look at an early preview version of the DataTransferObjectManager, a library we developed at netzkern to integrate WCF with O/RM tools. Today we will take a look at how nk.DTOM solves the problem of mapping updates from clients to entity objects. Here is how to do this:

// This object represents an update request from an external client.
HouseDTO updateHouseParam = new HouseDTO();
updateHouseParam.ID = “6”;
updateHouseParam.Name = “176 Wallstreet”;
updateHouseParam.Price = “10 Million Dollar”;

// Read the corresponding entity from the data source.
House houseEntity = houseRepository.GetHouse(updateHouseParam.ID);

// Map the properties of the DTO to the entity.
DataTransferObjectManager.Map(updateHouseParam, houseEntity);

// Update the data source.
houseRepository.Save(houseEntity);

Pretty straight forward, right? Remember, by default nk.DTOM only maps value type properties from the source object to the destination object, and that’s exactly what we need here.

Now, let’s consider our entity “houseEntity” contains a property that should be readonly for external clients. In our case, the price of our house is fix and we don’t want it to be changed. In this case, we use the support for selective updates in nk.DTOM. The “Map”-Method contains a fourth parameter that allows us to specify certain properties that we want to preserve in the destination object.

// Create an empty PropertyPathCollection as third parameter, as we do not want to include any references.
PropertyPathCollection includeSourceReferenceProperties = new PropertyPathCollection();

// Create a PropertyPathCollection containing all the PropertyPaths we want nk.DTOM to skip during the mapping, which means preserving the original value.
PropertyPathCollection skipDestinationProperties = new PropertyPathCollection();
skipDestinationProperties.Add(“Price”);

// Call Map() with all four parameters.
DataTransferObjectManager.Map(updateHouseParam, houseEntity, includeSourceReferenceProperties, skipDestinationProperties);

By combining the third and the fourth parameter, nk.DTOM even enables us to update certain values of complete graphs of entity objects. We just need to preserve the original reference to the entity object and maybe some other properties. Take a look:

// Update a referenced DTO on the client-side.
updateHouseParam.Owner.Name = “Some new guy”;

// Create a PropertyPathCollection on the server-side that allows the client to update the referenced entity “Person” in the property “Owner” as well.
PropertyPathCollection includeSourceReferenceProperties = new PropertyPathCollection();
includeSourceReferenceProperties.Add(“Owner”);

// Create a PropertyPathCollection containing all the PropertyPaths we want nk.DTOM to skip, in this case especially the property “Owner” (as the client is not allowed to change the Owner itself and we don’t want nk.DTOM to initialize the property with a new instance) the Owner’s ID.
PropertyPathCollection skipDestinationProperties = new PropertyPathCollection();
skipDestinationProperties.Add(“Price”);
skipDestinationProperties.Add(“Owner.ID”);

// Call Map().
DataTransferObjectManager.Map(updateHouseParam, houseEntity, includeSourceReferenceProperties, skipDestinationProperties);

The service developer can even decide which properties can be changed based on the identity of the caller, for example by relying on WCF authentication features.

We’re currently planning to release netzkern.DataTransferObjectManager as part of a small toolkit on CodePlex. We hope, you’re going to use and like it.

Julius Ganns . netzkern

Sitecore serialization for version control

Posted by admin On March - 17 - 2009

As described in the latest post about Continuous Integration we have been working on making it easier and less manual to have multiple developers work on the same project in different environments. However one thing that has always been a challenge is Sitecore items in form of templates, layouts etc. Until now we have run on a shared database server, making updates to Sitecore from a shared server to avoid data cache issues. This has a couple of disadvantages:

·         It is quite difficult to synchronize environments. If we want to update the development environment with content from production, we either have to create a huge package with all the content or restore the database from production, freezing all development while it is updated.

·         There is no way of tracking changes or roll back.

·         It is inconvenient for our developers to work on a shared server, when developing backend functionality.

When Sitecore introduced serialization in Sitecore 6, we were hoping to be able to allow local databases that syncs via SVN and (de)serialization. The dream is a VisualSVN or TurtoiseSVN like functionality for Sitecore. Imagine using the gutter as an indicator whether you have made changes to an item and then have a commit button, which commits the changes to the repository, allowing other developers to update their database with the changes. Has anyone out there tried implementing something similar?

I have taken a look at the serialization functionality and found a few issues. Most of them can be worked around, but I was hoping, that we could have achieved our goal mostly using standard functionality.

To have version control you need the following operations:

·         Create: This works more or less as expected in (de)serialization

·         Merge: There seem to be no actual merge functionality. If you deserialize an item, which already exists (identified by item id), the item with the latest _update date, will be used. There is no merging of fields, as far as I have been able to test. This is not such a big issue, as the serialized items can be merged on file level. However it would be nice to be able to force an update through via the UI. This is by default only possible from the API.

·         Delete: This is not possible with serialization. We have thought of a couple of solutions, but they are quite extensive.

So what really needs to be handled is a way of deleting items with serialization. Oh… and a lot of UI functionality to make it work as VisualSVN ;)

Anyone got any experiences?

Molten Core

Friday Catch: Page Editor Not Yet Available

Posted by admin On March - 15 - 2009
You may be getting this message in Page Editor after clicking any of the top bar buttons (Edit, Design, Log off).In my case it is caused by the System.Web.UI.WebControls.ImageButton control’s PostBackUrl property which I am assigning in code behind.It appears that any control with that property assigned and used such as asp:LinkButton, asp:Button cause this problem on SR-1 installations and

Consulting and Supporting Sitecore Developer Community

Text List Field

Posted by admin On 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.

Alexey Rusakov on Sitecore development

Surface PCs and you

Posted by admin On March - 13 - 2009
This post falls slightly (well… quite a bit, to be honest :P) off topic. But outsite the Sitecore realm of computing my eyes are very clearly focused on what I personally believe to be a big thing in the years to come; Surface Computing. Or - at least - that’s what the Microsoft term for it is.

Now I know we’re all gobsmacked about the Sitecore 6 Page Editor facilities. But try and take a look at this, and tell me (honestly) you couldn’t see technology like this implemented in a system like Sitecore.

Jeff Han: Unveiling the genius of multi-touch interface design

While I’m not even at a point (yet) where I can get my hands on the Microsoft Surface SDK, I know myself well enough to realise - once this technology becomes more widely available, I won’t be able to keep my nose out of it. Don’t take that literally ;-)

Could you imagine working with the structure of your site in this manner? Organising your Sitecore Media Library? Drag-and-dropping renderings onto your layouts?

I’m rambling, I’m sure. But ideas like this is what drives great development. Anyone else? :-)

Into the core

Limited Single-line Text field

Posted by admin On March - 11 - 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.

Alexey Rusakov on Sitecore development

Sometimes you want to retrieve an item or collection of items using C# and then pass these items to an XSLT rendering. The advantage of this is that you get the processing power of C# with the simple layout and Sitecore XSLT controls of a rendering. To do this the following methods and extension methods should help. The interesting stuff, the code:

        public static XPathNodeIterator ToXml(this Item item)
        {
            return ToXml(new Item[] { item });
        }

        public static XPathNodeIterator ToXml(this Item[] items)
        {
            return ConvertToXml(items);
        }

        private static XPathNodeIterator ConvertToXml (Item [] items)
        {
            var packet = new Packet("values", new string[0]);
            foreach (Item item  in items)
            {
                XmlDocument doc = new XmlDocument();
                doc.LoadXml(item.GetOuterXml(false));
                packet.AddXml(doc);
            }
            return GetChildIterator(packet);
        }

        private static XPathNodeIterator GetChildIterator(Packet packet)
        {
            XPathNavigator xpathNavigator = packet.XmlDocument.CreateNavigator();
            if (xpathNavigator == null)
            {
                return null;
            }
            xpathNavigator.MoveToRoot();
            xpathNavigator.MoveToFirstChild();
            return xpathNavigator.SelectChildren(XPathNodeType.Element);
        }

Using the Packet class which exists in the Sitecore.Xml namespace we can load our item/items into it and then pass the whole lot back to the XSLT rendering by creating an XPathNodeIterator from the packet . The extension methods allow us to more easily call the method. To call the methods:

        public static XPathNodeIterator doQuery(string query)
        {
            Item[] results = Sitecore.Context.Database.SelectItems(query);
            return results.ToXml();
        }

Or


        public static XPathNodeIterator doQuery(string query)
        {
            Item result = Sitecore.Context.Database.SelectSingleItem(query);
            return result.ToXml();
        }

Within our XSLT we can then use it like so:

    <xsl:variable select="eic:doQuery($query)" name="results" />
    <xsl:for-each select="$results">
        <sc:text field="Title" />
    </xsl:for-each>

I can iterate over the items as I would normally and can call of the standard Sitecore XSLT controls

Mike’s Blog

YouTube integration with Sitecore 6.0

Posted by admin On March - 9 - 2009
Recently I got a quite interesting task to build an integration between Sitecore CMS and YouTube repository. I finished that task and I’m willing to share my experience with public. I will describe code only partially. Only those parts I consider the most interesting.

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.

Sitecore Gadgets