Well, I was thinking about a configuration item (a key-value pair) with a standard configuration UI to define them after the macro installation. But you're right, a dedicated configuration class with all the necessary fields is probably more effective.
2011/2/17 Vincent Massol <[email protected]>: > > On Feb 17, 2011, at 4:20 PM, Maxime Sinclair wrote: > >> 2011/2/17 Vincent Massol <[email protected]>: >>> >>> On Feb 16, 2011, at 11:10 AM, Maxime Sinclair wrote: >>> >>>> @Vincent My question is about a groovy wiki macro, sorry for the lack >>>> of precision. I will read the suggested page about the Configuration >>>> module. Thank you for the link. >>> >>> ok we have not done this yet. I can see 2 solutions: >>> >>> 1) You create an XClass and an XObject with the config data and you access >>> that XObject from the macro >>> 2) You lookup the ConfigurationSource using Utils.getComponent() >>> >>> IMO the best is 1). >> >> Yes I agree with you, I will try this way. >> >> Maybe, it will be fine if this kind of class will be a standard >> component of XWiki (something like a WikiMacroConfigurationClass). >> I don't know if there is an existing feature request about this. If >> not, I will create one. > > Why would we need a WikiMacroConfigurationClass? For me it's not good since > each macro's need regarding configuration is different. > > Thanks > -Vincent > >> >> Regards, >> Maxime Sinclair >> >>> >>> Thanks >>> -Vincent >>> >>>> @Guillaume Yes I already read it and I didn't find anything about this >>>> concern. But it's a very good tutorial and a "must read" for anyone >>>> who want to create a macro. >>>> >>>> 2011/2/15 Guillaume Lerouge <[email protected]>: >>>>> Hi Maxime, >>>>> >>>>> On Tue, Feb 15, 2011 at 12:30, Maxime Sinclair >>>>> <[email protected]>wrote: >>>>> >>>>>> Hello, >>>>>> >>>>>> What is the best way to create a configurable macro ? >>>>>> For example, a macro uses an external resource (like the address of a >>>>>> server). The administrator of the wiki must configure this resource >>>>>> during the installation of the macro (just after the import). Of >>>>>> course, he can update the source code of the macro but it is not very >>>>>> user friendly. >>>>> >>>>> >>>>>> Do you have any suggestions ? Thank for your help. >>>>>> >>>>> >>>>> Have you looked at >>>>> http://platform.xwiki.org/xwiki/bin/view/DevGuide/WikiMacroTutorial ? >>>>> >>>>> Guillaume >>>>> >>>>> >>>>>> Maxime Sinclair > _______________________________________________ > users mailing list > [email protected] > http://lists.xwiki.org/mailman/listinfo/users > _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
