Hi Antoine,
antoine SEILLES wrote:
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.
If you want to code the annotation feature exactly as the comment
feature, you need to have to look at the "commentadd" action in
"WEB-INF/struts-config.xml" and at the related classes like
"CommentAddAction" and the places where they show up, like
XWikiRightServiceImpl.java, and then to introduce the same elements for
the Annotation classes.
That's not necessarily the simplest thing to do, though. Another option
is to use Groovy or Velocity scripts directly in wiki pages for
introducing the annotation feature. For example, for the help desk we're
developing, the answers to questions asked are added as XWiki objects
through Groovy scripts, even though the feature is similar to the
XWikiComment feature as well. The main advantage I see in using scripts
in wiki pages instead of external templates is that it's then easier to
evolve those scripts collaboratively. You can see the way it's coded
from [1], and the add "?viewer=code" at the end of the URLs for
viewing the code.
[1]
http://club.mandriva.com/xwiki/bin/view/ITS/
Introducing annotation capabilities to XWiki is very relevant in various
contexts. I would say we should think about the capabilities of the
plugin a bit more before developing it.
Here are some considerations:
1) do we want to have the possibility to annotate annotations? And also
to tag annotations? If yes, having each annotation in a separate
document would probably be a better design. Personally, I think that'd
be a good feature to support tagging for annotations, letting users
describe some annotations as "critique" for instance, or rating some
annotations through the rating plugin when one will be available.
2) what about rights? That may be handy to have various access rights
for annotations? Imagine a teacher and her students annotating a
document. The teacher may wish to keep her annotation private while the
students collaboratively annotate the same piece of document...
3) choosing a name would help packaging the plugin into a unique Space
(not sure about the guidelines we chose there eventually, but having all
the wiki pages for a given feature in a single space increases
lisibility, I think)
4) how will we manage annotations on evolving documents? If the
structure remains the same, that may be ok, but what will happen when a
user moves an entire paragraph to a different position? Do you know if
there has been some work on this?
I propose we use the following page for refining the design of the
feature:
http://www.xwiki.org/xwiki/bin/view/Design/AnnotationFeature
That may be easier to give input to the plugin development once we'll
have a common view on what we aim at.
Note that annotation capabilities also share some aspects with the PSEW
prototype, that allows for external annotations of wiki pages (external
in the sense that annotations are then stored in a completely distinct
database):
http://nepomuk-eclipse.semanticdesktop.org/xwiki/bin/view/Main/PSEW
Cheers
Stéphane
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
>>>
>>
>
------------------------------------------------------------------------
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs
--
Stéphane Laurière
slauriere(a)xwiki.com
XWiki
http://www.xwiki.com
http://concerto.xwiki.com
http://nepomuk.semanticdesktop.org