Document Hit Counter

Installation

  1. Download the Jar from Here: http://www.ocom.com.au/support/dms-audit/dms-audit.zip
  2. Change the daisy_home Property in Build.xml
  3. Check src\main\java\com\ocom\daisy\repository\audit\data\LocalAuditStrategy.java line 31 and update the MySQL url. I have hardcoded it there.
  4. Build with Ant
  5. Copy the contents of the Cocoon Directory to %WIKI_DATA%\sites\cocoon. You may have to merge the changes to sitemap.xmap
  6. Copy the MySQL driver from %DAISY_HOME%\lib\mysql\jars to %DAISY_HOME%\daisywiki\webapp\WEB-INF\lib
  7. Update the MySQL Database using the create_table.sql example
  8. Put the following code into documentlayout.xsl in your skin(I put it into template named comments)

    <img width="1" height="1">

<xsl:attribute name="src"><xsl:value-of select="$basePath"/>/ext/forms/audit.png?langid=<xsl:value-of select="/page/context/site/@languageId" />&amp;branchid=<xsl:value-of select="/page/context/site/@branchId" />&amp;userid=<xsl:value-of select="/page/context/user/id" />&amp;versionid=<xsl:value-of select="$document/@dataVersionId" />&amp;docid=<xsl:value-of select="$document/@id" /></xsl:attribute>

</img>



  1. Restart the Wiki



How it works

When a page is rendered by the browser, the browser requests the audit.png image. The pipeline for audit.png calls a flow script which populates a Bean with the parameters passed in the request. These parameters are used to insert a record in to the ReadAudit table. The image returned is rendered 1px by 1px and as the top pixel is white then it not appear on the page. If you want to change the output update the audit.svg (I uses Inkscape to create the template)

Todo

I have not come up with a report page but this should be a simple pipeline that queries the databases.