[xwiki-devs] Rendering Groovy Script in Objects
I am investigation the possibility to write Panels in Groovy. Unfortunately I am not able to figure out: - if I XWiki would render Groovy script code by itself and if how ? - If not can I render a Groovy script form another Groovy script ? BTW I was stuck for a while when trying to create my own BlogPostTemplate because XWiki would not allow me to run it as Groovy script even if I gave myself programming rights. But when I wrote the BlogPostSheet as Groovy class and loaded it inside the Velocity script of the BlogPostTemplate it worked perfectly. Now I am wondering why I could not execute the Groovy script if I can circumvent this restriction so easily. Cheers - Andy
Hi Andy, On Thu, Sep 17, 2009 at 4:56 AM, Andreas Schaefer <[email protected]> wrote:
I am investigation the possibility to write Panels in Groovy. Unfortunately I am not able to figure out:
- if I XWiki would render Groovy script code by itself and if how ?
- If not can I render a Groovy script form another Groovy script ?
BTW I was stuck for a while when trying to create my own BlogPostTemplate because XWiki would not allow me to run it as Groovy script even if I gave myself programming rights. But when I wrote the BlogPostSheet as Groovy class and loaded it inside the Velocity script of the BlogPostTemplate it worked perfectly. Now I am wondering why I could not execute the Groovy script if I can circumvent this restriction so easily.
I think that's because panels are loaded in the context of the current document. If the current document doesn't have programming rights, the groovy code won't work. I'm not sure how using {{include}} affects this though. Guillaume
Cheers - Andy
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Guillaume Lerouge Product Manager - XWiki Skype: wikibc Twitter: glerouge http://guillaumelerouge.com/
I figured it out. The reason for my troubles was that the syntax type of the Panel was still set to 1.0. Migrating it to 2.0 did fix the issue. Cheers - Andy On Sep 16, 2009, at 7:56 PM, Andreas Schaefer wrote:
I am investigation the possibility to write Panels in Groovy. Unfortunately I am not able to figure out:
- if I XWiki would render Groovy script code by itself and if how ?
- If not can I render a Groovy script form another Groovy script ?
BTW I was stuck for a while when trying to create my own BlogPostTemplate because XWiki would not allow me to run it as Groovy script even if I gave myself programming rights. But when I wrote the BlogPostSheet as Groovy class and loaded it inside the Velocity script of the BlogPostTemplate it worked perfectly. Now I am wondering why I could not execute the Groovy script if I can circumvent this restriction so easily.
Cheers - Andy
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
The Conversion of the Blog Application to Groovy is taking shape and I currently working on fixing minor issues. Now I run into a strange issue with the Blog Panels where the Panels show up nicely in the applications WebHome where the blog entries are listed as well as when I display a single entry. But when I want to edit a new Blog Entry the Panel fail to be executed because it says I don't have the right to execute it. Strangely enough I had the just beforehand. What I figured out so far is that as soon as I execute a script during 'inline' the test for programming rights fail. When I display the entry (rather editing it) it works perfectly. Is this a bug in XWiki? Beside executing Groovy scripts it also prevents me from accessing certain items like the Message Tool. Cheers - Andy On Sep 17, 2009, at 9:13 AM, Andreas Schaefer wrote:
I figured it out. The reason for my troubles was that the syntax type of the Panel was still set to 1.0. Migrating it to 2.0 did fix the issue.
Cheers - Andy
On Sep 16, 2009, at 7:56 PM, Andreas Schaefer wrote:
I am investigation the possibility to write Panels in Groovy. Unfortunately I am not able to figure out:
- if I XWiki would render Groovy script code by itself and if how ?
- If not can I render a Groovy script form another Groovy script ?
BTW I was stuck for a while when trying to create my own BlogPostTemplate because XWiki would not allow me to run it as Groovy script even if I gave myself programming rights. But when I wrote the BlogPostSheet as Groovy class and loaded it inside the Velocity script of the BlogPostTemplate it worked perfectly. Now I am wondering why I could not execute the Groovy script if I can circumvent this restriction so easily.
Cheers - Andy
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
Well, well, well. This issue becomes stranger by the minute. After dealing with a lot of issues related to the Panel I finally figured this out: 1) Creating a new Blog Post Entry using this URL: http://localhost:8080/xwiki/bin/inline/GBlog/GBlog+Entry+2?template=GBlog.Bl... is preventing me from displaying or using anything where I need programming rights. Keep in mind that I created a new Space called 'GBlog' for my Groovy Blog. 2) After I created the Blog Entry and then go back and edit it with this URL: http://localhost:8080/xwiki/bin/inline/GBlog/GBlog+Entry+2 Everything is peachy here. For whatever reason the 'AbstractJSR223ScriptMacro' class is not able to determine if I have programming rights if the document (GBlog Entry 2) is not created yet. In my settings I (Admin) has programming rights on All and Admin group on the XWiki as well as on the GBlog space. Is there anything I am missing or is this an issue with AbstractJSR223ScriptMacro when it tries to determine the access rights? Thanks - Andy P.S.: at least I managed to create a Velocity based Panel using the Groovy code to avoid code duplication. Therefore at least I can proceed with the project. On Sep 19, 2009, at 4:53 PM, Andreas Schaefer wrote:
The Conversion of the Blog Application to Groovy is taking shape and I currently working on fixing minor issues.
Now I run into a strange issue with the Blog Panels where the Panels show up nicely in the applications WebHome where the blog entries are listed as well as when I display a single entry. But when I want to edit a new Blog Entry the Panel fail to be executed because it says I don't have the right to execute it. Strangely enough I had the just beforehand.
What I figured out so far is that as soon as I execute a script during 'inline' the test for programming rights fail. When I display the entry (rather editing it) it works perfectly. Is this a bug in XWiki?
Beside executing Groovy scripts it also prevents me from accessing certain items like the Message Tool.
Cheers - Andy
On Sep 17, 2009, at 9:13 AM, Andreas Schaefer wrote:
I figured it out. The reason for my troubles was that the syntax type of the Panel was still set to 1.0. Migrating it to 2.0 did fix the issue.
Cheers - Andy
On Sep 16, 2009, at 7:56 PM, Andreas Schaefer wrote:
I am investigation the possibility to write Panels in Groovy. Unfortunately I am not able to figure out:
- if I XWiki would render Groovy script code by itself and if how ?
- If not can I render a Groovy script form another Groovy script ?
BTW I was stuck for a while when trying to create my own BlogPostTemplate because XWiki would not allow me to run it as Groovy script even if I gave myself programming rights. But when I wrote the BlogPostSheet as Groovy class and loaded it inside the Velocity script of the BlogPostTemplate it worked perfectly. Now I am wondering why I could not execute the Groovy script if I can circumvent this restriction so easily.
Cheers - Andy
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
participants (2)
-
Andreas Schaefer -
Guillaume Lerouge