Sitecore CMS and everything related RSS 2.0
 Monday, September 26, 2005

Extended mail action adds a little extra to the standard Sitecore workflow mail notification by using the NVelocity template engine. In case you didn't know, standard Sitecore email action supports three hard-coded macro expansions: $itemPath$, $itemLanguage$ and $itemVersion$. So instead of sending a completely static mail notification saying that something had been changed somewhere you can add something like "Hello. Item $itemPath$ had been changed".

Well, thanks to the NVelocity template engine, extended mail action takes it to the next level! Here's the example message template:

Time: $time

State of the $item.Name item (located at $item.Paths.Path) had been changed from '$state.DisplayName' to '$nextState' by $user.Name ($user.Email).

Item workflow history:
#foreach ($historyItem in $history)
Date: $historyItem.Date | User: $historyItem.User | Action: $historyItem.Text
#end

The item was last updated on $item.Statistics.Updated.

and here's the the result:

Time: 26.09.2005 1:03:25

State of the Extended Mail Item item (located at /sitecore/content/Home/Extended Mail Item) had been changed from 'Editing' to 'Done' by Admin (jc-[at]-sitecore.net).

Item workflow history:
Date: 26.09.2005 1:02:45 | User: sitecore\Admin | Action: Item created

The item was last updated on 26.09.2005 1:03:22.

Even though it mostly looks like an additional number of hardcoded macros, its much more powerful: using the NVelocity templates you can code against the Sitecore API using the Sitecore client as long as the method/property evaluates to string. So now you don't have to start Visual Studio every time you need to change your custom template, and the educated users can do it themselves.

How to use it:

  1. First of all, if you're not familiar with the Sitecore V5 workflows and workflow actions, I suggest that you read about them first.
  2. Download and install the package.
  3. Extended email action template is installed to the /templates/workflow folder.
  4. There's also an example 1-step workflow installed with the package - Extended Mail Demo Workflow.

Here's how the shortcuts are defined:

/// <summary>
/// Populates the velocity template context. Only the objects that were
/// added in this method will be accessible in the mail template.
/// </summary>
/// <remarks>Override this to add your own data to the context</remarks>
protected virtual void PopulateContext(WorkflowPipelineArgs args)
{
   velocityContext.Put("args", args);
   velocityContext.Put("item", args.DataItem);
   velocityContext.Put("processor", args.ProcessorItem);
   velocityContext.Put("user", Sitecore.Context.User);
   velocityContext.Put("history", args.DataItem.State.GetWorkflow().GetHistory(args.DataItem));
   velocityContext.Put("state", args.DataItem.State.GetWorkflowState());
   velocityContext.Put("nextState", GetNextState(args));
   velocityContext.Put("site", Sitecore.Context.Site);
   velocityContext.Put("time", DateTime.Now);
}

As it says, if you need your own shortcuts/helpers than override the method, place your assembly into the /bin folder and change the 'type' field in the action item in Sitecore.

