HI,
now next step is to add an annotation using velocity template.
I did an addannotation.vm template (view attached files).
I'had like to do a form like in commentsinline.vm.
But i have a problem: $doc.getURL("commentadd") How does it work? I
can't find the URLFactory.java file.
I had like to do $doc.getURL("annotationadd") that would add my
annotation and, like than for comments, would return to the active doc.
Thank you for your help.
Ludovic Dubost a écrit :
You plugin can create the class at initialization
time.. Check the
CalendarPlugin in the XWiki source
https://svn.xwiki.org/svnroot/xwiki/xwiki-platform/core/trunk/xwiki-core/sr…
Ludovic
antoine SEILLES wrote:
Ok
that's what i thought: i can't do without the XWiki class editor.
So if i want to add my plugin to another XWiki installation, i'll have
to create an AnnotationClass through the class editor.
Thank you.
Ludovic Dubost a écrit :
AnnotationClass should be a wiki page describing
your class..
Check the tutorial for FAQClass as an example
http://www.xwiki.org/xwiki/bin/view/DevGuide/FAQTutorial
Once you have a working XWiki Class storing data in your wiki, you can
work on your plugin to create such objects programmatically.
Ludovic
antoine SEILLES wrote:
Hi,
Thank for your help.
So i have changed my class Annotation into AnnotationClass (and i
changed debut into begin and fin into end).
But what does AnnotationClasses represents? Should it be the name of my
package?
In AnnotationPlugin i have a method getName:
public String getName() {
return "annotation";
}
What should it return instead of "annotation"?
Ludovic Dubost a écrit :
> Hi,
>
> Indeed you are lacking an AnnotationClass here
> You should use
>
> AnnotationClasses.AnnotationClass
> -> begin
> -> end
> -> selection
> -> author
> -> date
>
> Then you should make sure you persist your annotation using this object..
> Once you have that you would get them by doing
>
> $doc.getObject("AnnotationClasses.AnnotationClass")
> or better
> $doc.use("AnnotationClasses.AnnotationClass")
> $doc.getValue("begin")
>
>
> Ludovic
>
> antoine SEILLES wrote:
>
>
>
>
>
>> Now my objects are persistents. But i don't know how to access their
>> properties.
>> Should i create an annotation class through the XWiki class editor?
>> It seems that in my database, none of the properties of my annotations
>> are stored.
>>
>> I define an annotation for a document:
>>
$xwiki.annotation.addNewAnnotation($doc,"blablablaAnnotation",0,10,"blablaSelection","auteur")
>>
>> I retrieve all annotations of a document:
>> #set($annots=$doc.getObjects("annotation"))
>> And i try to get the selection field of my annotations:
>> #foreach($annot in $annots)
>> "$annot.get("selection")"
>> #end
>>
>> But all i have is "".
>>
>> What should i do?
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> devs mailing list
>> devs(a)xwiki.org
>>
http://lists.xwiki.org/mailman/listinfo/devs
>>
>>
>>
>>
>>
>
>
>
>
>
--
Antoine SEILLES
Doctorant (phd student)
Pikko software
Cap Omega - Rond Point Benjamin Franklin
CS 39521
34960 Montpellier Cedex 2
FRANCE
LIRMM CNRS
UMR 5506 - 161 rue Ada
34392 Montpellier Cedex 5
FRANCE
Tel: +33 (0)6 10 192 055
http://www.pikko-software.com
http://www.lirmm.fr
#if($xwiki.hasAccessLevel("comment"))
#set($cclass = $xwiki.getDocument("XWiki.AnnotationClass").getxWikiClass())
#set($comment = $cclass.newObject())
<form action="$doc.getURL("annotationadd")"
method="post">
<fieldset class="expanded" id="commentform">
<legend
onclick="toggleForm(this.form)">$msg.get("addcomment")<span
class="expands">...</span></legend>
<input type="hidden" name="xredirect"
value="${doc.getURL("view")}" />
<input type="hidden" name="XWiki.AnnotationClass_author"
value="$context.user"/>
<input type="hidden" name="XWiki.AnnotationClass_begin"
value="0"/>
<input type="hidden" name="XWiki.AnnotationClass_end"
value="10"/>
<input type="hidden" name="XWiki.AnnotationClass_selection"
value="blablabla pour le moment"/>
<div><textarea id='XWiki.XWikiComments_comment' rows='5'
cols="80" name='XWiki.Annotation_comment' style="width:
100%;"></textarea></div>
<div>
<span class="buttonwrapper"><input type="submit"
value="$msg.get("addannotation")"
class="button"/></span>
<span class="buttonwrapper"><input type="reset"
value="$msg.get("cancel")" onclick="hideForm(this.form);"
class="button"/></span>
</div>
</fieldset>
</form>
#end
</div> ## comments
</div> ## commentscontent