core-geonetwork
core-geonetwork copied to clipboard
Update thesaurus picker directive to work in the metadata editor template fields
The thesaurus selector directive does not work correctly when used in template fields. It allows the value to be selected, but when saving the editor, the value is cleared.
This change adds some additional attributes to the directive to make it compatible with the template fields.
Test case:
- Edit the iso19139
config-editor.xml
and add at the end of the 'tab' section in thedefault
view:
<section>
<!-- QOS -->
<field name="DQ_ConceptualConsistency" or="report" removable="true"
xpath="/gmd:MD_Metadata/gmd:dataQualityInfo/gmd:DQ_DataQuality/gmd:report[gmd:DQ_ConceptualConsistency]"
templateModeOnly="true" notDisplayedIfMissing="true" del=".">
<template>
<values>
<key label="nameOfMeasure"
xpath="gmd:DQ_ConceptualConsistency/gmd:nameOfMeasure"
use="data-gn-keyword-picker"
tooltip="gmd:nameOfMeasure">
<directiveAttributes data-thesaurus-key="external.theme.httpinspireeceuropaeumetadatacodelistQualityOfServiceCriteria-QualityOfServiceCriteria"
data-order-by-id="true"
data-display-definition="true"
data-template-field="true"
data-template-field-element="gco:CharacterString"
data-template-field-element-with-concept-id="gmx:Anchor"
data-template-field-value="eval#gmd:DQ_ConceptualConsistency/gmd:nameOfMeasure/*/text()"
data-template-field-concept-id-value="eval#gmd:DQ_ConceptualConsistency/gmd:nameOfMeasure/gmx:Anchor/@xlink:href"
data-thesaurus-concept-id-attribute="xlinkCOLONhref"/>
</key>
<key label="measureDescription" tooltip="gmd:measureDescription" xpath="gmd:DQ_ConceptualConsistency/gmd:measureDescription/gco:CharacterString"></key>
<key label="value" tooltip="gmd:value" xpath="gmd:DQ_ConceptualConsistency/gmd:result/gmd:DQ_QuantitativeResult/gmd:value/gco:Record"></key>
<key label="valueUnit" tooltip="gmd:valueUnit" xpath="gmd:DQ_ConceptualConsistency/gmd:result/gmd:DQ_QuantitativeResult/gmd:valueUnit/@xlink:href">
<helper name="valueUnitHref" />
</key>
</values>
<snippet>
<gmd:report>
<gmd:DQ_ConceptualConsistency>
<gmd:nameOfMeasure>
{{nameOfMeasure}}
</gmd:nameOfMeasure>
<gmd:measureDescription>
<gco:CharacterString>{{measureDescription}}</gco:CharacterString>
</gmd:measureDescription>
<gmd:result>
<gmd:DQ_QuantitativeResult>
<gmd:valueUnit xlink:href="{{valueUnit}}"/>
<gmd:value>
<gco:Record>{{value}}</gco:Record>
</gmd:value>
</gmd:DQ_QuantitativeResult>
</gmd:result>
</gmd:DQ_ConceptualConsistency>
</gmd:report>
</snippet>
</template>
</field>
<action type="add"
btnLabel="Add_DQ_ConceptualConsistency"
name="DQ_ConceptualConsistency" or="report"
in="/gmd:MD_Metadata/gmd:dataQualityInfo/gmd:DQ_DataQuality">
<template>
<snippet>
<gmd:report>
<gmd:DQ_ConceptualConsistency>
<gmd:nameOfMeasure><gmx:Anchor xlink:href="http://"></gmx:Anchor></gmd:nameOfMeasure>
<gmd:measureDescription/>
<gmd:result>
<gmd:DQ_QuantitativeResult>
<gmd:valueUnit xlink:href="" />
<gmd:value>
<gco:Record></gco:Record>
</gmd:value>
</gmd:DQ_QuantitativeResult>
</gmd:result>
</gmd:DQ_ConceptualConsistency>
</gmd:report>
</snippet>
</template>
</action>
</section>
- Start up GeoNetwork, login as Administrator and load the INSPIRE thesaurus
Quality of Service criteria code
-
Load the iso19139 templates and create a metadata with the default iso19139 template.
-
At the end of the default view click the button
Add_DQ_ConceptualConsistency
, a new section is added. The first field allows to select the values from the INSPIRE thesaurusQuality of Service criteria code
. -
Click the button
Save metadata
:
- Without the change the form is updated and the selected value is cleared.
- With the change the value is preserved.