The Velocity itself is a powerful tool: you can define your own macros and variables, use basic conditions (#if) and loops (#foreach) and parse external templates. Google it if you need more information - most of the hits will come from the java version of Velocity, but it's almost the same.

Monday, September 26, 2005 1:40:07 AM (FLE Standard Time, UTC+02:00)  #    Comments [0]
Sitecore | Extended mail action | Workflow
 Thursday, September 22, 2005

There's an interesting problem related to publish event and getting the full url to the item. Sometimes you'd like to get the full or relative link to the item in publish:end event to rebuild your own data cache/structures. However if you try to get item.Paths.GetFriendlyUrl() in publishing context, you will only get '/', and its a 'feature', not a bug.

If you look at the <sites> section in web.config you'll see that publisher site definition is quite scarce:
<site name="publisher" domain="sitecore" enableWorkflow="true" />
virtualFolder, physicalFolder and rootPath properties are all missing, because well, publisher site is only used to publish items from one database to other.

You could set those properties for yourself, if only you knew which site will be serving the item to the user. The same goes with host: to assemble a full url you need an actual http request to get the host and construct the full url from the host and item friendly url.

You can, however, go around this friendly url issue by yourself, if you only have one site that will be serving items, or if you have multiple sites but there's strict n-1 relation between items and site, i.e. each item can only be served by one and only one site.
Thursday, September 22, 2005 9:51:47 AM (FLE Standard Time, UTC+02:00)  #    Comments [0]
Sitecore
 Monday, September 12, 2005
How to add a custom button to Sitecore rich text editor (Html Editor). Soon to be available as an article on SDN5.

Buttons displayed in the html editor tool bars are determined by the editor profiles. However a 'click' in 'html editor button' item contains a button name that is recognizable by the Cutesoft editor, and not the actual client side command to execute. So two steps should be made to properly add a new button to the html editor toolbar...
Monday, September 12, 2005 7:09:04 AM (FLE Standard Time, UTC+02:00)  #    Comments [0]
Sitecore | Rich Text Editor
 Friday, September 02, 2005

I haven't been updating in a while. One of the reasons is that we now have a lot of new projects breeding inside, but the actual one is that at the moment we're at the St.Tomas hotel in Copenhagen, Denmark, enjoying the Sitecore Summer Party!

We arrived yesterday and Henrik gave was a wonderful tour around the city and we had a huge dinner later. The city is beautiful and I'm looking forward to seeing everyone in the Sitecore Denmark office today. I hope so see an many people I know from emails as possible!

Friday, September 02, 2005 8:14:38 AM (FLE Standard Time, UTC+02:00)  #    Comments [0]
Sitecore
 Monday, August 22, 2005

Sitecore.Data.Items.ItemAxes has a lot of handy methods, and its often overlooked. I can easily remember that I manually recursed items children to iterate through all of the item's descendants a few times, while I could simply use anItem.Axes.GetDescendants(). This reminds me of the .NET framework itself, where you can often find a nice little (or pretty complex) class that does the job you used to do by yourself, at least when you're only starting to get into it.
Monday, August 22, 2005 7:53:07 PM (FLE Standard Time, UTC+02:00)  #    Comments [0]
Sitecore
 Saturday, August 20, 2005

We've put on hold the two big articles I've told about in the last post. Reason? We expect similar articles right from the heart of the Sitecore development, and we expect them soon!

So, we've decided to keep converting our support knowledge base into the smaller articles. Here are the new ones:

Item-Specific Context Menu. How to dynamically create the context menu depending on the list item that was clicked.
Toggling Control Visibility. Shows how to show or hide any control in the application based on user preference (using the Registry).
Customizing Upload Process. How to tweak the media upload process (customizing the uiUpload pipeline)

All articles I've put here previously as the word documents are now available at the SDN5:

Understanding Workflows. Basic information on the Sitecore V5 workflows.
My First XAML Application. XAML application basics.
Publish Queue Viewer. Creating the real-world application and using the advanced controls.

Next week I'll go through the last ones and update them basing on the feedback I've received.
Saturday, August 20, 2005 9:05:37 AM (FLE Standard Time, UTC+02:00)  #    Comments [0]
Sitecore | Sheer UI | Workflow
 Wednesday, August 17, 2005

Having the first draft of the SDN5 go live, we're focusing on producing the new content. So we've started a couple of concept articles.

The first one is the "Sheer UI Architecture", and it covers different aspects of the new rendering engine, going from the client to server side and showing what makes those neat selective ajax-style postbacks possible. It is being written by Dmitry Kostenko, our lead developer here, and I know that a few people at yahoo groups demanded that docs should be written by the developers - this is exactly how it happens.

The second one is called "Pipeline Architecture". Topics covered include the explanation of the pipeline pattern, how the Sitecore is built around the pipelines, how to add your processor to tweak the existing pipelines and how to add a completely new pipeline to make your module (or a custom solution) to maintain the high level of extensibility. I'll try to post the sample code for this one by the end of the week, and here's an illustration:
pipeline assembly line.jpg

Our plan is to cover new major concepts in the first place, while adding small practical snippets at the same time. As I'm also the supervisor for the documentation here in Ukraine, I'm looking for any feedback regarding the existing articles, what should be covered next and the current documentation system. Mail me directly or leave a comment here. One of the next articles will focus on database/domain/site concepts, showing how these three connect, as it seems that it is one of the troublesome areas.
Wednesday, August 17, 2005 9:22:22 AM (FLE Standard Time, UTC+02:00)  #    Comments [0]
Sitecore
 Monday, August 15, 2005

The Sitecore Development Nerwork V5 went live last friday. Old SDN accounts should work fine.
Monday, August 15, 2005 12:10:43 PM (FLE Standard Time, UTC+02:00)  #    Comments [0]
Sitecore
Right clicking doesn't select a Listview item, so you cannot use .Selected property to determine which item was clicked. But you often will need to know that, because context menu items can depend on the actual item. Content Editor, for example, dynamically populates list of masters available for the item when you right click it in the content tree. This is where ClientRequest.Source comes in handy.
Monday, August 15, 2005 9:26:26 AM (FLE Standard Time, UTC+02:00)  #    Comments [0]
Sitecore | Sheer UI
 Friday, August 12, 2005

Arghhh, it seems that rss/atom feeds dont work at the moment. My hosting provider is killing me.
I'll post a note when its fixed.

Update: fixed.
Friday, August 12, 2005 3:56:48 PM (FLE Standard Time, UTC+02:00)  #    Comments [0]

Archive
<September 2005>
SunMonTueWedThuFriSat
28293031123
45678910
11121314151617
18192021222324
2526272829301
2345678
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 2009
Alexey Rusakov
Sign In
Statistics
Total Posts: 201
This Year: 0
This Month: 0
This Week: 0
Comments: 0
Themes
Pick a theme:
All Content © 2009, Alexey Rusakov
DasBlog theme 'Business' created by Christoph De Baene (delarou)