Index: RecentActivity.xml =================================================================== --- RecentActivity.xml (revision 32704) +++ RecentActivity.xml (working copy) @@ -888,6 +888,19 @@ #end #end #** + * Get annotation text and selection + *# +#macro(getAnnotation $event $annotationText $annotationSelection) + #set($annotationText = '') + #set($annotationSelection = '') + #isDocumentVersionValid($event) + #if($isDocumentVersionValid) + #set($pageDocRevision = $xwiki.getDocument($xwiki.getDocument($event.page), $event.version)) + #set($annotationSelection = $pageDocRevision.getObject('AnnotationCode.AnnotationClass', $util.parseInt($event.param2)).getProperty('selection').value) + #set($annotationText = $pageDocRevision.getObject('AnnotationCode.AnnotationClass', $util.parseInt($event.param2)).getProperty('annotation').value) + #end +#end +#** * Remove duplicated 'update' and 'addAttachment' events for the current page entry * NOTE: each time an event != 'update' (like 'addAttachment, updateComment' ...) is fired, an extra 'update' event is fired too (for backward compatibility reasons) *# @@ -1028,11 +1041,10 @@ * Display annotation *# #macro(displayAnnotation $event) - #isDocumentVersionValid($event) - #if($isDocumentVersionValid) - #set($pageDocRevision = $xwiki.getDocument($xwiki.getDocument($event.page), $event.version)) - <div class="annotated">$pageDocRevision.getObject('AnnotationCode.AnnotationClass', $util.parseInt($event.param2)).getProperty('selection').value</div> - <div class="annotation">$pageDocRevision.getObject('AnnotationCode.AnnotationClass', $util.parseInt($event.param2)).getProperty('annotation').value</div> + #getAnnotation($event $annotationText $annotationSelection) + #if("$!annotationText" != '' || "$!annotationSelection" != '') + <div class="annotated">$!annotationSelection</div> + <div class="annotation">$!annotationText</div> #end #end #** @@ -1065,10 +1077,8 @@ #macro(isEventEntryExpandable $event) #set($isEventEntryExpandable = false) #if($isAnnotationEvent) - #set($annotationObj = $xwiki.getDocument($event.page).getObject('AnnotationCode.AnnotationClass', $util.parseInt($event.param2))) - #set($selection = $annotationObj.getProperty('selection').value) - #set($annotation = $annotationObj.getProperty('annotation').value) - #if("$!selection" != '' && "$!annotation" != '') + #getAnnotation($event $annotationText $annotationSelection) + #if("$!annotationText" != '' || "$!annotationSelection" != '') #set($isEventEntryExpandable = true) #end #elseif($isAttachmentEvent && "$!event.param2" != '')