Skip to content

Commit

Permalink
UBO-18 unify name identifier handling (#316)
Browse files Browse the repository at this point in the history
* UBO-18 unify name identifier handling
* UBO-18 use name identifier classification and code refacturing
* UBO-18 do not display identifier marked with x-display=false
* UBO-18 set color of connected author icon to primary color
  • Loading branch information
kkrebs authored and Possommi committed Sep 5, 2023
1 parent 4959a57 commit 2e09307
Show file tree
Hide file tree
Showing 3 changed files with 133 additions and 116 deletions.
19 changes: 19 additions & 0 deletions ubo-cli/src/main/setup/classifications/nameIdentifier.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,37 @@
<category ID="scopus">
<label xml:lang="de" text="SCOPUS" />
<label xml:lang="en" text="SCOPUS" />
<label xml:lang="x-display" text="true" />
<label xml:lang="x-uri" text="https://www.scopus.com/authid/detail.url?partnerID=HzOxMe3b&amp;origin=inward&amp;authorId=" />
</category>
<category ID="gnd">
<label xml:lang="de" text="GND" />
<label xml:lang="en" text="GND" />
<label xml:lang="x-display" text="true" />
<label xml:lang="x-uri" text="https://d-nb.info/gnd/" />
</category>
<category ID="researcherid">
<label xml:lang="de" text="ResearcherID" />
<label xml:lang="en" text="ResearcherID" />
<label xml:lang="x-display" text="true" />
<label xml:lang="x-uri" text="http://www.researcherid.com/rid/" />
</category>
<category ID="orcid">
<label xml:lang="de" text="ORCID" />
<label xml:lang="en" text="ORCID" />
<label xml:lang="x-display" text="true" />
<label xml:lang="x-uri" text="https://orcid.org/" />
</category>
<category ID="lsf">
<label xml:lang="de" text="LSF ID" />
<label xml:lang="en" text="LSF ID" />
<label xml:lang="x-display" text="true" />
<label xml:lang="x-uri" text="https://www.uni-due.de/zim/services/suchdienste/mitarbeiter.php?id=" />
</category>
<category ID="local">
<label xml:lang="de" text="Lokale ID" />
<label xml:lang="en" text="Local ID" />
<label xml:lang="x-display" text="false" />
</category>
</categories>
</mycoreclass>
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@
cursor: pointer;
}

.is-connected-author {
color: $primary;
}

.ubo-mandatory::before {
content: "* \00A0";
}
Expand Down
226 changes: 110 additions & 116 deletions ubo-common/src/main/resources/xsl/mods-display.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,7 @@
<xsl:template match="mods:name[@type='personal' or @type='corporate']" mode="details">
<xsl:variable name="role" select="mods:role/mods:roleTerm[@type='code']" />
<xsl:variable name="list" select="../mods:name[mods:role/mods:roleTerm[@type='code']=$role]" />

<xsl:if test="count($list[1]|.)=1">

<div class="row">
Expand All @@ -483,6 +484,9 @@
</div>
<div class="col-9">
<xsl:for-each select="$list">
<xsl:variable name="is-corresponding-author" select="contains(mods:role/mods:roleTerm/@valueURI, 'author_roles#corresponding_author')" />
<xsl:variable name="is-connected-author" select="count(mods:nameIdentifier[@type='connection']) &gt; 0" />
<xsl:variable name="popId" select="generate-id()"/>
<span>
<xsl:attribute name="class">
<xsl:choose>
Expand All @@ -507,16 +511,33 @@

<xsl:apply-templates select="." />

<xsl:choose>
<xsl:when test="count(mods:nameIdentifier[@type='connection']) &gt;0">
<xsl:apply-templates select="mods:nameIdentifier[@type='connection']" />
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="mods:nameIdentifier[@type='orcid']" />
<xsl:apply-templates select="mods:nameIdentifier[not(@type='orcid')]" />
<xsl:apply-templates select="mods:role/mods:roleTerm" mode="corresponding-author"/>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="mods:nameIdentifier or $is-corresponding-author = true()">
<span id="{$popId}" title="{i18n:translate('person.search.information')}">
<xsl:attribute name="class">
<xsl:text>ubo-person-popover ml-1 fas fa-user</xsl:text>
<xsl:if test="$is-corresponding-author = true()">
<xsl:text>-edit</xsl:text>
</xsl:if>
<xsl:if test="$is-connected-author = true()">
<xsl:text> ubo-person-connected</xsl:text>
</xsl:if>
</xsl:attribute>
</span>

