Internal directory link management


This page should only be used if the assisted migration script asks you to manually migrate code.20250717.INTRANET.InternalLinks

Version 2.3.0 of the Intranet Design charter supports internal links/applications.

A directory link is "internal" as soon as an IP address range is defined in the "IP restriction" site parameter of the "Link directory" category and an internal url , and only an internal url, is defined for a link.

Outside the internal IP range, the link must therefore be inactive.
Inactive links are saxed with the "disabled" attribute.

Until now, these links were not managed by the graphic charter.
This is now the case with the following rules:

  • disabled" links do not appear for notifications, quick access and user paths
  • for business applications, HR, favorites, etc. in the user menu, the links are present but are grayed out, not clickable, with no hover style and a "This link is inaccessible" tooltip.

This migration is recommended but not mandatory if the notion of internal link is not used.

If you've landed on this page, it's because your charter overloads at least one of the following XSL templates:

  • <xsl:template name="quick-access">
  • <xsl:template name="notifications-links">
  • <xsl:template name="home-links">
  • <xsl:template match="link" mode="app">

For the first 3, the migration is very simple, it consists in filtering links on the "disabled" attribute.
For example, replace: 

<xsl:apply-templates select="/cms/inputData/linkDirectory[@id='quickAccess']/links/link" mode="quick-access"/>

by

<xsl:apply-templates select="/cms/inputData/linkDirectory[@id='quickAccess']/links/link[not(@disabled)]" mode="quick-access"/>

The href, title and target attributes are now handled in three separate templates:

<xsl:apply-templates select="." mode="app-href-attr"/>
<xsl:apply-templates select="." mode="app-title-attr"/>
<xsl:apply-templates select="." mode="app-target-attr"/>

The disabled nature of links is handled in these templates. The href and target calculation must therefore be replaced by a call to these templates:

<a data-list-link="" class="ametys-tools-list__link" data-serverid="{@id}">
                <xsl:attribute name="href">
                    <xsl:choose>
                        <xsl:when test="@urlType = 'PAGE'">
                            <xsl:value-of select="resolver:resolve('page', @url)"/>
                        </xsl:when>
                        <xsl:otherwise>
                            <xsl:value-of select="@url"/>
                        </xsl:otherwise>
                    </xsl:choose>
              </xsl:attribute>
              <xsl:if test="@urlType != 'PAGE'"><xsl:attribute name="target">_blank</xsl:attribute></xsl:if>
<!-- [...] -->
</a>

becomes

<a data-list-link="" class="ametys-tools-list__link" data-serverid="{@id}">
              <xsl:apply-templates select="." mode="app-href-attr"/>
               <xsl:apply-templates select="." mode="app-title-attr"/>
               <xsl:apply-templates select="." mode="app-target-attr"/>
<!-- [...] -->
</a>

JIRA ticket: https: ametys 

Back to top