Graphics migration 4.2 to 4.3


This guide covers the graphic migration of your charts from Ametys 4.2.x to 4.3.0.
See also the technical migration guide and the data migration guide.

  1. EncodingURL
  2. DecodingURL
  3. Research department
  4. Plugins

EncodingURL

Caution: risk of regression on this subject

TheURL encoding used until now handled accented characters correctly, but special characters poorly. Some (such as ':', '/', ';') caused the display to crash. And the character encoding spec was generally poorly respected.

As a result, we've overhauled the way URL encoding is handled: the org.ametys.core.util.URLEncoder class you were using no longer exists, and has been replaced by org.ametys.core.util.URIUtils, which now handles decoding as well.

But more importantly, semantics have also been reviewed, and this is a case-by-case approach.

Example in the charter ODF :

BEFORE :

xmlns:url="org.ametys.core.util.URLEncoder"      

...      

<!-- Url of PDF -->      
<xsl:param name="pdfUrl" select="concat($uri-prefix,      
                                 '/plugins/odf-web/',      
                                 $site,      
                                 '/_content/',      
                                 /view/content/@name,      
                                 '/',      
                                 url:encodePath(/view/content/@title), '.pdf')"/>      

<a href="{$pdfUrl}"/>      

The above code does not work with special characters. The name, which could potentially include special characters, must be encoded separately from the entireURL :

AFTER :

xmlns:url="org.ametys.core.util.URIUtils"      
xmlns:filename="org.ametys.core.util.FilenameUtils"      

...      

<!-- Url of PDF -->      
<xsl:param name="pdfUrl" select="concat($uri-prefix,    
                                 '/plugins/odf-web/',    
                                 $site,    
                                 '/_content/',    
                                 /view/content/@name,    
                                 '/',    
                                 filename:encodeName(/view/content/@title), '.pdf')"/>      

<a href="{url:encodePath($pdfUrl)}"/>      

To migrate, you need to search for all the links you've created manually in your XSL (in particular those that can be downloaded) and see if they're affected.

 

DecodingURL

Deletion of the org.ametys.cms.transformation.xslt.URIDecoder class. This class was used incorrectly most of the time.

It has an impact on all the XSL in which it is used. You need to do a search to identify them all. Then delete the "xmlns" that references it, as well as the corresponding "exclude", usually just below it.

Then you need to replace all calls to this namespace (usually "decoder:decode") in the XSL in question. This can happen anywhere, but often in docbook2html or in FO exports. There are several possible scenarios here:

  • If this was used by htmlexpert, we would often get the construction: htmlexpertresolver:parseAndResolve(decoder:decode(.)). Simply remove decoder:decode: htmlexpertresolver:parseAndResolve(.)
  • If it was used by plugin forms (especially in html:textarea), a new Helper must be used: xmlns:forms="org.ametys.plugins.forms.xslt.FormsXSLTHelper" and replace decoder:decode with forms:decode
  • In other cases, it may be necessary to continue decoding. In this case, use URIUtils.decode with the namespace org.ametys.core.util.URIUtils 

 

Research department

In the default rendering of search criteria, the XSL template named "criterion-enumeration-options" has been replaced by a "match" template with the "criterion-enumeration-options" mode.

Make the following changes to the rendering of the search service:

Replace

<xsl:call-template name="criterion-enumeration-options">         
       <xsl:with-param name="value" select="$value"/>           
</xsl:call-template>           

by

<xsl:apply-templates select="." mode="criterion-enumeration-options">         
       <xsl:with-param name="value" select="$value"/>           
</xsl:apply-templates>           

Replace

<xsl:template name="criterion-enumeration-options">         
   ...           
</xsl:template>           

by

<xsl:template match="criterion[enumeration]" mode="criterion-enumeration-options">         
   ...           
</xsl:template>           

Plugins

Depending on the plugins Ametys you use, you must follow the graphic migrations specific to each plugin :

Back to top