Publisher JavaScript/JSpell Problems? Fix ’em here.

Ah, Plumtree Publisher.  We had a good run; I’ve loved you, I’ve hated you.  I’ve even tried to throw you a bone by developing a better editor to replace your terrible WYSIWYG editor in AquaLogic Publisher 6.5, and a utility to replacing glaringly absent features. But I mean, c’mon, it’s like you don’t even try any more.

If you, dear reader, have written similar missives to the oft-maligned Publisher editor, this tip is for you.  Specifically, if you’re getting JavaScript errors in various Publisher administrative pages and it seems hopelessly broken, chances are the problems are with the new jSpell spellchecker (you’ll see file names like jspellSettings_UTF-8.js in the IE error window):

This problem typically occurs when you have multiple experience definitions and are accessing your WebCenter portal with different base URLs.  The reason is that Publisher creates absolute URLs to the spell checker JavaScript files, and the portal’s link transformation seems to be broken by creating the wrong base URLs for the gateway (more on this another time; I can only rant about one thing at a time…).  Consequently, Internet Explorer refuses to run the Javascript when it’s being executed from a different base URL.

It appears (although I haven’t done extensive testing) that if you have explicit mapping URLs for each distinct experience definition, the portal gateway works OK and picks the correct base URL.  But, if you just use wildcards in your mapping URLs, things get hairy, the gateway chokes, and the browser gets the wrong base URL for the gateway link.

What to do?  Remove the absolute URL in Publisher and provide the portal with a relative one.  I would say “proceed at your own risk” with this fix because I imagine this absolute link code is there for a reason, but we all read The Daily WTF, right?  Sometimes there just is no rhyme nor reason why crazy code exists.  (I’ll update this post if I find one).

The fix: Edit the following four files in the /ptcs/6.5/webapp/ptsc.war file:

  1. /portlet_packages/community_portlet.jsp
  2. /portlet_packages/portlet.jsp
  3. ciEditor.jsp
  4. ci_editor_jr.jsp

Find the lines that look like this:

<script language=”JavaScript” TYPE=”text/javascript” src=”<%=sURLGatewayBase%>/jspellEvolution/jspellEvolution_UTF-8.js” CHARSET=”UTF-8″></script>
<script language=”JavaScript” TYPE=”text/javascript” src=”<%=sURLGatewayBase%>/jspellEvolution/jspellSettings_UTF-8.js” CHARSET=”UTF-8″></script>
<script language=”JavaScript” TYPE=”text/javascript” src=”<%=sURLGatewayBase%>/jspellEvolution/jspellClient_UTF-8.js” CHARSET=”UTF-8″></script>

… and change them to this:

<script language=”JavaScript” TYPE=”text/javascript” src=”/jspellEvolution/jspellEvolution_UTF-8.js” CHARSET=”UTF-8″></script>
<script language=”JavaScript” TYPE=”text/javascript” src=”/jspellEvolution/jspellSettings_UTF-8.js” CHARSET=”UTF-8″></script>
<script language=”JavaScript” TYPE=”text/javascript” src=”/jspellEvolution/jspellClient_UTF-8.js” CHARSET=”UTF-8″></script>

So yeah, sorry Publisher; it’s not really yoru fault that you’re providing an absolute link instead of a relative link to these JS files – they point to the same files.  I might have done the same thing if i were you.  But, uh, Mr. Portal Link Transformation Engine, I’m eyein’ you for this one…

Tags: , , , ,

Leave a Reply