<div id="{$popId}-content" class="d-none">
<dl>
<xsl:choose>
<xsl:when test="count(mods:nameIdentifier[@type='connection']) &gt;0">
<xsl:apply-templates select="mods:nameIdentifier[@type='connection']" />
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="mods:nameIdentifier[not(@type='connection')]" />
</xsl:otherwise>
</xsl:choose>
</dl>
</div>
</xsl:if>

</span>
</xsl:for-each>

Expand All @@ -540,125 +561,98 @@
<xsl:if test="position() != last()"> / </xsl:if>
</xsl:template>

<xsl:param name="UBO.LSF.Link"/>

<xsl:template match="mods:nameIdentifier[@type='connection']">
<xsl:variable name="userXML" select="document(concat('userconnection:', text()))"/>
<xsl:variable name="userAttributeClassification" select="document('classification:metadata:-1:children:user_attributes')"/>
<xsl:variable name="popId" select="generate-id()"/>
<xsl:variable name="is-corresponding-author" select="contains(../mods:role/mods:roleTerm/@valueURI, 'author_roles#corresponding_author')"/>

<span id="{$popId}" title="{i18n:translate('person.search.information')}">
<xsl:attribute name="class">
<xsl:text>ubo-person-popover ml-1 fas fa-user</xsl:text>
<xsl:if test="$is-corresponding-author = true()">
<xsl:text>-edit</xsl:text>
</xsl:if>
</xsl:attribute>
</span>

<div id="{$popId}-content" class="d-none">
<dl>
<xsl:if test="count($userXML/user/attributes/attribute) &gt; 0">
<xsl:for-each select="$userXML/user/attributes/attribute">
<xsl:variable name="attrName" select="@name"/>
<xsl:variable name="classNode" select="$userAttributeClassification/.//category[@ID=$attrName]"/>
<xsl:if test="count($classNode)&gt;0 and count($classNode/label[@xml:lang='x-display' and @text='true'])&gt;0">
<dt>
<xsl:value-of select="$classNode/label[lang($CurrentLang)]/@text"/>
</dt>
<dd>
<xsl:choose>
<xsl:when test="$attrName='id_orcid'">
<!-- special display code for orcid -->
<xsl:variable name="url" select="concat($MCR.ORCID2.LinkURL,@value)" />
<a href="{$url}" title="ORCID iD: {@value}">
<xsl:value-of select="@value" />
<img alt="ORCID iD" src="{$WebApplicationBaseURL}images/orcid_icon.svg" class="orcid-icon" />
</a>
</xsl:when>
<xsl:when test="count($classNode/label[@xml:lang='x-uri']) &gt;0">
<!-- display as link -->
<a href="{$classNode/label[@xml:lang='x-uri']/@text}{@value}" title="{$classNode/label[lang($CurrentLang)]/@text}: {@value}">
<xsl:value-of select="@value" />
</a>
</xsl:when>
<xsl:otherwise>
<!-- display as text -->
<xsl:value-of select="@value" />
</xsl:otherwise>
</xsl:choose>
</dd>
</xsl:if>
</xsl:for-each>
<xsl:if test="count($userXML/user/attributes/attribute) &gt; 0">
<xsl:for-each select="$userXML/user/attributes/attribute">
<xsl:variable name="attrName" select="@name"/>
<xsl:variable name="classNode" select="$userAttributeClassification/.//category[@ID=$attrName]"/>
<xsl:if test="count($classNode)&gt;0 and count($classNode/label[@xml:lang='x-display' and @text='true'])&gt;0">
<dt>
<xsl:value-of select="$classNode/label[lang($CurrentLang)]/@text"/>
</dt>
<dd>
<xsl:choose>
<xsl:when test="$attrName='id_orcid'">
<!-- special display code for orcid -->
<xsl:variable name="url" select="concat($MCR.ORCID2.LinkURL,@value)" />
<a href="{$url}" title="ORCID iD: {@value}">
<xsl:value-of select="@value" />
<img alt="ORCID iD" src="{$WebApplicationBaseURL}images/orcid_icon.svg" class="orcid-icon" />
</a>
</xsl:when>
<xsl:when test="count($classNode/label[@xml:lang='x-uri']) &gt;0">
<!-- display as link -->
<a href="{$classNode/label[@xml:lang='x-uri']/@text}{@value}" title="{$classNode/label[lang($CurrentLang)]/@text}: {@value}">
<xsl:value-of select="@value" />
</a>
</xsl:when>
<xsl:otherwise>
<!-- display as text -->
<xsl:value-of select="@value" />
</xsl:otherwise>
</xsl:choose>
</dd>
</xsl:if>
</dl>
</div>
</xsl:template>

<xsl:template match="mods:nameIdentifier[@type='lsf']">
<span class="nameIdentifier lsf" title="LSF ID: {.}">
<a href="{$UBO.LSF.Link}{.}">LSF</a>
</span>
</xsl:template>

