geonetwork / core-geonetwork

GeoNetwork is a catalog application to manage spatially referenced resources. It provides powerful metadata editing and search functions as well as an interactive web map viewer. It is currently used in numerous Spatial Data Infrastructure initiatives across the world.
http://geonetwork-opensource.org/
GNU General Public License v2.0
410 stars 486 forks source link

Option to switch between characterString and Anchor #2867

Open pvgenuchten opened 6 years ago

pvgenuchten commented 6 years ago

Switching between anchor and characterstring New INSPIRE guidelines suggest to replace characterstring by anchor where relevant. To facilitate this we need functionality to switch between characterstring and anchor.

I suggest to create a new directive which allows to switch between character string and anchor

pvgenuchten commented 5 years ago

The directive can be configured for all fields that are suggested by TG's to potentially be anchors like gmd:identifier, gmd:suplementalinformation, gmd:protocol, gmd:organisationName

comment form @josegar74: Create a new directive that has 2 modes:

The initial mode is calculated from the element child that should be send to the directive. For the 1st mode display: [INPUT TEXT] [SWITCHER BUTTON] For the 2st mode display: [INPUT TEXT] [INPUT TEXT] [SWITCHER BUTTON]

The directive depending on the mode should update a hidden field with the id _REF_xml that will create the snippets for characterString/Anchor based on the UI input

For now we need to deal with xml snippets in the directive, I'm sorry it's not optimal, but if someone comes with a better idea (no hacks that can produce invalid xml), we should consider them With that directive we can support these cases:

fxprunayre commented 5 years ago

id _REF_xml that will create the snippets for characterstring/anchor based on the UI input

I think we should avoid that when possible to avoid to have to deal with some XML creation depending on schema on the client side which is also quite complex with Anchor/CharacterString+multilingualism. I don't really see why the current rule which is 'if you provide a link, encode with an Anchor, if not a CharacterString' will not work ? Do we need to force usage of Anchor in some cases ? BTW, we need to improve the current layout by providing a 'add a link/update link' button.

pvgenuchten commented 5 years ago

@fxprunayre, thank you for your comment, the challenge is: where can users add a link if the element is a string element

For sure I prefer not to introduce xml on the editor-scripts. Alternative suggestion is to store the output of this directive as

<gco:characterString>
{string}@{url}
</gco:characterString>

and let update-fixed-info transform this to

<gmx:Anchor xlink:href="{url}">{string}</gmx:Anchor>

BTW, we need to improve the current layout by providing a 'add a link/update link' button.

This is exactly what this issue tries to solve, if you have any suggestion to design better, let us know

fxprunayre commented 5 years ago

This is exactly what this issue tries to solve, if you have any suggestion to design better, let us know

A directive could display a "add a link" button which then create the input with xlink:href (like we did with the keyword picker directive https://github.com/geonetwork/core-geonetwork/blob/master/web-ui/src/main/resources/catalog/components/thesaurus/ThesaurusDirective.js#L574-L601). Then server side takes care of creating Anchor or CharacterString depending on the presence of the xlink:href no ?