Here a nice form to choose and delete manually some annoying event (like a page deleted or
some rude text in an page updated)
*********************************************************
*********************************************************
{{velocity}}
Form to delete manually some event entry from Activity stream :
#if ($xwiki.hasAdminRights())
{{html}}
##<form method="post" onsubmit="return confirm('Are you
sure?')">
## <form action="" id="newdoc" method="get">
<form method="get" id="DelActivityStream" onsubmit="return
confirm('Delete selected events: are you sure?')">
<div class="container">
#foreach ($MyEvent in $xwiki.activitystream.getEvents(false, 500, 0 ))
##1. AAA $MyEvent - $MyEvent.getPage()
#set($MycheckBox="<input type='checkbox' name='IdEntry'
value='")
#set($MycheckBox=$MycheckBox + "$MyEvent.getEventId()")
#set($MycheckBox=$MycheckBox + "'/>" +
"$MyEvent.getDisplayDate() - $MyEvent.getPage() - $MyEvent.getType() - -
$MyEvent.getUser() " + "<br />")
$MycheckBox
#end
## <input type="checkbox" name="IdEntry"
value="${doc.fullName}"/> This is checkbox <br />
</div>
<span class="buttonwrapper"><input type="submit"
value="Supprimer les entrées sélectionnées du flux d'activité"
class="button"/></span>
</form>
{{/html}}
#else
{{warning}}
Vous devez être connecté avec un compte Admin pour utiliser cette macro
{{/warning}}
#end
## Récupère les id des event sélectionnés
## mise en forme pour générer la requête hql cat.name in ( 'Foo', 'Bar',
'Baz' )
#set($ListIn = $stringtool.join($request.getParameterValues('IdEntry'),
"', '"))
#set($ListIn = "'" + $ListIn + "'")
##set($results=
$xwiki.activitystream.searchEvents("act.eventId='$MyValue'", false, 0,
0))
#set($results= $xwiki.activitystream.searchEvents("act.eventId in ($ListIn)",
false, 0, 0))
#foreach ($MyEventToDelete in $results)
## #foreach ($MyEventToDelete in $xwiki.activitystream.getEvents($MonStream, false, 1500,
0))
$xwiki.activitystream.deleteActivityEvent($MyEventToDelete)
* $MyEventToDelete.getDisplayDate() - $MyEventToDelete.getPage() -
$MyEventToDelete.getType() - - $MyEventToDelete.getUser() ~*~* //**deleted**// ~*~*
#end
{{/velocity}}
*********************************************************
*********************************************************
--------------------------------------------
En date de : Mer 20.1.16, Pascal BASTIEN <pbasnews-xwiki(a)yahoo.fr> a écrit :
it's working thxs a lot.
I will post my form here later when it will be ready if you
want it. :-)