Description

This patch is a variation of the /UserList patch. It is meant to display a list of all the people who contributed to the wiki within the expiration period ie. recently. Next to each username, rendered as a link to their user page, appears the number of contributions. The list is sorted by username, not by contributions, so as not to incite a competition of who's got the most contributions.

Example output

AnonymousCoward (9)
BradleyHughes (7)
CiprianPopovici (435)
(Glutinous)? (2)
JochemKossen? (1)
JohnClark? (2)
(MEO)? (5)
(rajm)? (1)
RobertMarshall? (1)

The patch

Created against 'Tavi 0.25. May or may not apply cleanly against later versions.


diff -ruN tavi/lib/defaults.php tavi.contriblist/lib/defaults.php
--- tavi/lib/defaults.php    Sun Sep  5 20:31:53 2004
+++ tavi.contriblist/lib/defaults.php    Wed Sep  8 14:20:14 2004
@@ -283,7 +283,8 @@
                      'TitleSearch'   => 'view_macro_titlesearch',
                      'PageLinks'     => 'view_macro_outlinks',
                      'PageRefs'      => 'view_macro_refs',
-                     'RefList'       => 'view_macro_reflist'
+                     'RefList'       => 'view_macro_reflist',
+                     'ContribList'   => 'view_macro_contriblist',
                    );
 
 // $SaveMacroEngine determines what save macros will be called after a
diff -ruN tavi/lib/pagestore.php tavi.contriblist/lib/pagestore.php
--- tavi/lib/pagestore.php    Sun Sep  5 20:31:53 2004
+++ tavi.contriblist/lib/pagestore.php    Wed Sep  8 14:20:21 2004
@@ -256,6 +256,23 @@
     return $list;
   }
 
+  // Retrieve a list of contributors ordered by contributions
+  function contributors()
+  {
+    global $PgTbl;
+
+    $query = "SELECT DISTINCT username,COUNT(username) AS cnt FROM $PgTbl WHERE username IS NOT NULL GROUP BY username ORDER BY username ASC";
+    $qid = $this->dbh->query($query);
+
+    $list = array();
+    while(($result = $this->dbh->result($qid)))
+    {
+      $list[] = array($result[0], $result[1]);
+    }
+
+    return $list;
+  }
+
   // Retrieve a list of all new pages in the wiki.
   function newpages()
   {
diff -ruN tavi/parse/macros.php tavi.contriblist/parse/macros.php
--- tavi/parse/macros.php    Sun Sep  5 20:31:53 2004
+++ tavi.contriblist/parse/macros.php    Wed Sep  8 14:20:26 2004
@@ -66,6 +66,31 @@
 function nameSort($p1, $p2)
   { return strcmp($p1[1], $p2[1]); }
 
+// Prepare a list of contributors ordered by contributions
+function view_macro_contriblist()
+{
+  global $pagestore;
+
+  $first = 1;
+  $list = $pagestore->contributors();
+
+  $text = '';
+
+  foreach($list as $page)
+  {
+    if(!$first)                         // Don't prepend newline to first one.
+      { $text = $text . "<br />"; }
+    else
+      { $first = 0; }
+
+    $text = $text .
+            ($page[0] ? html_ref($page[0], $page[0]) : '<strong>Unsigned</strong>') .
+            ' ('.$page[1] .')';
+  }
+
+  return $text;
+}
+
 // Prepare a list of pages sorted by size.
 function view_macro_pagesize()
 {