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

Tooltips in table field display incorrect message for cit:party/*/cit:name #8630

Open
ByronCinNZ opened this issue Jan 30, 2025 · 3 comments

Comments

@ByronCinNZ
Copy link
Contributor

ByronCinNZ commented Jan 30, 2025

Describe the bug
When editing an ISO19115-3 record in GN4.2.5, the tooltip text displays the wrong text for cit:party/*/cit:name - both for cit:CI_Organisation and cit:individual. Instead, it displays the value for '<element name="cit:name" context="cit:CI_OnlineResource" id="409.0">'

To Reproduce
Steps to reproduce the behavior (in an unmodified GN4.2.5):

  1. Go to 'Contribute->Add new record'
  2. Click on 'Template for geographical data' and click '+ Create"
  3. Click the 'Tooltips' checkbox under the Eyeball in the menubar
  4. Scroll down to 'Point of contact' in the new record and click on the 'Organisation' textfield
  5. See error in the value of text in tooltips being the value from labels.xml '<element name="cit:name" context="cit:CI_OnlineResource" id="409.0">'
  6. Expected value should come from '<element name="cit:name" context="cit:CI_Organisation(" id="376.0">'

Screenshots

Image

Log file
If applicable, add the server log file to help trace your problem.

Desktop (please complete the following information):

  • Browser Firefox
  • GeoNetwork Version 4.2.5
  • Server Application - Tomcat 9 with Java 8

Additional context
Add any other context about the problem here.

@ByronCinNZ
Copy link
Contributor Author

Further to this bug -
I noticed in inspector that data-gn-field-tooltip="iso19115-3.2018|cit:name|col|/mdb:MD_Metadata/mdb:identificationInfo/mri:MD_DataIdentification/mri:citation/cit:CI_Citation/cit:citedResponsibleParty/cit:CI_Responsibility/cit:party/
Notice the "|col|" in the path. This is what is throwing it off. If we include in "labels.xml" <element name="cit:name" context="col", we can change the text. However this does not allow use to distinguish between names for "cit:CI_Organisation" and "cit:CI_Individual".
Instead of "|col|", this should be "cit:CI_Organisation" and "cit:CI_Individual" respectively.

@ByronCinNZ
Copy link
Contributor Author

ByronCinNZ commented Feb 10, 2025

In "form-builder.xsl" we see the 'tooltips' varible populated this way:
<legend class="{$cls}" data-gn-field-tooltip="{$schema}|{name()}|{name(..)}|">
Not yet sure why it is finding "col" for "name(..)" when the data is displayed in a table in the editor. Is this because it expects the form to match the schema and when it looks at the parent of the element in the table it sees "col"?

@ByronCinNZ
Copy link
Contributor Author

ByronCinNZ commented Feb 12, 2025

Found and implemented a local fix. Hesitant to submit without a bit of feedback on the approach. The fix was indeed in form-builder.xml, but not the line cited above. This issue is that when data is in tables, the 'context' parameter, selected by name(..), selects the parent in the layout, not the parent element in the metadata. This is then passed as the 'context' element for a selection from 'labels.xml', which determines the content of the popup help message. We fixed this by checking if the value of name(..) is equal to col then setting it to the parent element in $xpath instead as shown bellow -
`<xsl:param name="parentXPath" required="no" as="xs:string" select="name(..)"/>

<xsl:variable name="parentxpath" as="xs:string">
  <xsl:choose>
    <!-- Hacky, where exactly is the issue? -->
    <xsl:when test="$parentXPath = 'col'">
      <xsl:value-of select="fn:tokenize($xpath, '/')[last() - 1]" />
    </xsl:when>
    <xsl:otherwise>
      <xsl:value-of select="$parentXPath" />
    </xsl:otherwise>
  </xsl:choose>
</xsl:variable>`

Our question is, is there a case where the parent value passed as 'context' would ever be more appropriately extracted from the page layout rather than the schema? If not, we can remove the condition and always set this to a value from the schema?
As a catalogue administrator (and standards focused), I would find it most natural to have help messages be related to the schema and not the layout.

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

1 participant