[2014-10-15 10:25] Clemens Klein-Robbenhaar <[email protected]>
On 10/14/2014 08:02 PM, markus schnalke wrote:
in Mediawiki it's possible to insert one's name and the current date quite easily with four tilde characters: ~~~~.
Is it possible to do this in a convenient way in Xwiki, as well? And if so, how?
I think it should be possible by creating a macro. However, I would appreciate if inserting the signature would be a simpler tag than: {{sign/}}.
A macro has the disadvantage that it is evaluated every time the page is rendered, and it will not "remember" when it has been inserted.
What you want here is something that is evaluated when the page is saved, remembering the author / current date when saving.
Exactly.
To me this looks more like a use case for an Event Listener, e.g.:
http://platform.xwiki.org/xwiki/bin/view/DevGuide/WritingEventListenerTutori...
You will have to replace
docSource.setContent(docSource.content + "\n\nSome extra content...")
in the tutorial by something like:
docSource.setContent(docSource.content.replaceAll('~~~~',xcontext.user + ' ' + docSource.date) )
Thanks. I'm sure this is how it could be done. However, in the meantime, I think that using the annotation plugin/application might be the more XWiki-like way to go -- although less familiar to me it might actually be more familiar to most of the users of our wiki. Thanks for your help! meillo