[xwiki-users] accessing to document running macro
Hello, I develop a macro which display object attached to the current page. Here summary of my code: {{goovy}} def topic = doc.getObject(ActivityReport.TopicClass, Integer.valueOf(xcontext.macro.params.id)) println |+doc.displayPrettyName(topic, title)+|+topic.get(title) println |+doc.displayPrettyName(topic, action)+|+topic.get(action) println |+doc.displayPrettyName(topic, status)+|+topic.get(status) {{/groovy}} In my macro page, I put one instance of my TopicClass for development. That working fine. In an other page I put an other instance and call my macro. It display instance from macro page !!! I suppose that I should not used doc to find current document in macro. But I don't find in http://platform.xwiki.org/xwiki/bin/view/DevGuide/WikiMacroTutorial how to retrieved current document. I also test xcontext.doc, but it is same as doc. So how can find current document (the document which call my macro)? Regards, Arnaud. ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] accessing to document running macro
Hi Arnaud, On 10/26/2010 12:38 PM, Arnaud bourree wrote: Hello, I develop a macro which display object attached to the current page. Here summary of my code: {{goovy}} def topic = doc.getObject(ActivityReport.TopicClass, Integer.valueOf(xcontext.macro.params.id)) println |+doc.displayPrettyName(topic, title)+|+topic.get(title) println |+doc.displayPrettyName(topic, action)+|+topic.get(action) println |+doc.displayPrettyName(topic, status)+|+topic.get(status) {{/groovy}} In my macro page, I put one instance of my TopicClass for development. That working fine. In an other page I put an other instance and call my macro. It display instance from macro page !!! Indeed. I just tested a wiki macro with this code: --8-- {{velocity}} $doc | $xcontext.doc {{/velocity}} {{groovy}} print doc.toString() + | + xcontext.doc.toString() {{/groovy}} --8-- and the result is: --8-- Sandbox.FF | Sandbox.WikiMacroTest Sandbox.WikiMacroTest | Sandbox.WikiMacroTest --8-- As you can see $doc points to the right document in velocity but to the wiki macro document in groovy. This looks like a bug to me. Can you report an issue on http://jira.xwiki.org/jira/browse/XWIKI . Thanks, Marius I suppose that I should not used doc to find current document in macro. But I don't find in http://platform.xwiki.org/xwiki/bin/view/DevGuide/WikiMacroTutorial how to retrieved current document. I also test xcontext.doc, but it is same as doc. So how can find current document (the document which call my macro)? Regards, Arnaud. ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] accessing to document running macro
Hi Marius, 2010/10/26 Marius Dumitru Florea mariusdumitru.flo...@xwiki.com: Hi Arnaud, On 10/26/2010 12:38 PM, Arnaud bourree wrote: Hello, I develop a macro which display object attached to the current page. Here summary of my code: {{goovy}} def topic = doc.getObject(ActivityReport.TopicClass, Integer.valueOf(xcontext.macro.params.id)) println |+doc.displayPrettyName(topic, title)+|+topic.get(title) println |+doc.displayPrettyName(topic, action)+|+topic.get(action) println |+doc.displayPrettyName(topic, status)+|+topic.get(status) {{/groovy}} In my macro page, I put one instance of my TopicClass for development. That working fine. In an other page I put an other instance and call my macro. It display instance from macro page !!! Indeed. I just tested a wiki macro with this code: --8-- {{velocity}} $doc | $xcontext.doc {{/velocity}} {{groovy}} print doc.toString() + | + xcontext.doc.toString() {{/groovy}} --8-- I made same test and the result is: --8-- Sandbox.FF | Sandbox.WikiMacroTest and I have Sandbox.FF | Sandbox.FF Note that I used XWiki 2.4.3 Sandbox.WikiMacroTest | Sandbox.WikiMacroTest --8-- As you can see $doc points to the right document in velocity but to the wiki macro document in groovy. This looks like a bug to me. Can you report an issue on http://jira.xwiki.org/jira/browse/XWIKI . Thanks, Marius I suppose that I should not used doc to find current document in macro. But I don't find in http://platform.xwiki.org/xwiki/bin/view/DevGuide/WikiMacroTutorial how to retrieved current document. I also test xcontext.doc, but it is same as doc. So how can find current document (the document which call my macro)? Regards, Arnaud. ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] accessing to document running macro
On 10/26/2010 12:28 PM, Marius Dumitru Florea wrote: Hi Arnaud, On 10/26/2010 12:38 PM, Arnaud bourree wrote: Hello, I develop a macro which display object attached to the current page. Here summary of my code: {{goovy}} def topic = doc.getObject(ActivityReport.TopicClass, Integer.valueOf(xcontext.macro.params.id)) println |+doc.displayPrettyName(topic, title)+|+topic.get(title) println |+doc.displayPrettyName(topic, action)+|+topic.get(action) println |+doc.displayPrettyName(topic, status)+|+topic.get(status) {{/groovy}} In my macro page, I put one instance of my TopicClass for development. That working fine. In an other page I put an other instance and call my macro. It display instance from macro page !!! Indeed. I just tested a wiki macro with this code: --8-- {{velocity}} $doc | $xcontext.doc {{/velocity}} {{groovy}} print doc.toString() + | + xcontext.doc.toString() {{/groovy}} --8-- and the result is: --8-- Sandbox.FF | Sandbox.WikiMacroTest Sandbox.WikiMacroTest | Sandbox.WikiMacroTest --8-- As you can see $doc points to the right document in velocity but to the wiki macro document in groovy. This looks like a bug to me. Can you report an issue on http://jira.xwiki.org/jira/browse/XWIKI . Isn't it this issue: http://jira.xwiki.org/jira/browse/XWIKI-4262 ? Thanks, Anca Thanks, Marius I suppose that I should not used doc to find current document in macro. But I don't find in http://platform.xwiki.org/xwiki/bin/view/DevGuide/WikiMacroTutorial how to retrieved current document. I also test xcontext.doc, but it is same as doc. So how can find current document (the document which call my macro)? Regards, Arnaud. ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] accessing to document running macro
2010/10/26 Anca Luca lu...@xwiki.com: On 10/26/2010 12:28 PM, Marius Dumitru Florea wrote: Hi Arnaud, On 10/26/2010 12:38 PM, Arnaud bourree wrote: Hello, I develop a macro which display object attached to the current page. Here summary of my code: {{goovy}} def topic = doc.getObject(ActivityReport.TopicClass, Integer.valueOf(xcontext.macro.params.id)) println |+doc.displayPrettyName(topic, title)+|+topic.get(title) println |+doc.displayPrettyName(topic, action)+|+topic.get(action) println |+doc.displayPrettyName(topic, status)+|+topic.get(status) {{/groovy}} In my macro page, I put one instance of my TopicClass for development. That working fine. In an other page I put an other instance and call my macro. It display instance from macro page !!! Indeed. I just tested a wiki macro with this code: --8-- {{velocity}} $doc | $xcontext.doc {{/velocity}} {{groovy}} print doc.toString() + | + xcontext.doc.toString() {{/groovy}} --8-- and the result is: --8-- Sandbox.FF | Sandbox.WikiMacroTest Sandbox.WikiMacroTest | Sandbox.WikiMacroTest --8-- As you can see $doc points to the right document in velocity but to the wiki macro document in groovy. This looks like a bug to me. Can you report an issue on http://jira.xwiki.org/jira/browse/XWIKI . Isn't it this issue: http://jira.xwiki.org/jira/browse/XWIKI-4262 ? That is not the case as I'm administrator of my wiki and I've all right. I just upgrade to 2.4.4 and find same issue. Next step, I upgrade to 2.5 and retry Arnaud. Thanks, Anca Thanks, Marius I suppose that I should not used doc to find current document in macro. But I don't find in http://platform.xwiki.org/xwiki/bin/view/DevGuide/WikiMacroTutorial how to retrieved current document. I also test xcontext.doc, but it is same as doc. So how can find current document (the document which call my macro)? Regards, Arnaud. ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] accessing to document running macro
On 10/26/2010 03:38 PM, Arnaud bourree wrote: Hi Marius, 2010/10/26 Marius Dumitru Floreamariusdumitru.flo...@xwiki.com: Hi Arnaud, On 10/26/2010 12:38 PM, Arnaud bourree wrote: Hello, I develop a macro which display object attached to the current page. Here summary of my code: {{goovy}} def topic = doc.getObject(ActivityReport.TopicClass, Integer.valueOf(xcontext.macro.params.id)) println |+doc.displayPrettyName(topic, title)+|+topic.get(title) println |+doc.displayPrettyName(topic, action)+|+topic.get(action) println |+doc.displayPrettyName(topic, status)+|+topic.get(status) {{/groovy}} In my macro page, I put one instance of my TopicClass for development. That working fine. In an other page I put an other instance and call my macro. It display instance from macro page !!! Indeed. I just tested a wiki macro with this code: --8-- {{velocity}} $doc | $xcontext.doc {{/velocity}} {{groovy}} print doc.toString() + | + xcontext.doc.toString() {{/groovy}} --8-- I made same test and the result is: --8-- Sandbox.FF | Sandbox.WikiMacroTest and I have Sandbox.FF | Sandbox.FF Note that I used XWiki 2.4.3 I used XE 2.5RC1 and a XE2.6-SNAPSHOT so I'm pretty sure $doc points to the right document in XE 2.5. Maybe there was a bug in the previous versions. There is still the groovy issue though. Marius Sandbox.WikiMacroTest | Sandbox.WikiMacroTest --8-- As you can see $doc points to the right document in velocity but to the wiki macro document in groovy. This looks like a bug to me. Can you report an issue on http://jira.xwiki.org/jira/browse/XWIKI . Thanks, Marius I suppose that I should not used doc to find current document in macro. But I don't find in http://platform.xwiki.org/xwiki/bin/view/DevGuide/WikiMacroTutorial how to retrieved current document. I also test xcontext.doc, but it is same as doc. So how can find current document (the document which call my macro)? Regards, Arnaud. ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] accessing to document running macro
2010/10/26 Marius Dumitru Florea mariusdumitru.flo...@xwiki.com: On 10/26/2010 03:38 PM, Arnaud bourree wrote: Hi Marius, 2010/10/26 Marius Dumitru Floreamariusdumitru.flo...@xwiki.com: Hi Arnaud, On 10/26/2010 12:38 PM, Arnaud bourree wrote: Hello, I develop a macro which display object attached to the current page. Here summary of my code: {{goovy}} def topic = doc.getObject(ActivityReport.TopicClass, Integer.valueOf(xcontext.macro.params.id)) println |+doc.displayPrettyName(topic, title)+|+topic.get(title) println |+doc.displayPrettyName(topic, action)+|+topic.get(action) println |+doc.displayPrettyName(topic, status)+|+topic.get(status) {{/groovy}} In my macro page, I put one instance of my TopicClass for development. That working fine. In an other page I put an other instance and call my macro. It display instance from macro page !!! Indeed. I just tested a wiki macro with this code: --8-- {{velocity}} $doc | $xcontext.doc {{/velocity}} {{groovy}} print doc.toString() + | + xcontext.doc.toString() {{/groovy}} --8-- I made same test and the result is: --8-- Sandbox.FF | Sandbox.WikiMacroTest and I have Sandbox.FF | Sandbox.FF Note that I used XWiki 2.4.3 I used XE 2.5RC1 and a XE2.6-SNAPSHOT so I'm pretty sure $doc points to the right document in XE 2.5. Maybe there was a bug in the previous versions. There is still the groovy issue though. I migrate to 2.5: same issue. I prefered groovy, so I don't made test with velocity. Now I made test with velocity and that works Marius you are true, that is groovy issue Arnaud. Marius Sandbox.WikiMacroTest | Sandbox.WikiMacroTest --8-- As you can see $doc points to the right document in velocity but to the wiki macro document in groovy. This looks like a bug to me. Can you report an issue on http://jira.xwiki.org/jira/browse/XWIKI . Thanks, Marius I suppose that I should not used doc to find current document in macro. But I don't find in http://platform.xwiki.org/xwiki/bin/view/DevGuide/WikiMacroTutorial how to retrieved current document. I also test xcontext.doc, but it is same as doc. So how can find current document (the document which call my macro)? Regards, Arnaud. ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] accessing to document running macro
2010/10/26 Arnaud bourree arnaud.bour...@gmail.com: 2010/10/26 Anca Luca lu...@xwiki.com: On 10/26/2010 12:28 PM, Marius Dumitru Florea wrote: Hi Arnaud, On 10/26/2010 12:38 PM, Arnaud bourree wrote: Hello, I develop a macro which display object attached to the current page. Here summary of my code: {{goovy}} def topic = doc.getObject(ActivityReport.TopicClass, Integer.valueOf(xcontext.macro.params.id)) println |+doc.displayPrettyName(topic, title)+|+topic.get(title) println |+doc.displayPrettyName(topic, action)+|+topic.get(action) println |+doc.displayPrettyName(topic, status)+|+topic.get(status) {{/groovy}} In my macro page, I put one instance of my TopicClass for development. That working fine. In an other page I put an other instance and call my macro. It display instance from macro page !!! Indeed. I just tested a wiki macro with this code: --8-- {{velocity}} $doc | $xcontext.doc {{/velocity}} {{groovy}} print doc.toString() + | + xcontext.doc.toString() {{/groovy}} --8-- and the result is: --8-- Sandbox.FF | Sandbox.WikiMacroTest Sandbox.WikiMacroTest | Sandbox.WikiMacroTest --8-- As you can see $doc points to the right document in velocity but to the wiki macro document in groovy. This looks like a bug to me. Can you report an issue on http://jira.xwiki.org/jira/browse/XWIKI . Isn't it this issue: http://jira.xwiki.org/jira/browse/XWIKI-4262 ? That is not the case as I'm administrator of my wiki and I've all right. I just upgrade to 2.4.4 and find same issue. Next step, I upgrade to 2.5 and retry Sorry Ancra, I read referenced bug to fast, you are true: Thomas Mortagne said: Another side effect of this is that it makes impossible to access current document from groovy or any other non-velocity script macro. Regards, Arnaud. Arnaud. Thanks, Anca Thanks, Marius I suppose that I should not used doc to find current document in macro. But I don't find in http://platform.xwiki.org/xwiki/bin/view/DevGuide/WikiMacroTutorial how to retrieved current document. I also test xcontext.doc, but it is same as doc. So how can find current document (the document which call my macro)? Regards, Arnaud. ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] accessing to document running macro
Here is a trick {{velocity}} #set($ok = $context.context.put(mydoc, $doc)) {{/velocity}} {{groovy}} println xcontext.mydoc {{/groovy}} Ludovic Le 26/10/10 16:57, Arnaud bourree a écrit : 2010/10/26 Arnaud bourreearnaud.bour...@gmail.com: 2010/10/26 Anca Lucalu...@xwiki.com: On 10/26/2010 12:28 PM, Marius Dumitru Florea wrote: Hi Arnaud, On 10/26/2010 12:38 PM, Arnaud bourree wrote: Hello, I develop a macro which display object attached to the current page. Here summary of my code: {{goovy}} def topic = doc.getObject(ActivityReport.TopicClass, Integer.valueOf(xcontext.macro.params.id)) println |+doc.displayPrettyName(topic, title)+|+topic.get(title) println |+doc.displayPrettyName(topic, action)+|+topic.get(action) println |+doc.displayPrettyName(topic, status)+|+topic.get(status) {{/groovy}} In my macro page, I put one instance of my TopicClass for development. That working fine. In an other page I put an other instance and call my macro. It display instance from macro page !!! Indeed. I just tested a wiki macro with this code: --8-- {{velocity}} $doc | $xcontext.doc {{/velocity}} {{groovy}} print doc.toString() + | + xcontext.doc.toString() {{/groovy}} --8-- and the result is: --8-- Sandbox.FF | Sandbox.WikiMacroTest Sandbox.WikiMacroTest | Sandbox.WikiMacroTest --8-- As you can see $doc points to the right document in velocity but to the wiki macro document in groovy. This looks like a bug to me. Can you report an issue on http://jira.xwiki.org/jira/browse/XWIKI . Isn't it this issue: http://jira.xwiki.org/jira/browse/XWIKI-4262 ? That is not the case as I'm administrator of my wiki and I've all right. I just upgrade to 2.4.4 and find same issue. Next step, I upgrade to 2.5 and retry Sorry Ancra, I read referenced bug to fast, you are true: Thomas Mortagne said: Another side effect of this is that it makes impossible to access current document from groovy or any other non-velocity script macro. Regards, Arnaud. Arnaud. Thanks, Anca Thanks, Marius I suppose that I should not used doc to find current document in macro. But I don't find in http://platform.xwiki.org/xwiki/bin/view/DevGuide/WikiMacroTutorial how to retrieved current document. I also test xcontext.doc, but it is same as doc. So how can find current document (the document which call my macro)? Regards, Arnaud. ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users -- Ludovic Dubost Blog: http://blog.ludovic.org/ XWiki: http://www.xwiki.com Skype: ldubost GTalk: ldubost ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users