<xsl:template match="mods:nameIdentifier[@type='orcid']">
<xsl:variable name="url" select="concat($MCR.ORCID2.LinkURL,text())" />
<a href="{$url}" title="ORCID iD: {text()}">
<img alt="ORCID iD" src="{$WebApplicationBaseURL}images/orcid_icon.svg" class="orcid-icon" />
</a>
</xsl:template>

<xsl:template match="mods:nameIdentifier[@type='researcherid']">
<span class="nameIdentifier researcherid" title="ResearcherID: {.}">
<a href="http://www.researcherid.com/rid/{.}">ResearcherID</a>
</span>
</xsl:template>

<xsl:template match="mods:nameIdentifier[@type='gnd']">
<span class="nameIdentifier gnd" title="GND: {.}">
<a href="http://d-nb.info/gnd/{.}">GND</a>
</span>
</xsl:template>

<xsl:param name="UBO.Scopus.Author.Link" />

<xsl:template match="mods:nameIdentifier[@type='scopus']">
<span class="nameIdentifier scopus" title="SCOPUS Author ID: {.}">
<a href="{$UBO.Scopus.Author.Link}{.}">SCOPUS</a>
</span>
</xsl:for-each>
</xsl:if>
</xsl:template>

<xsl:param name="UBO.Local.Author.Link" />

<xsl:template match="mods:nameIdentifier[@type='local']">
<span class="nameIdentifier local" title="{i18n:translate('ubo.authorlink.local.title')}: {.}">
<xsl:choose>
<xsl:when test="string-length($UBO.Local.Author.Link) &gt; 0">
<a href="{$UBO.Local.Author.Link}{.}"><xsl:value-of select="i18n:translate('ubo.authorlink.local.text')" /></a>
</xsl:when>
<xsl:otherwise><xsl:value-of select="i18n:translate('ubo.authorlink.local.text')" /></xsl:otherwise>
</xsl:choose>
</span>
</xsl:template>
<xsl:variable name="nameIdentifierClassification" select="document('classification:metadata:-1:children:nameIdentifier')"/>

<xsl:template match="mods:nameIdentifier">
<xsl:variable name="badge.label">
<xsl:choose>
<xsl:when test="i18n:exists(concat('badge.nameIdentifier.', @type))">
<xsl:value-of select="i18n:translate(concat('badge.nameIdentifier.', @type))"/>
<xsl:variable name="identifierType" select="@type" />
<xsl:variable name="classNode" select="$nameIdentifierClassification/.//category[@ID=$identifierType]"/>
<xsl:choose>
<xsl:when test="$classNode/label[@xml:lang='x-display']/@text='false'"></xsl:when>
<xsl:when test="count($classNode)&gt;0 and $classNode/label[@xml:lang='x-display']/@text='true'">
<dt>
<xsl:value-of select="$classNode/label[lang($CurrentLang)]/@text"/>
</dt>
<dd>
<xsl:choose>
<xsl:when test="@type='orcid'">
<!-- special display code for orcid -->
<xsl:variable name="url" select="concat($MCR.ORCID2.LinkURL, .)" />
<a href="{$url}" title="ORCID iD: {.}">
<xsl:value-of select="." />
<img alt="ORCID iD" src="{$WebApplicationBaseURL}images/orcid_icon.svg" class="orcid-icon" />
</a>
</xsl:when>
<xsl:when test="count($classNode/label[@xml:lang='x-uri']) &gt;0">
<!-- display as link -->
<a href="{$classNode/label[@xml:lang='x-uri']/@text}{.}" title="{$classNode/label[lang($CurrentLang)]/@text}: {.}">
<xsl:value-of select="." />
</a>
</xsl:when>
<xsl:otherwise>
<!-- display as text -->
<xsl:value-of select="." />
</xsl:otherwise>
</xsl:choose>
</dd>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@type"/>
<xsl:variable name="identifier.label">
<xsl:choose>
<xsl:when test="i18n:exists(concat('badge.nameIdentifier.', @type))">
<xsl:value-of select="i18n:translate(concat('badge.nameIdentifier.', @type))"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@type"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<dt>
<xsl:value-of select="$identifier.label" />
</dt>
<dd>
<xsl:value-of select="." />
</dd>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>

<span class="nameIdentifier genericid" title="{@type}: '{.}'">
<a href="javascript:void(0)">
<xsl:value-of select="$badge.label" />
</a>
</span>
</xsl:template>

<!-- ========== Konferenz ========== -->
Expand Down

0 comments on commit 2e09307

Please sign in to comment.