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

From Libopedia
Jump to navigation Jump to search
 
(16 intermediate revisions by the same user not shown)
Line 2: Line 2:
 
  '''[[SUNScholar/Altmetrics|BACK TO ALTMETRICS]]'''
 
  '''[[SUNScholar/Altmetrics|BACK TO ALTMETRICS]]'''
 
</center>
 
</center>
 
+
__TOC__
==Step 1==
+
==Step 1 - Modify config==
 
Edit the following file:
 
Edit the following file:
 
  nano $HOME/{{Source}}/dspace/config/modules/altmetrics.cfg
 
  nano $HOME/{{Source}}/dspace/config/modules/altmetrics.cfg
Line 82: Line 82:
 
</pre>
 
</pre>
  
==Step 2==
+
==Step 2 - Render in XMLUI Mirage 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.
+
<font color="red">'''Normally this step would be the rebuild of DSpace, however in DSpace versions 5.X no provision was made for Altmetrics to be rendered in the new Mirage 2 theme.'''</font>
 
 
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 <tt>'''<xsl:template name="itemSummaryView-DIM">'''</tt> on line 42, add the following. Make sure to indent correctly.
 
<pre>
 
        <!-- 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>
 
</pre>
 
Now we have to insert the templates called above. Go to the very end of the file and before the last <tt>'''</xsl:stylesheet>'''</tt> closing tag, and insert the following:
 
<pre>
 
    <xsl:template name='impact-altmetric'>
 
        <div id='impact-altmetric'>
 
            <!-- Altmetric.com -->
 
            <script type="text/javascript" src="{concat($scheme, 'd1bxh8uas1mnw7.cloudfront.net/assets/embed.js')}">&#xFEFF;
 
            </script>
 
            <div id='altmetric'
 
                class='altmetric-embed'>
 
                <xsl:variable name='badge_type' select='confman:getProperty("altmetrics", "altmetric.badgeType")'/>
 
                <xsl:if test='boolean($badge_type)'>
 
                    <xsl:attribute name='data-badge-type'><xsl:value-of select='$badge_type'/></xsl:attribute>
 
                </xsl:if>
 
 
 
                <xsl:variable name='badge_popover' select='confman:getProperty("altmetrics", "altmetric.popover")'/>
 
                <xsl:if test='$badge_popover'>
 
                    <xsl:attribute name='data-badge-popover'><xsl:value-of select='$badge_popover'/></xsl:attribute>
 
                </xsl:if>
 
 
 
                <xsl:variable name='badge_details' select='confman:getProperty("altmetrics", "altmetric.details")'/>
 
                <xsl:if test='$badge_details'>
 
                    <xsl:attribute name='data-badge-details'><xsl:value-of select='$badge_details'/></xsl:attribute>
 
                </xsl:if>
 
 
 
                <xsl:variable name='no_score' select='confman:getProperty("altmetrics", "altmetric.noScore")'/>
 
                <xsl:if test='$no_score'>
 
                    <xsl:attribute name='data-no-score'><xsl:value-of select='$no_score'/></xsl:attribute>
 
                </xsl:if>
 
 
 
                <xsl:if test='confman:getProperty("altmetrics", "altmetric.hideNoMentions")'>
 
                    <xsl:attribute name='data-hide-no-mentions'>true</xsl:attribute>
 
                </xsl:if>
 
 
 
                <xsl:variable name='link_target' select='confman:getProperty("altmetrics", "altmetric.linkTarget")'/>
 
                <xsl:if test='$link_target'>
 
                    <xsl:attribute name='data-link-target'><xsl:value-of select='$link_target'/></xsl:attribute>
 
                </xsl:if>
 
 
 
                <xsl:choose>    <!-- data-doi data-handle data-arxiv-id data-pmid -->
 
                    <xsl:when test='$identifier_doi'>
 
                        <xsl:attribute name='data-doi'><xsl:value-of select='$identifier_doi'/></xsl:attribute>
 
                    </xsl:when>
 
                    <xsl:when test='$identifier_handle'>
 
                        <xsl:attribute name='data-handle'><xsl:value-of select='$identifier_handle'/></xsl:attribute>
 
                    </xsl:when>
 
                </xsl:choose>
 
                &#xFEFF;
 
            </div>
 
        </div>
 
    </xsl:template>
 
 
 
    <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}">&#xFEFF;
 
            </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>
 
                &#xFEFF;
 
            </a>
 
 
 
        </div>
 
</pre>
 
 
 
==Step 3==
 
After updating the XSL file, the next step is to updated the CSS style.
 
  
Edit the following file:
+
Bug reports have been submitted, see;
  nano $HOME/{{Source}}/dspace-xmlui-mirage2/src/main/webapp/styles/classic_mirage_color_scheme/_item-view.scss
+
  https://jira.duraspace.org/browse/DS-2607
Go to the bottom of the file and add the following:
+
https://jira.duraspace.org/browse/DS-2447
<pre>
+
https://jira.duraspace.org/browse/DS-2446
#impact-altmetric {
 
    float:right;
 
    margin:0 30px 0 30px;
 
}
 
 
 
#impact-plumx {
 
    float:right;
 
}
 
</pre>
 
  
==Step X==
+
==Step 3 - Rebuild DSpace==
 
Then [[SUNScholar/Rebuild_DSpace|rebuild DSpace]].
 
Then [[SUNScholar/Rebuild_DSpace|rebuild DSpace]].
 +
[[Category:Customisation]]

Latest revision as of 18:58, 27 September 2016

BACK TO ALTMETRICS

Step 1 - Modify config

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 - Render in XMLUI Mirage 2

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

Bug reports have been submitted, see;

https://jira.duraspace.org/browse/DS-2607
https://jira.duraspace.org/browse/DS-2447
https://jira.duraspace.org/browse/DS-2446

Step 3 - Rebuild DSpace

Then rebuild DSpace.