InputData - Several InputData for one template


This migration is not necessary if you have only one menu at a time referencing the link directory (apart from services) in a given template.

When multiple link-directory InputData can be brought up by a single template, or to make multiple menus from link-directory InputData in a single template. It is necessary to add identifiers to these InputData to differentiate them. In this way, customizations won't overlap.

Old method

Up to now, we've tried to refer to the theme to differentiate the links to be displayed in one menu or another. However, a link that belongs to more than one theme is automatically (de)selected from the various menus when one of them is customized.

<themes templates="index,page" configurable="true"> 
    <theme id="MESSAGERIE" lang="fr"/> 
    <theme id="AGENDA" lang="fr"/> 
    <theme id="APPLICATIONS_CLIENT" lang="fr"/> 
    <theme id="AUTRES_APPLICATIONS" lang="fr"/> 
</themes> 

For this example, we have a page header for the MESSAGING and AGENDA themes (which are not configurable via the charter, but are configurable via the declaration).

A customizable menu for links contained in APPLICATIONS_CLIENT, and another for AUTRES_APPLICATIONS.

In the chart, to select links belonging to a theme, we use the XPath expression :

/cms/inputData/linkDirectory/links/link[contains(themes, 'Autres applications')] 

Please note: It's not the theme identifier that's used, but the theme label.

When a link belongs to both APPLICATIONS_CLIENT and AUTRES_APPLICATIONS and is selected for bookmarking, even if this is done from the second menu, it is automatically bookmarked in both menus.

New method

Each menu needs to be separated and identified. To do this, we've added the notion of an InputData identifier: inputDataId.

<themes templates="index,page"> 
    <theme id="MESSAGERIE" lang="fr"/> 
    <theme id="AGENDA" lang="fr"/> 
</themes> 
<themes templates="index,page" configurable="true" inputDataId="appClient"> 
    <theme id="APPLICATIONS_CLIENT" lang="fr"/> 
</themes> 
<themes templates="index,page" configurable="true" inputDataId="appOther"> 
    <theme id="AUTRES_APPLICATIONS" lang="fr"/> 
</themes> 

In the chart, to retrieve the set of links corresponding to InputData, we use the XPath expression : 

/cms/inputData/linkDirectory[@id='appOther']/links/link 

Thus, when customizing, links are bookmarked according to the InputData identifier, and multiple themes can be selected for a single InputData.

Example

Link-themes file .xml:

<?xml version="1.0" encoding="UTF-8" ?>
<link-themes>
    <themes templates="index,page" configurable="true" displayUserLinks="true">
        <theme id="OUTILS" lang="fr"/>
        <theme id="TOOLS" lang="en"/>
    </themes>
</link-themes>

Old XML returned:

<linkDirectory applicable="true" configurable="true">
    <themes>
        <theme>directoryTheme://9afefe2e-9f17-4059-a9fc-21b68166879f</theme>
    </themes>
    <links>
        <link id="directoryLink://f9706d93-c83e-44fb-b22b-e012d797a8fe" lang="fr" url="http://www.ametys.org/forum/" urlType="URL" title="Forum" content="" alternative="Forum Ametys" pictureAlternative="" user-selected="false" color="#9900CC" pictureType="external" picturePath="picture" pictureName="chat.png" pictureSize="4497" imageType="link-metadata" limitedAccess="false" userLink="false" isHidden="false" status="NORMAL">
            <themes>Outils</themes>
        </link>
        <link id="directoryLink://2e62b33d-fe90-4447-b135-01b11d6e270e" lang="fr" url="https://fr-fr.facebook.com/AmetysCMS" urlType="URL" title="Facebook" content="" alternative="Facebook" pictureAlternative="" user-selected="false" color="#9900CC" pictureType="external" picturePath="picture" pictureName="facebook.png" pictureSize="2809" imageType="link-metadata" limitedAccess="false" userLink="false" isHidden="false" status="NORMAL">
            <themes>Outils</themes>
        </link>
        <link id="directoryLink://5a7746c6-1fe2-4292-9326-6fe88db24f9b" lang="fr" url="https://twitter.com/ametyscms" urlType="URL" title="Twitter" content="" alternative="Twitter" pictureAlternative="" user-selected="false" color="#9900CC" pictureType="external" picturePath="picture" pictureName="twitter_black.jpg" pictureSize="5140" imageType="link-metadata" limitedAccess="false" userLink="false" isHidden="false" status="NORMAL">
            <themes>Outils</themes>
        </link>
        <link id="directoryLink://c5bd0a76-d671-4f76-8f64-ddf63b5f9d8e" lang="fr" url="https://wiki.ametys.org/display/AMETYSFR/Documentation+du+CMS+Ametys" urlType="URL" title="Wiki" content="" alternative="Wiki Ametys" pictureAlternative="" user-selected="false" color="#9900CC" pictureType="external" picturePath="picture" pictureName="wiki.png" pictureSize="7008" imageType="link-metadata" limitedAccess="false" userLink="false" isHidden="false" status="NORMAL">
            <themes>Outils</themes>
        </link>
    </links>
