<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>MarkvanAalst.com &#187; Sitecore</title>
	<atom:link href="http://www.markvanaalst.com/tag/sitecore/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.markvanaalst.com</link>
	<description>Sharing Sitecore tips, tricks and techniques to build better solutions</description>
	<lastBuildDate>Wed, 25 Jan 2012 11:09:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Using XAML controls outside the Sitecore folder</title>
		<link>http://www.markvanaalst.com/2012/01/23/using-xaml-controls-outside-the-sitecore-folder/</link>
		<comments>http://www.markvanaalst.com/2012/01/23/using-xaml-controls-outside-the-sitecore-folder/#comments</comments>
		<pubDate>Mon, 23 Jan 2012 23:19:05 +0000</pubDate>
		<dc:creator>Mark</dc:creator>
				<category><![CDATA[Sitecore]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[Xaml]]></category>
		<category><![CDATA[sheerui]]></category>
		<category><![CDATA[xaml]]></category>

		<guid isPermaLink="false">http://www.markvanaalst.com/?p=179</guid>
		<description><![CDATA[In certain cases you want to offer the end-user a userfriendly interface to manage content, users or anything else. Thanks to Sitecore&#8217;s backend flexibility this is possible in more ways than one. In this case I will use the technique which is described in this blogpost by Adam Conn. In the example you can see that a new window is opened by the code below: public override void Execute&#40;CommandContext context&#41; &#123; Assert.ArgumentNotNull&#40;context, &#34;context&#34;&#41;; UrlString url [...]]]></description>
			<content:encoded><![CDATA[<p>In certain cases you want to offer the end-user a userfriendly interface to manage content, users or anything else. Thanks to Sitecore&#8217;s backend flexibility this is possible in more ways than one. In this case I will use the technique which is described in <a href="http://www.sitecore.net/Community/Technical-Blogs/Getting-to-Know-Sitecore/Posts/2010/06/Customizing-With-Large-Data-Sets.aspx" target="_blank">this blogpost</a> by Adam Conn.</p>
<p>In the example you can see that a new window is opened by the code below:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">override</span> <span style="color: #6666cc; font-weight: bold;">void</span> Execute<span style="color: #008000;">&#40;</span>CommandContext context<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
	Assert<span style="color: #008000;">.</span><span style="color: #0000FF;">ArgumentNotNull</span><span style="color: #008000;">&#40;</span>context, <span style="color: #666666;">&quot;context&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
	UrlString url <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> UrlString<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;/sitecore/shell/~/xaml/GridExample.GridExamplePage&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
	url<span style="color: #008000;">&#91;</span><span style="color: #666666;">&quot;id&quot;</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> context<span style="color: #008000;">.</span><span style="color: #0000FF;">Items</span><span style="color: #008000;">&#91;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ID</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
	SheerResponse<span style="color: #008000;">.</span><span style="color: #0000FF;">ShowModalDialog</span><span style="color: #008000;">&#40;</span>url<span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>, <span style="color: #666666;">&quot;650&quot;</span>, <span style="color: #666666;">&quot;500&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

</p>
<p>As you can see this is done by calling a url with a /~xaml/ handler. The xaml handler calls the Sitecore.Web.UI.XamlSharp.Xaml.XamlPageHandlerFactory class which basicly searches for the control. In the example from Adam the control which is being searched for is placed in the &#8220;/sitecore modules&#8221; folder. By default Sitecore searches these controls in the &#8220;/sitecore modules&#8221;  and &#8220;/sitecore/shell/Applications&#8221; folders.</p>
<p>But if you build custom applications within Sitecore the chance is that you do not want to place the custom code into the &#8220;/sitecore&#8221; or &#8220;/sitecore modules&#8221; folders. Of course you can place the code into your own location, but then the XAML handler cannot find the control.</p>
<p>The configuration which defines the folders for Sitecore to look for controls is inside the &#8220;/App_Config/XamlSharp.config&#8221; file. There are two watchers defined which tell Sitecore to look into the folder mentioned earlier. You can add a new watcher by adding it to the XamlSharp.config. Or better, use a Sitecore include config file.</p>
<p>That would be something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;utf-8&quot;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;configuration</span> <span style="color: #000066;">xmlns:patch</span>=<span style="color: #ff0000;">&quot;http://www.sitecore.net/xmlconfig/&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;sitecore<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;xamlsharp<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;sources<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;source</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;Sitecore.Web.UI.XamlSharp.Xaml.XamlFileControlSource,Sitecore.Kernel&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;watchers</span> <span style="color: #000066;">hint</span>=<span style="color: #ff0000;">&quot;list:AddWatcher&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;watcher</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;Sitecore.Web.UI.XamlSharp.Xaml.XamlFileWatcher,Sitecore.Kernel&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
              <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;folder<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>/CustomShell/GridExample<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/folder<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
              <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>*.xaml.xml<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
              <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;codefilter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>*.xaml.xml.cs<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/codefilter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
              <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;includesubdirectories<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>true<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/includesubdirectories<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/watcher<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/watchers<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/source<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/sources<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/xamlsharp<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/sitecore<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>and the url to call in the command would be like this</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">override</span> <span style="color: #6666cc; font-weight: bold;">void</span> Execute<span style="color: #008000;">&#40;</span>CommandContext context<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
	Assert<span style="color: #008000;">.</span><span style="color: #0000FF;">ArgumentNotNull</span><span style="color: #008000;">&#40;</span>context, <span style="color: #666666;">&quot;context&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
	UrlString url <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> UrlString<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;/~/xaml/GridExample.GridExamplePage&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
	url<span style="color: #008000;">&#91;</span><span style="color: #666666;">&quot;id&quot;</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> context<span style="color: #008000;">.</span><span style="color: #0000FF;">Items</span><span style="color: #008000;">&#91;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ID</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
	SheerResponse<span style="color: #008000;">.</span><span style="color: #0000FF;">ShowModalDialog</span><span style="color: #008000;">&#40;</span>url<span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>, <span style="color: #666666;">&quot;650&quot;</span>, <span style="color: #666666;">&quot;500&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<p><em>Update:</em></p>
<p>Mike Ursino (check out his blog <a href="http://firebreaksice.com/">here</a>) added a comment that it is also possible to register a single control by adding the namespace and assembly to the XamlSharp.config file. In that case your config file would be like this:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;utf-8&quot;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;configuration</span> <span style="color: #000066;">xmlns:patch</span>=<span style="color: #ff0000;">&quot;http://www.sitecore.net/xmlconfig/&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;sitecore<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;xamlsharp<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;sources<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;source</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;Sitecore.Web.UI.XamlSharp.AssemblyControlSource,Sitecore.Kernel&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;namespaceuri<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>http://www.yourcompany.com/webcontrols<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/namespaceuri<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;assemblyname<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Company.Controls<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/assemblyname<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;namespace<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Company.Web.UI.WebControls<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/namespace<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/source<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;sources<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>    
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/xamlsharp<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/sitecore<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.markvanaalst.com/2012/01/23/using-xaml-controls-outside-the-sitecore-folder/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Using ELMAH for error logging within Sitecore</title>
		<link>http://www.markvanaalst.com/2011/03/24/using-elmah-for-error-logging-within-sitecore/</link>
		<comments>http://www.markvanaalst.com/2011/03/24/using-elmah-for-error-logging-within-sitecore/#comments</comments>
		<pubDate>Thu, 24 Mar 2011 21:31:34 +0000</pubDate>
		<dc:creator>Mark</dc:creator>
				<category><![CDATA[Sitecore]]></category>
		<category><![CDATA[Elmah]]></category>
		<category><![CDATA[Exceptions]]></category>
		<category><![CDATA[Logging]]></category>

		<guid isPermaLink="false">http://www.markvanaalst.com/?p=147</guid>
		<description><![CDATA[Since a while I use ELMAH for error logging in my custom ASP.NET applications. Normally in a Sitecore project I log all exceptions to the Sitecore log files. But the disadvantage of this is that the exceptions are in the same files as all Sitecore log messages. So I tried to implement ELMAH within my Sitecore installation. What is ELMAH? According to the official site: “ELMAH (Error Logging Modules and Handlers) is an application-wide error [...]]]></description>
			<content:encoded><![CDATA[<p>Since a while I use ELMAH for error logging in my custom ASP.NET applications. Normally in a Sitecore project I log all exceptions to the Sitecore log files. But the disadvantage of this is that the exceptions are in the same files as all Sitecore log messages. So I tried to implement ELMAH within my Sitecore installation.</p>
<h3>What is ELMAH?</h3>
<p>According to the official site: “ELMAH (Error Logging Modules and Handlers) is an application-wide error logging facility that is completely pluggable. It can be dynamically added to a running ASP.NET web application, or even all ASP.NET web applications on a machine, without any need for re-compilation or re-deployment.”</p>
<h3>What does this mean?</h3>
<p>ELMAH has the following features</p>
<ul>
<li>Log all (unhandled) exceptions</li>
<li>A user interface which lets you view remotely all exceptions, including detailed information (even when customerrors mode is turned off!) and the original yellow error screen (YSOD)</li>
<li>Email notification when errors occur</li>
<li>RSS feeds which show the latest errors</li>
</ul>
<p>ELMAH uses two key components. There is one HTTP module which logs exceptions, and one HTTP Handler that shows the exceptions. You can choose SQL Server, SQLite, MS Access, Oracle, Vista DB or MySQL  as a storage medium to save the exceptions to.</p>
<h3>How do you implement it?</h3>
<p>First off all you need to download the right version from the official <a href="http://code.google.com/p/elmah/downloads/list">download</a> page. Then copy the Elmah.dll file to your Bin folder. If you want to use the SQLite data storage then you also need to copy the System.Data.SQLite.dll into the Bin folder. For this example I will use the SQLite data storage.</p>
<p>When you copied the files into the Bin folder, you need to edit the web.config. Unfortunately the web.config changes are outside the &lt;sitecore&gt; node, so we can’t use the config include files.</p>
<dl>
<dt>1. First we need to add a new sectiongroup to the configuration/configSections node</dt>
<dd> &lt;sectionGroup name=&#8221;elmah&#8221;&gt;<br />
&lt;section name=&#8221;errorLog&#8221; requirePermission=&#8221;false&#8221; type=&#8221;Elmah.ErrorLogSectionHandler, Elmah&#8221;/&gt;<br />
&lt;/sectionGroup&gt; </dd>
<dt>2. Then we need to add the ELMAH section to the configuration node. In this section is configured what type of storage we use</dt>
<dd> &lt;elmah&gt;<br />
&lt;errorLog type=&#8221;Elmah.SQLiteErrorLog, Elmah&#8221; connectionStringName=&#8221;ELMAH.SQLite&#8221;/&gt;<br />
&lt;/elmah&gt; </dd>
<dt>3. As you might noticed we also need to add a connectionstring. This can be added to the /App_Config/ConnectionStrings.config</dt>
<dd> &lt;add name=&#8221;ELMAH.SQLite&#8221; connectionString=&#8221;Data Source=|DataDirectory|errors.s3db&#8221;/&gt; </dd>
<dt>4. ELMAH uses a HTTP Handler with the file extension .axd. To prevent IIS returning a 404 we need to add the location and filename of the handler  to the IgnoreUrlPrefixes setting.</dt>
<dd> &lt;setting name=&#8221;IgnoreUrlPrefixes&#8221; value=&#8221;/sitecore/admin/elmah.axd|/sitecore…. </dd>
<dt>5. Then we need to add the Http module which logs the exceptions to the end of the system.webserver/modules section</dt>
<dd> &lt;add name=&#8221;ErrorLog&#8221; type=&#8221;Elmah.ErrorLogModule, Elmah&#8221;/&gt; </dd>
<dt>6. The last part is adding the Http handler to the end of to the system.webserver/handlers section</dt>
<dd> &lt;add name=&#8221;Elmah&#8221; path=&#8221;/sitecore/admin/elmah.axd&#8221; verb=&#8221;POST,GET,HEAD&#8221; type=&#8221;Elmah.ErrorLogPageFactory, Elmah&#8221; preCondition=&#8221;integratedMode&#8221; /&gt; </dd>
</dl>
<p>If all it setup correctly you can now view ELMAH log at <a href="http://www.mysite.com/sitecore/admin/elmah.axd">http://www.mysite.com/sitecore/admin/elmah.axd</a></p>
<p>Right now ELMAH only logs the unhandled exceptions. If you want ELMAH to log exceptions which you handle in a catch statement you need to add the following line in your catch statement:</p>
<p>Elmah.ErrorSignal.FromCurrentContext().Raise(ex);</p>
<p>I created a simple application which lets you view the ELMAH error log within Sitecore. I will put this on the Shared Source environment later this week.</p>
<p><a href="http://www.markvanaalst.com/wp-content/uploads/2011/03/Elmah.png"><img class="alignnone size-full wp-image-148" title="View Elmah logs within Sitecore" src="http://www.markvanaalst.com/wp-content/uploads/2011/03/Elmah.png" alt="View Elmah logs within Sitecore" width="465" height="258" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.markvanaalst.com/2011/03/24/using-elmah-for-error-logging-within-sitecore/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using JQuery in custom fields</title>
		<link>http://www.markvanaalst.com/2010/02/18/using-jquery-in-custom-fields/</link>
		<comments>http://www.markvanaalst.com/2010/02/18/using-jquery-in-custom-fields/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 17:27:38 +0000</pubDate>
		<dc:creator>Mark</dc:creator>
				<category><![CDATA[Custom field]]></category>
		<category><![CDATA[Sitecore]]></category>
		<category><![CDATA[JQuery]]></category>

		<guid isPermaLink="false">http://www.markvanaalst.net/?p=99</guid>
		<description><![CDATA[At the moment I&#8217;m creating a custom field for tagging content items. I prototyped my custom field in html using JQuery. But when I wanted to convert this to the actual custom field I ran into a problem. As you might know Sitecore uses the Prototype library for all of it&#8217;s javascript. And prototype uses the same dollar sign for all of its functions and variables as JQuery does. But JQuery provides a noConflict function [...]]]></description>
			<content:encoded><![CDATA[<p>At the moment I&#8217;m creating a custom field for tagging content items. I prototyped my custom field in html using JQuery. But when I wanted to convert this to the actual custom field I ran into a problem. As you might know Sitecore uses the Prototype library for all of it&#8217;s javascript. And prototype uses the same dollar sign for all of its functions and variables as JQuery does. But JQuery provides a <a href="http://api.jquery.com/jQuery.noConflict/">noConflict</a> function where you can reassign the default $.</p>
<p>But then came the next challenge. I needed to use the noConflict function before all other javascript was called. Luckally I remembered that I have seen it before in other custom fields that are on the <a href="http://trac.sitecore.net/Index/">Shared Source</a> environment. So I started browsing the source code of Alexey Rusakov&#8217;s project (<a href="http://trac.sitecore.net/FieldTypes/">Sitecore Fieldtypes</a>) and I found the <a href="http://svn.sitecore.net/FieldTypes/trunk/sitecore%20modules/Outercore.FieldTypes/Common/InjectScripts.cs">InjectScripts</a> class which provides an option to add HTML to the section of the Content Editor. There I just added a reference to my JQuery library and off course calling the .noConflict funtion.</p>
<p>[sourcecode language="csharp"]</p>
<p>namespace Sitecore.SharedSource.Taxonomy<br />
{<br />
class AddScripts<br />
{<br />
public void Process(PipelineArgs args)<br />
{<br />
if (Sitecore.Context.ClientPage.IsEvent)<br />
return;</p>
<p>HttpContext context = HttpContext.Current;<br />
if (context == null)<br />
return;</p>
<p>Page page = context.Handler as Page;<br />
if (page == null)<br />
return;</p>
<p>Assert.IsNotNull(page.Header, &#8220;Content Editor <head> tag is missing runat=&#8217;value&#8217;&#8221;);</p>
<p>string[] scripts = new[]<br />
{<br />
&#8220;/sitecore modules/Shell/Taxonomy/jquery-1.4.1.min.js&#8221;<br />
};</p>
<p>foreach (string script in scripts)<br />
{<br />
page.Header.Controls.Add(new LiteralControl(&#8220;<script type='text/javascript' language='javascript' src='{0}'></script>&#8220;.FormatWith(script)));<br />
page.Header.Controls.Add(new LiteralControl(&#8220;<script type="text/javascript">$.noConflict();</script>&#8220;));<br />
}<br />
}</p>
<p>}<br />
}</p>
<p>[/sourcecode]</p>
<p>So now I can call my JQuery by using &#8220;jQuery&#8221; in stead of &#8220;$&#8221; and the field works.</p>
<p>In my opinion this is just an example of how the Shared Source environment can help you. So if you have created a module, field or any thing else please put it on the Shared Source environment so others can benefit from it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.markvanaalst.com/2010/02/18/using-jquery-in-custom-fields/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Restricting FieldEditor to specific template based items</title>
		<link>http://www.markvanaalst.com/2010/02/17/restricting-fieldeditor-to-specific-template-based-items/</link>
		<comments>http://www.markvanaalst.com/2010/02/17/restricting-fieldeditor-to-specific-template-based-items/#comments</comments>
		<pubDate>Wed, 17 Feb 2010 11:28:04 +0000</pubDate>
		<dc:creator>Mark</dc:creator>
				<category><![CDATA[Sitecore]]></category>
		<category><![CDATA[FieldEditor]]></category>

		<guid isPermaLink="false">http://www.markvanaalst.net/?p=94</guid>
		<description><![CDATA[In Sitecore 6.2 it is possible to integrate FieldEditors. These are command which enables users edit item settings when they work in the page editor. Personally I think it is a great option when you want editors to only work within the Page Editor, and still let them edit settings. For the blog module that I created I implemented two FieldEditorCommands which let the user edit the blog and entry settings. When you use the [...]]]></description>
			<content:encoded><![CDATA[<p>In Sitecore 6.2 it is possible to integrate FieldEditors. These are command which enables users edit item settings when they work in the page editor. Personally I think it is a great option when you want editors to only work within the Page Editor, and still let them edit settings.<br />
For the blog module that I created I implemented two FieldEditorCommands which let the user edit the blog and entry settings. When you use the default implementation as described in one of the cookbooks users can always click on the ribbon button regarding if the fields are on the currentitem. When those field don not exist on that item, they just get a empty popup.<br />
I decided to restrict the option only to items which are based on a certain template. You can do this the following way:<br />
You’ll need to override the Execute method in the your class (which overrides from Sitecore.Shell.Applications.WebEdit.Commands.FieldEditorCommand).</p>
<p>Then you isolate the function Context.ClientPage.Start in for instance an if statement.</p>
<p>Example:<br />
[sourcecode language="csharp"]<br />
if (context.Items[0].TemplateID == new ID(Settings.Default.EntryTemplateID))<br />
{<br />
Context.ClientPage.Start(this, &#8220;StartFieldEditor&#8221;, args);<br />
}<br />
else<br />
{<br />
Context.ClientPage.ClientResponse.Alert(&#8220;Please select an entry first&#8221;);<br />
}<br />
[/sourcecode]</p>
<p>If anyone else has a better way to get the same results please let me know.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.markvanaalst.com/2010/02/17/restricting-fieldeditor-to-specific-template-based-items/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating a Item Editor</title>
		<link>http://www.markvanaalst.com/2009/08/19/creating-a-item-editor/</link>
		<comments>http://www.markvanaalst.com/2009/08/19/creating-a-item-editor/#comments</comments>
		<pubDate>Wed, 19 Aug 2009 11:55:03 +0000</pubDate>
		<dc:creator>Mark</dc:creator>
				<category><![CDATA[Sitecore]]></category>
		<category><![CDATA[item editor]]></category>
		<category><![CDATA[User Interface]]></category>

		<guid isPermaLink="false">http://www.markvanaalst.net/?p=22</guid>
		<description><![CDATA[For a blog module that I am developing I wanted to create an custom item editor. As you might know those are the &#8220;tabs&#8221; in the Content Editor. 1. Create a aspx file for the item editor user interface. 2. Select the core database in the desktop mode 3. Open the Content Editor and go to the following path /Sitecore/Content/Applications/Content Editor/Editors/Items. 4. You can create an item editor using the /Sitecore Client/Content Editor/Editor data template. 5. You can give your [...]]]></description>
			<content:encoded><![CDATA[<p>For a blog module that I am developing I wanted to create an custom item editor. As you might know those are the &#8220;tabs&#8221; in the Content Editor.</p>
<p>1. Create a aspx file for the item editor user interface.<br />
2. Select the core database in the desktop mode<br />
3. Open the Content Editor and go to the following path /Sitecore/Content/Applications/Content Editor/Editors/Items.<br />
4. You can create an item editor using the /Sitecore Client/Content Editor/Editor data template.<br />
5. You can give your item editor a name using the header field in the data section.<br />
6. In the icon field you can enter a path to the icon.<br />
7. In the url field you need to fill in the url to the aspx file created in step 1<br />
8. Save the item.<br />
9. Switch back to the master database.</p>
<p><span id="more-22"></span></p>
<p>Now we have created the item and the user-interface for the Item Editor. The next step is to assign the item editor to a template.</p>
<p>10. You can do this by setting it on the standard values or a individual item. Open the item in the content editor or template manager.<br />
11 . Click on the configure tab, go to the appearance group and click the editor command. A dialog will appear.<br />
12. In this dialog you can select the item editor you want to use, using the arrows you can sort.<br />
13. Finally close the dialog and save and publish.</p>
<p>Now when you select a item based on this template you see a item editor in the content editor with the title you filled in. You can edit the item editor using normal ASP.Net controls. This is a great solution for creating custom reports. But when you want to create an real custom editor functionality, you would like to use the default save button of the content editor. I might be confusing for a end-user to have two save button in one screen.</p>
<p>Unfortunately, Sitecore provides no default solution for capturing that event. Thanks to Eugene Omelnitsky from <a href="http://support.sitecore.net" target="_blank">Sitecore Support</a> (for pointing me in the right direction) I found a solution. You can adapt to the Save event using javascript. I then used <a title="JQuery" href="http://www.jquery.com" target="_blank">JQuery</a> to do an ajax call to the server and execute my save method.</p>
<p>This is the Javascript function which captures the save event and triggers an ajax call to my page method.</p>
<p>[sourcecode language='jscript']<br />
<script type="text/javascript">
function scGetFrameValue(value, request)
{
if (request.parameters == "contenteditor:save" || request.parameters == "item:save")
{
$.ajax({
type: "POST",
url: "EntryEditor.aspx/SaveItem",
data: "{ e: '" + $('#EditorIntroduction').val() + "', title: '" + $('#tbTitle').val() + "', content: '" + $('#EditorContent').val() + "' }",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg) {
alert("succes!");
}
});
}
}
</script><br />
[/sourcecode]</p>
<p>And this is the method that I use server side<br />
[sourcecode language='csharp']<br />
[System.Web.Services.WebMethod]<br />
public static void SaveItem(string entryid, string introduction, string content, string title)<br />
{<br />
Database master = Factory.GetDatabase(&#8220;master&#8221;);</p>
<p>Item currentItem = ItemManager.GetItem(new ID(entryid), Sitecore.Context.Language, Sitecore.Data.Version.Latest, master);<br />
Entry currentEntry = new Entry(currentItem);</p>
<p>currentEntry.BeginEdit();<br />
currentEntry.Title = title;<br />
currentEntry.Introduction = introduction;<br />
currentEntry.Text = content;<br />
currentEntry.EndEdit();<br />
}<br />
[/sourcecode]</p>
<p>The code above is not perfect, it needs a bit more flexibility but for testing purposes it works.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.markvanaalst.com/2009/08/19/creating-a-item-editor/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>New search for SDN</title>
		<link>http://www.markvanaalst.com/2009/08/13/new-search-for-sdn/</link>
		<comments>http://www.markvanaalst.com/2009/08/13/new-search-for-sdn/#comments</comments>
		<pubDate>Thu, 13 Aug 2009 11:47:02 +0000</pubDate>
		<dc:creator>Mark</dc:creator>
				<category><![CDATA[Sitecore]]></category>
		<category><![CDATA[SDN]]></category>
		<category><![CDATA[search]]></category>

		<guid isPermaLink="false">http://www.markvanaalst.net/?p=59</guid>
		<description><![CDATA[I just noticed that Sitecore has greatly improved their search on SDN. You can now search through SDN, the shared source and Sitecore blogs.You even can filter your results by sdn sections, collections and datatypes. Only minor is that I can&#8217;t find a list of blogs they included in the search, so for that I will use my own search.]]></description>
			<content:encoded><![CDATA[<p>I just noticed that Sitecore has greatly improved their <a href="http://sdn5.sitecore.net/searchresults.aspx?&amp;lcid=9&amp;q=&amp;t=120" target="_blank">search</a> on <a href="http://sdn.sitecore.net" target="_blank">SDN</a>. You can now search through SDN, the shared source and Sitecore blogs.You even can filter your results by sdn sections, collections and datatypes.</p>
<p><a href="http://www.markvanaalst.net/files/2009/08/sdn-search.jpg"><img class="alignnone size-full wp-image-60" title="sdn-search" src="http://www.markvanaalst.net/files/2009/08/sdn-search.jpg" alt="sdn-search" width="389" height="264" /></a></p>
<p>Only minor is that I can&#8217;t find a list of blogs they included in the search, so for that I will use my own <a href="http://www.google.com/coop/cse?cx=015305827533630957323:tnp7jv7rwps&amp;hl=nl" target="_blank">search</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.markvanaalst.com/2009/08/13/new-search-for-sdn/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Maximum number of Sitecore query items</title>
		<link>http://www.markvanaalst.com/2008/11/05/maximum-number-of-sitecore-query-items/</link>
		<comments>http://www.markvanaalst.com/2008/11/05/maximum-number-of-sitecore-query-items/#comments</comments>
		<pubDate>Wed, 05 Nov 2008 22:47:16 +0000</pubDate>
		<dc:creator>Mark</dc:creator>
				<category><![CDATA[Sitecore]]></category>
		<category><![CDATA[query]]></category>

		<guid isPermaLink="false">http://www.markvanaalst.com/?p=10</guid>
		<description><![CDATA[Last week I had some problems with an Sitecore Query. It didn&#8217;t show more than an fixed number of items. After some hard thinking I rembered that there is a web.config key called Query.MaxItem which, you might guessed it, controls the maximum number of results of an Sitecore Query.]]></description>
			<content:encoded><![CDATA[<p>Last week I had some problems with an Sitecore Query. It didn&#8217;t show more than an fixed number of items. After some hard thinking I rembered that there is a web.config key called Query.MaxItem which, you might guessed it, controls the maximum number of results of an Sitecore Query.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.markvanaalst.com/2008/11/05/maximum-number-of-sitecore-query-items/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Using profile with the Rich Text Editor</title>
		<link>http://www.markvanaalst.com/2008/11/05/using-profile-with-the-rich-text-editor/</link>
		<comments>http://www.markvanaalst.com/2008/11/05/using-profile-with-the-rich-text-editor/#comments</comments>
		<pubDate>Wed, 05 Nov 2008 17:36:39 +0000</pubDate>
		<dc:creator>Mark</dc:creator>
				<category><![CDATA[Sitecore]]></category>
		<category><![CDATA[profiles]]></category>
		<category><![CDATA[rich text editor]]></category>
		<category><![CDATA[Sitecore 6]]></category>

		<guid isPermaLink="false">http://www.markvanaalst.com/?p=8</guid>
		<description><![CDATA[Regularly I see topics on the SDN5 forums where people ask if it is possible to use a custom Rich Text editor. Wll, yes it is. You can use so called profiles with the Rich Text editor. These profiles are stored in the Core database under /sitecore/system/Settings/Html Editor Profiles/. There are some default pre-configurated profile which you van duplicate and customize to your own needs. To use these profile you need to set the source [...]]]></description>
			<content:encoded><![CDATA[<p>Regularly I see topics on the SDN5 forums where people ask if it is possible to use a custom Rich Text editor. Wll, yes it is. You can use so called profiles with the Rich Text editor. These profiles are stored in the Core database under /sitecore/system/Settings/Html Editor Profiles/. There are some default pre-configurated profile which you van duplicate and customize to your own needs.</p>
<p>To use these profile you need to set the source value of an rich text field in your template.</p>
<p><a title="View image fullsize" href="http://www.markvanaalst.com/files/2008/11/sc6_rteprofile.gif"><img src="http://www.markvanaalst.com/files/2008/11/sc6_rteprofile.gif" alt="Sitecore 5 Rich Text Editor" width="422" height="73" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.markvanaalst.com/2008/11/05/using-profile-with-the-rich-text-editor/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Disable Sitecore publishing</title>
		<link>http://www.markvanaalst.com/2008/10/20/disable-sitecore-publishing/</link>
		<comments>http://www.markvanaalst.com/2008/10/20/disable-sitecore-publishing/#comments</comments>
		<pubDate>Mon, 20 Oct 2008 22:49:45 +0000</pubDate>
		<dc:creator>Mark</dc:creator>
				<category><![CDATA[Sitecore]]></category>
		<category><![CDATA[publishing]]></category>

		<guid isPermaLink="false">http://www.markvanaalst.com/?p=11</guid>
		<description><![CDATA[To avoid problems during the development of an Sitecore site it could be useful to disable the Sitecore Publishing method. This can be done by editing the following web.config rule: &#60;site name=&#8221;website&#8221; virtualFolder=&#8221;/&#8221; physicalFolder=&#8221;/&#8221; rootPath=&#8221;/sitecore/content&#8221; startItem=&#8221;/home&#8221; database=&#8221;web&#8221; domain=&#8221;extranet&#8221; allowDebug=&#8221;true&#8221; cacheHtml=&#8221;true&#8221; htmlCacheSize=&#8221;10MB&#8221; enablePreview=&#8221;true&#8221; enableWebEdit=&#8221;true&#8221; enableDebugger=&#8221;true&#8221; disableClientData=&#8221;false&#8221;/&#62; These are the settings of your current site. The database key contains the database name from where the site needs to get its content. By setting this to the master [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;">To avoid problems during the development of an Sitecore site it could be useful to disable the Sitecore Publishing method.</p>
<p>This can be done by editing the following web.config rule:</p>
<p>&lt;site name=&#8221;website&#8221; virtualFolder=&#8221;/&#8221; physicalFolder=&#8221;/&#8221; rootPath=&#8221;/sitecore/content&#8221; startItem=&#8221;/home&#8221; database=&#8221;web&#8221; domain=&#8221;extranet&#8221; allowDebug=&#8221;true&#8221; cacheHtml=&#8221;true&#8221; htmlCacheSize=&#8221;10MB&#8221; enablePreview=&#8221;true&#8221; enableWebEdit=&#8221;true&#8221; enableDebugger=&#8221;true&#8221; disableClientData=&#8221;false&#8221;/&gt;</p>
<p>These are the settings of your current site. The database key contains the database name from where the site needs to get its content. By setting this to the master database you do not need to publish your content anymore.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.markvanaalst.com/2008/10/20/disable-sitecore-publishing/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Copy &amp; Paste Layout Settings</title>
		<link>http://www.markvanaalst.com/2008/05/13/copy-paste-layout-settings/</link>
		<comments>http://www.markvanaalst.com/2008/05/13/copy-paste-layout-settings/#comments</comments>
		<pubDate>Tue, 13 May 2008 21:55:44 +0000</pubDate>
		<dc:creator>Mark</dc:creator>
				<category><![CDATA[Sitecore]]></category>
		<category><![CDATA[layout settings]]></category>

		<guid isPermaLink="false">http://www.markvanaalst.com/?p=6</guid>
		<description><![CDATA[While developing a Sitecore website there are lots of situations where you want multiple items to have the same Presentation Settings (renderings/sublayouts/layout). The ideal case is that your item Masters have these settings included but sometimes this isn&#8217;t the case. You can copy and paste the settings all at one time this way: 1. Navigate to the source item in the Content Editor (or Template Manager) 2. On the &#8216;View&#8217; Ribbon (Menu tab on top [...]]]></description>
			<content:encoded><![CDATA[<p>While developing a Sitecore website there are lots of situations where you want multiple items to have the same Presentation Settings (renderings/sublayouts/layout). The ideal case is that your item Masters have these settings included but sometimes this isn&#8217;t the case.</p>
<p>You can copy and paste the settings all at one time this way:</p>
<p>1. Navigate to the source item in the Content Editor (or Template Manager)</p>
<p>2. On the &#8216;View&#8217; Ribbon (Menu tab on top of the screen) select Standard Fields and Raw Values</p>
<p>3. Copy the (raw) Renderings field value (in the layout section of the content of the item)</p>
<p>4. Paste it into the destination item Renderings Field.</p>
<p>5. Disable Raw values and standard fields if necessary.</p>
<p>There also is a (unsupported) Sitecore Module for this action. Check it out <a class="externallink" title="Layout copy paste" href="http://sitecoresupport.blogspot.com/2008/01/dev-layout-chunk.html" target="_blank">Layout copy paste</a>here.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.markvanaalst.com/2008/05/13/copy-paste-layout-settings/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

