-
Notifications
You must be signed in to change notification settings - Fork 7
MIR-1556 migrate solr response #1319
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 0 additions & 37 deletions
37
mir-module/src/main/resources/xsl/relatedItem-subselect.xsl
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
10 changes: 10 additions & 0 deletions
10
mir-module/src/main/resources/xslt/badges/mir-badges-base.xsl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <xsl:stylesheet version="3.0" | ||
| xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | ||
| exclude-result-prefixes="#all"> | ||
|
|
||
| <xsl:import href="xslImport:badges:badges/mir-badges-base.xsl"/> | ||
|
|
||
| <xsl:template match="doc" mode="badge"/> | ||
|
|
||
| </xsl:stylesheet> |
68 changes: 68 additions & 0 deletions
68
mir-module/src/main/resources/xslt/badges/mir-badges-date.xsl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <xsl:stylesheet version="3.0" | ||
| xmlns:mirdateconverter="http://www.mycore.de/xslt/mirdateconverter" | ||
| xmlns:mods="http://www.loc.gov/mods/v3" | ||
| xmlns:xs="http://www.w3.org/2001/XMLSchema" | ||
| xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | ||
| exclude-result-prefixes="#all"> | ||
|
|
||
| <xsl:import href="xslImport:badges:badges/mir-badges-date.xsl"/> | ||
| <xsl:include href="resource:xslt/badges/mir-badges-utils.xsl"/> | ||
|
|
||
| <xsl:template match="doc" mode="badge"> | ||
| <xsl:apply-imports/> | ||
|
|
||
| <xsl:choose> | ||
| <xsl:when test="str[@name='mods.dateIssued'] or str[@name='mods.dateIssued.host']"> | ||
| <xsl:call-template name="output-date-badge"> | ||
| <xsl:with-param name="date" select="str[@name='mods.dateIssued'] | str[@name='mods.dateIssued.host']"/> | ||
| </xsl:call-template> | ||
| </xsl:when> | ||
| <xsl:when test="field[@name='mods.dateIssued'] or field[@name='mods.dateIssued.host']"> | ||
| <xsl:call-template name="output-date-badge"> | ||
| <xsl:with-param name="date" select="field[@name='mods.dateIssued'] | field[@name='mods.dateIssued.host']"/> | ||
| </xsl:call-template> | ||
| </xsl:when> | ||
| </xsl:choose> | ||
| </xsl:template> | ||
|
|
||
| <xsl:template name="output-date-badge"> | ||
| <xsl:param name="date"/> | ||
| <xsl:variable name="label"> | ||
| <xsl:call-template name="format-date-label"> | ||
| <xsl:with-param name="date" select="string(($date)[1])"/> | ||
| </xsl:call-template> | ||
| </xsl:variable> | ||
|
|
||
| <xsl:call-template name="output-badge"> | ||
| <xsl:with-param name="class" select="'mir-badge-date'"/> | ||
| <xsl:with-param name="label" select="$label"/> | ||
| <xsl:with-param name="link" select="concat($ServletsBaseURL, 'solr/find?condQuery=*&fq=mods.dateIssued:%22', string(($date)[1]), '%22')"/> | ||
| <xsl:with-param name="tooltip" select="document('i18n:mir.date.published')/i18n/text()"/> | ||
| </xsl:call-template> | ||
| </xsl:template> | ||
|
|
||
| <xsl:template name="format-date-label"> | ||
| <xsl:param name="date" as="xs:string?"/> | ||
| <xsl:variable name="normalized" select="mirdateconverter:convert-date($date, 'ISO8601')"/> | ||
|
|
||
| <xsl:choose> | ||
| <xsl:when test="matches($normalized, '^\d{4}$')"> | ||
| <xsl:value-of select="$normalized"/> | ||
| </xsl:when> | ||
| <xsl:when test="matches($normalized, '^\d{4}-\d{2}$')"> | ||
| <xsl:value-of select="$normalized"/> | ||
| </xsl:when> | ||
| <xsl:when test="matches($normalized, '^\d{4}-\d{2}-\d{2}$')"> | ||
| <xsl:value-of select="format-date(xs:date($normalized), '[Y0001]-[M01]-[D01]')"/> | ||
| </xsl:when> | ||
| <xsl:when test="$normalized castable as xs:dateTime"> | ||
| <xsl:value-of select="format-dateTime(xs:dateTime($normalized), '[Y0001]-[M01]-[D01] [H01]:[m01]')"/> | ||
| </xsl:when> | ||
| <xsl:otherwise> | ||
| <xsl:value-of select="$normalized"/> | ||
| </xsl:otherwise> | ||
| </xsl:choose> | ||
| </xsl:template> | ||
|
|
||
| </xsl:stylesheet> | ||
48 changes: 48 additions & 0 deletions
48
mir-module/src/main/resources/xslt/badges/mir-badges-genre.xsl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <xsl:stylesheet version="3.0" | ||
| xmlns:mcrclassification="http://www.mycore.de/xslt/classification" | ||
| xmlns:mods="http://www.loc.gov/mods/v3" | ||
| xmlns:xlink="http://www.w3.org/1999/xlink" | ||
| xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | ||
| exclude-result-prefixes="#all"> | ||
|
|
||
| <xsl:import href="xslImport:badges:badges/mir-badges-genre.xsl"/> | ||
| <xsl:include href="resource:xslt/badges/mir-badges-utils.xsl"/> | ||
|
|
||
| <xsl:template match="doc" mode="badge"> | ||
| <xsl:apply-imports/> | ||
|
|
||
| <xsl:choose> | ||
| <xsl:when test="arr[@name='mods.genre']"> | ||
| <xsl:for-each select="arr[@name='mods.genre']/str"> | ||
| <xsl:call-template name="output-genre-badge"> | ||
| <xsl:with-param name="genre" select="."/> | ||
| </xsl:call-template> | ||
| </xsl:for-each> | ||
| </xsl:when> | ||
| <xsl:when test="field[@name='mods.genre']"> | ||
| <xsl:for-each select="field[@name='mods.genre']"> | ||
| <xsl:call-template name="output-genre-badge"> | ||
| <xsl:with-param name="genre" select="."/> | ||
| </xsl:call-template> | ||
| </xsl:for-each> | ||
| </xsl:when> | ||
| <xsl:otherwise> | ||
| <xsl:call-template name="output-genre-badge"> | ||
| <xsl:with-param name="genre" select="'article'"/> | ||
| </xsl:call-template> | ||
| </xsl:otherwise> | ||
| </xsl:choose> | ||
| </xsl:template> | ||
|
|
||
| <xsl:template name="output-genre-badge"> | ||
| <xsl:param name="genre"/> | ||
| <xsl:call-template name="output-badge"> | ||
| <xsl:with-param name="class" select="concat('mir-badge-genre-', $genre)"/> | ||
| <xsl:with-param name="label" select="mcrclassification:current-label-text(mcrclassification:category('mir_genres', $genre))"/> | ||
| <xsl:with-param name="link" select="concat($ServletsBaseURL, 'solr/find?condQuery=*&fq=category.top:%22mir_genres:', $genre, '%22')"/> | ||
| <xsl:with-param name="tooltip" select="substring-before(document('i18n:component.mods.genre')/i18n/text(), ':')"/> | ||
| </xsl:call-template> | ||
| </xsl:template> | ||
|
|
||
| </xsl:stylesheet> |
53 changes: 53 additions & 0 deletions
53
mir-module/src/main/resources/xslt/badges/mir-badges-license.xsl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <xsl:stylesheet version="3.0" | ||
| xmlns:mcrclassification="http://www.mycore.de/xslt/classification" | ||
| xmlns:mods="http://www.loc.gov/mods/v3" | ||
| xmlns:xlink="http://www.w3.org/1999/xlink" | ||
| xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | ||
| exclude-result-prefixes="#all"> | ||
|
|
||
| <xsl:import href="xslImport:badges:badges/mir-badges-license.xsl"/> | ||
| <xsl:include href="resource:xslt/badges/mir-badges-utils.xsl"/> | ||
|
|
||
| <xsl:template match="doc" mode="badge"> | ||
| <xsl:apply-imports/> | ||
|
|
||
| <xsl:choose> | ||
| <xsl:when test="arr[@name='category.top']/str[contains(text(), 'mir_licenses:')]"> | ||
| <xsl:call-template name="output-license-badge"> | ||
| <xsl:with-param name="accessConditionClass" select="arr[@name='category.top']/str[contains(text(), 'mir_licenses:')][last()]"/> | ||
| </xsl:call-template> | ||
| </xsl:when> | ||
| <xsl:when test="field[@name='category.top'][starts-with(., 'mir_licenses:')]"> | ||
| <xsl:call-template name="output-license-badge"> | ||
| <xsl:with-param name="accessConditionClass" select="field[@name='category.top'][starts-with(., 'mir_licenses:')][last()]"/> | ||
| </xsl:call-template> | ||
| </xsl:when> | ||
| </xsl:choose> | ||
| </xsl:template> | ||
|
|
||
| <xsl:template name="output-license-badge"> | ||
| <xsl:param name="accessConditionClass"/> | ||
| <xsl:variable name="accessCondition" select="substring-after($accessConditionClass, ':')"/> | ||
| <xsl:variable name="label"> | ||
| <xsl:choose> | ||
| <xsl:when test="contains($accessCondition, 'rights_reserved')"> | ||
| <xsl:value-of select="document('i18n:component.mods.metaData.dictionary.rightsReserved')/i18n/text()"/> | ||
| </xsl:when> | ||
| <xsl:when test="contains($accessCondition, 'oa_nlz')"> | ||
| <xsl:value-of select="document('i18n:component.mods.metaData.dictionary.oa_nlz.short')/i18n/text()"/> | ||
| </xsl:when> | ||
| <xsl:otherwise> | ||
| <xsl:value-of select="mcrclassification:current-label-text(mcrclassification:category('mir_licenses', $accessCondition))"/> | ||
| </xsl:otherwise> | ||
| </xsl:choose> | ||
| </xsl:variable> | ||
| <xsl:call-template name="output-badge"> | ||
| <xsl:with-param name="class" select="concat('mir-badge-license-', $accessCondition)"/> | ||
| <xsl:with-param name="label" select="$label"/> | ||
| <xsl:with-param name="link" select="concat($ServletsBaseURL, 'solr/find?condQuery=*&fq=category:%22', $accessConditionClass, '%22')"/> | ||
| <xsl:with-param name="tooltip" select="document('i18n:mir.rights')/i18n/text()"/> | ||
| </xsl:call-template> | ||
| </xsl:template> | ||
|
|
||
| </xsl:stylesheet> |
37 changes: 37 additions & 0 deletions
37
mir-module/src/main/resources/xslt/badges/mir-badges-oa.xsl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <xsl:stylesheet version="3.0" | ||
| xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | ||
| exclude-result-prefixes="#all"> | ||
|
|
||
| <xsl:import href="xslImport:badges:badges/mir-badges-oa.xsl"/> | ||
| <xsl:include href="resource:xslt/badges/mir-badges-utils.xsl"/> | ||
|
|
||
| <xsl:template match="doc" mode="badge"> | ||
| <xsl:apply-imports/> | ||
|
|
||
| <xsl:call-template name="output-oa-badge"> | ||
| <xsl:with-param name="isOpenAccess" select="bool[@name='worldReadableComplete']='true' or field[@name='worldReadableComplete']='true'"/> | ||
| </xsl:call-template> | ||
| </xsl:template> | ||
|
|
||
| <xsl:template name="output-oa-badge"> | ||
| <xsl:param name="isOpenAccess"/> | ||
|
|
||
| <xsl:variable name="icon-class"> | ||
| <xsl:choose> | ||
| <xsl:when test="$isOpenAccess"> | ||
| <xsl:value-of select="'fas fa-unlock-alt'"/> | ||
|
yagee-de marked this conversation as resolved.
|
||
| </xsl:when> | ||
| <xsl:otherwise> | ||
| <xsl:value-of select="'fas fa-lock'"/> | ||
| </xsl:otherwise> | ||
| </xsl:choose> | ||
| </xsl:variable> | ||
|
|
||
| <xsl:call-template name="output-badge"> | ||
| <xsl:with-param name="class" select="concat('mir-badge-oa-', $isOpenAccess)"/> | ||
| <xsl:with-param name="tooltip" select="document(concat('i18n:mir.response.openAccess.', $isOpenAccess))/i18n/text()"/> | ||
| <xsl:with-param name="icon-class" select="$icon-class"/> | ||
| </xsl:call-template> | ||
| </xsl:template> | ||
| </xsl:stylesheet> | ||
39 changes: 39 additions & 0 deletions
39
mir-module/src/main/resources/xslt/badges/mir-badges-orcid.xsl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <xsl:stylesheet version="3.0" | ||
| xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | ||
| exclude-result-prefixes="#all"> | ||
|
|
||
| <xsl:import href="xslImport:badges:badges/mir-badges-orcid.xsl"/> | ||
| <xsl:import href="resource:xslt/orcid/mir-orcid-user.xsl"/> | ||
| <xsl:include href="resource:xslt/orcid/mir-orcid-work.xsl"/> | ||
| <xsl:include href="resource:xslt/badges/mir-badges-utils.xsl"/> | ||
|
|
||
|
yagee-de marked this conversation as resolved.
|
||
| <xsl:template match="doc" mode="badge"> | ||
| <xsl:apply-imports/> | ||
|
|
||
| <xsl:if test="not($isCurrentUserGuest) | ||
| and $isOrcidEnabled | ||
| and count($userOrcids) > 0 | ||
| and ( | ||
| str[@name='state'][. = 'published'] | ||
| or field[@name='state'][. = 'published'] | ||
| )"> | ||
| <xsl:variable name="currentUserMatchingTrustedIds"> | ||
| <xsl:call-template name="check-current-user-has-trusted-matching-id"> | ||
| <xsl:with-param name="nameIds" select="arr[@name='mods.nameIdentifier']/str | field[@name='mods.nameIdentifier']"/> | ||
| </xsl:call-template> | ||
| </xsl:variable> | ||
|
|
||
| <xsl:if test="normalize-space($currentUserMatchingTrustedIds) = 'true'"> | ||
| <xsl:variable name="objectId" select="string((str[@name='id'] | field[@name='id'])[1])"/> | ||
| <span class="badge mir-badge-orcid-in-profile" data-object-id="{$objectId}"> | ||
| <i class="fa-brands fa-orcid"></i> | ||
|
yagee-de marked this conversation as resolved.
|
||
| <span class="mir-badge-orcid-in-profile-text"> | ||
| <xsl:value-of select="document('i18n:mir.orcid.publication.badge.inProfile.loading')/i18n/text()"/> | ||
| </span> | ||
| </span> | ||
| </xsl:if> | ||
| </xsl:if> | ||
| </xsl:template> | ||
|
|
||
| </xsl:stylesheet> | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.