On Thu, Apr 2, 2015 at 5:51 PM, Pascal BASTIEN <[email protected]> wrote: > Hello, > > I'm looking for advice about a way to add some tags on saved page with class. > What I have: > - a sheet page with an object Class ( with an object class + properties) + a > template page > - a velocity code in a page AddMyTag to add some tags on some page with this > URL parameters: > $!request.PageSource, $!request.ClassName > > What I'm trying to do, is: when a user save a page, a tag is added. The tag > to add is coming from a properties value (last character on property name is > _Tag). > If I call my 'AddMyTag' page, tags are correctly added on PageSource. > > To resume: > - the user save HisPage > - HisPage add tags from a properties value (name xxx_Tag) > > My problem is "how can I launch" automaticelly my 'AddMyTag' page when a user > record PageSource? > I tried with Ajax with > document.observe("xwiki:actions:save", function(event){ > (http://platform.xwiki.org/xwiki/bin/view/DevGuide/JavaScriptAPI#HActionevents28actionButtons.js29) > but the problem is: sometime xxx_Tag property value is updated after my > AJAX call (and the old tag is attached on page). > > A the moment, I'm looking for another way, I read > http://extensions.xwiki.org/xwiki/bin/view/Extension/WikiComponent+Module > But documentation indicate: "The goal is to listen ... DocumentUpdatingEvent > events (note that these events are fired before the page is saved and thus > our code doesn't need to perform the save itself ..."
> Then I can not use this method either because I must add tag from new value > from my _Tag properties. It doesn't say the document doesn't have the changes. But that the event is fired before the changes are saved. So if you listen to this event you should be able to get the new property value and add the tag. Just don't call save() in the event handled because this is done automatically after the event is passed to all handlers (including yours). Hope this helps, Marius > > How can I launch a velocity script on a document after document is saved (to > add some tag from the document itself)? > > Thxs for any help > > Pascal B > > > > > _______________________________________________ > users mailing list > [email protected] > http://lists.xwiki.org/mailman/listinfo/users _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
