Hi all,
Since annotation prototype seems to be stable enough, I'm proposing you
to add it to
myxwiki.org in order to test it and to get feed back about
bugs and UI improvements.
*Annotation location retrieval system*
We chose to use a typographic alteration system in order to map a
selection from html document to the xwiki source which had generated it.
So, each non alphanumeric character is deleted whereas others becomes
uppercase. After matching the altered selection in the altered source,
we are enable to deduce real ''offsets'' from ''altered''
offsets
(having previously filled a hash map).
*Rendering*
In order to produce an annotated html code we inject in the document
xwiki source marks and render it. Then we replace marks by span markups.
In order to avoid ''tag crossing''
(<c><d></c></d>) annotation zone can
be splited in several span tags.
*Architecture and Installation*
This feature implementation can be divided in three modules :
http://svn.xwiki.org/svnroot/xwiki/sandbox/xwiki-plugin-annotation/
This plugin provide the logic side of the feature:
- determining annotation location
- adding annotation to the document
- rendering and injection of span
it require a standard plugin installation process.
http://svn.xwiki.org/svnroot/xwiki/sandbox/xwiki-rest-annotation/
This module provide a rest interface in order to communication with plugin.
Communication is done using this rest resource :
http://{host}/xwiki/rest/wikis/xwiki/spaces/{space}/pages{page}/annotation
A GET request returns generated and annotated html and the set of
annotations in the page.
A PUT request aims to add an annotation to resource.
To install it, web.xml must be modified:
<!-- RESTful API Restlet servlet -->
<servlet>
<servlet-name>RestletServlet</servlet-name>
<servlet-class>
org.xwiki.rest.XWikiRestletServlet
</servlet-class>
<init-param>
<param-name>resources</param-name>
<param-value>
...
com.xpn.xwiki.rest.annotation.AnnotationService;
</param-value>
</init-param>
...
http://svn.xwiki.org/svnroot/xwiki/sandbox/xwiki-application-annotation/
This is the client side of the feature, it use rest interface in order
to request an annotation, retrieve html annotated content and put in the
DOM.
it's a xar package which must be imported.
*Prototype usage*
Just select a non dynamique data in page content, an annotation edition
box should appear, fill it and validate.
To display annotation just click on Annotations > Show annotations menu
item.
Lucien Pereira.