MediaWiki:Api-stylesheets/TopReviewers.xsl

From Wikinews, the free news source you can write!
Jump to navigation Jump to search

<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html"/> <xsl:key name="users" match="/api/query/logevents/item[@action='approve-i'][starts-with(@comment, 'Publishing article after successful peer review')]" use="@user"/> <xsl:variable select="/api/query/logevents/item[@action='approve-i'][starts-with(@comment, 'Publishing article after successful peer review')]" name="a"/> <xsl:variable select="count($a)" name="articleCount"/> <xsl:template match="/">

<xsl:variable name="userList" select="$a[generate-id(.)=generate-id(key('users', @user)[1])]"/>

<xsl:variable name="maxReviewed"> <xsl:for-each select="$userList"> <xsl:sort select="count(key('users', @user))" data-type="number" order="descending"/> <xsl:if test="position() = 1"> <xsl:value-of select="count(key('users', @user))"/> </xsl:if> </xsl:for-each> </xsl:variable> <html> <head> <title>Review statistics</title> <link rev="made" href="http://en.wikinews.org/wiki/User:Bawolff"/> <style> <xsl:text> ul#graph {height:407px; position:relative; background: #DDD;list-style:none;border: 2px solid grey;}

  1. graph ul {list-style:none;}
  2. graph li {position: absolute; bottom: 0;
width:60px; z-index: 3;margin-bottom: -2.7em; padding:5px; text-align:center;overflow-x:hidden}
  1. graph ul li {background-color:#9D9; z-index:1;margin:0; border: thin outset #9D9}

</xsl:text> </style> </head> <body>

Top reviewers on <a href="http://en.wikinews.org/">EN Wikinews</a> for last <xsl:value-of select="$articleCount"/> articles (from <xsl:value-of select="/api/query/logevents/item[1]/@timestamp"/> to <xsl:value-of select="/api/query/logevents/item[last()]/@timestamp"/>) by number of articles {{Publish}}ed per user.

    <xsl:for-each select="$userList"> <xsl:sort select="count(key('users', @user))" data-type="number" order="descending"/>
  • <a href="http://en.wikinews.org/w/index.php?title=User:{translate(@user, ' &"<>', '_____')}" title="{translate(@user, '"<>', '___')}" > <xsl:value-of select="@user"/></a>
    • <xsl:value-of select="count(key('users', @user))"/> (<xsl:value-of select="round(1000*(count(key('users', @user)) div $articleCount)) div 10"/>%)

    </xsl:for-each>



<form method="GET" action="http://en.wikinews.org/w/api.php"> Fetch statistics from <input type="text" value="{/api/query/logevents/item[1]/@timestamp}" name="lestart" size="21"/> to <input size="21" type="text" value="{/api/query/logevents/item[last()]/@timestamp}" name="leend"/> <input type="submit" value="Go"/> (subject to api limits) <input type="hidden" name="action" value="query"/> <input type="hidden" name="list" value="logevents"/> <input type="hidden" name="letype" value="review"/> <input type="hidden" name="leaction" value="review/approve-i"/> <input type="hidden" name="lelimit" value="max"/> <input type="hidden" name="format" value="xml"/> <input type="hidden" name="xslt" value="MediaWiki:Api-stylesheets/TopReviewers.xsl"/> </form>


These statistics are generated by an xslt stylesheet developed by [[<a href="http://en.wikinews.org/wiki/User:Bawolff">User:Bawolff</a>]]. Based on "CSS Vertical Bar Graphs" design from <a href="http://meyerweb.com/eric/css/edge/bargraph/demo-ie.html">CSS/edge</a>. This counts the number of entries in the <a href="http://en.wikinews.org/wiki/Special:Log/review">review log</a> that look like an article being published and groups it by the user who flagged that revision. This counts articles that were subsequently deleted (such as test articles). This only counts articles sighted by easy peer review. Manually sighted articles don't count. It is possible this is inaccurate. Use at your own risk.

XSLT source is available at: <a href="http://en.wikinews.org/w/index.php?title=MediaWiki:Api-stylesheets/TopReviewers.xsl&action=raw">http://en.wikinews.org/w/index.php?title=MediaWiki:Api-stylesheets/TopReviewers.xsl&action=raw</a> . Meant to be accessed via the url <a href="http://en.wikinews.org/w/api.php?action=query&list=logevents&letype=review&lelimit=max&format=xml&xslt=MediaWiki:Api-stylesheets/TopReviewers.xsl&leaction=review/approve-i">http://en.wikinews.org/w/api.php?action=query&list=logevents&letype=review&lelimit=max&format=xml&xslt=MediaWiki:Api-stylesheets/TopReviewers.xsl&leaction=review/approve-i</a>

</body> </html> </xsl:template>


</xsl:stylesheet>