[xwiki-users] Fw : Re: How can I get event object through a form (a form to choose and delete manually some events)
--- En date de : Jeu 21.1.16, vinc...@massol.net a écrit : > De: vinc...@massol.net > Arial;font-size:13px;}Very nice Bastien, I > wasn't asking that much! :) np :-) You are right some nice screenshot is always better. > I’ve taken the liberty > of editing the page to tune the language here and there, I > hope you don’t mind. I’ve also used the {{image}} macro > which is our best practice in order to have similar images > across xwiki.org. In fact, I hoped secretly that you (or nice xwiki team) correct my "english" ;-)) > Thanks a lot for providing > this, I’m sure it’ll help others!-Vincent PS: I’ve > checked a bit the non-working link (the fact that the user > cannot click on it). The generated HTML seems to have a > wrong & : Ok thxs Pascal ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] Fw : Re: How can I get event object through a form
Also note that the AS has a buitin feature to delete old events, see your xwiki.cfg file: #-# Number of days the events should be kept (0 or any negative value: infinite duration) #-# Note: if this value is greater than 0 a scheduler job will be created, this job will then be fired every week to #-# delete events older than the configured value. #-# Default: 0 # xwiki.plugin.activitystream.daystokeepevents=0 If you still need to delete event manually you could check the code executed by the scheduler job. Thanks -Vincent On 19 Jan 2016 at 07:33:20, Pascal BASTIEN (pbasnews-xw...@yahoo.fr) wrote: > > 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. That is what I was affraid of ... hql query. I though there was a simplier way like xcontext stuff or convert id in event object ;-) Thxs I will give a try (must found id field and table) > > 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 > > id="DelActivityStream" onsubmit="return > confirm('Are you sure?')"> > > > > #foreach ($MonEvent in > $xwiki.activitystream.getEvents(false, 200, 0 )) > > ##1. AAA $MonEvent - $MonEvent.getPage() > > #set($MycheckBox=" 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() " + "") > > $MycheckBox > > #end > > ## name="IdEntry" > value="${doc.fullName}"/> This is checkbox > > > > > class="buttonwrapper"> type="submit" value="Supprimer les entrées > du flux d'activité" > class="button"/> > > > > {{/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@xwiki.org > > http://lists.xwiki.org/mailman/listinfo/users > > > ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
[xwiki-users] Fw : Re: How can I get event object through a form
> > 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. That is what I was affraid of ... hql query. I though there was a simplier way like xcontext stuff or convert id in event object ;-) Thxs I will give a try (must found id field and table) > > 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 > > id="DelActivityStream" onsubmit="return > confirm('Are you sure?')"> > > > > #foreach ($MonEvent in > $xwiki.activitystream.getEvents(false, 200, 0 )) > > ##1. AAA $MonEvent - $MonEvent.getPage() > > #set($MycheckBox=" 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() " + "") > > $MycheckBox > > #end > > ## name="IdEntry" > value="${doc.fullName}"/> This is checkbox > > > > > class="buttonwrapper"> type="submit" value="Supprimer les entrées > du flux d'activité" > class="button"/> > > > > {{/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@xwiki.org > > http://lists.xwiki.org/mailman/listinfo/users > > > ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users