CleanActivityStream

Version 11.1 by Pascal Bastien on 2016/01/21 09:19

cogA form to remove some events from Activity Stream
TypeXAR
CategoryApplication
Developed by

Pascal Bastien

Rating
0 Votes
LicenseGNU Lesser General Public License 2.1
Compatibility

7.0.1

Installable with the Extension Manager

Description

By default ActivityStream is on front page of xWiki and sometime, if someone modify a page with rude langage or create/delete a page, we don't need that activity stream show these notifications.

Then we can remove some specific events from activity stream with this extension.

Form to delete selected events

CleanASBefore.png

Result

CleanASAfter.png

ASBeforeAfter.png

Notices

  • the form is installed in Sandbox by default but it is an admin tool, once installed you can move page in a space of your choice
  • the form show only last 500 events by default
  • anyways, old ActivityStream events can be removed with xwiki.cfg parameters
    #-# 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

Prerequisites & Installation Instructions

We recommend using the Extension Manager to install this extension (Make sure that the text "Installable with the Extension Manager" is displayed at the top right location on this page to know if this extension can be installed with the Extension Manager). Note that installing Extensions when being offline is currently not supported and you'd need to use some complex manual method.

You can also use the following manual method, which is useful if this extension cannot be installed with the Extension Manager or if you're using an old version of XWiki that doesn't have the Extension Manager:

  1. Log in the wiki with a user having Administration rights
  2. Go to the Administration page and select the Import category
  3. Follow the on-screen instructions to upload the downloaded XAR
  4. Click on the uploaded XAR and follow the instructions
  5. You'll also need to install all dependent Extensions that are not already installed in your wiki

Download/install Sandbox.CleanActivityStream-v0.9.xar xar extension and move page in a space of your choice OR

  • Copy/paste this code below in a page:
    {{velocity}}
    =Form to delete manually some events entries from Activity Stream =

    Select events below (last 500) and click on button to delete them

    #if ($xwiki.hasAdminRights())
      {{html}}
     <form method="get" id="DelActivityStream" onsubmit="return confirm('Delete selected events: are you sure?')">
     <div class="container">
        ## List 500 last events
        #foreach ($MyEvent in $xwiki.activitystream.getEvents(false, 500, 0 ))
          #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
       </div>
       <span class="buttonwrapper"><input type="submit" value="Delete selected entries from Activity stream" class="button"/></span>
     </form>
    {{/html}}
     #else
    {{warning}}
     You must login with an administrator account.
    {{/warning}}
    #end

    ## Get selected events ids
    ## formatting to use data in next hql query: act.eventId in ( 'xxx-yyyyy', 'another-ide', 'etc' )
    #set($ListIn = $stringtool.join($request.getParameterValues('IdEntry'), "', '"))
    #set($ListIn = "'" + $ListIn + "'")

    ## Get selected events object
    #set($results= $xwiki.activitystream.searchEvents("act.eventId in ($ListIn)", false, 0, 0))

    ## loop on theses events and delete them
    #foreach ($MyEventToDelete in $results)
      $xwiki.activitystream.deleteActivityEvent($MyEventToDelete)
     * $MyEventToDelete.getDisplayDate() - $MyEventToDelete.getPage() - $MyEventToDelete.getType() - - $MyEventToDelete.getUser() ~*~*  //**deleted**//  ~*~*
    #end

    {{/velocity}}
  • Add this XWiki.StyleSheetExtension object on the page:
    .container {
     border:2px;
     solid #ccc;
     width:800px;
     height: 300px;
     overflow-y: scroll;
     margin-left: unset;
    }

Release Notes

v0.9

  • v0.9: initial version
    

Get Connected