Details
-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
13.10.3
-
None
-
Unknown
-
Description
Steps to reproduce:
- create an event listener in a wiki page as explained in https://extensions.xwiki.org/xwiki/bin/view/Extension/WikiComponent%20Module#HImplementingmethods ; the listner should listen to DocumentUpdatingEvent at least.
- instead of a groovy macro use a velocity macro in the method code body, like
{{velocity}} ## {{/velocity}}
(The comment symbols are important, a wholly empty velocity code block does not reproduce the issue
- go to and "AppWithinMinutes" generated application, and click on "Edit Application" (I tried this with the pre-installed "Movies" Application: http://localhost:8080/xwiki/wiki/subwiki1/view/Help/Applications/Movies/
- in the "Step 2 — Structure your data" do not update anything, just click "Next Step"
Expected behavior:
- the next step ("Step 3 — Locate your data") should be shown
Actually observed:
- a different page is shown, with the page name of the event handler page, appended by TemplateProvider
(Instead of implementing the event listener you can also import the attached xar: Sandbox.Surprise.xar )
The problem seems to occur because the velocity macro is executed in a velocity context shared with the velocity code of the page AppWithinMinutes.ClassEditSheet in the #macro(updateAndSaveClass)
## ## Save ## #if(!$errorMessage) #set($discard = $xdoc.setXClass($xclass)) #set($discard = $xdoc.renameProperties($doc.documentReference, $fieldsToRename)) #set($discard = $xdoc.setHidden(true)) #set($discard = $xdoc.setMetaDataDirty(true)) #### here before the save $doc points to the class under edit #set($discard = $doc.save($services.localization.render('core.comment.updateClassProperty'), $minorEdit)) #### here after the save $doc points to the event listener page #end
(Comments starting with #### are inserted by me and not part of the platform code.)
Obvious workaround: do not use velocity macros for event listeners in wiki pages, but use groovy-macros (you need programming rights anyway.)