Search code examples
xslt-1.0dspace

How to display the top 50 most viewed items in DSpace statistics


When logged in as a site administrator, you can access the statistics page by clicking the Statistics link from the sidebar (Administrative) menu. The page looked like this (From DSpace Demo):

enter image description here

Based on the image above, all items with 20 or more views are displayed. Is it possible to change this to only display the top 50 (or any arbitrary number) most viewed items regardless whether it has 20 or more views? So instead of Items Viewed, I would like to change it to Top 50 Items Viewed. Also by default, the list only display the title of the top 10 most viewed items while the rest are just urls. How can I modify that to display the titles of the remaining items?

UPDATE

I've discovered that the settings item.floor and item.lookup in [dspace]/config/dstat.cfg are ignored if you changed it from its default values. I submitted this issue in JIRA: DS-3470.

With regards to displaying only the top 50 items, this is my xslt code:

<xsl:template match="dri:div[@id='aspect.artifactbrowser.StatisticsViewer.div.items_viewed']/dri:table[@id='aspect.artifactbrowser.StatisticsViewer.table.reportBlock']">
    <table class="ds-table table table-striped table-hover detailtable">
        <xsl:for-each select="dri:row[position() &lt;=51]">
            <xsl:apply-templates select="."/>
        </xsl:for-each>
    </table>
</xsl:template>

I am using DSpace version 6 (XMLUI) for this instance.

Thanks in advance.


Solution

  • Ok, I've found out that to reflect the changes made in dstat.cfg, all you need to do is to rerun dspace stat-initial. With regards to displaying only the top 50 viewed items, I used the code below:

    <xsl:template match="dri:div[@id='aspect.artifactbrowser.StatisticsViewer.div.items_viewed']/dri:table[@id='aspect.artifactbrowser.StatisticsViewer.table.reportBlock']">
        <table class="ds-table table table-striped table-hover detailtable">
            <xsl:for-each select="dri:row[position() &lt;=51]">
                <xsl:apply-templates select="."/>
            </xsl:for-each>
        </table>
    </xsl:template>
    

    Hope this helps anyone who have similar issues. Thanks to Andrea, Terry and Benoît for their answers.