Difference between revisions of "SUNScholar/Altmetrics/5.X"

From Libopedia
Jump to navigation Jump to search
Line 165: Line 165:
 
     </xsl:template>
 
     </xsl:template>
 
</pre>
 
</pre>
 +
 +
==Step 3==
 +
After updating the XSL file, the next step is to updated the CSS style.
 +
 +
Edit the following file:
 +
nano $HOME/[[Source}}/dspace-xmlui-mirage2/src/main/webapp/styles/classic_mirage_color_scheme/_item-view.scss
  
 
==Step X==
 
==Step X==
 
Then [[SUNScholar/Rebuild_DSpace|rebuild DSpace]].
 
Then [[SUNScholar/Rebuild_DSpace|rebuild DSpace]].

Revision as of 12:07, 10 June 2015

BACK TO ALTMETRICS

Step 1

Edit the following file:

nano $HOME/source/dspace/config/modules/altmetrics.cfg

Modify as need.

See example below.

#---------------------------------------------------------------#
#-----------IMPACT METRICS DISPLAY CONFIGURATIONS---------------#
#---------------------------------------------------------------#
# Configuration properties used by impact metrics badges        #
#---------------------------------------------------------------#
 
# Metadata field which contains the interesting identifiers
altmetrics.field = dc.identifier.uri

#---------------------------------------------------------------#
# Configure altmetric.com badges.                               #
# See http://api.altmetric.com/embeds.html                      #
#---------------------------------------------------------------#

# Is the Altmetric.com badge enabled?
altmetric.enabled = true

# Possible values: donut medium-donut large-donut 1 4
altmetric.badgeType = donut

# Possible values: left right top bottom
#altmetric.popover =

# Possible values: right
#altmetric.details =

# Possible values: true
#altmetric.noScore = 

# Possible values: true
#altmetric.hideNoMentions =

# e.g. _blank
#altmetric.linkTarget =


#---------------------------------------------------------------#
# Configure PlumX Artifact widgets.                             #
# See https://plu.mx/pitt/developers/widgets                    #
#---------------------------------------------------------------#

# Is the PlumX Artifact widget enabled?
plumx.enabled = true

# Possible values: popup summary details
plumx.widget-type = popup

# Used with widget types: popup
# Possible values: top bottom left right
#plumx.data-popup = left

# Used with widget types: popup summary details
# Possible values: true false
#plumx.data-hide-when-empty = true

# Used with widget types: summary details
# Possible values: true false
#plumx.data-hide-print = false

# Used with widget types: summary
# Possible values: vertical horizontal
#plumx.data-orientation = vertical

# Used with widget types: details
# Possible values: any positive integer
#plumx.data-width = 

# Used with widget types: details
# Possible values: true false
#plumx.data-border = false

Step 2

Normally this step would be the rebuild of DSpace, however in DSpace 5.2 no provision was made for Altmetrics to be rendered in the new Mirage 2 theme.

So we continue and enable Altmetrics in the XMLUI Mirage 2 theme.

Edit the following file:

nano $HOME/source/dspace-xmlui-mirage2/src/main/webapp/xsl/aspect/artifactbrowser/item-view.xsl

Directly after the <xsl:template name="itemSummaryView-DIM"> on line 42, add the following. Make sure to indent correctly.

        <!-- optional: Altmeric.com badge and PlumX widget -->
        <xsl:if test='confman:getProperty("altmetrics", "altmetric.enabled") and ($identifier_doi or $identifier_handle)'>
            <xsl:call-template name='impact-altmetric'/>
        </xsl:if>
        <xsl:if test='confman:getProperty("altmetrics", "plumx.enabled") and $identifier_doi'>
            <xsl:call-template name='impact-plumx'/>
        </xsl:if>

Now we have to insert the templates called above. Go to the very end of the file and before the last </xsl:stylesheet> closing tag, insert the following:

    <xsl:template name="impact-plumx">
        <div id="impact-plumx" style="clear:right">
            <!-- PlumX <http://plu.mx> -->
            <xsl:variable name="plumx_type" select="confman:getProperty('altmetrics', 'plumx.widget-type')"/>
            <xsl:variable name="plumx-script-url">
                <xsl:choose>
                    <xsl:when test="boolean($plumx_type)">
                        <xsl:value-of select="concat($scheme, 'd39af2mgp1pqhg.cloudfront.net/widget-', $plumx_type, '.js')"/>
                    </xsl:when>
                    <xsl:otherwise>
                        <xsl:value-of select="concat($scheme, 'd39af2mgp1pqhg.cloudfront.net/widget-popup.js')"/>
                    </xsl:otherwise>
                </xsl:choose>
            </xsl:variable>

            <script type="text/javascript" src="{$plumx-script-url}">
            </script>

            <xsl:variable name="plumx-class">
                <xsl:choose>
                    <xsl:when test="boolean($plumx_type) and ($plumx_type != 'popup')">
                        <xsl:value-of select="concat('plumx-', $plumx_type)"/>
                    </xsl:when>
                    <xsl:otherwise>plumx-plum-print-popup</xsl:otherwise>
                </xsl:choose>
            </xsl:variable>

            <a>
                <xsl:attribute name="id">plumx</xsl:attribute>
                <xsl:attribute name="class"><xsl:value-of select="$plumx-class"/></xsl:attribute>
                <xsl:attribute name="href">https://plu.mx/pitt/a/?doi=<xsl:value-of select="$identifier_doi"/></xsl:attribute>

                <xsl:variable name="plumx_data-popup" select="confman:getProperty('altmetrics', 'plumx.data-popup')"/>
                <xsl:if test="$plumx_data-popup">
                    <xsl:attribute name="data-popup"><xsl:value-of select="$plumx_data-popup"/></xsl:attribute>
                </xsl:if>

                <xsl:if test="confman:getProperty('altmetrics', 'plumx.data-hide-when-empty')">
                    <xsl:attribute name="data-hide-when-empty">true</xsl:attribute>
                </xsl:if>

                <xsl:if test="confman:getProperty('altmetrics', 'plumx.data-hide-print')">
                    <xsl:attribute name="data-hide-print">true</xsl:attribute>
                </xsl:if>

                <xsl:variable name="plumx_data-orientation" select="confman:getProperty('altmetrics', 'plumx.data-orientation')"/>
                <xsl:if test="$plumx_data-orientation">
                    <xsl:attribute name="data-orientation"><xsl:value-of select="$plumx_data-orientation"/></xsl:attribute>
                </xsl:if>

                <xsl:variable name="plumx_data-width" select="confman:getProperty('altmetrics', 'plumx.data-width')"/>
                <xsl:if test="$plumx_data-width">
                    <xsl:attribute name="data-width"><xsl:value-of select="$plumx_data-width"/></xsl:attribute>
                </xsl:if>

                <xsl:if test="confman:getProperty('altmetrics', 'plumx.data-border')">
                    <xsl:attribute name="data-border">true</xsl:attribute>
                </xsl:if>
                
            </a>

        </div>
    </xsl:template>

Step 3

After updating the XSL file, the next step is to updated the CSS style.

Edit the following file:

nano $HOME/[[Source}}/dspace-xmlui-mirage2/src/main/webapp/styles/classic_mirage_color_scheme/_item-view.scss

Step X

Then rebuild DSpace.