StampFilter is a PageFilter that can be used to stamp a comment with your username and date. The filter is triggered by the presence of the word menow either with an underscore prefix or suffix. Specifically it makes the following replacements (I can write these as-is only as long as the filter is not installed on this wiki):

source replacement example
_menow ''--[username] yyyy-mm-dd'' --Daggerbox 2003-11-17
menow_ ''yyyy-mm-dd [username]: 2003-11-17 Daggerbox:

Unimplemented idea: allow customization of name value and date format via user preferences

The Java code is attached to this page. It requires, of course, support for PageFilters, which I imagine it exists in most any 2.1 build.

You also have to add a line to your jspwiki.properties file to turn on the filter, such as

jspwiki.pageFilter.101 = StampFilter

For convenience, the code lives in the com.ecyrd.jspwiki.filters package. Someone let me know if that's a bad thing.

FYI: The filter initialization was changed in 2.1.88 to prefer an XML-based system. This means that the correct invocation in 2.1.88 onwards is

<filter>
   <class>StampFilter</class>
</filter>
in your "filters.xml" -file. --JanneJalkanen

Excuse this question if I'm missing something obvious, but if this filter is supposed to provide a comment stamp, wouldn't you want to specify the date on which you actually commented, instead of always displaying the current date (which could be months or years after the time at which you inserted your comment)? -- Theosophe74

At least you'll always seem to be current and topical! Pic/smile.png --MichaelGentry

I should have been more explicit since filters have a few options for when they execute. This filter gets activated when the page is saved, not when it is viewed. After that, the page text has the name and date (of the save) and the menow directive is gone. --Daggerbox

I'm having a problem getting the Stamp Filter to work in my Wiki (yes, I'm a rookie). I've copied the StampFilter.java into my JSPWiki source tree and rebuilt the JSPWiki.jar file. I've copied the JSPWiki.jar file back into my deployed wiki directory, replacing the existing JSPWiki.jar file. I've updated the webapps/wiki/WEB-INF/filters.xml file to reflect the StampFilter (listed either as just StampFilter or with the full class path). And I've updated my jspwiki.properties file to include the jspwiki.pagefilter.101 property as describe above. I've restarted the webapp from within Tomcat and I've even restarted Tomcat. But still when I include the tag _menow or menow_ in one of my pages, nothing happens. What did I miss???? --Jerald Pratt

Add new attachment

Only authorized users are allowed to upload new attachments.

List of attachments

Kind Attachment Name Size Version Date Modified Author Change note
java
StampFilter.java 2.5 kB 2 18-Nov-2003 01:51 Daggerbox
« This page (revision-9) was last changed on 17-Jul-2006 22:18 by Janne Jalkanen