Friday, January 30, 2009

New hotfix for EPiServer Community 3.1

About a week ago, 23 January, the EPiServer Community team has made a new hotfix for the EPiServer Community 3.1 available. The hotfix addresses some bugs that are already fixed in the 3.2 release. To be more specific, these are the bugs that are fixed:

  • AssignedQuestion.Expert returns null
  • Author Attributes mapping error in query system
  • Club membership attribute mapping error in query system
  • Error when adding image to expert
  • Error in query system for Criterions having both a return value from ParseParameters (originating from GetQuery) and base.GetCriterionQuery
  • Error when trying to open the ReportingControl when there is a reference to a removed user in a report case
  • Missing cache clearing in AddMailAccount and UpdateTopic

Since it seems that the data migration tool from 3.1 to 3.2 is a couple of weeks away, my guess is that the partners will wait to upgrade their customer’s sites. With this in mind this hotfix for the old version is great news.

I encourage everyone who have any of the above stated problems with their site to head over to the download section of the “world of EPiServer” and get your copy of the hotfix.

The inner workings of Relate+ Button

Early on in the development of the EPiServer Relate+ template package we decided to use a custom web control for all the buttons instead of using the standard System.Web.UI.WebControls.Button. There were many reasons to go down this path:

  • In the early stages we didn’t know if we wanted a Button or a LinkButton
  • Enable the possibility to change the layout of the button more than you can do with CSS
  • We wanted to make it easy for developers working with Relate+ to customize all the buttons in one place

Lucky for us that we made this decision since the layout of the button changed three or four times along the way. Anyhow, in the end we decided to go with a LinkButton with a span-element wrapped around it to enable the desired layout. This was done by inheriting from LinkButton and override the RenderBeginTag and RenderEndTag methods. Pretty straight forward stuff.

The decision to go with a LinkButton caused us some problem when we wanted to utilize the DefaultButton property of ASP.NET to enable sending forms on enter keystroke. In Internet Explorer everything worked fine, but in Firefox it didn’t. The reason is that a LinkButton will result in an a-element in the HTML and Firefox doesn’t define a click() method for the a-element.

But there is a solution! Inspired by this great blog post by Dmytro Shteflyuk we added some JavaScript to our custom LinkButton that adds a click() method to the a element if it does not already exist. Once this is done we will be able to submit forms by pressing enter regardless of which browser we are using, happy days!

What is ajaxTweaks.js in Relate+?

I got a question the other day about the ajaxTweaks.js file that is included in the Relate+ template package, located in /Templates/RelatePlus/JavaScripts. The actual question was; what is it and why do we include it? Even though the answer is pretty straight forward, I’m going to elaborate a bit.

Pretty early on in the process of developing the templates we decided to include some Ajax features. We didn’t want to overdo the Ajax implementations and we wanted to give the developers an easy way out if they decided to skip the use of Ajax. For these reasons, among others, we decided to go with Microsoft ASP.NET AJAX together with ASP.NET AJAX Control Toolkit.

As soon as you introduce AJAX and more advanced JavaScript you are more likely to run into compatibility issues with different browsers, which we indeed did. Of course this is dependent on which browsers you want to support. We first noted that we had a problem with our modal pop-ups in the newly-out-of-beta Chrome. As we suspected we got the same issues with Safari 3, since both browsers are using new versions of WebKit as browser engine.

The problem appeared similar to what follows:

   1: Sys.ScriptLoadFailedException: The script 'http://localhost:2241/WebResource.axd?d=hvpXhV5kEMwLgAoaIglURevR_XTtDTBoKZ3aZWWaIvEkBXbLudri1AIv5bRs5f6licjCZMs3Z3MioQLqLTXV98582pKDHkD7BucGkKsPLz41&t=633444640020014740' failed to load. 
   2: Check for: Inaccessible path. 
   3: Script errors. (IE) Enable 'Display a notification about every script error' under advanced settings. 
   4: Missing call to Sys.Application.notifyScriptLoaded()
Apparently Microsoft AJAX doesn’t recognize Chrome and Safari 3 as browsers using WebKit, therefore they will be treated as unsupported browsers. This is due to the version number of WebKit. With that said we need a way to “tell” Microsoft AJAX that these browsers are in fact supported – in comes ajaxTweaks.js!What ajaxTweaks.js actually does is to add new browser detection code to recognize any browser with WebKit in its user-agent as a Webkit browser, independent of the version of WebKit. To enable the ajaxTweaks to be run, we put a reference to the ajaxTweaks.js file in our MasterPages.

Microsoft will hopefully address this limitation in the near future, but until then we just have to use the ajaxTweaks.js!

For more information see: http://forums.asp.net/t/1252014.aspx