[xwiki-users] Executing a page from another page

2011-11-22 Thread jerem
Hello,

I'm trying to "execute" a page from another page.
The "executed" page has some groovy and velocity, does some queries, and as
output attaches a computed file to itself (and outputs some success or error
message to page content).
"Executing" it means just showing the page, as a result the attachment gets
increased version.

Now I want to do the same but calling it from another page. This is what I
did :
xwiki.getDocument('Space.MyPageToExecute').getRenderedContent()

This returns my success message, but nothing gets attached. Is there any
chance that this could work ? I checked the rights of my user (set correct
user in context before the setAttachment()) but I could not make it work ...
Am I forced to write my page as a groovy class to achieve this ?

Thanks,
Jeremie

--
View this message in context: 
http://xwiki.475771.n2.nabble.com/Executing-a-page-from-another-page-tp7019817p7019817.html
Sent from the XWiki- Users mailing list archive at Nabble.com.
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] Executing a page from another page

2011-11-22 Thread Marius Dumitru Florea
On Tue, Nov 22, 2011 at 11:14 AM, jerem  wrote:
> Hello,
>
> I'm trying to "execute" a page from another page.
> The "executed" page has some groovy and velocity, does some queries, and as
> output attaches a computed file to itself (and outputs some success or error
> message to page content).
> "Executing" it means just showing the page, as a result the attachment gets
> increased version.
>
> Now I want to do the same but calling it from another page. This is what I
> did :

> xwiki.getDocument('Space.MyPageToExecute').getRenderedContent()

What about:

{{include document="Space.MyPageToExecute" context="new" /}}

See http://extensions.xwiki.org/xwiki/bin/view/Extension/Include+Macro .

Hope this helps,
Marius

>
> This returns my success message, but nothing gets attached. Is there any
> chance that this could work ? I checked the rights of my user (set correct
> user in context before the setAttachment()) but I could not make it work ...
> Am I forced to write my page as a groovy class to achieve this ?
>
> Thanks,
> Jeremie
>
> --
> View this message in context: 
> http://xwiki.475771.n2.nabble.com/Executing-a-page-from-another-page-tp7019817p7019817.html
> Sent from the XWiki- Users mailing list archive at Nabble.com.
> ___
> 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] Executing a page from another page

2011-11-22 Thread jerem
Seems great but ... I was not complete in my description.
In fact the caller page is a groovy class ... And I want to execute
"MyPageToExecute" from groovy, depending on conditions.
Tried println """{{include document/}}""" but it did not work.
I could close my groovy block and restart after, but then the {{include}}
would not be added depending on conditions tested in groovy.
Maybe I should do something like a wget of "MyPageToExecute" url in view
mode instead ?

--
View this message in context: 
http://xwiki.475771.n2.nabble.com/Executing-a-page-from-another-page-tp7019817p7019922.html
Sent from the XWiki- Users mailing list archive at Nabble.com.
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] Executing a page from another page

2011-11-22 Thread jerem
It's working with coding a sort-of "wget" from groovy code (Reader on
URLConnection) :)

Thanks,
Jeremie

--
View this message in context: 
http://xwiki.475771.n2.nabble.com/Executing-a-page-from-another-page-tp7019817p7019940.html
Sent from the XWiki- Users mailing list archive at Nabble.com.
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users