Document Hit Counter
Installation
- Change the daisy_home
Property in Build.xml
-
Check
src\main\java\com\ocom\daisy\repository\audit\data\LocalAuditStrategy.java
line 31 and update the MySQL url. I have hardcoded it there.
-
Build with Ant
-
Copy the contents of the Cocoon
Directory to %WIKI_DATA%\sites\cocoon.
You may have to merge the changes to sitemap.xmap
-
Copy the MySQL driver from
%DAISY_HOME%\lib\mysql\jars
to %DAISY_HOME%\daisywiki\webapp\WEB-INF\lib
-
Update the MySQL Database using the
create_table.sql example
-
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"
/>&branchid=<xsl:value-of
select="/page/context/site/@branchId"
/>&userid=<xsl:value-of
select="/page/context/user/id"
/>&versionid=<xsl:value-of
select="$document/@dataVersionId"
/>&docid=<xsl:value-of
select="$document/@id"
/></xsl:attribute>
</img>
- 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.