On Wed, Aug 24, 2016 at 1:02 PM, D R <rir....@gmail.com> wrote:

> Hi,
> I have an issue with a template.
> I created Dashboard.CustomerDocsDashboard with the following content:
> ```
> {{velocity}}
> #if ($context.display == 'edit')
>   {{info}}
>   Du bist im Begriff den neuen Kunden-Dokument-Bereich "//$doc.title//" zu
> erstellen.
>   Um fortzufahren wähle eine der unten stehenden Buttons.
>   {{/info}}
> #else
>   {{dashboard/}}
> #end
> {{/velocity}}
> ```
> So far so good. When I enter WYSIWYG edit mode I get the info message, in
> wiki edit mode I get the source code, exactly how I want it.
> I also defined a template provider via XWiki administration. Creating a new
> document with the template also works as intended.
> Now the issue:
> I have an application with a button leading to the page creation:
> http://localhost:8080/xwiki/bin/inline/Customer+Docs/Test+
> Customer+2/WebHome?template=Dashboard.CustomerDocsDashboard.WebHome&
> parent=Customer+Docs.Test+Customer+2&title=Test+Customer+2
> The link worked correctly before without the velocity code and only
> ```{{dashboard/}}``` in the template but now via the URL I get
> "
> Failed to execute the [velocity] macro.
> org.xwiki.rendering.macro.MacroExecutionException: The execution of the
> [velocity] script macro is not allowed. Check the rights of its last author
> or the parameters if it's rendered from another script.
> "
> instead of the info message.
> Can somebody help me, please?

Does the user that clicks on the button have script access right? See
. We don't usually put the scripts in the template because we don't want
them to be copied whenever we create a new page with the template. Instead
we put the scripts in a sheet which is then used to display each of the
pages that are created with the template. See
http://extensions.xwiki.org/xwiki/bin/view/Extension/Sheet+Module . Since
the sheet author doesn't change when you create a new page there is no
rights issue.

But you probably don't have a sheet because you don't have a class, i.e.
your template doesn't have a dedicated object. In this case, a solution is
to move the script in a wiki macro (
http://platform.xwiki.org/xwiki/bin/view/DevGuide/WikiMacroTutorial ) and
to use that wiki macro in the template content.

Hope this helps,

> Thansk in advance,
> Dennis
> _______________________________________________
> users mailing list
> users@xwiki.org
> http://lists.xwiki.org/mailman/listinfo/users
users mailing list

Reply via email to