Fixes for EPiServer Composer client script issues in Internet Explorer and Firefox

From dropIT blog http://labs.dropit.se/blogs/post/2009/10/23/Fixes-for-EPiServer-Composer-client-script-issues-in-Internet-Explorer-and-Firefox.aspx

In my current EPiServer project (using EPiServer CMS R2 SP2 and EPiServer Composer) I discovered a bunch of client script issues which basically made it impossible to use Composer in any web browser. This post describes these issues, how to fix them and make it possible to use Composer in the latest versions of Internet Explorer and Firefox.

Problems in Internet Explorer

  • Script error “Extension.Client not found” when saving content function data in Internet Explorer 7 and 8.
  • Not possible to create functions in Internet Explorer 8 standard mode. Error message when dragging functions to page.

Both of these problems are related to how the setAttribute method of the DOMElement is handled in Internet Explorer. The solution is to pass an empty string as value instead of null.

Fixes:

Add the following code to Dropit\Plugin\Extension\UI\Js\Utils.js

[code lang=”javascript”]
Util.HandleNulls = function(val) {
    return (val == null || val == “null”) ? “” : val;
}[/code]
Locate the function Extension.ContentFunction.prototype.ToXml in Dropit\Plugin\Extension\UI\Js\Extension.ContentFunction.js

Replace line 444:

[code lang=”javascript”]
contentFunctionNode.setAttribute(“remotesite”, this.RemoteSite);
[/code]
with this code:
[code lang=”javascript”]
contentFunctionNode.setAttribute(“remotesite”, Util.HandleNulls(this.RemoteSite));
[/code]
Locate the function Extension.ContentArea.prototype.HandleCategoryItem in Dropit\Plugin\Extension\UI\Js\Extension.ContentArea.js

Replace lines 354 and 355:

[code lang=”javascript”]
div.setAttribute(“pid”, pid);
div.setAttribute(“wid”, wid);
[/code]
With this code:

[code lang=”javascript”]
div.setAttribute(“pid”, Util.HandleNulls(pid));
div.setAttribute(“wid”, Util.HandleNulls(wid));
[/code]

Problem in Firefox 3.5

Drag and drop doesn’t work. Nothing happens when you drag a function from the toolbox.

Fix:

This turned out to be solved. You can read more about it in this thread on EPiServer World. Simply replace your Rico.js file with this one: http://www.m2b.se/ext/composer/rico.js.

Leave a Reply

Your email address will not be published. Required fields are marked *