All these considerations are interesting.
I agree we should think a bit more about capabilities of the plugin but
i'had like to do a demo of what it could look like on wednesday 12
december.
Timing is short.
Well, i have new difficulties every day.
I don't understand why but i have difficulties to include javascript.
When i do
<script language="javascript" type="text/javascript">
alert("toto");</script> no pbs.
but when i do:
<script language="javascript" type="text/javascript"
src="getSelection.js"></script>
<script language="javascript" type="text/javascript">
getSelection();</script>
with getSelection.js :
function getSelection(){
alert("toto");
}
I have an error in my console: getSelection is not define.
Another point is, how to get the values of a form in velocity?
I have an addannotation.vm :
#if($xwiki.hasAccessLevel("comment"))
#set($cclass = $xwiki.getDocument("XWiki.AnnotationClass").getxWikiClass())
#set($annotation = $cclass.newObject())
<form action="XXXXXXXXX" method="post"
id="myForm">
<fieldset class="expanded" id="commentform">
<legend
onclick="toggleForm(this.form)">$msg.get("addannotationcomment")<span
class="expands">...</span></legend>
<input type="hidden" name="xredirect"
value="${doc.getURL("view")}" />
<input type="hidden" name="AnnotationClass_author"
value="$context.user"/>
<input type="hidden" name="AnnotationClass_begin"
value=0/>
<input type="hidden" name="AnnotationClass_end"
value=0/>
<input type="hidden" name="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
I'd like to have a link to a page in "<form action=" that would print
"your annotation has been added" and that would call my function
$xwiki.annotation.addNewAnnotation($doc, $AnnotationClass_selection,
$AnnotationClass_begin, $AnnotationClass_end,
$AnnotationClass_selection, $AnnotationClass_author)
(where $AnnotationClass_begin is the value of AnnotationClass_begin field).
Stéphane Laurière a écrit :
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.
I agrre, it's a bit hard for a xwiki beginner.
[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.
We want to have the possibility to tag and annotate annotations. But we
want to have the possiblility to list for a doc all the annotations
linked to.
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...
OK
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)
I'm not sure to understand.
I have named my plugin: annotation.
And i want to be able to annotate any docs in any space.
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?
Arf. I don't know.
In this case, to localise annotation using tag should be better than
using references.
I propose we use the following page for refining the
design of the
feature:
http://www.xwiki.org/xwiki/bin/view/Design/AnnotationFeature
Great idea but i can't edit the page.
That may be easier to give input to the plugin
development once we'll
have a common view on what we aim at.
Of course.
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.
And thank for your help.
PS: my plugin and templates are attached. addannotation.vm doesn't work
cause of the form action.
--
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($annotation = $cclass.newObject())
<form action=$xwiki.annotation.addNewAnnotation($doc, $AnnotationClass_selection,
$AnnotationClass_begin, $AnnotationClass_end, $AnnotationClass_selection,
$AnnotationClass_author) method="post" id="myForm">
<fieldset class="expanded" id="commentform">
<legend
onclick="toggleForm(this.form)">$msg.get("addannotationcomment")<span
class="expands">...</span></legend>
<input type="hidden" name="xredirect"
value="${doc.getURL("view")}" />
<input type="hidden" name="AnnotationClass_author"
value="$context.user"/>
<input type="hidden" name="AnnotationClass_begin" value=0/>
<input type="hidden" name="AnnotationClass_end" value=0/>
<input type="hidden" name="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
###
### List document annotations
###
### TODO: web service?
###
#if($xwiki.getWebPreferenceAsInt("commentsorder",1)==1)
#set($annotations = $xwiki.annotation.getAnnotations($doc))
#end
<div id="annotationscontent" class="xwikiintracontent">
#if($inline && ($inline == true)) <div class="xwikititlewrapper"
onclick="toggleClass($('annotations'), 'hidden');
toggleClass($('annotationscontent'), 'exp')"><h3
class="xwikiintratitle">$msg.get("annotations")<span
class="hidden">:</span> <span
class="annotationsno"><span>$annotations.size()</span></span></h3></div>#end
<div id="annotations">
#if($annotations.size()>0)
#foreach($annotation in $annotations)
#if($velocityCount > 1) <hr class="annotationspacer"/>
#end
<div id="xwikiannotation_${velocityCount}" class="xwikiannotation
#if($velocityCount % 2 == 1) odd #else even #end">
## <div
class="annotationavatar">#useravatar($annotation.getAuthor())</div>
<div class="annotationheader"><span
class="annotationauthor">$!xwiki.getLocalUserName($doc.display('author','view',
$annotation))</span>
## #set($date = $doc.display("date","view",$annotation))
#set($date = $doc.display("created","view",$annotation))
#if($date)
| <span class="annotationdate">$date</span>
#end
#if($hasedit) <span class="annotationdelete"><a
class="annotationremove" href="$doc.getURL("objectremove" ,
"classname=XWiki.AnnotationClass&classid=${annotation.number}&xredirect=${request.getRequestURL()}")"
onclick="return
confirm('$msg.get("confirmannotationremove")')">[$msg.get("removethisannotation")]</a></span>#end
</div>
<div
class="annotationcontent"><b>$msg.get("annotationselection")
:</b>
$doc.getRenderedContent($doc.display("selection","view",$annotation))
<br> <b>$msg.get("annotationcommentaire") :</b>
$doc.getRenderedContent($doc.display("comment","view",$annotation))
</div>
</div>
#end
#else
$msg.get("noannotations")
#end
</div> ## annotations
</div> ## annotationscontent
#if($inline && ($inline == true))
<script type="text/javascript">
//<!--
if(document.getElementById("annotationform")) {
document.getElementById("annotationform").className = "collapsed";
}
document.getElementById("annotations").className += " hidden";
//-->
</script>
#end