Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2630,7 +2630,7 @@ Your account on ${wikiname} has been successfully activated. You can now login a
<showRightPanels>1</showRightPanels>
</property>
<property>
<showannotations></showannotations>
<showannotations>0</showannotations>
</property>
<property>
<showattachments></showattachments>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ E6XXiobSRS0opnII3NtUYrLGcq2snWE0lIjrb1v5f0WM9mBc/Mn7AAAAAElFTkSuQmCC</content></
<activated>1</activated>
</property>
<property>
<annotationClass>AnnotationCode.AnnotationClass</annotationClass>
<annotationClass>XWiki.XWikiComments</annotationClass>
</property>
<property>
<displayHighlight>1</displayHighlight>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@
##
##
## Do not display these 'internal' properties in the form:
#set($hiddenProperties = ['selection', 'selectionLeftContext', 'selectionRightContext', 'originalSelection', 'target', 'date', 'author', 'state'])## TODO: 'color'
#set($hiddenProperties = ['selection', 'selectionLeftContext', 'selectionRightContext', 'originalSelection', 'target', 'date', 'author', 'state', 'replyto', 'highlight'])## TODO: 'color'
##
##
#*
* Display a box for creating an annotation
*
* @param $space the space of the annotated document
* @param $space the space of the annotated document
* @param $page the name of the annotated document
* @param $annData a map containing the mandatory selection-related fields
* @param $docWiki the wiki of the annotated document
Expand All @@ -82,7 +82,7 @@
#*
* Display a box for editing an annotation
*
* @param $target the annotated entity identifier
* @param $target the annotated entity identifier
* @param $id the annotation identifier
* @param $docWiki the wiki of the annotated document
* @param $docSpace the space of the annotated document
Expand All @@ -106,7 +106,7 @@
#*
* Display a box containing the annotation
*
* @param $target the annotated entity identifier
* @param $target the annotated entity identifier
* @param $id the annotation identifier
* @param $docWiki the wiki of the annotated document
* @param $docSpace the space of the annotated document
Expand All @@ -133,7 +133,7 @@
#*
* Display form buttons
*
* @param $mode 'create' or 'edit'
* @param $mode 'create' or 'edit'
*#
#macro(displayAnnotationBoxButtons $mode)
&lt;div class="buttons"&gt;
Expand Down Expand Up @@ -161,6 +161,14 @@
&lt;/div&gt;
&lt;div class="annotationContent"&gt;
#displayAnnotationBody($ann $mode)
#if ($mode == 'view' &amp;&amp; $annotationClassDocName == 'XWiki.XWikiComments')
#set($annDocReference = $services.model.createDocumentReference($docWiki, $docSpace, $docPage))
#set($annoDoc = $xwiki.getDocument($annDocReference))
#set($repliesList = $annoDoc.getObjects('XWiki.XWikiComments', 'replyto', $ann.id))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be commented, is a hack from the annotations pov, since it gets objects directly and uses annotation id as an object number, which is not necessarrily a hard requirement. Other storage can use the ann id differently.
Maybe we could put a test for the annotation class around it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. Will wrap it with a check to see if the current annotationClass in the configuration object is "XWiki.XWikiComments". Thanks.

#if($repliesList.size() &gt; 0)
&lt;a href="#xwikicomment_${ann.id}"&gt;See thread&lt;/a&gt;
#end
#end
&lt;/div&gt;
&lt;/div&gt;
#end
Expand Down Expand Up @@ -200,6 +208,17 @@
&lt;span class="tool accept"&gt;&lt;a class="validate" href="${editURL}" title="$msg.get('annotations.action.validate.tooltip')"&gt;$msg.get('annotations.action.validate.text')&lt;/a&gt;&lt;/span&gt;
#end
#if ($mode != 'edit')
## Comment reply button only for default annotations.
#if ("$!annotationClassDocName" == 'XWiki.XWikiComments')
#set($annDocReference = $services.model.createDocumentReference($docWiki, $docSpace, $docPage))
#set($annoDoc = $xwiki.getDocument($annDocReference))
#set($xredirect = $!escapetool.xml($request.get('xredirect')))
#if("$!xredirect" == '')
#set($xredirect = "$annoDoc.getURL('view')?$!request.getQueryString()")
#end
## add "comment reply" button
&lt;span class="tool annotationReply commenttool commentreply"&gt;&lt;a class="commentreply" href="$xredirect.replaceAll('&amp;?replyto=\d++', '')&amp;amp;replyto=${ann.id}#xwikicomment_${ann.id}" title="$msg.get('core.viewers.comments.reply')"&gt;$msg.get('core.viewers.comments.reply')&lt;/a&gt;&lt;/span&gt;
#end
## use an edit url just for the fanciness of it, it won't really be used in this case. An edit form will be loaded
&lt;span class="tool annotationEdit"&gt;&lt;a class="edit" href="${editURL}" title="$msg.get('annotations.action.edit.tooltip')"&gt;$msg.get('annotations.action.edit.text')&lt;/a&gt;&lt;/span&gt;
#end
Expand All @@ -220,7 +239,7 @@
* @param $mode view (default), list, create or edit
*#
#macro(displayAnnotationBody $ann $mode)
#if ($mode == 'list')
#if ($mode == 'list')
#if ($ann.state == 'ALTERED')
&lt;div class="annotationOriginalSelection"&gt;$msg.get("annotations.altered.text")&lt;/div&gt;
#end
Expand All @@ -236,13 +255,20 @@
#set($properties = $annotationClass.properties)
#if ($properties.size() == $hiddenProperties.size() + 1)
## Do not show property labels if there's only one property to display
#set($prop = $annotationClass.get('annotation'))
#set($discard = $fakeObj.set($prop.name, "$!{ann.get($prop.name)}"))
## get the only property that is to be displayed
#set($onlyProperty = '')
#foreach($prop in $properties)
#if(!$listtool.contains($hiddenProperties, $prop.name))
#set($onlyProperty = $prop)
#break
#end
#end
#set($discard = $fakeObj.set($onlyProperty.name, "$!{ann.get($onlyProperty.name)}"))
&lt;div class="annotationText"&gt;
#if($mode == 'edit' || $mode == 'create')
$doc.displayEdit($prop, '', $fakeObj)
$doc.displayEdit($onlyProperty, '', $fakeObj)
#else
$doc.displayView($prop, '', $fakeObj)
$doc.displayView($onlyProperty, '', $fakeObj)
#end
&lt;/div&gt;
#else
Expand Down
Loading