Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

None mandatory Linkage field has red asterisk mark #315

Open
wangf1122 opened this issue Mar 10, 2023 · 5 comments
Open

None mandatory Linkage field has red asterisk mark #315

wangf1122 opened this issue Mar 10, 2023 · 5 comments

Comments

@wangf1122
Copy link
Contributor

Some none mandatory fields for example linkage has the red astrix mark in front

image

The label for this field has no such condition as in this code.

<element name="gmd:linkage" id="397.0">
<label>Linkage</label>
<description>Location (address) for on-line access using a Uniform Resource Locator address
or similar addressing scheme such as http://www.statkart.no/isotc211</description>
<!--<condition>mandatory</condition>-->
</element>

I found the logic to place such required mark is probably related to the form builder and its parentEditInfo

https://github.com/geonetwork/core-geonetwork/blob/2731e560fd9e3a8cea16047082cf557d3c0978c5/web/src/main/webapp/xslt/ui-metadata/form-builder.xsl#L116-L120

And this parentEditInfo was passed from HNAP layout.xsl

<xsl:with-param name="parentEditInfo"
select="if ($refToDelete) then $refToDelete else gn:element"/>

So far, this is my investigation. This gmd:linkage is just one of them. There are couple of other fields are forced to set the gn_required (red astrix ) without stating the condition as mandatory.

@josegar74
Copy link
Contributor

The "problem" is that the code check is using also the cardinality of the element, that indeed is mandatory to be present in the XML:

http://www.datypic.com/sc/niem21/t-gmd_CI_OnlineResource_Type.html

But that doesn't really imply that the element must contain a value.

We could try to remove that check, and verify how affects other elements as probably some will require to add the condition as mandatory to be displayed as currently.

@ianwallen
Copy link
Contributor

Isn't the real problem that it should be based on gmd:onlineResource which is not mandatory according to the following:

http://www.datypic.com/sc/niem21/e-gmd_CI_Contact.html

And only if a the gmd:onlineResource is added then the linkage is required.

@ianwallen ianwallen changed the title None mandatory fields has red astrix mark None mandatory Linkage field has red asterisk mark Dec 8, 2023
@josegar74
Copy link
Contributor

gmd:linkage is mandatory in http://www.datypic.com/sc/niem21/e-gmd_CI_OnlineResource.html

By default, gmd:onlineResource is not added to contacts, unless you have that in your template, or add it in the advanced view, which adds the following:

 <gmd:onlineResource>
    <gmd:CI_OnlineResource>
        <gmd:linkage>
            <gmd:URL></gmd:URL>
        </gmd:linkage>
        <gmd:protocol gco:nilReason="missing">
            <gco:CharacterString/>
        </gmd:protocol>
        <gmd:name gco:nilReason="missing" xsi:type="gmd:PT_FreeText_PropertyType">
            <gco:CharacterString/>
        </gmd:name>
        <gmd:description gco:nilReason="missing" xsi:type="gmd:PT_FreeText_PropertyType">
            <gco:CharacterString/>
        </gmd:description>
    </gmd:CI_OnlineResource>
</gmd:onlineResource>  

In the default view, this information is flatten, so you just the linkage element, not the container. To remove it you need to go to the full view.

About the mandatory calculation, I think is used for 2 things:

  1. Show / hide the delete button. In this case as gmd:linkage is mandatory in the XSD doesn't allow you to remove it, what is correct.

  2. Add the mandatory asterisk. This is a bit more confusing, as the usage in GeoNetwork is to indicate XSD mandatory elements, but also can be customised in the labels.xml to define some non XSD mandatory elements, but that require the value filled to validate in the schema.

Maybe we should keep the current check just for 1) and for 2) use the configuration in labels.xml, but need some research.

@wangf1122
Copy link
Contributor Author

The "problem" is that the code check is using also the cardinality of the element, that indeed is mandatory to be present in the XML:

http://www.datypic.com/sc/niem21/t-gmd_CI_OnlineResource_Type.html

But that doesn't really imply that the element must contain a value.

We could try to remove that check, and verify how affects other elements as probably some will require to add the condition as mandatory to be displayed as currently.

@josegar74

Do you have any sample or suggestion where I can remove such check so I can give it some tests on my localhost?

@wangf1122
Copy link
Contributor Author

@josegar74 @ianwallen

I have prepared two pull request. One is for Geonetwork render-element in form-builder to have extra parameter to force checking the xsd schema.

geonetwork/core-geonetwork#8294

And one within the HNAP schema, to update the label xml to have the required fields be mandatory and not force to check the xsd schema.

#391

Please review and see if it fits the purpose of removing this linkage's red asterisk mark

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants