Help Text in on Content Editor

Hi Guys

We have a requirement to insert help text next the the form element controls on the content editor. What is the best way to add in help text to the right next of the form control on the content editor other than the label of the control.

So for example.

It this possible and how can I achieve this.

We’ve implemented this as a “Custom Solution” for customers in the past. The code is fairly generic, but it does require modifying some system files (and therefore will not survive an upgrade). There are also some manual steps.

First, you must add a “helptext” parameter to each of the controls. The content editor control definitions are located in the file

<Rhythmyx>/sys_resources/stylesheets/sys_Templates.xsl.

Each control definition that you wish to add help text to must be modified. Search for the control parameter list: <psxctl:ParamList>. At the end of each parameter list, add the following parameter:


<psxctl:Param name="helptext" datatype="String" paramtype="generic">
    <psxctl:Description>Help text for this control</psxctl:Description>
</psxctl:Param>

Next you must modify the rx_Templates.xsl (in /Rhythmyx/rx_resources/stylesheets) to include the following templates:


<xsl:template match="Control[ParamList/Param[@name='helptext'] and @isReadOnly='no']" priority="25" mode="psxcontrol">
      <!-- override all controls to display helptext, then return control to standard template -->
      
      
      <!-- dispatch to normal control template -->
      <xsl:variable name="control-stripped-of-help">
         <xsl:apply-templates select="." mode="copy-all-but-help-param" />
      </xsl:variable>
    
      <xsl:apply-templates select="exsl:node-set($control-stripped-of-help)" mode="psxcontrol" />
      
      <!-- display help text -->
      <img src="../rx_resources/images/help.gif" />
      <span><xsl:value-of  select="ParamList/Param[@name='helptext']"/></span>
   </xsl:template>

   <xsl:template match="@* | node()" mode="copy-all-but-help-param">
      <xsl:copy>
         <xsl:apply-templates select="@* | node()" mode="copy-all-but-help-param" />
      </xsl:copy>
   </xsl:template>

You may need to modify the template where it displays the help text (see the comment in the XSL code). The big manual effort will be in adding the parameters to each control and then adding the parameter value to each field.

You need to make sure you take a backup of rx_Templates.xsl and sys_Templates.xsl before you start and then again after you are done, as sys_Templates.xsl will be overwritten when an upgrade is run.

Tried implementing this on a fresh install of 6.7 and get the following error when trying to load a content editor with a field that includes the helptext parameter

An error occurred generating HTML from XML using the “” style sheet for the request submitted by session id 63cbefe9d5d8e0b499d37080d29ce6083c07dd50.
1 An exception occurred while processing the ContentEditor XML document through the file:sys_resources/stylesheets/activeEdit.xsl style sheet: Error while transforming the XML file with stylesheet.Namespace prefix exsl has not been declared; SystemID: file:C:/RX67/rx_resources/stylesheets/rx_Templates.xsl; Line#: 24; Column#: -1 [Error data in range: <xsl:apply-templates select=“exsl:node-set($control-stripped-of-help)” mode=“psxcontrol” /> ] Namespace prefix exsl has not been declared; SystemID: file:C:/RX67/rx_resources/stylesheets/rx_Templates.xsl; Line#: 24; Column#: -1 [Error data in range: <xsl:apply-templates select=“exsl:node-set($control-stripped-of-help)” mode=“psxcontrol” /> ]

Does your rx_Templates.xsl declare the exsl prefix ? if not, you must add the declaration:

<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
xmlns:psxctl="URN:percussion.com/control" 
xmlns="http://www.w3.org/1999/xhtml" 
xmlns:exsl="http://exslt.org/common"
extension-element-prefixes="exsl"  
exclude-result-prefixes="psxi18n" 
xmlns:psxi18n="urn:www.percussion.com/i18n" >

No I didn’t have that declaration. I have added it and now get a new error

An exception occurred while processing the ContentEditor XML document through the file:sys_resources/stylesheets/activeEdit.xsl style sheet: java.lang.StackOverflowError

This is displayed on the console


15:47:34,484 INFO  [PSServerLogHandler] appid: 0 type: 1 time: Wed Jul 29 15:47:34 BST 2009 msg: An internal error (end-
condition) was encountered. An unexpected exception occurred:
An unexpected exception occurred. The reason was: An exception occurred while processing the ContentEditor XML document
through the file:sys_resources/stylesheets/activeEdit.xsl style sheet: java.lang.StackOverflowError. Please consult the
log for further information..
The call-stack was:
com.percussion.data.PSConversionException: An exception occurred while processing the ContentEditor XML document through
 the file:sys_resources/stylesheets/activeEdit.xsl style sheet: java.lang.StackOverflowError
        at com.percussion.data.PSStyleSheetMerger.throwConversionException(Unknown Source)
        at com.percussion.data.PSXslStyleSheetMerger.merge(Unknown Source)
        at com.percussion.data.PSXslStyleSheetMerger.merge(Unknown Source)
        at com.percussion.data.PSStyleSheetMerger.merge(Unknown Source)
        at com.percussion.cms.handlers.PSQueryCommandHandler.processRequest(Unknown Source)
        at com.percussion.cms.handlers.PSContentEditorHandler.processRequest(Unknown Source)
        at com.percussion.server.PSApplicationHandler.processRequest(Unknown Source)
        at com.percussion.servlets.PSAppServlet.service(Unknown Source)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
        at com.percussion.webdav.PSWebDavRequestFilter.doFilter(Unknown Source)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
        at com.percussion.servlets.PSSecurityFilter.doFilter(Unknown Source)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
        at com.percussion.servlets.PSCharacterSetFilter.doFilter(Unknown Source)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
        at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
        at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
        at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
        at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
        at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
        at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
        at java.lang.Thread.run(Unknown Source)

15:47:34,547 ERROR [Cms] An unexpected exception occurred. The reason was: An exception occurred while processing the Co
ntentEditor XML document through the file:sys_resources/stylesheets/activeEdit.xsl style sheet: java.lang.StackOverflowE
rror. Please consult the log for further information.


Hi

I have just implemented this and get the same error.

Can anybody help with this error?

Dominic

I have this working in 6.5.2 but implemented it independent from the forum gurus, (i.e. on my own). I’m attaching my sys_Templates.xsl so you can have an example of something that works. (You’ll need to remove the .xml extension from the filename, though - I had to add it in order for the forum to let me upload it.) You’ll want to edit it to reflect your own requirements anyway… as in mind, I added a new column between label and field and use the image title rollover as a cheap pop-up help bubble.

I’m sure that things have changed in 6.7… but hopefully it’s not too different.

Hi

I have added the new column and the content is showing up in the raw XML (see below) for the content type but what I can’t get it to do is display on the content editor form.


         <DisplayLabel sourceType="sys_shared">Title:</DisplayLabel>
         <Control accessKey="" dataType="sys_shared" dimension="single" isReadOnly="no" isRequired="yes" name="sys_EditBox" paramName="displaytitle">
            <ParamList>
               <Param name="maxlength" sourceType="sys_local">512</Param>
               <Param name="contextual_help" sourceType="sys_local">qwerty</Param>
            </ParamList>
         </Control>

Do you have any example code to display the contextual help?

I have the helptext working. However, it seems to not go well with Ephox editor (when it is active). The helptext toolbar hides behind the active editlive. Any help?

I’ve outlined it here, but the algorithm posted by the original poster (and incorporated into CM System 7.2 and above) breaks the functionality of sys_File fields because it hides the XML ancestors from the templates that render the “Preview File” link. (And which, coincidentally, I also use here, to display inline previews of image files)