Skip to content

Commit

Permalink
CVOC : Adding hidden metadata fields (Ontoportal integration) (#10503)
Browse files Browse the repository at this point in the history
* Add hidden metadata fields for cvoc JS

* adding release note

* Accept review suggestion on documentation

* CVOC: fix typo to have "data-cvoc-managedfields" on dataset page visualization

* Add cvoc index to identity bloc metadata

---------

Co-authored-by: Jérôme ROUCOU <jerome.roucou@inrae.fr>
  • Loading branch information
luddaniel and jeromeroucou committed Jun 24, 2024
1 parent 9c098f9 commit 3dccdb7
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 6 deletions.
11 changes: 11 additions & 0 deletions doc/release-notes/10503-cvoc-hidden-html-fields.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## Release Highlights

### Updates on Support for External Vocabulary Services

#### Hidden HTML Fields

External Controlled Vocabulary scripts, configured via [:CVocConf](https://guides.dataverse.org/en/6.3/installation/config.html#cvocconf), can now access the values of managed fields as well as the term-uri-field for use in constructing the metadata view for a dataset.

Those values are hidden and can be found with the html attribute `data-cvoc-metadata-name`.

For more information, see [#10503](https://github.com/IQSS/dataverse/pull/10503).
25 changes: 19 additions & 6 deletions src/main/webapp/metadataFragment.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
<f:passThroughAttribute name="data-cvoc-service-url" value="#{cvocConf.get(dsf.datasetFieldType.id).getString('cvoc-url','')}" />
<f:passThroughAttribute name="data-cvoc-headers" value="#{cvocConf.get(dsf.datasetFieldType.id).containsKey('headers') ? cvocConf.get(dsf.datasetFieldType.id).get('headers').toString() : '{}'}"/>
<f:passThroughAttribute name="data-cvoc-protocol" value="#{cvocConf.get(dsf.datasetFieldType.id).getString('protocol','')}" />
<f:passThroughAttribute name="data-cvoc-managedfields" value="#{cvocConf.get(dsf.datasetFieldType.id).get('managedfields').toString()}" />
<f:passThroughAttribute name="data-cvoc-managedfields" value="#{cvocConf.get(dsf.datasetFieldType.id).get('managed-fields').toString()}" />
</h:outputText>
<h:outputText value="#{dsf.getDisplayValue(mdLangCode)}"
rendered="#{!dsf.datasetFieldType.allowMultiples and !cvocOnDsf}"
Expand All @@ -103,7 +103,7 @@
<f:passThroughAttribute name="data-cvoc-service-url" value="#{cvocConf.get(dsf.datasetFieldType.id).getString('cvoc-url','')}" />
<f:passThroughAttribute name="data-cvoc-headers" value="#{cvocConf.get(dsf.datasetFieldType.id).containsKey('headers') ? cvocConf.get(dsf.datasetFieldType.id).get('headers').toString() : '{}'}"/>
<f:passThroughAttribute name="data-cvoc-protocol" value="#{cvocConf.get(dsf.datasetFieldType.id).getString('protocol','')}" />
<f:passThroughAttribute name="data-cvoc-managedfields" value="#{cvocConf.get(dsf.datasetFieldType.id).get('managedfields').toString()}" />
<f:passThroughAttribute name="data-cvoc-managedfields" value="#{cvocConf.get(dsf.datasetFieldType.id).get('managed-fields').toString()}" />
</h:outputText>
</ui:repeat>
<ui:repeat value="#{dsf.getValues(mdLangCode)}" var="value" varStatus="loop" rendered="#{dsf.datasetFieldType.allowMultiples and !cvocOnDsf}">
Expand All @@ -125,7 +125,7 @@
</div>
</ui:fragment>

<ui:repeat value="#{dsf.datasetFieldCompoundValues}" var="compoundValue" varStatus="compoundValuesstatus">
<ui:repeat value="#{dsf.datasetFieldCompoundValues}" var="compoundValue" varStatus="compoundValuesStatus">

<ui:repeat value="#{compoundValue.displayValueMap.entrySet().toArray()}" var="cvPart" varStatus="partStatus">
<c:set var="cvocOnCvPart" value="#{cvocConf.containsKey(cvPart.key.datasetFieldType.id)}"/>
Expand All @@ -151,7 +151,8 @@
<f:passThroughAttribute name="data-cvoc-headers" value="#{cvocConf.get(cvPart.key.datasetFieldType.id).containsKey('headers') ? cvocConf.get(cvPart.key.datasetFieldType.id).get('headers').toString() : '{}'}"/>
<f:passThroughAttribute name="data-cvoc-protocol" value="#{cvocConf.get(cvPart.key.datasetFieldType.id).getString('protocol','')}" />
<!-- unlikely to be used in this case -->
<f:passThroughAttribute name="data-cvoc-managedfields" value="#{cvocConf.get(cvPart.key.datasetFieldType.id).get('managedfields').toString()}" />
<f:passThroughAttribute name="data-cvoc-managedfields" value="#{cvocConf.get(cvPart.key.datasetFieldType.id).get('managed-fields').toString()}" />
<f:passThroughAttribute name="data-cvoc-index" value="#{compoundValuesStatus.index}" />
</h:outputText>
<!-- Cvoc on parent field -->
<h:outputText value="#{cvPart.key.value}"
Expand All @@ -161,10 +162,22 @@
<f:passThroughAttribute name="data-cvoc-service-url" value="#{cvocConf.get(dsf.datasetFieldType.id).getString('cvoc-url','')}" />
<f:passThroughAttribute name="data-cvoc-headers" value="#{cvocConf.get(dsf.datasetFieldType.id).containsKey('headers') ? cvocConf.get(dsf.datasetFieldType.id).get('headers').toString() : '{}'}"/>
<f:passThroughAttribute name="data-cvoc-protocol" value="#{cvocConf.get(dsf.datasetFieldType.id).getString('protocol','')}" />
<f:passThroughAttribute name="data-cvoc-managedfields" value="#{cvocConf.get(dsf.datasetFieldType.id).get('managedfields').toString()}" />
<f:passThroughAttribute name="data-cvoc-managedfields" value="#{cvocConf.get(dsf.datasetFieldType.id).get('managed-fields').toString()}" />
<f:passThroughAttribute name="data-cvoc-index" value="#{compoundValuesStatus.index}" />
</h:outputText>
<!-- Cvoc for others fields -->
<h:outputText value="#{cvPart.key.value}"
escape="#{cvPart.key.datasetFieldType.isEscapeOutputText()}"
rendered="#{(cvocOnDsf or cvocOnCvPart) and not (
cvPart.key.datasetFieldType.name.equals(cvocConf.get(cvPart.key.datasetFieldType.id).getString('term-uri-field'))
or cvPart.key.datasetFieldType.name.equals(cvocConf.get(dsf.datasetFieldType.id).getString('term-uri-field')))}"
styleClass="hidden">
<f:passThroughAttribute name="hidden" value="hidden" />
<f:passThroughAttribute name="data-cvoc-metadata-name" value="#{cvPart.key.datasetFieldType.name}" />
<f:passThroughAttribute name="data-cvoc-index" value="#{compoundValuesStatus.index}" />
</h:outputText>
</ui:repeat>
<ui:fragment rendered="#{not compoundValuesstatus.last}">
<ui:fragment rendered="#{not compoundValuesStatus.last}">
<br/>
</ui:fragment>
</ui:repeat>
Expand Down

0 comments on commit 3dccdb7

Please sign in to comment.