Hi Ludovic, On Sun, Oct 11, 2009 at 1:48 AM, Ludovic Dubost <[email protected]> wrote:
I've been partially mistaken.. Indeed it listen to the save event which actually means that the macro gets registered on import (if the user which is initially set as the contentAuthor has programming rights).
However when I then visited my page which perform the $doc.save then my macros got unregistered which is really weird as they were registered just before.
Do you still have this issue? Btw, this could be due to a programming rights issue. Currently it's required that the user saving the macro definition has programming rights. So in this case when you are invoking $doc.save(), you should have PR for macros to register. Thanks. - Asiri
Here is what I have in my macro wiki content page:
= TODO Macro =
You can use this macro from the Wysiwyg Editor
{{velocity}} #set($doc1 = $xwiki.getDocument("XWiki.TodoMacroService")) #set($doc2 = $xwiki.getDocument("XWiki.TodoMacroGroovy")) #set($doc3 = $xwiki.getDocument("XWiki.TodoListMacro")) #if(!$xwiki.hasProgrammingRights()) #if($xwiki.hasAdminRights()) #set($ok = $doc.save()) #set($ok = $doc1.save()) #set($ok = $doc2.save()) #set($ok = $doc3.save()) {{html}} #info("The TODO macro has been installed") {{/html}} #else {{html}} #warning("The TODO macro is not completely installed. You need to visit this page as an admin") {{/html}} #end #end {{/velocity}}
It's when this is run the first time that my macro gets unregistered. If it's run a second time it gets registered again.
Ludovic
Asiri Rathnayake a écrit :
Hi,
On Sat, Oct 10, 2009 at 12:25 PM, Ludovic Dubost <[email protected]> wrote:
I'm on a local install and if I save using the save action it works but does not seem to register it with $doc.save()
WikiMacroListener is responsible for listening to document save events and creating / registering wiki macros. It should work with $doc.save() because this should fire a document save event. This looks like a bug, I will check this out and report a bug (or you can do it).
Thanks.
- Asiri
Envoyé de mon iPhone
Le 10 oct. 2009 à 00:46, Sergiu Dumitriu <[email protected]> a écrit :
On Fri, Oct 9, 2009 at 23:28, Ludovic Dubost <[email protected]> wrote:
Hi,
Is there a way to register a Wiki Macro through scripting. When I import a Wiki Macro it does not seem to get registered and when I do $doc.save() on it it does not register it either. I suppose it's because we intercept the save at a different level (probably on the save action).
How can I workaround that ?
Are you sure you're not trying to register a macro in a local wiki? Currently they only work if they are in the main wiki. -- http://purl.org/net/sergiu _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Ludovic Dubost Blog: http://blog.ludovic.org/ XWiki: http://www.xwiki.com Skype: ldubost GTalk: ldubost
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs