Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[DS-1193] display bitstream read access permissions on item page (squ…

…ashed)

This displays the bitstream READ rights information at the item page
in Mirage, but doesn't indicate whether the currently logged in user
has READ access.
  • Loading branch information...
commit 2499436c970fa5ba7818b0db208d6870f15b52cb 1 parent 3b1cc06
@helix84 authored
View
BIN  ...ce-xmlui-webapp/src/main/webapp/themes/Classic/images/Crystal_Clear_action_lock3_64px.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  ...ce-xmlui-webapp/src/main/webapp/themes/Kubrick/images/Crystal_Clear_action_lock3_64px.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  ...ace-xmlui-webapp/src/main/webapp/themes/Mirage/images/Crystal_Clear_action_lock3_64px.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
57 ...e-xmlui-webapp/src/main/webapp/themes/Mirage/lib/xsl/aspect/artifactbrowser/item-view.xsl
@@ -31,7 +31,9 @@
xmlns:xalan="http://xml.apache.org/xalan"
xmlns:encoder="xalan://java.net.URLEncoder"
xmlns:util="org.dspace.app.xmlui.utils.XSLUtils"
- exclude-result-prefixes="xalan encoder i18n dri mets dim xlink xsl util">
+ xmlns:jstring="java.lang.String"
+ xmlns:rights="http://cosimo.stanford.edu/sdr/metsrights/"
+ exclude-result-prefixes="xalan encoder i18n dri mets dim xlink xsl util jstring rights">
<xsl:output indent="yes"/>
@@ -481,16 +483,57 @@
</xsl:if>
</div>
<div class="file-link" style="height: {$thumbnail.maxheight}px;">
- <a>
- <xsl:attribute name="href">
- <xsl:value-of select="mets:FLocat[@LOCTYPE='URL']/@xlink:href"/>
- </xsl:attribute>
- <i18n:text>xmlui.dri2xhtml.METS-1.0.item-files-viewOpen</i18n:text>
- </a>
+ <xsl:choose>
+ <xsl:when test="@ADMID">
+ <xsl:call-template name="display-rights"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="view-open"/>
+ </xsl:otherwise>
+ </xsl:choose>
</div>
</div>
+ </xsl:template>
+
+ <xsl:template name="view-open">
+ <a>
+ <xsl:attribute name="href">
+ <xsl:value-of select="mets:FLocat[@LOCTYPE='URL']/@xlink:href"/>
+ </xsl:attribute>
+ <i18n:text>xmlui.dri2xhtml.METS-1.0.item-files-viewOpen</i18n:text>
+ </a>
+ </xsl:template>
+ <xsl:template name="display-rights">
+ <xsl:variable name="file_id" select="jstring:replaceAll(jstring:replaceAll(string(@ADMID), '_METSRIGHTS', ''), 'rightsMD_', '')"/>
+ <xsl:variable name="rights_declaration" select="../../../mets:amdSec/mets:rightsMD[@ID = concat('rightsMD_', $file_id, '_METSRIGHTS')]/mets:mdWrap/mets:xmlData/rights:RightsDeclarationMD"/>
+ <xsl:variable name="rights_context" select="$rights_declaration/rights:Context"/>
+ <xsl:variable name="users">
+ <xsl:for-each select="$rights_declaration/*">
+ <xsl:value-of select="rights:UserName"/>
+ <xsl:choose>
+ <xsl:when test="rights:UserName/@USERTYPE = 'GROUP'">
+ <xsl:text> (group)</xsl:text>
+ </xsl:when>
+ <xsl:when test="rights:UserName/@USERTYPE = 'INDIVIDUAL'">
+ <xsl:text> (individual)</xsl:text>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="position() != last()">, </xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="not ($rights_context/@CONTEXTCLASS = 'GENERAL PUBLIC') and ($rights_context/rights:Permissions/@DISPLAY = 'true')">
+ <a href="{mets:FLocat[@LOCTYPE='URL']/@xlink:href}">
+ <img width="64" height="64" src="{concat($theme-path,'/images/Crystal_Clear_action_lock3_64px.png')}" title="Read access available for {$users}"/>
+ <!-- icon source: http://commons.wikimedia.org/wiki/File:Crystal_Clear_action_lock3.png -->
+ </a>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="view-open"/>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:template>
</xsl:stylesheet>
View
BIN  ...-xmlui-webapp/src/main/webapp/themes/Reference/images/Crystal_Clear_action_lock3_64px.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
13 ...space-xmlui-webapp/src/main/webapp/themes/dri2xhtml-alt/aspect/artifactbrowser/common.xsl
@@ -32,7 +32,8 @@
xmlns="http://www.w3.org/1999/xhtml"
xmlns:xalan="http://xml.apache.org/xalan"
xmlns:encoder="xalan://java.net.URLEncoder"
- exclude-result-prefixes="xalan encoder i18n dri mets dim xlink xsl">
+ xmlns:confman="org.dspace.core.ConfigurationManager"
+ exclude-result-prefixes="i18n dri mets dim xlink xsl xalan encoder confman">
<xsl:output indent="yes"/>
@@ -187,11 +188,19 @@
</xsl:template>
<xsl:template match="dri:reference" mode="summaryView">
+ <!-- simplified check to verify whether access rights are available in METS -->
+ <xsl:variable name='METSRIGHTS-enabled' select="contains(confman:getProperty('plugin.named.org.dspace.content.crosswalk.DisseminationCrosswalk'), 'METSRIGHTS')" />
<xsl:variable name="externalMetadataURL">
<xsl:text>cocoon:/</xsl:text>
<xsl:value-of select="@url"/>
- <!-- No options selected, render the full METS document -->
+ <!-- If this is an Item, display the METSRIGHTS section, so we
+ know which files have access restrictions.
+ This requires the METSRightsCrosswalk to be enabled! -->
+ <xsl:if test="@type='DSpace Item' and $METSRIGHTS-enabled">
+ <xsl:text>?rightsMDTypes=METSRIGHTS</xsl:text>
+ </xsl:if>
</xsl:variable>
+ <!-- This comment just displays the full URL in an HTML comment, for easy reference. -->
<xsl:comment> External Metadata URL: <xsl:value-of select="$externalMetadataURL"/> </xsl:comment>
<xsl:apply-templates select="document($externalMetadataURL)" mode="summaryView"/>
<xsl:apply-templates />
View
60 dspace-xmlui/dspace-xmlui-webapp/src/main/webapp/themes/dri2xhtml/General-Handler.xsl
@@ -22,7 +22,9 @@
xmlns:xlink="http://www.w3.org/TR/xlink/"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns="http://www.w3.org/1999/xhtml"
- exclude-result-prefixes="i18n dri mets xlink xsl">
+ xmlns:jstring="java.lang.String"
+ xmlns:rights="http://cosimo.stanford.edu/sdr/metsrights/"
+ exclude-result-prefixes="i18n dri mets xlink xsl jstring rights">
<xsl:output indent="yes"/>
@@ -162,12 +164,14 @@
</a>
</xsl:when>
<xsl:otherwise>
- <a>
- <xsl:attribute name="href">
- <xsl:value-of select="mets:FLocat[@LOCTYPE='URL']/@xlink:href"/>
- </xsl:attribute>
- <i18n:text>xmlui.dri2xhtml.METS-1.0.item-files-viewOpen</i18n:text>
- </a>
+ <xsl:choose>
+ <xsl:when test="@ADMID">
+ <xsl:call-template name="display-rights"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="view-open"/>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:otherwise>
</xsl:choose>
</td>
@@ -181,6 +185,48 @@
</tr>
</xsl:template>
+ <xsl:template name="view-open">
+ <a>
+ <xsl:attribute name="href">
+ <xsl:value-of select="mets:FLocat[@LOCTYPE='URL']/@xlink:href"/>
+ </xsl:attribute>
+ <i18n:text>xmlui.dri2xhtml.METS-1.0.item-files-viewOpen</i18n:text>
+ </a>
+ </xsl:template>
+
+ <xsl:template name="display-rights">
+ <xsl:variable name="file_id" select="jstring:replaceAll(jstring:replaceAll(string(@ADMID), '_METSRIGHTS', ''), 'rightsMD_', '')"/>
+ <xsl:variable name="rights_declaration" select="../../../mets:amdSec/mets:rightsMD[@ID = concat('rightsMD_', $file_id, '_METSRIGHTS')]/mets:mdWrap/mets:xmlData/rights:RightsDeclarationMD"/>
+ <xsl:variable name="rights_context" select="$rights_declaration/rights:Context"/>
+ <xsl:variable name="users">
+ <xsl:for-each select="$rights_declaration/*">
+ <xsl:value-of select="rights:UserName"/>
+ <xsl:choose>
+ <xsl:when test="rights:UserName/@USERTYPE = 'GROUP'">
+ <xsl:text> (group)</xsl:text>
+ </xsl:when>
+ <xsl:when test="rights:UserName/@USERTYPE = 'INDIVIDUAL'">
+ <xsl:text> (individual)</xsl:text>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="position() != last()">, </xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
+
+ <xsl:choose>
+ <xsl:when test="not ($rights_context/@CONTEXTCLASS = 'GENERAL PUBLIC') and ($rights_context/rights:Permissions/@DISPLAY = 'true')">
+ <a href="{mets:FLocat[@LOCTYPE='URL']/@xlink:href}">
+ <img width="64" height="64" src="{concat($theme-path,'/images/Crystal_Clear_action_lock3_64px.png')}" title="Read access available for {$users}"/>
+ <!-- icon source: http://commons.wikimedia.org/wiki/File:Crystal_Clear_action_lock3.png -->
+ </a>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="view-open"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
<!--
File Type Mapping template
View
11 dspace-xmlui/dspace-xmlui-webapp/src/main/webapp/themes/dri2xhtml/structural.xsl
@@ -24,7 +24,8 @@
xmlns:mods="http://www.loc.gov/mods/v3"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns="http://www.w3.org/1999/xhtml"
- exclude-result-prefixes="mets xlink xsl dim xhtml mods dc">
+ xmlns:confman="org.dspace.core.ConfigurationManager"
+ exclude-result-prefixes="mets xlink xsl dim xhtml mods dc confman">
<xsl:output indent="yes"/>
@@ -2954,10 +2955,16 @@
</xsl:template>
<xsl:template match="dri:reference" mode="summaryView">
+ <xsl:variable name='METSRIGHTS-enabled' select="contains(confman:getProperty('plugin.named.org.dspace.content.crosswalk.DisseminationCrosswalk'), 'METSRIGHTS')" />
<xsl:variable name="externalMetadataURL">
<xsl:text>cocoon:/</xsl:text>
<xsl:value-of select="@url"/>
- <!-- No options selected, render the full METS document -->
+ <!-- If this is an Item, display the METSRIGHTS section, so we
+ know which files have access restrictions.
+ This requires the METSRightsCrosswalk to be enabled! -->
+ <xsl:if test="@type='DSpace Item' and $METSRIGHTS-enabled">
+ <xsl:text>?rightsMDTypes=METSRIGHTS</xsl:text>
+ </xsl:if>
</xsl:variable>
<xsl:comment> External Metadata URL: <xsl:value-of select="$externalMetadataURL"/> </xsl:comment>
<xsl:apply-templates select="document($externalMetadataURL)" mode="summaryView"/>
View
BIN  ...e-xmlui-webapp/src/main/webapp/themes/template/images/Crystal_Clear_action_lock3_64px.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Please sign in to comment.
Something went wrong with that request. Please try again.