Created
December 12, 2016 18:19
-
-
Save terrywbrady/307f6c95b17903c351516136336946aa to your computer and use it in GitHub Desktop.
Evaluating the access rights for a Thumbnail in DSpace XMLUI
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
<xsl:template name="gu-thumbnail-link"> | |
<xsl:param name="thumb" select="."/> | |
<xsl:param name="src"/> | |
<xsl:variable name="thumbmets" select="$EXTMETS//mets:fileSec/mets:fileGrp[@USE='THUMBNAIL']/mets:file[@GROUPID=$thumb/@GROUPID]"/> | |
<xsl:variable name="authid" select="$thumbmets/@ADMID"/> | |
<xsl:variable name="thumbauth" select="$EXTMETS//mets:rightsMD[@ID=$authid]"/> | |
<xsl:variable name="angrec" select="$thumbauth//metsrights:Context[@in-effect='true'][@CONTEXTCLASS='MANAGED GRP'][metsrights:UserName[text()=$GUCOMM]]"/> | |
<xsl:variable name="pubrec" select="$thumbauth//metsrights:Context[@in-effect='true'][@CONTEXTCLASS='GENERAL PUBLIC']"/> | |
<xsl:choose> | |
<xsl:when test="($angrec and $AUTH='yes') or ($pubrec)"> | |
<div class="artifact-preview"> | |
<div class="thumbnail"> | |
<xsl:variable name="thumbimg"> | |
<img alt="Thumbnail"> | |
<xsl:attribute name="src"> | |
<xsl:value-of select="$src" /> | |
</xsl:attribute> | |
<xsl:if test="$MICROTAG != $SCH_VID"> | |
<xsl:attribute name="itemprop">thumbnailUrl</xsl:attribute> | |
<xsl:attribute name="content"> | |
<xsl:value-of select="$src" /> | |
</xsl:attribute> | |
</xsl:if> | |
</img> | |
</xsl:variable> | |
<xsl:choose> | |
<xsl:when test="$FULLMODE"> | |
<a href="{mets:FLocat[@LOCTYPE='URL']/@xlink:href}"> | |
<xsl:copy-of select="$thumbimg"/> | |
</a> | |
</xsl:when> | |
<xsl:otherwise> | |
<xsl:copy-of select="$thumbimg"/> | |
</xsl:otherwise> | |
</xsl:choose> | |
</div> | |
</div> | |
</xsl:when> | |
<xsl:otherwise> | |
<div class="artifact-preview">Restricted Access</div> | |
</xsl:otherwise> | |
</xsl:choose> | |
</xsl:template> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment