[Moin-user] Dynamic page(section) subscriptions

Paul Boddie paul at boddie.org.uk
Sun Nov 17 13:09:41 EST 2013


On Saturday 16. November 2013 22.55.54 Sascha Holzhauer wrote:
> 
> I would be grateful if someone could give me some hints on the following
> challenge:
> The wiki has different "service" pages consisting of a table with
> columns date and user name.
> The aim is to subscribe users to those actions when others edit a row on
> some service page of that date when they are listed on another service
> page.
> 
> Example:
> 
> Service A
> 01.01.   JohnSurname
> 02.01.   MariaSurname
> 
> Service B
> 01.01.    PeterSurname
> 02.01.    SamSurname
> 
> For instance, Maria should receive an alert when someone changes Sam at
> 02.01. in service B because she is listed for service A at that date.

So what you want to do is this: analyze an edit on a page ("Service B"), 
extract the date, search for the date in other pages, extract the username, 
and then notify those users?

All of the above is possible but probably not very convenient: use an event 
handler to detect a page edit, parse the change (a regular expression may be 
enough, but you would want the "diff" to begin with), perform a full-text 
search, parse each page in the search results to get affected users, then 
invoke a notification for each user.

> There is also some kind of overview page for each date named e.g.
> Service_0201 which includes relevant user names. However, these pages
> are filled dynamically with the information by include macros from the
> service pages and are thus probably not helpful regarding the alert
> challenge.

I wonder whether a different way of organising the underlying data might be 
better. Grouping the data by date might eliminate the need to perform a search 
to discover who to notify when the data changes, so that Service_0201 page 
might hold the actual data like this (using a wikidict notation for potential 
convenience):

 Service A:: MariaSurname
 Service B:: SamSurname

Then, any edit to the page could fairly easily cause a scan of the different 
entries and some notifications to be sent. You skip the awkward "diff" parsing 
and can hopefully just grab everybody's details.

To show the original "Service A" and "Service B" pages might then involve more 
work, however, but you could potentially write a macro to do that. This 
actually starts to approach the EventAggregator extension I wrote in some ways 
[1], but that extension only supports notifications in terms of RSS for 
particular event criteria, although you can use Moin search expressions to 
define which events/pages will be selected and thus appear in the RSS feed.

> It may also help to get some summary on how the subscription and alert
> process works (which modules are involved).

I can't provide immediate advice about subscriptions and alerts, but the event 
handler API is something I use in my ApproveChanges plugin [2]. Maybe it can 
provide some inspiration.

Good luck!

Paul

[1] https://moinmo.in/MacroMarket/EventAggregator
[2] https://moinmo.in/ActionMarket/ApproveChanges




More information about the Moin-user mailing list