Velocity code in XWiki Enterprise 1.9.1.21780

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Velocity code in XWiki Enterprise 1.9.1.21780

Marc Lijour
Hi,

I have the brand new XWiki Enterprise 1.9.1.21780. I noticed that the class
wizard has issues
(http://xwiki.markmail.org/message/kl7vi6p2dlc3ouwr?q=FAQTutorial#query:FAQTutorial+page:1+mid:zyimlrxfkx3uff6x+state:results),
but I did create a class, a class sheet and a class template manually. I also
added an empty object to the class.

Because the Velocity code is not interpreted the same way in syntax xwiki 2.0,
I followed the syntax help guide included in the XWiki instance and I
protected the code as follows:
{{velocity}}
## replace Main with the Space where you want your documents to be created
## replace the default parent with the one of your choice
## Save this template using the 'Save' button
#set( $class = $doc.name.substring(0,$doc.name.indexOf("Class")))
#set($defaultparent = "XWiki.${class}Class")
#set($defaultweb = "LSQ")
#includeForm("XWiki.ClassSheet")
{{/velocity}}

The Velocity code is parsed but it produce HTML that is not parsed by the Wiki
page. It is displayed as-is:

<h1 id="HClass3ATermeClass"><span>Class: TermeClass</span></h1><p/>
The first thing to do is to <a
href="/xwiki/bin/edit/LSQ/TermeClass?xpage=editclass">Edit the Class</a> to
add properties to it.<p/>
<h2 id="HCreateanewdocument"><span>Create a new document</span></h2><p/>
To create a new document, you should first choose a name for you document<p/>
<form action="" id="newdoc" method="post">
<div>
<input type="hidden" name="parent" value="XWiki.TermeClass"/>
<input type="hidden" name="template" value="LSQ.TermeClassTemplate"/>
<input type="hidden" name="sheet" value="1"/>
Space: <input type="text" name="webname" value="LSQ" size="8"/>
Document: <input type="text" name="name" value="Name of your document"/>
<br/>
<br/>
<input type="button" value="Create this document" onclick='if
(updateName(this.form.name)) {this.form.action="../../inline/" +
this.form.webname.value + "/" + this.form.name.value; this.form.submit(); }'/>
</div>
</form><p/>
<h2 id="HSheetandTemplate"><span>Sheet and Template</span></h2><p/>
<ul class="star">
<li>Sheet: <span class="wikilink"><a
href="/xwiki/bin/view/LSQ/TermeClassSheet">Terme Class Sheet</a></span></li>
<li>Template: <span class="wikilink"><a
href="/xwiki/bin/view/LSQ/TermeClassTemplate">Terme Class
Template</a></span></li>
<li><span class="wikilink"><a
href="/xwiki/bin/view/XWiki/ClassSheet?xpage=code">View the sample code to
show the document list and create new documents</a></span></li>
</ul>
<h2 id="HExistingdocuments"><span>Existing documents</span></h2><p/>

Is there a workaround that to make the page parse this HTML properly or to
produce an equivalent display?

It would be nice to also let people know at
http://platform.xwiki.org/xwiki/bin/view/DevGuide/FAQTutorial (completing
tapaya's remark) -I could do that if I knew the answer.

Thanks

Marc
_______________________________________________
users mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Velocity code in XWiki Enterprise 1.9.1.21780

Marc Lijour
On Tuesday 21 July 2009 23:00:15 Marc Lijour wrote:

> Hi,
>
> I have the brand new XWiki Enterprise 1.9.1.21780. I noticed that the class
> wizard has issues
> (http://xwiki.markmail.org/message/kl7vi6p2dlc3ouwr?q=FAQTutorial#query:FAQ
>Tutorial+page:1+mid:zyimlrxfkx3uff6x+state:results), but I did create a
> class, a class sheet and a class template manually. I also added an empty
> object to the class.
>
> Because the Velocity code is not interpreted the same way in syntax xwiki
> 2.0, I followed the syntax help guide included in the XWiki instance and I
> protected the code as follows:
> {{velocity}}
> ## replace Main with the Space where you want your documents to be created
> ## replace the default parent with the one of your choice
> ## Save this template using the 'Save' button
> #set( $class = $doc.name.substring(0,$doc.name.indexOf("Class")))
> #set($defaultparent = "XWiki.${class}Class")
> #set($defaultweb = "LSQ")
> #includeForm("XWiki.ClassSheet")
> {{/velocity}}
>
> The Velocity code is parsed but it produce HTML that is not parsed by the
> Wiki page. It is displayed as-is:
>
> <h1 id="HClass3ATermeClass"><span>Class: TermeClass</span></h1><p/>
> The first thing to do is to <a
> href="/xwiki/bin/edit/LSQ/TermeClass?xpage=editclass">Edit the Class</a> to
> add properties to it.<p/>
> <h2 id="HCreateanewdocument"><span>Create a new document</span></h2><p/>
> To create a new document, you should first choose a name for you
> document<p/> <form action="" id="newdoc" method="post">
> <div>
> <input type="hidden" name="parent" value="XWiki.TermeClass"/>
> <input type="hidden" name="template" value="LSQ.TermeClassTemplate"/>
> <input type="hidden" name="sheet" value="1"/>
> Space: <input type="text" name="webname" value="LSQ" size="8"/>
> Document: <input type="text" name="name" value="Name of your document"/>
> <br/>
> <br/>
> <input type="button" value="Create this document" onclick='if
> (updateName(this.form.name)) {this.form.action="../../inline/" +
> this.form.webname.value + "/" + this.form.name.value; this.form.submit();
> }'/> </div>
> </form><p/>
> <h2 id="HSheetandTemplate"><span>Sheet and Template</span></h2><p/>
> <ul class="star">
> <li>Sheet: <span class="wikilink"><a
> href="/xwiki/bin/view/LSQ/TermeClassSheet">Terme Class
> Sheet</a></span></li> <li>Template: <span class="wikilink"><a
> href="/xwiki/bin/view/LSQ/TermeClassTemplate">Terme Class
> Template</a></span></li>
> <li><span class="wikilink"><a
> href="/xwiki/bin/view/XWiki/ClassSheet?xpage=code">View the sample code to
> show the document list and create new documents</a></span></li>
> </ul>
> <h2 id="HExistingdocuments"><span>Existing documents</span></h2><p/>
>
> Is there a workaround that to make the page parse this HTML properly or to
> produce an equivalent display?
>
> It would be nice to also let people know at
> http://platform.xwiki.org/xwiki/bin/view/DevGuide/FAQTutorial (completing
> tapaya's remark) -I could do that if I knew the answer.

The solution would be that:

To make the tutorial work in XWiki 1.9.1, use XWiki syntax 2.0 by adding the
velocity (around the Velocity code) and html (around the {{{#includeForm}}}
macro) tags as below:

{{{
{{velocity}}
## replace Main with the Space where you want your documents to be created
## replace the default parent with the one of your choice
## Save this template using the 'Save' button
#set( $class = $doc.name.substring(0,$doc.name.indexOf("Class")))
#set($defaultparent = "XWiki.${class}Class")
#set($defaultweb = "LSQ")
{{html}}#includeForm("XWiki.ClassSheet"){{/html}}
{{/velocity}} }}}

See http://jira.xwiki.org/jira/browse/XWIKI-4032

----

I did not find how to submit this fully as a comment to  
http://platform.xwiki.org/xwiki/bin/view/DevGuide/FAQTutorial 

Marc
_______________________________________________
users mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Velocity code in XWiki Enterprise 1.9.1.21780

Sergiu Dumitriu-2
Marc Lijour wrote:
> I did not find how to submit this fully as a comment to  
> http://platform.xwiki.org/xwiki/bin/view/DevGuide/FAQTutorial 

What do you mean by that? Logged in users can post comments, and I see
that you do have a user account on xwiki.org.

--
Sergiu Dumitriu
http://purl.org/net/sergiu/
_______________________________________________
users mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Velocity code in XWiki Enterprise 1.9.1.21780

Marc Lijour
On Wednesday 22 July 2009 02:26:48 Sergiu Dumitriu wrote:
> Marc Lijour wrote:
> > I did not find how to submit this fully as a comment to
> > http://platform.xwiki.org/xwiki/bin/view/DevGuide/FAQTutorial
>
> What do you mean by that? Logged in users can post comments, and I see
> that you do have a user account on xwiki.org.

I did not find how to escape the code (which contains things as {{velocity}}).
The parser can not bite it. I only submitted a portion of the comment.
_______________________________________________
users mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Velocity code in XWiki Enterprise 1.9.1.21780

Jean Couteau
Marc Lijour a écrit :

> On Wednesday 22 July 2009 02:26:48 Sergiu Dumitriu wrote:
>  
>> Marc Lijour wrote:
>>    
>>> I did not find how to submit this fully as a comment to
>>> http://platform.xwiki.org/xwiki/bin/view/DevGuide/FAQTutorial
>>>      
>> What do you mean by that? Logged in users can post comments, and I see
>> that you do have a user account on xwiki.org.
>>    
>
> I did not find how to escape the code (which contains things as {{velocity}}).
> The parser can not bite it. I only submitted a portion of the comment.
> _______________________________________________
> users mailing list
> [hidden email]
> http://lists.xwiki.org/mailman/listinfo/users
>
>  
If you put it between the {pre} and {/pre} tags it does not escape ?

--
----
Jean Couteau
Code Lutin - http://www.codelutin.com
44 Bd des Pas Enchantés - 44230 St-Sébastien/Loire
Tél : 02 40 50 29 28 - Fax : 09 59 92 29 28

_______________________________________________
users mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Velocity code in XWiki Enterprise 1.9.1.21780

Sergiu Dumitriu-2
In reply to this post by Marc Lijour
Marc Lijour wrote:
> On Wednesday 22 July 2009 02:26:48 Sergiu Dumitriu wrote:
>> Marc Lijour wrote:
>>> I did not find how to submit this fully as a comment to
>>> http://platform.xwiki.org/xwiki/bin/view/DevGuide/FAQTutorial
>> What do you mean by that? Logged in users can post comments, and I see
>> that you do have a user account on xwiki.org.
>
> I did not find how to escape the code (which contains things as {{velocity}}).
> The parser can not bite it. I only submitted a portion of the comment.

Since that is the 1.0 syntax, you should place it inside:

{code}
your code here
{code}

--
Sergiu Dumitriu
http://purl.org/net/sergiu/
_______________________________________________
users mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/users