</linkDirectory>

New XML returned :

<linkDirectory applicable="true" configurable="true" displayUserLinks="true" id="">
    <themes>
        <theme>directoryTheme://9afefe2e-9f17-4059-a9fc-21b68166879f</theme>
    </themes>
    <links>
        <link id="directoryLink://f9706d93-c83e-44fb-b22b-e012d797a8fe" lang="fr" url="http://www.ametys.org/forum/" urlType="URL" title="Forum" content="" alternative="Forum Ametys" pictureAlternative="" user-selected="false" color="#9900CC" pictureType="external" picturePath="picture" pictureName="chat.png" pictureSize="4497" imageType="link-metadata" limitedAccess="false" userLink="false" isHidden="false" status="NORMAL">
            <themes>
                <theme id="directoryTheme://9afefe2e-9f17-4059-a9fc-21b68166879f" name="OUTILS" label="Outils"/>
            </themes>
        </link>
        <link id="directoryLink://2e62b33d-fe90-4447-b135-01b11d6e270e" lang="fr" url="https://fr-fr.facebook.com/AmetysCMS" urlType="URL" title="Facebook" content="" alternative="Facebook" pictureAlternative="" user-selected="false" color="#9900CC" pictureType="external" picturePath="picture" pictureName="facebook.png" pictureSize="2809" imageType="link-metadata" limitedAccess="false" userLink="false" isHidden="false" status="NORMAL">
            <themes>
                <theme id="directoryTheme://9afefe2e-9f17-4059-a9fc-21b68166879f" name="OUTILS" label="Outils"/>
            </themes>
        </link>
        <link id="directoryLink://5a7746c6-1fe2-4292-9326-6fe88db24f9b" lang="fr" url="https://twitter.com/ametyscms" urlType="URL" title="Twitter" content="" alternative="Twitter" pictureAlternative="" user-selected="false" color="#9900CC" pictureType="external" picturePath="picture" pictureName="twitter_black.jpg" pictureSize="5140" imageType="link-metadata" limitedAccess="false" userLink="false" isHidden="false" status="NORMAL">
            <themes>
                <theme id="directoryTheme://9afefe2e-9f17-4059-a9fc-21b68166879f" name="OUTILS" label="Outils"/>
            </themes>
        </link>
        <link id="directoryLink://c5bd0a76-d671-4f76-8f64-ddf63b5f9d8e" lang="fr" url="https://wiki.ametys.org/display/AMETYSFR/Documentation+du+CMS+Ametys" urlType="URL" title="Wiki" content="" alternative="Wiki Ametys" pictureAlternative="" user-selected="false" color="#9900CC" pictureType="external" picturePath="picture" pictureName="wiki.png" pictureSize="7008" imageType="link-metadata" limitedAccess="false" userLink="false" isHidden="false" status="NORMAL">
            <themes>
                <theme id="directoryTheme://9afefe2e-9f17-4059-a9fc-21b68166879f" name="OUTILS" label="Outils"/>
            </themes>
        </link>
    </links>
</linkDirectory>

We can see that there are several differences:

  1. The displayUserLinks data is parsed, so it was previously impossible to define whether the custom links were to be parsed and whether the button was to be added, since the element was not visible.
  2. The InputData has an identifier, so you can create several of them to create different menus. However, this data is managed by default in the XSL kernel templates as empty. However, it can be parameterized to call up kernel templates on an InputData other than the one with the empty identifier (default identifier).
  3. The names of the themes to which each link belongs are no longer simply listed and separated by commas, but have independent tags.
Back to top