Graphics migration 3.8 to 4.0


  1. Search engine service
  2. JQuery and JQueryUI
  3. Javascript and CSS charter
  4. Minifier
  5. Users and Groups
  6. FOUserInputData
  7. User Preferences Service
  8. Authentication
  9. Authentication
  10. Password change service
  11. Decorators for restricted-access pages
  12. Retrieving service parameters with AmetysXSLTHelper
  13. Retrieve content linked to logged-in user (UserXSLTHelper)
  14. Connected utility
  15. Correction of search engine pagination
  16. AmetysXSLTHelper
  17. Class CSS "hidden-L" in the calendar service
  18. Search engine and listings
  19. Newsletter template migration (model.xml)

 

Search engine service

The XML input changes slightly.

The content linked to the pages retrieved is sent in the same way as for classic content rendering.
For example, unlike before, each content item receives only its own metadata (if you have 3 news items in v3.8, the 3 news items received 3 start-date metadata).
For example, for images, there is no longer a $downloadUrl and $viewUrl attribute: you must use the resolver as for classic content rendering.

Par exemple, concernant les images, il n'y a plus d'attribut $content : l'identifiant du content est sur la balise <content> racine

JQuery and JQueryUI

The default versions are different. As a result, you'll need to redo / re-download the CSS theme for JQueryUI. Alternatively, you can re-impose older versions ativy .

Javascript and CSS charter

The CSS and JS for the charter + services + content are now grouped (CSS then JS) and unique. We need to make sure this doesn't create any bugs.

Minifier

If Ametys is set to Production mode, JS and CSS are grouped and minimized.

It's the equivalent of modPageSpeed in Apache.

We need to make sure this doesn't lead to any regression in the charter.

