In v4.0, courses can be shared and thus linked to several courses. Some of the methods in the XSLT org.ametys.odf.OdfXSLTHelper helper have therefore evolved:
Method
ODF 2.6.x
ODF 4.0
getParentProgramStructure(String subProgramId, int depth)
Renvoie un seul nœud <program> contenant la structure de la formation parente
Renvoie autant de noeuds <program> qu'il y a de formation intégrant ce sous-programme. Si vous connaissez l'identifiant de la formation souhaitée, utilisez plutôt la méthode getProgramStructure.
getParentProgram (String subprogramId)
Renvoie un seul nœud <program> avec les informations de la formation parente
Oops!
Copy to clipboard failed. Open the code and copy it manually.
Renvoie autant de noeuds <program> qu'il y a de formation intégrant ce sous-programme. Si vous connaissez l'identifiant de la formation souhaitée, utilisez plutôt la méthode getProgram.
Oops!
Copy to clipboard failed. Open the code and copy it manually.
Useful: display the complete structure of a course in XSL
Voici un exemple de code XSL afin d'afficher la structure complète d'une formation (dans des <ul> <li>) sur une même page, avec les liens vers les pages des sous-programmes et UE enfants.
Oops!
Copy to clipboard failed. Open the code and copy it manually.
<xsl:template name="structure">
<!-- Récupérer la structure complète à l'aide du helper XSLT 'org.ametys.odf.OdfXSLTHelper' -->
<xsl:variable name="structure" select="odf:getProgramStructure(/view/content/@id, -1)"/>
<ul>
<xsl:apply-templates select="$structure" mode="structure">
<xsl:with-param name="parentId" select="/view/content/@id"/>
</xsl:apply-templates>
</ul>
</xsl:template>
<xsl:template match="subprogram" mode="structure">
<xsl:param name="parentId"/><!-- Id des parents par ordre ascendant, séparés par des ; -->
<li>
<a href="{resolver:resolve('odf', concat(@id, ';', $parentId))}"><xsl:value-of select="@title"/></a>
<xsl:if test="subprogram|courseList|container">
<ul>
<xsl:apply-templates select="subprogram|container|courseList" mode="structure">
<xsl:with-param name="parentId" select="concat(@id, ';', $parentId)"/>
</xsl:apply-templates>
</ul>
</xsl:if>
</li>
</xsl:template>
<xsl:template match="container" mode="structure">
<xsl:param name="parentId"/><!-- Id des parents par ordre ascendant, séparés par des ; -->
<li>
<xsl:value-of select="@title"/>
<xsl:if test="subprogram|courseList|container">
<ul>
<xsl:apply-templates select="subprogram|courseList|container" mode="structure">
<xsl:with-param name="parentId" select="$parentId"/>
</xsl:apply-templates>
</ul>
</xsl:if>
</li>
</xsl:template>
<xsl:template match="courseList" mode="structure">
<xsl:param name="parentId"/><!-- Id des parents par ordre ascendant, séparés par des ; -->
<li>
<xsl:value-of select="@title"/>
<xsl:if test="course">
<ul>
<xsl:apply-templates select="course" mode="structure">
<xsl:with-param name="parentId" select="$parentId"/>
</xsl:apply-templates>
</ul>
</xsl:if>
</li>
</xsl:template>
<xsl:template match="course" mode="structure">
<xsl:param name="parentId"/><!-- Id des parents par ordre ascendant, séparés par des ; -->
<li>
<a href="{resolver:resolve('odf', concat(@id, ';', $parentId))}"><xsl:value-of select="@title"/></a>
<xsl:if test="courseList">
<ul>
<xsl:apply-templates select="courseList" mode="structure">
<xsl:with-param name="parentId" select="concat(@id, ';', $parentId)"/>
</xsl:apply-templates>
</ul>
</xsl:if>
</li>
</xsl:template>
<xsl:template name="structure">
<!-- Récupérer la structure complète à l'aide du helper XSLT 'org.ametys.odf.OdfXSLTHelper' -->
<xsl:variable name="structure" select="odf:getProgramStructure(/view/content/@id, -1)"/>
<ul>
<xsl:apply-templates select="$structure" mode="structure">
<xsl:with-param name="parentId" select="/view/content/@id"/>
</xsl:apply-templates>
</ul>
</xsl:template>
<xsl:template match="subprogram" mode="structure">
<xsl:param name="parentId"/><!-- Id des parents par ordre ascendant, séparés par des ; -->
<li>
<a href="{resolver:resolve('odf', concat(@id, ';', $parentId))}"><xsl:value-of select="@title"/></a>
<xsl:if test="subprogram|courseList|container">
<ul>
<xsl:apply-templates select="subprogram|container|courseList" mode="structure">
<xsl:with-param name="parentId" select="concat(@id, ';', $parentId)"/>
</xsl:apply-templates>
</ul>
</xsl:if>
</li>
</xsl:template>
<xsl:template match="container" mode="structure">
<xsl:param name="parentId"/><!-- Id des parents par ordre ascendant, séparés par des ; -->
<li>
<xsl:value-of select="@title"/>
<xsl:if test="subprogram|courseList|container">
<ul>
<xsl:apply-templates select="subprogram|courseList|container" mode="structure">
<xsl:with-param name="parentId" select="$parentId"/>
</xsl:apply-templates>
</ul>
</xsl:if>
</li>
</xsl:template>
<xsl:template match="courseList" mode="structure">
<xsl:param name="parentId"/><!-- Id des parents par ordre ascendant, séparés par des ; -->
<li>
<xsl:value-of select="@title"/>
<xsl:if test="course">
<ul>
<xsl:apply-templates select="course" mode="structure">
<xsl:with-param name="parentId" select="$parentId"/>
</xsl:apply-templates>
</ul>
</xsl:if>
</li>
</xsl:template>
<xsl:template match="course" mode="structure">
<xsl:param name="parentId"/><!-- Id des parents par ordre ascendant, séparés par des ; -->
<li>
<a href="{resolver:resolve('odf', concat(@id, ';', $parentId))}"><xsl:value-of select="@title"/></a>
<xsl:if test="courseList">
<ul>
<xsl:apply-templates select="courseList" mode="structure">
<xsl:with-param name="parentId" select="concat(@id, ';', $parentId)"/>
</xsl:apply-templates>
</ul>
</xsl:if>
</li>
</xsl:template>
<xsl:template name="structure">
<!-- Récupérer la structure complète à l'aide du helper XSLT 'org.ametys.odf.OdfXSLTHelper' -->
<xsl:variable name="structure" select="odf:getProgramStructure(/view/content/@id, -1)"/>
<ul>
<xsl:apply-templates select="$structure" mode="structure">
<xsl:with-param name="parentId" select="/view/content/@id"/>
</xsl:apply-templates>
</ul>
</xsl:template>
<xsl:template match="subprogram" mode="structure">
<xsl:param name="parentId"/><!-- Id des parents par ordre ascendant, séparés par des ; -->
<li>
<a href="{resolver:resolve('odf', concat(@id, ';', $parentId))}"><xsl:value-of select="@title"/></a>
<xsl:if test="subprogram|courseList|container">
<ul>
<xsl:apply-templates select="subprogram|container|courseList" mode="structure">
<xsl:with-param name="parentId" select="concat(@id, ';', $parentId)"/>
</xsl:apply-templates>
</ul>
</xsl:if>
</li>
</xsl:template>
<xsl:template match="container" mode="structure">
<xsl:param name="parentId"/><!-- Id des parents par ordre ascendant, séparés par des ; -->
<li>
<xsl:value-of select="@title"/>
<xsl:if test="subprogram|courseList|container">
<ul>
<xsl:apply-templates select="subprogram|courseList|container" mode="structure">
<xsl:with-param name="parentId" select="$parentId"/>
</xsl:apply-templates>
</ul>
</xsl:if>
</li>
</xsl:template>
<xsl:template match="courseList" mode="structure">
<xsl:param name="parentId"/><!-- Id des parents par ordre ascendant, séparés par des ; -->
<li>
<xsl:value-of select="@title"/>
<xsl:if test="course">
<ul>
<xsl:apply-templates select="course" mode="structure">
<xsl:with-param name="parentId" select="$parentId"/>
</xsl:apply-templates>
</ul>
</xsl:if>
</li>
</xsl:template>
<xsl:template match="course" mode="structure">
<xsl:param name="parentId"/><!-- Id des parents par ordre ascendant, séparés par des ; -->
<li>
<a href="{resolver:resolve('odf', concat(@id, ';', $parentId))}"><xsl:value-of select="@title"/></a>
<xsl:if test="courseList">
<ul>
<xsl:apply-templates select="courseList" mode="structure">
<xsl:with-param name="parentId" select="concat(@id, ';', $parentId)"/>
</xsl:apply-templates>
</ul>
</xsl:if>
</li>
</xsl:template>
Services
Training Scheme Department
As a reminder, this service contains an image map whose zones redirect to the search engine with the pre-selection of a diploma type (bachelor's, master's, doctorate, etc.).
Links to the search engine must contain the identifier of the diploma searched for. In 2.6.x, the identifier corresponded to the diploma code ('XA', 'XB', ...). In v4, the identifier is the content identifier Ametys (in the form "content://xxxxx..."). The identifier Ametys must first be retrieved from the diploma code, using the getEntryId method in the helper XSLT org.ametys.odf.OdfXSLTHelper.
v4.0
Oops!
Copy to clipboard failed. Open the code and copy it manually.
The XML entry format has evolved for all search engines:
Each metadata search criterion is the subject of a form >fields > metadata node. If the criterion is an enumerated field (drop-down list), the possible values can be found in form >fields > metadata > enumeration > item.
The value sought for a metadata search criterion can be found in a form > values > metadata > metadata node.
If facets are enabled, they are listed for each field in form > facets > facet
XML input in 2.6.x
XML entry in 4.x
Oops!
Copy to clipboard failed. Open the code and copy it manually.
This new entry format is taken into account in all your overloads or own views on search engines ODF.
The following describes the modifications that have been made to XSL for plugin ODF -web.
Default view for courses (search_1.2.xsl)
For the default view, the file XSL search-criteria_1.2.xsl has been modified as follows:
Added import of service:web://pages/services/search/search-criteria/search-criteria_3.3.xsl. The rendering of the classic search engine now supports facets (in a drop-down list) and a list of generic metadata search criteria.
Removal of "common-service-head-title", "common-service-body-nonempty-content-title", "common-service-body-nonempty-content-content", "common-service-head-js" templates. Indeed, following the previous import, overloading these templates is unnecessary.
The facet-lists.js file no longer exists in plugin ODF , but must be imported from plugin web. Thanks to the previous import, this file is imported automatically if facets are enabled.
Template overload "form-search for :
add the hidden "catalog" field (required for facet calculation)
add the hidden "content-types" field (needed to calculate facets) => template XSL form-search-content-types
In the demo chart, using jqTransform, the following changes have been made to the search-criteria_1.2 file .xsl:
the common-service-head-js template has been renamed js-facets
l'import du fichier JS <script src="{ametys:pluginResourceURL('odf-web', 'js/search/facet-lists.i18n.js')}" type="text/javascript"></script> a été remplacé par <script src="{$uri-prefix}/plugins/web/resources/js/search/facet-lists.{$lang}.js" type="text/javascript"/>
Injection for jqTransform :
Oops!
Copy to clipboard failed. Open the code and copy it manually.
In the demo chart, using jqTransform, as for the previous view, the following modifications have been made to the search-course_2.3 file .xsl:
the common-service-head-js template has been renamed js-facets
l'import du fichier JS <script src="{ametys:pluginResourceURL('odf-web', 'js/search/facet-lists.i18n.js')}" type="text/javascript"></script> a été remplacé par <script src="{$uri-prefix}/plugins/web/resources/js/search/facet-lists.{$lang}.js" type="text/javascript"/>
Injection for jqTransform :
Oops!
Copy to clipboard failed. Open the code and copy it manually.
For this view, the file XSL search-criteria-links_1.3.xsl has been modified as follows:
The "form-search", "form-search-element", "form-search-element-selected-choice", "form-search-element-list-choice" templates have been adapted to the new XML input format:
to search the list of facets, instructions of the type /search/form/fields/*[starts-with(name(), 'criterion-enumerated-')] must be replaced by /search/form/facets/facet[item].
to search for the value of a selected facet, statements of type /search/form/values/*[name() = $elementName and normalize-space(.) != ''] must be replaced by /search/form/values/*/metadata[@name = $name and normalize-space(.) != ''].
For this view, the file XSL search-criteria-multiple.xsl has been modified as follows:
The "common-service-head-js" template has been renamed "js-facets".
The "form-search-element-title", "form-search-element-keywords", "form-search-element-allwords" and "form-search-element-exactwording" templates have been removed, as their overloading is unnecessary.
The template "form-search-element" has been replaced by the template "form-search-by-metadata-enum".
Views "classification of results by field" and "classification of results by field then diploma".
For these views, it's the input format for the "domain" and "degree" fields for each search result that has evolved:
In 2.6.x
Oops!
Copy to clipboard failed. Open the code and copy it manually.
<hit>
<content id="..." title="Licence LEA Anglais - Allemand">
<domain value="ALL">Art, Lettres et Langues</domain>
<degree value="XA">Licence</domain>
<!-- autres champs du contenus -->
</content>
</hit>
<hit>
<content id="..." title="Licence LEA Anglais - Allemand">
<domain value="ALL">Art, Lettres et Langues</domain>
<degree value="XA">Licence</domain>
<!-- autres champs du contenus -->
</content>
</hit>
<hit>
<content id="..." title="Licence LEA Anglais - Allemand">
<domain value="ALL">Art, Lettres et Langues</domain>
<degree value="XA">Licence</domain>
<!-- autres champs du contenus -->
</content>
</hit>
In 4.x
Oops!
Copy to clipboard failed. Open the code and copy it manually.
<hit>
<content id="..." title="Licence LEA Anglais - Allemand">
<domain id="content://xxxx" title="Art, Lettres et Langues" lang="fr" name="art-lettres-langues"/>
<degree id="content://yyyy" title="Licence" lang="fr" name="licence"/>
<!-- autres champs du contenus -->
</content>
</hit>
<hit>
<content id="..." title="Licence LEA Anglais - Allemand">
<domain id="content://xxxx" title="Art, Lettres et Langues" lang="fr" name="art-lettres-langues"/>
<degree id="content://yyyy" title="Licence" lang="fr" name="licence"/>
<!-- autres champs du contenus -->
</content>
</hit>
<hit>
<content id="..." title="Licence LEA Anglais - Allemand">
<domain id="content://xxxx" title="Art, Lettres et Langues" lang="fr" name="art-lettres-langues"/>
<degree id="content://yyyy" title="Licence" lang="fr" name="licence"/>
<!-- autres champs du contenus -->
</content>
</hit>
De fait, il faut remplacer les occurences de content/domain/@value par content/domain/@id et les occurences de <xsl:value-of select="content/domain"/> par <xsl:value-of select="content/domain/@title"/>
In addition, you need to be careful, as we now have a label for each reference table, whereas before we used to construct a name by hand! For example, for ECTS, we used to store "2" and then add "ECTS credits" to skin. Now the label can be directly "2 ECTS credits", so you need to remove the extra i18n keys in the skins.
Manager(s)
The Responsible(s) attribute (personInCharge) has changed its structure. It's now a repeater ... It must therefore be managed in skin :
We used to have
Oops!
Copy to clipboard failed. Open the code and copy it manually.
"Sub"-contents people and components in content display ODF
Previously, the persons and orgunits content referenced by the content to be displayed were placed after the main content SAX in persons and orgunits tags, which in turn contained tags with the name of the original metadata and then the "sub"-content saxed in turn.
The second level corresponding to the name of the metadata has been removed to avoid redundant content referenced several times in the main content.
For example, to retrieve a manager, the operation used to be as follows:
Oops!
Copy to clipboard failed. Open the code and copy it manually.