Hi,
Did you try using searchEvents and building an HQL that retrieves the Event
object with the given IDs? Then, once you get the Event objects, you can
use deleteActivityEvent on each of them.
Hope this helps,
Eduard
On Mon, Jan 18, 2016 at 2:39 PM, Pascal BASTIEN <pbasnews-xwiki(a)yahoo.fr>
wrote:
Hi,
I try to make an Admin form to delete some event from activity stream.
I manage:
- to list events in a checkbox list
- to delete an event
#foreach ($MonEvent in $xwiki.activitystream.getEventsForUser($MyUserr,
false, 300, 0))
#if ($MonEvent.getPage()=='MySpace.MyPage')
* event deletion
$xwiki.activitystream.deleteActivityEvent($MonEvent)
#end
#end
- but I didn't manage to pass an event id/object with form to my
deleteActivityEvent method :-(
It doesn't work because when I get my event through
$request.getParameterValues('IdEntry'), event ID is transformed in text and
is not event object anymore.
I use velocity with xwiki 7.0.1 and my page contains this code:
**********************************
{{velocity}}
{{html}}
## My form to select events to delete
<form method="get" id="DelActivityStream" onsubmit="return
confirm('Are
you sure?')">
<div class="container">
#foreach ($MonEvent in $xwiki.activitystream.getEvents(false, 200, 0 ))
##1. AAA $MonEvent - $MonEvent.getPage()
#set($MycheckBox="<input type='checkbox' name='IdEntry'
value='")
#set($MycheckBox=$MycheckBox + "$MonEvent")
#set($MycheckBox=$MycheckBox + "'/>" + "$MonEvent.getPage() -
$MonEvent.getDisplayDate() - $MonEvent.getType() - $MonEvent.getPriority()
- $MonEvent.getUser() - $MonEvent.getEventId() - $MonEvent.getEvent() " +
"<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 du flux d'activité" class="button"/></span>
</form>
{{/html}}
## get select events ID
$request.getParameterValues('IdEntry')
## i want to delete these ID
#foreach ($MyValue in $request.getParameterValues('IdEntry'))
* try to delete this event with ID: $MyValue $MyValue.getPage()
## $MyValue.getPage() it doesn't work because $MyValue is not event
anymore
## delete event method
:-(
#end
**********************************
To resume, do you have a way to give an event object to my
deleteActivityEvent with form+velocity (because deleteActivityEvent accept
only event object) ?
Thxs
Pascal B
_______________________________________________
users mailing list
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users