Caution: Pay particular attention to external imports of css files (in the form @import url(//fonts.googleapis.com/css?family=Lato:700); for example).
These files must be on the first line of the CSS minified file, otherwise imports are not carried out and no alert is raised. In our charters, fonts are mainly imported in this way. Either declare this import in the head of the xsl file, or move them to the first CSS file imported.

Users and Groups

For "extranet" or "intranet" type charters, a User or Group is now identified not simply by a login or an idenfier, but by a pair of values: (login, populationId) and (groupId, directoryId).

In particular

  • ametys:users returns a different XML since it also returns the population as an attribute and whether the user is disconnectable or not.
  • ametys:groups now takes 2 arguments: login and populationId.

FOUserInputData

This inputdata is now renamed UserInputData. In particular, its root node "FOUser" => "User". Then it saxes the same thing as ametys:user. The difference lies in the fact that the info is only present if the information is not cached.

The "inputdata.fo.user.infos" feature => "inputdata.user.infos" (if ever disabled in your runtime.xml : change the name).

User Preferences Service

The XSLT ametys :serviceParameter helper has been modified to handle multiple parameters.

Here's what you get when you call this helper, depending on the parameter type

 

Single parameter
<xsl:variable name="header" select="ametys:serviceParameter('header')">     
<header name="header" type="string">Titre du service</header>     
Multiple parameter
<xsl:variable name="prefs" select="ametys:serviceParameter('preferences-ids')">     
<preferences-ids name="preferences-ids" type="string">     
    <value>firstname</value>     
    <value>lastname</value>     
    <value>birthdate</value>     
    <value>phone</value>     
    <value>hobbies</value>     
</preferences-ids>     
Repeater
<xsl:variable name="feeds" select="ametys:serviceParameter('feeds')">     
<feeds name="feeds" type="composite">     
  <_x0035_ name="5" type="composite">     
    <title name="title" type="string">Yahoo Actualités</title>     
    <url name="url" type="string">https://fr.news.yahoo.com/rss/france</url>     
  </_x0035_>     
  <_x0034_ name="4" type="composite">     
    <title name="title" type="string">Le Monde informatique</title>      
    <url name="url" type="string">http://www.lemondeinformatique.fr/flux-rss/thematique/toutes-les-actualites/rss.xml</url>     
  </_x0034_>     
</feeds>     

If you have overloaded the rendering of the "User preferences" service, the retrieval of preferences has been modified. Apply the following modifications:

 

  • Replace

    <xsl:variable name="preferences-ids" select="ametys:serviceParameter('preferences-ids')"/>     
    <xsl:variable name="prefs" select="concat(',', $preferences-ids, ',')"/>     

 

  • By

    <xsl:variable name="prefs" select="ametys:serviceParameter('preferences-ids')"/>     
  • Replace all occurrences of contains($prefs, concat(',', @id, ',')) with $prefs/value = @id

 

Authentication

Site declared in contexts: Authentication is now correctly handled by site => if you were redirecting to _authenticate, make sure it's in the form

<a href="{ametys:siteUriPrefix()}/_authenticate?requestedURL={ametys:siteUriPrefix()}/{$lang}/{/cms/inputData/sitemap//page[@sitemap:current = 'true']/@sitemap:path}.html">S'identifier</a>     

Disconnection: now natively managed:

<a href="{ametys:siteUriPrefix()}/logout.html?requestedURL={ametys:siteUriPrefix()}/{$lang}/index.html">Se déconnecter</a>     

 

Authentication

Front-end authentication can now be charted. 

Beware, the screen is much more complicated to create than before, as there are many cases to manage.
Take the example of the skin demo, which simply imports a XSL kernel and wraps/CSSify it.
However, the XSL kernel is well cut out and can be overloaded in certain places. 

 

Password change service

This service has evolved to manage populations (it displays a list or a field depending on the case).

Decorators for restricted-access pages

For the limited-access page decorator, replace in WEB-INF\param\sitemap-icons.xml the following condition:

<conditions>     
   <metadata type="OR">     
      <metadata name="granted-users"></metadata>     
      <metadata name="granted-groups"></metadata>     
      <metadata name="grant-any-user">true</metadata>     
   </metadata>     
</conditions>     

by

<conditions>     
    <restricted/>     
</conditions>     

Note that in v4 you can use glyphs for icons and decorators, for example :

<icon>     
   <glyph>ametysicon-file94 validated</glyph>     
   <image plugin="default-sitemap">img/icons/section_validated.png</image>     
   <conditions>     
        <tags>     
           <tag>SECTION</tag>     
        </tags>     
        <live />     
   </conditions>        
</icon>     
           
<decorator id="limited_access">     
   <label i18n="true">plugin.default-sitemap:PLUGIN_DEFAULT_SITEMAP_DECORATOR_LIMITED_ACCESS</label>     
   <glyph>ametysicon-lock81</glyph>                
   <conditions>     
    <restricted/>     
   </conditions>     
</decorator>     

Full example: https: //code.ametys.org/projects/WEB/repos/template-web/browse/webapp/cms/WEB-INF/param/sitemap-icons.xml

Retrieving service parameters with AmetysXSLTHelper

AmetysXSLTHelper's serviceParameter() method has evolved to handle multiple parameters and repeaters (see table above).

When retrieving the value of a parameter, you must use ametys:serviceParameter('paramName')/text() to obtain the text value of the parameter.

La plupart du temps, il n'est pas nécessaire de récupérer explicitement la valeur texte du nœud car <xsl:value-of select="ametys:serviceParameter('paramName')"/> est strictement équivalent à <xsl:value-of select="ametys:serviceParameter('paramName')/text()"/>

On the other hand, if you use the "common-service-body-nonempty-content-title-content" template, with a service parameter as parameter, it's important to pass the value "text", as in the example below:

<xsl:variable name="service-title" select="string(ametys:serviceParameter('header')/text())"/>     
           
<xsl:call-template name="common-service-body-nonempty-content-title-content">     
    <xsl:with-param name="title" select="$service-title"/>     
 <xsl:with-param name="default-title"><i18n:text i18n:key="DEFAULT_TITLE"/></xsl:with-param>     
</xsl:call-template>     

Retrieve content linked to logged-in user (UserXSLTHelper)

Content identifier linked to the logged-in user

Requires current language

<xsl:value-of select="user:getCurrentUserContent($lang)"/>     
Page identifier linked to logged-in user

Requires current language

<xsl:value-of select="user:getCurrentUserPage($lang)"/>     
Page identifier to directory content
<xsl:value-of select="user:getUserPage($contentId)"/>     

Connected utility

The FOUser inputdata no longer exists. The "head-js-user" template no longer exists. You need to use ametys:user(), which works on both the BO and FO sides.

Correction of search engine pagination

Criteria on dates or metadata were lost when browsing search results.

If you have overloaded the "form-search-hidden " or "pagination" templates, you must add the following hidden fields to the 2 templates XSL.

<!-- Metadata -->     
<xsl:for-each select="/search/form/fields/metadata">     
 <xsl:variable name="value" select="/search/form/values/metadata/metadata[@name = current()/@name]"/>     
 <input type="hidden" name="metadata-{translate(@name, '/', '.')}" value="{$value}"/>     
</xsl:for-each>     
                    
<!-- Dates -->     
<xsl:if test="/search/form/fields/dates = 'true'">     
 <input type="hidden" name="startDate" value="{/search/form/values/startDate}"/>     
    <input type="hidden" name="endDate" value="{/search/form/values/endDate}"/>     
</xsl:if>     

AmetysXSLTHelper

The siteUriPrefix(String sitename) method has been removed as it can't work. Use absoluteSiteUriPrefix(String sitename) if you want to link to other sites.

Class CSS "hidden-L" in the calendar service

The CSS "hidden-L" class, positioned in JS over the event categories in the full-page calendar, has been renamed "event-category-title".
If you want the categories to remain hidden in the calendar, add the following CSS instruction to your charter:

.event-category-title {     
    position: absolute;     
    left: -20000px;     
    top: -20000px;     
}     

Search engine and listings

The metadata listed is now searchable and displayable in its own right. This has necessitated a change in the input XML : but the existing XML has been retained and so compatibility with the existing is assured for the time being.

If you want to be at the top of your game, start by checking whether you've overloaded the "form-search-by-metadata" template: if so, you'll need to migrate it a bit like the kernel: I invite you to consult this code diff https://code.ametys.org/projects/AMETYS /repos/web/commits/9046b80feeeb178df76333b40dc8706158b5f3c9#main/ plugin-web/pages/services/search/search-criteria/search-criteria_3 .3. xsl

Pour résumer, avant on avait /search/form/fields/metadata qui listait les libellés des metadonnées, et maintenant on a /search/form/fields/metadataDef qui liste des sous-balises : <label> et éventuellement <enumeration>.

Newsletter template migration (model.xml)

Since the TinyMce update, the attributes to be used for images in newsletter models (models/model.xml) are no longer :

<img ametys_type="external" ametys_src="./skins/InternetAgglo/resources/img/newsletter/bg-people.jpg" alt=""/>     

but :

<img data-ametys-type="external" data-ametys-src="./skins/InternetAgglo/resources/img/newsletter/bg-people.jpg" alt=""/>     

 

Back to top