Re: [xwiki-users] Newline after include macro
Hi Thomas, apologies for the delayed reply. I tried removing the {{groovy}} macro, but the p/p still seems to be there :-( Also tried using wiki=false, but same results.. It still seems like the newline between {{include}} and {{groovy}} and the {{include}} in TestService causes this. Any other ideas? On Sat, Jun 12, 2010 at 1:07 AM, Thomas Mortagne thomas.morta...@xwiki.comwrote: On Fri, Jun 11, 2010 at 17:17, Lewis Denizen orang...@gmail.com wrote: Yup, {{test /}} is a wiki macro. The contents are: {{include document=Sandbox.TestService context=current /}} {{groovy}} import com.test.TestService out.println( TestService.testMe() ) {{/groovy}} What happen if you remove this groovy macro ? Do you still have the p/p ? Basically the game is to try to find from where this p/p comes from. Could you try to put wiki=false in this groovy macro to see what it exactly produce before being re-parsed. The Sandbox.TestService2 page just has another class defined (no contents tho): {{groovy output=false}} package com.test class TestService2 { def static testMe2() { return TEST } } {{/groovy}} Any ideas? On Fri, Jun 11, 2010 at 12:49 AM, Thomas Mortagne thomas.morta...@xwiki.com wrote: On Thu, Jun 10, 2010 at 17:05, Lewis Denizen orang...@gmail.com wrote: Hi Thomas, {{test /}} just outputs the result of TestService.testMe(): What is {{test /}} exactly ? A wiki macro ? What is its code ? out.println( TestService.testMe() ) TestService.testMe() just returns the literal string TEST, so I think it should be fine. Would there be anything I could do to enable some debug output perhaps? What do you have when you directly see Sandbox.TestService2 page (instead of include it) ? On Thu, Jun 10, 2010 at 9:57 PM, Thomas Mortagne thomas.morta...@xwiki.comwrote: On Thu, Jun 10, 2010 at 14:36, Lewis Denizen orang...@gmail.com wrote: Thanks for the quick reply, Thomas! Actually, I tried that but without luck. It gives the exact same output as what I have below :-( BTW, I am using XWiki 2.3.1, which should be the latest stable release as well. As far as i can see the p/pTEST is produced by your macro. What {{text /}} is supposed to do ? On Thu, Jun 10, 2010 at 12:55 AM, Thomas Mortagne thomas.morta...@xwiki.com wrote: On Wed, Jun 9, 2010 at 15:39, Lewis Denizen orang...@gmail.com wrote: Hi xwiki-users, I created a page called Sandbox.TestMacro with the following content: * {{test /}} The page also has a WikiMacro object defined: {{include document=Sandbox.TestService context=current /}}{{groovy}} import com.test.TestService out.println( TestService.testMe() ) {{/groovy}} Sandbox.TestService has the following content in it: {{include document=Sandbox.TestService2 context=current /}}{{groovy output=false}} package com.test class TestService { def static testMe() { return TEST } } {{/groovy}} When you do that you write a paragraph containing two macros (include and groovy). You should write {{include document=Sandbox.TestService2 context=current /}} {{groovy output=false}} package com.test class TestService { def static testMe() { return TEST } } {{/groovy}} instead. Now, when I render the TestMacro page, I get a few extra p inserted before the text TEST: ullip/pTEST/li/ul This makes the page look weird, since the bullet point text is on a new line now.. I've also had to put the {{include}} and the {{groovy}} lines together in the pages above; otherwise, there would just be more p's inserted.. Is there any way around this? Appreciate any tips! ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users -- Thomas Mortagne ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users -- Thomas Mortagne ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users -- Thomas Mortagne ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing
Re: [xwiki-users] Newline after include macro
Yup, {{test /}} is a wiki macro. The contents are: {{include document=Sandbox.TestService context=current /}} {{groovy}} import com.test.TestService out.println( TestService.testMe() ) {{/groovy}} The Sandbox.TestService2 page just has another class defined (no contents tho): {{groovy output=false}} package com.test class TestService2 { def static testMe2() { return TEST } } {{/groovy}} Any ideas? On Fri, Jun 11, 2010 at 12:49 AM, Thomas Mortagne thomas.morta...@xwiki.com wrote: On Thu, Jun 10, 2010 at 17:05, Lewis Denizen orang...@gmail.com wrote: Hi Thomas, {{test /}} just outputs the result of TestService.testMe(): What is {{test /}} exactly ? A wiki macro ? What is its code ? out.println( TestService.testMe() ) TestService.testMe() just returns the literal string TEST, so I think it should be fine. Would there be anything I could do to enable some debug output perhaps? What do you have when you directly see Sandbox.TestService2 page (instead of include it) ? On Thu, Jun 10, 2010 at 9:57 PM, Thomas Mortagne thomas.morta...@xwiki.comwrote: On Thu, Jun 10, 2010 at 14:36, Lewis Denizen orang...@gmail.com wrote: Thanks for the quick reply, Thomas! Actually, I tried that but without luck. It gives the exact same output as what I have below :-( BTW, I am using XWiki 2.3.1, which should be the latest stable release as well. As far as i can see the p/pTEST is produced by your macro. What {{text /}} is supposed to do ? On Thu, Jun 10, 2010 at 12:55 AM, Thomas Mortagne thomas.morta...@xwiki.com wrote: On Wed, Jun 9, 2010 at 15:39, Lewis Denizen orang...@gmail.com wrote: Hi xwiki-users, I created a page called Sandbox.TestMacro with the following content: * {{test /}} The page also has a WikiMacro object defined: {{include document=Sandbox.TestService context=current /}}{{groovy}} import com.test.TestService out.println( TestService.testMe() ) {{/groovy}} Sandbox.TestService has the following content in it: {{include document=Sandbox.TestService2 context=current /}}{{groovy output=false}} package com.test class TestService { def static testMe() { return TEST } } {{/groovy}} When you do that you write a paragraph containing two macros (include and groovy). You should write {{include document=Sandbox.TestService2 context=current /}} {{groovy output=false}} package com.test class TestService { def static testMe() { return TEST } } {{/groovy}} instead. Now, when I render the TestMacro page, I get a few extra p inserted before the text TEST: ullip/pTEST/li/ul This makes the page look weird, since the bullet point text is on a new line now.. I've also had to put the {{include}} and the {{groovy}} lines together in the pages above; otherwise, there would just be more p's inserted.. Is there any way around this? Appreciate any tips! ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users -- Thomas Mortagne ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users -- Thomas Mortagne ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users -- Thomas Mortagne ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] Newline after include macro
Thanks for the quick reply, Thomas! Actually, I tried that but without luck. It gives the exact same output as what I have below :-( BTW, I am using XWiki 2.3.1, which should be the latest stable release as well. On Thu, Jun 10, 2010 at 12:55 AM, Thomas Mortagne thomas.morta...@xwiki.com wrote: On Wed, Jun 9, 2010 at 15:39, Lewis Denizen orang...@gmail.com wrote: Hi xwiki-users, I created a page called Sandbox.TestMacro with the following content: * {{test /}} The page also has a WikiMacro object defined: {{include document=Sandbox.TestService context=current /}}{{groovy}} import com.test.TestService out.println( TestService.testMe() ) {{/groovy}} Sandbox.TestService has the following content in it: {{include document=Sandbox.TestService2 context=current /}}{{groovy output=false}} package com.test class TestService { def static testMe() { return TEST } } {{/groovy}} When you do that you write a paragraph containing two macros (include and groovy). You should write {{include document=Sandbox.TestService2 context=current /}} {{groovy output=false}} package com.test class TestService { def static testMe() { return TEST } } {{/groovy}} instead. Now, when I render the TestMacro page, I get a few extra p inserted before the text TEST: ullip/pTEST/li/ul This makes the page look weird, since the bullet point text is on a new line now.. I've also had to put the {{include}} and the {{groovy}} lines together in the pages above; otherwise, there would just be more p's inserted.. Is there any way around this? Appreciate any tips! ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users -- Thomas Mortagne ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] Newline after include macro
Hi Thomas, {{test /}} just outputs the result of TestService.testMe(): out.println( TestService.testMe() ) TestService.testMe() just returns the literal string TEST, so I think it should be fine. Would there be anything I could do to enable some debug output perhaps? On Thu, Jun 10, 2010 at 9:57 PM, Thomas Mortagne thomas.morta...@xwiki.comwrote: On Thu, Jun 10, 2010 at 14:36, Lewis Denizen orang...@gmail.com wrote: Thanks for the quick reply, Thomas! Actually, I tried that but without luck. It gives the exact same output as what I have below :-( BTW, I am using XWiki 2.3.1, which should be the latest stable release as well. As far as i can see the p/pTEST is produced by your macro. What {{text /}} is supposed to do ? On Thu, Jun 10, 2010 at 12:55 AM, Thomas Mortagne thomas.morta...@xwiki.com wrote: On Wed, Jun 9, 2010 at 15:39, Lewis Denizen orang...@gmail.com wrote: Hi xwiki-users, I created a page called Sandbox.TestMacro with the following content: * {{test /}} The page also has a WikiMacro object defined: {{include document=Sandbox.TestService context=current /}}{{groovy}} import com.test.TestService out.println( TestService.testMe() ) {{/groovy}} Sandbox.TestService has the following content in it: {{include document=Sandbox.TestService2 context=current /}}{{groovy output=false}} package com.test class TestService { def static testMe() { return TEST } } {{/groovy}} When you do that you write a paragraph containing two macros (include and groovy). You should write {{include document=Sandbox.TestService2 context=current /}} {{groovy output=false}} package com.test class TestService { def static testMe() { return TEST } } {{/groovy}} instead. Now, when I render the TestMacro page, I get a few extra p inserted before the text TEST: ullip/pTEST/li/ul This makes the page look weird, since the bullet point text is on a new line now.. I've also had to put the {{include}} and the {{groovy}} lines together in the pages above; otherwise, there would just be more p's inserted.. Is there any way around this? Appreciate any tips! ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users -- Thomas Mortagne ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users -- Thomas Mortagne ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
[xwiki-users] Groovy JAR attach
Hi xwiki-users, I seem to be having trouble including JARs in my Groovy classpath. I'm trying the following: {{groovy jars=attach:test-1.0.jar}} try { def x = Class.forName(com.test.TestMe) out.println(x) } catch(e) { out.println(FAILURE: + e) } {{/groovy}} This ends up with the text FAILURE: ClassNotFoundException, but if I change the first line to: Class.forName(com.test.TestMe, false, this.getClass().getClassLoader()) it seems to work. But, when I try this instead: {{groovy jars=attach:wiki:Sandbox.Test}} try { def x = Class.forName(com.test.TestMe, false, this.getClass().getClassLoader()) out.println(x) } catch(e) { out.println(FAILURE: + e) } {{/groovy}} it red-boxes me with a NullPointerException at the end (at com.xpn.xwiki.doc.DefaultDocumentAccessBridge.getAttachmentContent(DefaultDocumentAccessBridge.java:510)). And, same issue if I try it without the ClassLoader. Ultimately, I'm trying to wrap this in a WikiMacro, but none of these options work if I put the code in a WikiMacro object. Anyone have luck with JAR attachments? Thanks in advance! ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] Components from the wiki
Thanks again, Vincent! Yup, ComponentDescriptorFactory did the magic :-D On Dec 4, 2009, at 1:39 AM, Vincent Massol vinc...@massol.net wrote: On Dec 3, 2009, at 4:34 PM, Lewis Denizen wrote: Thanks Vincent! That's exactly what I needed :-) Just one more question, though.. Is it possible to inject dependencies by using the attributes defined within the class then? Right now, using the DefaultComponentDescriptor, I can inject dependencies using: componentDescriptor.addComponentDependency(QueryManager.class, default) but would be nice if it could auto-inject into something like: class UserXWQLDAO implements UserDAO { @Requirement def QueryManager queryManager //... } You'd need to use the annotation loader to do that. new ComponentAnnotationLoader().initialize(componentManager, classloader) However note that it'll re-register all components for which it finds annotations. I guess you could also use the ComponentDescriptorFactory class which would be much simpler since you pass to it the class to configure. See http://svn.xwiki.org/svnroot/xwiki/platform/core/trunk/xwiki-component/xwiki-component-default/src/main/java/org/xwiki/component/annotation/ComponentDescriptorFactory.java Thanks -Vincent Thanks again for a great wiki! On Wed, Dec 2, 2009 at 3:56 AM, Vincent Massol vinc...@massol.net wrote: Hi Lewis, On Dec 1, 2009, at 7:12 PM, Lewis Denizen wrote: Hi xwiki-users, I'm trying to bootstrap a component from the wiki itself (via Groovy). I have an interface defined as follows: // This is the text inside the User.UserDAO document {{groovy}} interface UserDAO { def ROLE = UserDAO.class.name /** * Returns the current user name. */ def getUserName() /** * Returns the current user's password */ def getPassword() } {{/groovy}} I also have a dummy implementation defined as follows: // This is the text inside the User.UserXWQLDAO document {{include document=User.UserDAO /}} {{groovy}} import org.xwiki.component.annotation.Component import org.xwiki.component.annotation.Requirement import org.xwiki.component.descriptor.DefaultComponentDescriptor import org.xwiki.query.Query import org.xwiki.query.QueryManager import com.xpn.xwiki.web.Utils @Component(roles = [ UserDAO.class ]) class UserXWQLDAO implements UserDAO { @Requirement def QueryManager queryManager /** * Returns the current user name. */ def getUserName() { return bleh } /** * Returns the current user's password */ def getPassword() { return bleh } } if(!Utils.componentManager.hasComponent(UserDAO.class)) { def componentDescriptor = new DefaultComponentDescriptor() componentDescriptor.setImplementation(UserDAO.class) Utils.componentManager.registerComponent(componentDescriptor, new UserXWQLDAO()) } {{/groovy}} The first problem I ran into was that Groovy 1.6.5 ran into IncompatibleClassChangeErrors ( http://jira.codehaus.org/browse/GROOVY-3830 ). Upgrading to 1.6.6 fixed this issue. But, then I ran into a NPE: *exception* javax.servlet.ServletException: Failed to initialize Request/ Response or Session com .xpn .xwiki .web.XWikiAction.initializeContainerComponent(XWikiAction.java: 391) com .xpn.xwiki.web.XWikiAction.initializeXWikiContext(XWikiAction.java: 372) com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:112) org .apache .struts .action.RequestProcessor.processActionPerform (RequestProcessor.java: 431) org .apache .struts.action.RequestProcessor.process(RequestProcessor.java: 236) org.apache.struts.action.ActionServlet.process(ActionServlet.java: 1196) org.apache.struts.action.ActionServlet.doPost(ActionServlet.java: 432) javax.servlet.http.HttpServlet.service(Unknown Source) javax.servlet.http.HttpServlet.service(Unknown Source) com .xpn .xwiki .wysiwyg .server.filter.ConversionFilter.doFilter(ConversionFilter.java:152) com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:119) com .xpn .xwiki.plugin.webdav.XWikiDavFilter.doFilter(XWikiDavFilter.java: 68) com .xpn .xwiki .web .SavedRequestRestorerFilter .doFilter(SavedRequestRestorerFilter.java: 295) com .xpn .xwiki .web .SetCharacterEncodingFilter .doFilter(SetCharacterEncodingFilter.java: 112) *root cause* org.xwiki.container.servlet.ServletContainerException: Failed to initialize request org .xwiki .container .servlet .internal .DefaultServletContainerInitializer .initializeRequest(DefaultServletContainerInitializer.java:98) com .xpn .xwiki .web.XWikiAction.initializeContainerComponent(XWikiAction.java: 387) com .xpn.xwiki.web.XWikiAction.initializeXWikiContext(XWikiAction.java: 372) com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:112) org .apache .struts .action.RequestProcessor.processActionPerform (RequestProcessor.java: 431) org .apache .struts.action.RequestProcessor.process
Re: [xwiki-users] Components from the wiki
Thanks Vincent! That's exactly what I needed :-) Just one more question, though.. Is it possible to inject dependencies by using the attributes defined within the class then? Right now, using the DefaultComponentDescriptor, I can inject dependencies using: componentDescriptor.addComponentDependency(QueryManager.class, default) but would be nice if it could auto-inject into something like: class UserXWQLDAO implements UserDAO { @Requirement def QueryManager queryManager //... } Thanks again for a great wiki! On Wed, Dec 2, 2009 at 3:56 AM, Vincent Massol vinc...@massol.net wrote: Hi Lewis, On Dec 1, 2009, at 7:12 PM, Lewis Denizen wrote: Hi xwiki-users, I'm trying to bootstrap a component from the wiki itself (via Groovy). I have an interface defined as follows: // This is the text inside the User.UserDAO document {{groovy}} interface UserDAO { def ROLE = UserDAO.class.name /** * Returns the current user name. */ def getUserName() /** * Returns the current user's password */ def getPassword() } {{/groovy}} I also have a dummy implementation defined as follows: // This is the text inside the User.UserXWQLDAO document {{include document=User.UserDAO /}} {{groovy}} import org.xwiki.component.annotation.Component import org.xwiki.component.annotation.Requirement import org.xwiki.component.descriptor.DefaultComponentDescriptor import org.xwiki.query.Query import org.xwiki.query.QueryManager import com.xpn.xwiki.web.Utils @Component(roles = [ UserDAO.class ]) class UserXWQLDAO implements UserDAO { @Requirement def QueryManager queryManager /** * Returns the current user name. */ def getUserName() { return bleh } /** * Returns the current user's password */ def getPassword() { return bleh } } if(!Utils.componentManager.hasComponent(UserDAO.class)) { def componentDescriptor = new DefaultComponentDescriptor() componentDescriptor.setImplementation(UserDAO.class) Utils.componentManager.registerComponent(componentDescriptor, new UserXWQLDAO()) } {{/groovy}} The first problem I ran into was that Groovy 1.6.5 ran into IncompatibleClassChangeErrors ( http://jira.codehaus.org/browse/GROOVY-3830 ). Upgrading to 1.6.6 fixed this issue. But, then I ran into a NPE: *exception* javax.servlet.ServletException: Failed to initialize Request/ Response or Session com .xpn .xwiki.web.XWikiAction.initializeContainerComponent(XWikiAction.java: 391) com .xpn.xwiki.web.XWikiAction.initializeXWikiContext(XWikiAction.java: 372) com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:112) org .apache .struts .action.RequestProcessor.processActionPerform(RequestProcessor.java: 431) org .apache.struts.action.RequestProcessor.process(RequestProcessor.java: 236) org.apache.struts.action.ActionServlet.process(ActionServlet.java: 1196) org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432) javax.servlet.http.HttpServlet.service(Unknown Source) javax.servlet.http.HttpServlet.service(Unknown Source) com .xpn .xwiki .wysiwyg .server.filter.ConversionFilter.doFilter(ConversionFilter.java:152) com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:119) com .xpn.xwiki.plugin.webdav.XWikiDavFilter.doFilter(XWikiDavFilter.java: 68) com .xpn .xwiki .web .SavedRequestRestorerFilter.doFilter(SavedRequestRestorerFilter.java: 295) com .xpn .xwiki .web .SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java: 112) *root cause* org.xwiki.container.servlet.ServletContainerException: Failed to initialize request org .xwiki .container .servlet .internal .DefaultServletContainerInitializer .initializeRequest(DefaultServletContainerInitializer.java:98) com .xpn .xwiki.web.XWikiAction.initializeContainerComponent(XWikiAction.java: 387) com .xpn.xwiki.web.XWikiAction.initializeXWikiContext(XWikiAction.java: 372) com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:112) org .apache .struts .action.RequestProcessor.processActionPerform(RequestProcessor.java: 431) org .apache.struts.action.RequestProcessor.process(RequestProcessor.java: 236) org.apache.struts.action.ActionServlet.process(ActionServlet.java: 1196) org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432) javax.servlet.http.HttpServlet.service(Unknown Source) javax.servlet.http.HttpServlet.service(Unknown Source) com .xpn .xwiki .wysiwyg .server.filter.ConversionFilter.doFilter(ConversionFilter.java:152) com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:119) com .xpn.xwiki.plugin.webdav.XWikiDavFilter.doFilter(XWikiDavFilter.java
Re: [xwiki-users] Edit bug?
Thanks for the tip Joshua and Thomas! Raised a JIRA though: http://jira.xwiki.org/jira/browse/XWIKI-4643 Appreciate the hard work on XWiki! On Wed, Dec 2, 2009 at 3:19 AM, Thomas Mortagne thomas.morta...@xwiki.comwrote: Hi, On Tue, Dec 1, 2009 at 18:51, Lewis Denizen orang...@gmail.com wrote: Hi xwiki-users, When I browse to a new space ( http://localhost/xwiki_root/bin/view/MySpace) and edit the page using the edit this page link, it forwards me to a different space: http://localhost/xwiki_root/bin/edit/view/MySpace). It works when I browse to http://localhost/xwiki_root/bin/edit/MySpace/WebHome, but would be nice to have this fixed :-) But great work stuff in XWiki 2.0.x! http://localhost/xwiki_root/bin/view/MySpace is not the same thing than http://localhost/xwiki_root/bin/view/MySpace/ * http://localhost/xwiki_root/bin/view/MySpace/ targets space MySpace and page WebHome * http://localhost/xwiki_root/bin/view/MySpace targets space view and page MySpace Now i agree that is does not seems right. Could you create an issue on http://jira.xwiki.org -- Lewis ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users -- Thomas Mortagne ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] Components from the wiki
Actually... seems like componentDescriptor.addComponentDependency() doesn't add the dependency either :-( Just ends up being null when retrieving it. Is there something that needs to be done before injection happens on these objects? On Fri, Dec 4, 2009 at 12:34 AM, Lewis Denizen orang...@gmail.com wrote: Thanks Vincent! That's exactly what I needed :-) Just one more question, though.. Is it possible to inject dependencies by using the attributes defined within the class then? Right now, using the DefaultComponentDescriptor, I can inject dependencies using: componentDescriptor.addComponentDependency(QueryManager.class, default) but would be nice if it could auto-inject into something like: class UserXWQLDAO implements UserDAO { @Requirement def QueryManager queryManager //... } Thanks again for a great wiki! On Wed, Dec 2, 2009 at 3:56 AM, Vincent Massol vinc...@massol.net wrote: Hi Lewis, On Dec 1, 2009, at 7:12 PM, Lewis Denizen wrote: Hi xwiki-users, I'm trying to bootstrap a component from the wiki itself (via Groovy). I have an interface defined as follows: // This is the text inside the User.UserDAO document {{groovy}} interface UserDAO { def ROLE = UserDAO.class.name /** * Returns the current user name. */ def getUserName() /** * Returns the current user's password */ def getPassword() } {{/groovy}} I also have a dummy implementation defined as follows: // This is the text inside the User.UserXWQLDAO document {{include document=User.UserDAO /}} {{groovy}} import org.xwiki.component.annotation.Component import org.xwiki.component.annotation.Requirement import org.xwiki.component.descriptor.DefaultComponentDescriptor import org.xwiki.query.Query import org.xwiki.query.QueryManager import com.xpn.xwiki.web.Utils @Component(roles = [ UserDAO.class ]) class UserXWQLDAO implements UserDAO { @Requirement def QueryManager queryManager /** * Returns the current user name. */ def getUserName() { return bleh } /** * Returns the current user's password */ def getPassword() { return bleh } } if(!Utils.componentManager.hasComponent(UserDAO.class)) { def componentDescriptor = new DefaultComponentDescriptor() componentDescriptor.setImplementation(UserDAO.class) Utils.componentManager.registerComponent(componentDescriptor, new UserXWQLDAO()) } {{/groovy}} The first problem I ran into was that Groovy 1.6.5 ran into IncompatibleClassChangeErrors ( http://jira.codehaus.org/browse/GROOVY-3830 ). Upgrading to 1.6.6 fixed this issue. But, then I ran into a NPE: *exception* javax.servlet.ServletException: Failed to initialize Request/ Response or Session com .xpn .xwiki.web.XWikiAction.initializeContainerComponent(XWikiAction.java: 391) com .xpn.xwiki.web.XWikiAction.initializeXWikiContext(XWikiAction.java: 372) com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:112) org .apache .struts .action.RequestProcessor.processActionPerform(RequestProcessor.java: 431) org .apache.struts.action.RequestProcessor.process(RequestProcessor.java: 236) org.apache.struts.action.ActionServlet.process(ActionServlet.java: 1196) org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432) javax.servlet.http.HttpServlet.service(Unknown Source) javax.servlet.http.HttpServlet.service(Unknown Source) com .xpn .xwiki .wysiwyg .server.filter.ConversionFilter.doFilter(ConversionFilter.java:152) com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:119) com .xpn.xwiki.plugin.webdav.XWikiDavFilter.doFilter(XWikiDavFilter.java: 68) com .xpn .xwiki .web .SavedRequestRestorerFilter.doFilter(SavedRequestRestorerFilter.java: 295) com .xpn .xwiki .web .SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java: 112) *root cause* org.xwiki.container.servlet.ServletContainerException: Failed to initialize request org .xwiki .container .servlet .internal .DefaultServletContainerInitializer .initializeRequest(DefaultServletContainerInitializer.java:98) com .xpn .xwiki.web.XWikiAction.initializeContainerComponent(XWikiAction.java: 387) com .xpn.xwiki.web.XWikiAction.initializeXWikiContext(XWikiAction.java: 372) com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:112) org .apache .struts .action.RequestProcessor.processActionPerform(RequestProcessor.java: 431) org .apache.struts.action.RequestProcessor.process(RequestProcessor.java: 236) org.apache.struts.action.ActionServlet.process(ActionServlet.java: 1196) org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432) javax.servlet.http.HttpServlet.service(Unknown
[xwiki-users] Edit bug?
Hi xwiki-users, When I browse to a new space (http://localhost/xwiki_root/bin/view/MySpace) and edit the page using the edit this page link, it forwards me to a different space: http://localhost/xwiki_root/bin/edit/view/MySpace). It works when I browse to http://localhost/xwiki_root/bin/edit/MySpace/WebHome, but would be nice to have this fixed :-) But great work stuff in XWiki 2.0.x! -- Lewis ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
[xwiki-users] Components from the wiki
Hi xwiki-users, I'm trying to bootstrap a component from the wiki itself (via Groovy). I have an interface defined as follows: // This is the text inside the User.UserDAO document {{groovy}} interface UserDAO { def ROLE = UserDAO.class.name /** * Returns the current user name. */ def getUserName() /** * Returns the current user's password */ def getPassword() } {{/groovy}} I also have a dummy implementation defined as follows: // This is the text inside the User.UserXWQLDAO document {{include document=User.UserDAO /}} {{groovy}} import org.xwiki.component.annotation.Component import org.xwiki.component.annotation.Requirement import org.xwiki.component.descriptor.DefaultComponentDescriptor import org.xwiki.query.Query import org.xwiki.query.QueryManager import com.xpn.xwiki.web.Utils @Component(roles = [ UserDAO.class ]) class UserXWQLDAO implements UserDAO { @Requirement def QueryManager queryManager /** * Returns the current user name. */ def getUserName() { return bleh } /** * Returns the current user's password */ def getPassword() { return bleh } } if(!Utils.componentManager.hasComponent(UserDAO.class)) { def componentDescriptor = new DefaultComponentDescriptor() componentDescriptor.setImplementation(UserDAO.class) Utils.componentManager.registerComponent(componentDescriptor, new UserXWQLDAO()) } {{/groovy}} The first problem I ran into was that Groovy 1.6.5 ran into IncompatibleClassChangeErrors (http://jira.codehaus.org/browse/GROOVY-3830). Upgrading to 1.6.6 fixed this issue. But, then I ran into a NPE: *exception* javax.servlet.ServletException: Failed to initialize Request/Response or Session com.xpn.xwiki.web.XWikiAction.initializeContainerComponent(XWikiAction.java:391) com.xpn.xwiki.web.XWikiAction.initializeXWikiContext(XWikiAction.java:372) com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:112) org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196) org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432) javax.servlet.http.HttpServlet.service(Unknown Source) javax.servlet.http.HttpServlet.service(Unknown Source) com.xpn.xwiki.wysiwyg.server.filter.ConversionFilter.doFilter(ConversionFilter.java:152) com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:119) com.xpn.xwiki.plugin.webdav.XWikiDavFilter.doFilter(XWikiDavFilter.java:68) com.xpn.xwiki.web.SavedRequestRestorerFilter.doFilter(SavedRequestRestorerFilter.java:295) com.xpn.xwiki.web.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:112) *root cause* org.xwiki.container.servlet.ServletContainerException: Failed to initialize request org.xwiki.container.servlet.internal.DefaultServletContainerInitializer.initializeRequest(DefaultServletContainerInitializer.java:98) com.xpn.xwiki.web.XWikiAction.initializeContainerComponent(XWikiAction.java:387) com.xpn.xwiki.web.XWikiAction.initializeXWikiContext(XWikiAction.java:372) com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:112) org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196) org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432) javax.servlet.http.HttpServlet.service(Unknown Source) javax.servlet.http.HttpServlet.service(Unknown Source) com.xpn.xwiki.wysiwyg.server.filter.ConversionFilter.doFilter(ConversionFilter.java:152) com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:119) com.xpn.xwiki.plugin.webdav.XWikiDavFilter.doFilter(XWikiDavFilter.java:68) com.xpn.xwiki.web.SavedRequestRestorerFilter.doFilter(SavedRequestRestorerFilter.java:295) com.xpn.xwiki.web.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:112) *root cause* java.lang.NullPointerException Haven't investigated any further than this, but has anyone successfully created components completely within a wiki document? That would just be so cool! Great work! -- Lewis ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] Groovy JARs
Thanks a million Vincent! If there's anything I can help with (I guess mainly testing :-S), please give me a shout - I'd be more than willing to try it out :-) On Wed, Oct 7, 2009 at 11:32 PM, Vincent Massol vinc...@massol.net wrote: Hi Lewis, On Oct 7, 2009, at 4:24 PM, Lewis Denizen wrote: Thanks Thomas! Must be that :-) Not only do we not allow Guest logins in our wiki, but since we're using custom authentication module at the container level, the URLClassLoader must be hitting the login page provided by the authentication valve configured in Tomcat... Sorry, should've checked in JIRA beforehand! I have a fix on my local workspace. Will take me a bit of time to apply it though as it's complex. Thanks -Vincent On Wed, Oct 7, 2009 at 5:07 PM, Thomas Mortagne thomas.morta...@xwiki.comwrote: On Tue, Oct 6, 2009 at 19:20, Lewis Denizen orang...@gmail.com wrote: Hi xwiki-users, Just wondering - does the jars parameter work for the groovy macro? This has been tested almost only on groovy macro AFAIK :) Tried executing something simple with no luck: {{groovy jars=attach:main.webh...@blah.jar}} import blahblah... println(Blah.class.getName()) {{/groovy}} Always throws a ClassNotFoundException (even tho the class exists in the JAR file) :-( Any idea what I could be doing wrong? Thanks in advance! Maybe it's because of http://jira.xwiki.org/jira/browse/XWIKI-4428 -- Lewis ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] Groovy JARs
Thanks Thomas! Must be that :-) Not only do we not allow Guest logins in our wiki, but since we're using custom authentication module at the container level, the URLClassLoader must be hitting the login page provided by the authentication valve configured in Tomcat... Sorry, should've checked in JIRA beforehand! On Wed, Oct 7, 2009 at 5:07 PM, Thomas Mortagne thomas.morta...@xwiki.comwrote: On Tue, Oct 6, 2009 at 19:20, Lewis Denizen orang...@gmail.com wrote: Hi xwiki-users, Just wondering - does the jars parameter work for the groovy macro? This has been tested almost only on groovy macro AFAIK :) Tried executing something simple with no luck: {{groovy jars=attach:main.webh...@blah.jar}} import blahblah... println(Blah.class.getName()) {{/groovy}} Always throws a ClassNotFoundException (even tho the class exists in the JAR file) :-( Any idea what I could be doing wrong? Thanks in advance! Maybe it's because of http://jira.xwiki.org/jira/browse/XWIKI-4428 -- Lewis ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users -- Thomas Mortagne ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
[xwiki-users] Macro parameters
Hi xwiki-users, One small quirck with the 2.0 release - when I try something like this: {{box title={{info}}test{{/infothis is a test{{/box}} the output becomes a bit screwey... Parts of the {{info}} tag gets added to the content of the box instead of into the title. It does work when the {{info}} is escaped properly: {{box title=~{~{info~}~}test~{~{/info~}~}}}this is a test{{/box}} but the WYSIWYG editor doesn't escape these (and it would make things look a bit nicer if we didn't have to escape on properly-quoted parameters.. with the obvious exception of a double-quote inside a quoted-parameter :-)). So... what should the right behavior be? -- Lewis ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
[xwiki-users] Groovy JARs
Hi xwiki-users, Just wondering - does the jars parameter work for the groovy macro? Tried executing something simple with no luck: {{groovy jars=attach:main.webh...@blah.jar}} import blahblah... println(Blah.class.getName()) {{/groovy}} Always throws a ClassNotFoundException (even tho the class exists in the JAR file) :-( Any idea what I could be doing wrong? Thanks in advance! -- Lewis ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] Macro parameters
Seems like I opened a can of worms :-S Logged a JIRA for tracking: http://jira.xwiki.org/jira/browse/XWIKI-4457 I'll try to beautify the ticket once I get access to a PC instead of an iPhone ;-) Thanks for looking into this! On Oct 7, 2009, at 1:49 AM, Thomas Mortagne thomas.morta...@xwiki.com wrote: 2009/10/6 Marius Dumitru Florea mariusdumitru.flo...@xwiki.com: Thomas Mortagne wrote: 2009/10/6 Vincent Massol vinc...@massol.net: On Oct 6, 2009, at 5:15 PM, Marius Dumitru Florea wrote: Hi Lewis, Lewis Denizen wrote: Hi xwiki-users, One small quirck with the 2.0 release - when I try something like this: {{box title={{info}}test{{/infothis is a test{{/box}} the output becomes a bit screwey... Parts of the {{info}} tag gets added to the content of the box instead of into the title. It does work when the {{info}} is escaped properly: {{box title=~{~{info~}~}test~{~{/info~}~}}}this is a test{{/ box}} but the WYSIWYG editor doesn't escape these (and it would make things look a bit nicer if we didn't have to escape on properly-quoted parameters.. with the obvious exception of a double-quote inside a quoted- parameter :-)). So... what should the right behavior be? IMO there shouldn't be any need for escaping the { and } inside a parameter value. It seems the XWiki 2.0 parser stops reading the parameter value when it encounters }} which I think it's a bug. Thomas should know more about it. This is voluntary right now. Here's the grammar: | #MACRO_NAME: (XWIKI_CHAR)+ ([-, _, ., :] (XWIKI_CHAR)+)* | #MACRO_PARAMS: ( ~ ~[] | ~[}] | } ~[}] )* | #MACRO_EMPTY: {{ MACRO_NAME ((SPACE) MACRO_PARAMS)? /}} | #MACRO_START: {{ MACRO_NAME ((SPACE) MACRO_PARAMS)? }} | #MACRO_END: {{/ MACRO_NAME (SPACE)* }} | #MACRO_CONTENT: ( XWIKI_CHAR | SPACE |NEW_LINE | XWIKI_SPECIAL_SYMBOL ) So }} is not allowed in a macro parameter. Otherwise there would be a pb to know which }} correspond to the macro end (it would be harder). There is no official rule to forbid }} in macro parameters, we just did not tough of that IMO. From pure syntax POV we should support it IMO the same way we support it in macro content. I agree. Otherwise the WYSIWYG editor needs to escape the }} in macro parameters. The WYSIWYG can't do that since it does not know xwiki/2.0 escaping syntax. Thanks, Marius BTW you only need to escape one } to make it work fine ;) Note that quotes for macro values are optional right now and this is the reason macro params are checked for }}. We could support it, it's not a good reason. It's not a big difference to support with or without the quotes. The hard part is the refactor needed to actually parse the macro parameters in javacc directly instead of after the javacc pass. We could decide that quotes are mandatory but it's a pretty big change -1 for that, i'm pretty sure most of the users don't use the quotes. It would just be more pain for the user. It's a wiki syntax not hidden serialization format. (would be for Syntax 2.1) and I don't think it's a good idea since this your use case is pretty rare. And btw I still don't know if accepting wiki syntax in parameters is a good thing or not. Thanks -Vincent Thanks, Marius -- Lewis ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users -- Thomas Mortagne ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] Wiki Macros
Thanks Vincent Asiri! That did the trick! This is a really powerful feature (don't think any other wiki supports something this dynamic)! Please keep up the great work on XWiki!!! -- Lewis On Tue, Sep 29, 2009 at 1:46 AM, Vincent Massol vinc...@massol.net wrote: On Sep 28, 2009, at 6:46 PM, Vincent Massol wrote: On Sep 28, 2009, at 6:34 PM, Lewis Denizen wrote: Hi xwiki-users, I've been playing with this new Wiki Macros stuff (this stuff is superb!), but I've got one question. In a conventional 2.0 Java Macro, I can inject things like DAOs and AccessBridges (like DocumentAccessBridge). Is this possible using the new Wiki Macros (for example, how can I inject a DocumentAccessBridge into a Groovy class defined within the Wiki Macro? Is there a static ComponentManager that can perform lookups())? Yes, for now you can use: Utils.getComponent(TheComponentClass.class) or Utils.getComponent(TheComponentClass.class, String hint) Forgot to mention you'll need to import: import com.xpn.xwiki.web.* -Vincent -Vincent Again, great great great work with XWiki 2.0! -- Lewis ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] Bean converter in XWiki 2.0
Sorry Thomas, I think the issue was that I was using Boolean rather than boolean for the macro parameter. Switching to its primitive type fixed it... Apologies for the false alarm! -- Lewis On Tue, Sep 29, 2009 at 5:13 PM, Thomas Mortagne thomas.morta...@xwiki.comwrote: On Mon, Sep 28, 2009 at 21:08, Thomas Mortagne thomas.morta...@xwiki.com wrote: On Mon, Sep 28, 2009 at 18:22, Lewis Denizen orang...@gmail.com wrote: Hi xwiki-users, I just have to say... Thank you to the Dev team for such a great XWiki 2.0 release! XWiki is the best wiki I've ever encountered - the ideas in it have really shown what Java + open source libs can achieve. The result is purely extraordinary! Thank you so much for such a great piece of software! Now to the real stuff - I was trying to migrate my XWiki 1.x macro to 2.0. But, it seems something has changed within the bean converter and now Booleans on MacroParameters have to be specified with a getX(), rather than a isX() (which is JavaBeans convention). I haven't digged into the code, and changing my macro to use getX() fixed the issue, but... 1) it would be nice if the bean converter supported the conventional JavaBeans syntax and... 2) it would be nice if XWiki threw some exception (or logged an exception) if the parameter could not be converted properly (not sure if it's just my log level, but digging out the issue would've been easy if there were logs). The new bean converter is just an extension of standard JavaBeans and reuse it so it's supposed to support at least the same things. Can you create an issue on http://jira.xwiki.org ? I just checked and standard macros are using isParameter() form and it's working very well. See org.xwiki.rendering.macro.script.ScriptMacroParameters for example. Also if you try {{toc start=toto/}} you will see that you get an error Invalid macro parameters used for macro: toc because start is supposed to get integer. So it seems your exact use case is very special, could you describe you bean class ? But again, really appreciate the great release, looking forward to further development on this wonderful software! -- Lewis ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users -- Thomas Mortagne -- Thomas Mortagne ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
[xwiki-users] Bean converter in XWiki 2.0
Hi xwiki-users, I just have to say... Thank you to the Dev team for such a great XWiki 2.0 release! XWiki is the best wiki I've ever encountered - the ideas in it have really shown what Java + open source libs can achieve. The result is purely extraordinary! Thank you so much for such a great piece of software! Now to the real stuff - I was trying to migrate my XWiki 1.x macro to 2.0. But, it seems something has changed within the bean converter and now Booleans on MacroParameters have to be specified with a getX(), rather than a isX() (which is JavaBeans convention). I haven't digged into the code, and changing my macro to use getX() fixed the issue, but... 1) it would be nice if the bean converter supported the conventional JavaBeans syntax and... 2) it would be nice if XWiki threw some exception (or logged an exception) if the parameter could not be converted properly (not sure if it's just my log level, but digging out the issue would've been easy if there were logs). But again, really appreciate the great release, looking forward to further development on this wonderful software! -- Lewis ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
[xwiki-users] Wiki Macros
Hi xwiki-users, I've been playing with this new Wiki Macros stuff (this stuff is superb!), but I've got one question. In a conventional 2.0 Java Macro, I can inject things like DAOs and AccessBridges (like DocumentAccessBridge). Is this possible using the new Wiki Macros (for example, how can I inject a DocumentAccessBridge into a Groovy class defined within the Wiki Macro? Is there a static ComponentManager that can perform lookups())? Again, great great great work with XWiki 2.0! -- Lewis ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
[xwiki-users] Macro within code macro
Hi xwiki-users, Just wondering if it's possible to add a macro inside a code macro? What I want to do is something like this: {{code language=sql}} select * from xyz where from_date = '{{date-macro date=-1b format=MMdd/}}' -- The date-macro returns the last business date in MMdd format {{/code}} Thanks in advance! ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
[xwiki-users] Proposal: box macro with show/hide parameter
Hi xwiki-users, Quick proposal - would it be possible to enhance the box macro so that it includes two extra (optional) parameters: hideable=[true/false] initial=[show/hide] It would be useful to have a show/hide button on box macros (and all its children) using JavaScript (possibly based on http://code.xwiki.org/xwiki/bin/view/Snippets/ShowHideDIVSnippet). Thanks! ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] Macro within code macro
Thanks Vincent. One more question - is it possible to execute an XWiki 2.0 macro from Velocity context? On Tue, May 5, 2009 at 4:46 PM, Vincent Massol vinc...@massol.net wrote: Hi Lewis, On May 5, 2009, at 9:11 AM, Lewis Denizen wrote: Hi xwiki-users, Just wondering if it's possible to add a macro inside a code macro? What I want to do is something like this: {{code language=sql}} select * from xyz where from_date = '{{date-macro date=-1b format=MMdd/}}' -- The date-macro returns the last business date in MMdd format {{/code}} If by adding you mean execution it, then no it's not possible since it's not the goal of the code macro. The code macro is supposed to render its content as is without any interpretation (only syntax coloring). However if what you want is to execute some stuff you can use this trick: {{velocity}} {{code}} ... Some velocity code here that will be executed, including a velocity macro ... {{/code}} {{/velocity}} Thanks -Vincent ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] Proposal: box macro with show/hide parameter
Possible, wondering if that would look strange if there was a div right under it. Would be possible to remove the first div, though (if that's the only element under it). On Tue, May 5, 2009 at 7:00 PM, Vincent Massol vinc...@massol.net wrote: On May 5, 2009, at 11:55 AM, Lewis Denizen wrote: Hi xwiki-users, Quick proposal - would it be possible to enhance the box macro so that it includes two extra (optional) parameters: hideable=[true/false] initial=[show/hide] It would be useful to have a show/hide button on box macros (and all its children) using JavaScript (possibly based on http://code.xwiki.org/xwiki/bin/view/Snippets/ShowHideDIVSnippet). Thanks! hmmm... whould it be better to add a showhide macro instead that could be used around anything? Thanks -Vincent ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] Macro within code macro
Thanks Vincent/Thomas, Just like Thomas mentioned, my intention was to execute a macro within another macro so that I could generate the arguments for a macro on the fly. We're using XWiki as a knowledge base/support tool at work, and we encounter situations like this where we'd like to dynamically generate some text as input for a macro. The {{date}} macro is one example, but I was hoping to extend this to extract other information for usage in other macros as well. Also, since we depend on a (proprietary) Java API for calculating business dates, it's easier for us to extract this info from a standardized Java macro than from velocity or groovy. Currently, we're only trying to utilize it with the {{code}} macro for generating pretty copy/paste-able SQL and scripts, but we'd like to create a completely new macro to execute SQLs/scripts on our production servers right from the wiki (something similar to the SQL plugin for XWiki 1.x). Hope this gives some background to the issue. Again, thanks for the immediate feedback on this! On Tue, May 5, 2009 at 7:46 PM, Vincent Massol vinc...@massol.net wrote: On May 5, 2009, at 12:32 PM, Thomas Mortagne wrote: On Tue, May 5, 2009 at 12:01, Vincent Massol vinc...@massol.net wrote: On May 5, 2009, at 11:57 AM, Lewis Denizen wrote: Thanks Vincent. One more question - is it possible to execute an XWiki 2.0 macro from Velocity context? yes the velocity macro does this: 1) executes velocity on the full macro content which is considered as text 2) run the wiki parser on the result I think it's not exactly what Lewis asked. His problem is that he want to execute a macro inside code macro so for that he need velocity to generate the result of the macro in the code macro content and not just the macro itself. There is no easy way to do that in velocity, this means access the parser as component execute it on {{date-macro date=-1b format=MMdd/}}, execute transformations (other components) on it and re-render the XDOM. And all that just to print a date if i understood well your use case. Well first we'd need to know why Lewis needs to do that! I think we can rephrase the question as: how to pretty print a generated text. The general answer I think is: {{velocity}} ## Compute the content here #set ($content = ) {{code language=java}} $content {{/code}} {{/velocity}} As Thomas said though, if you want to execute wiki syntax from velocity you can probably do something like: #set ($mydoc = $xwiki.getDocument(dummy)) $mydoc.setContent({{mymacro/}}) #set ($content = $mydoc.getRenderedContent()) Note that the current document in the xwiki context would still be the current document and not dummy so any macro that uses the current document would not use dummy. I'd like to know more about the use case. Thanks -Vincent On Tue, May 5, 2009 at 4:46 PM, Vincent Massol vinc...@massol.net wrote: Hi Lewis, On May 5, 2009, at 9:11 AM, Lewis Denizen wrote: Hi xwiki-users, Just wondering if it's possible to add a macro inside a code macro? What I want to do is something like this: {{code language=sql}} select * from xyz where from_date = '{{date-macro date=-1b format=MMdd/}}' -- The date-macro returns the last business date in MMdd format {{/code}} If by adding you mean execution it, then no it's not possible since it's not the goal of the code macro. The code macro is supposed to render its content as is without any interpretation (only syntax coloring). However if what you want is to execute some stuff you can use this trick: {{velocity}} {{code}} ... Some velocity code here that will be executed, including a velocity macro ... {{/code}} {{/velocity}} Thanks -Vincent ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] TOC not displaying properly
Thanks for the reply, Thomas! Will keep that in mind next time. http://jira.xwiki.org/jira/browse/XWIKI-3462 On Thu, Mar 26, 2009 at 5:09 AM, Thomas Mortagne thomas.morta...@xwiki.comwrote: Hi Lewis, Thanks for this report. It would be great if you could create an issue on http://jira.xwiki.org (eventually with a screenshot to be sure everyone understand the bug). On Wed, Mar 25, 2009 at 16:11, Lewis Denizen orang...@gmail.com wrote: Hi xwiki-users, When I try the following in a page: = Level 1 {{toc start=1 depth=3 numbered=false scope=page /}} == Level 2a === Level 3a === Level 3b == Level 2b === Level 3c [Level 2b] does not untab itself in the TOC. This only happens when there are 2 or more children preceding the parent's siblings (i.e. if [Level 3b] did not exist, this would work properly). Very minor, but would be nice to have this fixed :-) Thanks in advance! -- Lewis ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users -- Thomas Mortagne ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
[xwiki-users] TOC not displaying properly
Hi xwiki-users, When I try the following in a page: = Level 1 {{toc start=1 depth=3 numbered=false scope=page /}} == Level 2a === Level 3a === Level 3b == Level 2b === Level 3c [Level 2b] does not untab itself in the TOC. This only happens when there are 2 or more children preceding the parent's siblings (i.e. if [Level 3b] did not exist, this would work properly). Very minor, but would be nice to have this fixed :-) Thanks in advance! -- Lewis ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] TOC not displaying properly
Oops, also forgot to mention, this was tested using XWiki 1.8 (2.0 Syntax) - sorry for the multiple spam! On Thu, Mar 26, 2009 at 12:11 AM, Lewis Denizen orang...@gmail.com wrote: Hi xwiki-users, When I try the following in a page: = Level 1 {{toc start=1 depth=3 numbered=false scope=page /}} == Level 2a === Level 3a === Level 3b == Level 2b === Level 3c [Level 2b] does not untab itself in the TOC. This only happens when there are 2 or more children preceding the parent's siblings (i.e. if [Level 3b] did not exist, this would work properly). Very minor, but would be nice to have this fixed :-) Thanks in advance! -- Lewis ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] Inline forms in XWiki Syntax 2.0
Thanks for the reply, Thomas! Looking forward to the new form support :-) On Wed, Mar 18, 2009 at 2:21 AM, Thomas Mortagne thomas.morta...@xwiki.comwrote: On Tue, Mar 17, 2009 at 17:03, Lewis Denizen orang...@gmail.com wrote: Hi xwiki-users, When attempting to include an inline form in XWiki Syntax 2.0, the resulting page always gets wrapped in a {pre} tag. It says this was to prevent further rendering of the form, but this doesn't work too well with the 2.0 syntax since {pre} is not a valid tag (just renders it as a literal string). I just created a custom form (using the {{html}} tag), but what is the preferred way of creating inline forms using the 2.0 syntax? Is this ( http://jira.xwiki.org/jira/browse/XWIKI-2891) the JIRA that tracks this issue? Also, I'm not 100% certain, but it also seems that a #includeForm( needs to exist in order for the default edit mode to enter inline editing (I think viewheader.vm is used to render the top panel... and there's a check [#if($doc.content.indexOf(includeForm()!=-1)], which probably detects this) - again, will this still hold true in the 2.0 syntax? http://jira.xwiki.org/jira/browse/XWIKI-2891 is more about find a way to choose the right editor event without the #includeForm I'm currently working on the general issue about display form fields with 2.0 doc in template, 2.0 doc in 2.0 content, etc. for http://jira.xwiki.org/jira/browse/XWIKI-3364 it will be fixed today for 1.8RC3 Thanks in advance! -- Lewis ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users -- Thomas Mortagne ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
[xwiki-users] Inline forms in XWiki Syntax 2.0
Hi xwiki-users, When attempting to include an inline form in XWiki Syntax 2.0, the resulting page always gets wrapped in a {pre} tag. It says this was to prevent further rendering of the form, but this doesn't work too well with the 2.0 syntax since {pre} is not a valid tag (just renders it as a literal string). I just created a custom form (using the {{html}} tag), but what is the preferred way of creating inline forms using the 2.0 syntax? Is this ( http://jira.xwiki.org/jira/browse/XWIKI-2891) the JIRA that tracks this issue? Also, I'm not 100% certain, but it also seems that a #includeForm( needs to exist in order for the default edit mode to enter inline editing (I think viewheader.vm is used to render the top panel... and there's a check [#if($doc.content.indexOf(includeForm()!=-1)], which probably detects this) - again, will this still hold true in the 2.0 syntax? Thanks in advance! -- Lewis ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
[xwiki-users] Images in links
Hi xwiki-users, In XWiki Syntax 1.0, I was able to do something like this: a href=${documentURLRoot}img src=$xwiki.getSkinFile('icons/black-file.png') alt=Root URL title=Root URL //a This would render an icon from the current skin as a link. I understand that in XWiki Syntax 2.0, there's a new form of this available: [[image:space.w...@picture.png${documentURLRoot}]] This works if the image exists in your document as an attachment, but doesn't work when the image link is relative to your web context: [[image:$xwiki.getSkinFile('icons/black-file.png')${documentURLRoot}]] This renders as the following: a href=http://www.google.com/; img alt=/xwiki/skins/albatross/icons/black%2Dfile.png class=wikimodel-freestanding src=/xwiki/bin/download/XWiki/WebHome/%2Fxwiki%2Fskins%2Falbatross%2Ficons%2Fblack%252Dfile.png/ /a which is not what I expected... One workaround is to put an explicit http://server-name:port/; before the $xwiki.getSkin() call, but that ties the wiki to the server's address/port. One other interesting thing I found out was that: {{velocity}} {{html wiki=true}} * this works - [[image: http://localhost:8080/$xwiki.getSkinFile('icons/black-file.png')]] * this doesn't work - img src=$xwiki.getSkinFile('icons/black-file.png') {{/html}} {{/velocity}} It seems that the HTML Macro's final filter parses this last test case as 1 BulletedListBlock and 1 XMLBlock, but I'm not sure if this the expected behavior. If this is the expected behavior, the more need to get the [[image:]] tag working... Thanks again for the great job! ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] Velocity + Tables
Hi Vincent, have to thank you again for such a quick and precise response ;-) Switching the two tags worked perfectly! And apologies for not trying this out before posting! On Mon, Feb 23, 2009 at 9:30 AM, Vincent Massol vinc...@massol.net wrote: Hi Lewis, On Feb 23, 2009, at 12:14 AM, Vincent Massol wrote: Hi Lewis, On Feb 22, 2009, at 5:56 PM, Lewis Denizen wrote: Hi xwiki-users, I've been playing with the new XWiki Syntax 2.0, Great, we need feedback on the new syntax from using it in the real world! but there are still some things possible with the old 1.0 syntax which are impossible in the new 2.0 syntax. One thing that I still cannot figure out is something like the following: {{html wiki=true}} table id=serverList class=grid sortable filterable doOddEven tr class=sortHeader th class=selectFilterSpace/th thClass/th thServer Name/th th class=unsortable noFilterLink/th /tr {{velocity}} #foreach($serverDocument in $serverDocuments) tr td$serverDocument.Space/td td$serverDocument.Name/td td #foreach($serverObject in $serverDocument.getObjects($serverClass)) * $serverObject.HostName #end /td td[[$serverDocument]]/td /tr #end {{/velocity}} /table {{/html}} I've tried your example and indeed it's not working. I've created the following issue: http://jira.xwiki.org/jira/browse/XWIKI-3258 You can monitor it if you want to follow the progress. I'll be working on it tomorrow. Actually I've worked on it and the result is that it's not valid... :) The HTML macro must only contain valid HTML and it's not the case in your example. You need to have the velocity content evaluated first so that the content is valid HTML: {{velocity}}{{html}}... Thanks -Vincent [snip] ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
[xwiki-users] Velocity + Tables
Hi xwiki-users, I've been playing with the new XWiki Syntax 2.0, but there are still some things possible with the old 1.0 syntax which are impossible in the new 2.0 syntax. One thing that I still cannot figure out is something like the following: {{html wiki=true}} table id=serverList class=grid sortable filterable doOddEven tr class=sortHeader th class=selectFilterSpace/th thClass/th thServer Name/th th class=unsortable noFilterLink/th /tr {{velocity}} #foreach($serverDocument in $serverDocuments) tr td$serverDocument.Space/td td$serverDocument.Name/td td #foreach($serverObject in $serverDocument.getObjects($serverClass)) * $serverObject.HostName #end /td td[[$serverDocument]]/td /tr #end {{/velocity}} /table {{/html}} This gives me a lot of br / tags (the number of $server in $serverList), and ends up displaying 1 row with the literal string $server.Space, $server.Class, etc. It works if I use the normal table syntax: |=Space|=Class|=Server Name|=Link {{velocity}} #foreach($serverDocument in $serverDocuments) |$serverDocument.Space|$serverDocument.Name|???|[[$serverDocument]] #end {{/velocity}} but I'm not sure how I'd iterate over each object associated with the document in the tag marked '???'. Also, whenever I have a {{velocity}} tag, I end up with a lot of empty p elements: * Line 1 {{velocity}} #set($foo = bar) {{/velocity}} * Line 2 This ends up with a p tag between Line 1 and Line 2, which seems very strange when rendered (since there's no content when viewing). Just my 2 cents on the new syntax. But other than that, creating macros now is a breeze (XWiki + Plexus is just purely amazing!), and I think the new syntax is only inches away from surpassing the old 1.0 syntax :-D Thanks again for the great work! ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
[xwiki-users] XWikiAuthServiceImpl.java
Hi xwiki-users, In XWikiAuthServiceImpl.java, I see the following lines: Line 521: String createuser = getParam(auth_createuser, context); Line 500~517: protected String getParam(String name, XWikiContext context) { String param = ; try { param = context.getWiki().getXWikiPreference(name, context); } catch (Exception e) { } if (param == null || .equals(param)) { try { param = context.getWiki().Param(xwiki.authentication. + StringUtils.replace(name, auth_, .)); } catch (Exception e) { } } if (param == null) { param = ; } return param; } Which requires me to create a key called xwiki.authentication..createuser in the config - which is strange... Unless there are any side effects, would it be possible to request the StringUtils.replace() removed? Thanks again for a great release! ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] Pygments
Thank you so much for the feedback (as always!), Vincent :-D Can't wait to try out 1.7 - looking forward to the next release! And, appreciate the tip, Jerome - these sorts of tutes reeally help a lot :-) On 11/26/08, Jerome Velociter [EMAIL PROTECTED] wrote: Lewis Denizen wrote: Hi xwiki-users, I have a question (or more of a request) regarding the upcoming Pygments support in XWiki 1.7. We currently use XWiki at work to keep an internal documentation wiki for our application. We've created a few plugins which we've used in the following fashion perfectly (XWiki 1.0 syntax): {code:sql} DECLARE myDate DATETIME SELECT myDate = '$xwiki.dateParser.parseDate( -1b, MMdd )' -- this gives us the previous business date in MMdd format ... {code} Vincent kindly gave me a heads up regarding XWiki 1.7's Pygments support (seems to be supported by running it under Jython - VERY exciting :-D). So, I was wondering... Would something like the above be supported (i.e. verbatim code, but allow velocity macros to be run inside the code block)? If not, are there any documentation out there (other than the source code) detailing steps to create an XWiki macro (found http://dev.xwiki.org/xwiki/bin/view/Drafts/Tutorial+to+Write+a+Macro+in+the+new+rendering+enginewhich does help a bit if viewed in the code viewer), This draft http://dev.xwiki.org/xwiki/bin/view/Drafts/Tutorial+to+Write+a+Macro+in+the+new+rendering+engine is actually written for XWiki Syntax 2.0, but the version on XWiki.org does not support it yet. You can copy its code (from the code viewer) to a page in syntax 2.0 to see it more comfortable. Jerome. so that maybe we can build in support for something like that? Again, thanks for the great work! ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
[xwiki-users] Pygments
Hi xwiki-users, I have a question (or more of a request) regarding the upcoming Pygments support in XWiki 1.7. We currently use XWiki at work to keep an internal documentation wiki for our application. We've created a few plugins which we've used in the following fashion perfectly (XWiki 1.0 syntax): {code:sql} DECLARE myDate DATETIME SELECT myDate = '$xwiki.dateParser.parseDate( -1b, MMdd )' -- this gives us the previous business date in MMdd format ... {code} Vincent kindly gave me a heads up regarding XWiki 1.7's Pygments support (seems to be supported by running it under Jython - VERY exciting :-D). So, I was wondering... Would something like the above be supported (i.e. verbatim code, but allow velocity macros to be run inside the code block)? If not, are there any documentation out there (other than the source code) detailing steps to create an XWiki macro (found http://dev.xwiki.org/xwiki/bin/view/Drafts/Tutorial+to+Write+a+Macro+in+the+new+rendering+enginewhich does help a bit if viewed in the code viewer), so that maybe we can build in support for something like that? Again, thanks for the great work! ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] mailto links code blocks
Thanks a ton, Vincent! Really great work on XWiki :-D On Sat, Nov 15, 2008 at 4:01 AM, Vincent Massol [EMAIL PROTECTED] wrote: On Nov 14, 2008, at 7:27 PM, Vincent Massol wrote: Hi Lewis, On Nov 14, 2008, at 6:13 PM, Lewis Denizen wrote: Hi xwiki-users, I've been using XE 1.6 for quite some time and it's one of the best apps that I've ever used (thank you so much)! Thanks a lot for the praise. You're sure to earn a quick response with such comments ;) Few small questons/issues. Whenever I create a mailto: link in xwiki 2.0 syntax, I can't put spaces in it: [[mailto:[EMAIL PROTECTED]@test.comsubject=This is a test]] It used to be possible with the xwiki 1.0 syntax, though. I'm checking this since this looks like a bug. Fixed now, will be in XE 1.7M3. See http://jira.xwiki.org/jira/browse/XWIKI-2838 Thanks for reporting this. -Vincent I'm really glad to see people are starting to use the XWiki 2.0 syntax. It's brand new and not fully finished yet (will be for 1.7 final) so all feedback is much appreciated. Also, I'd like to know how people are managing to place code snippets in xwiki 2.0 syntax. In the past, I had used the {code} macro, but now that it's gone, what do people use? Do people just wrap it in a pre now? How about code syntax highlighting? It's being rewritten by Thomas Mortagne right now. It's almost ready actually. We're now using Pygments (http://pygments.org) under the hood so you get access to syntax highlighting for all the following languages: http://pygments.org/languages/ Now if you only need to escape content and not do any formatting/ highlighting you can use the new verbatim syntax. For example: {{{ whatever here }}} or {{{ whatever here }}} Thanks -Vincent Keep up the good work! ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
[xwiki-users] mailto links code blocks
Hi xwiki-users, I've been using XE 1.6 for quite some time and it's one of the best apps that I've ever used (thank you so much)! Few small questons/issues. Whenever I create a mailto: link in xwiki 2.0 syntax, I can't put spaces in it: [[mailto:[EMAIL PROTECTED]@test.comsubject=This is a test]] It used to be possible with the xwiki 1.0 syntax, though. Also, I'd like to know how people are managing to place code snippets in xwiki 2.0 syntax. In the past, I had used the {code} macro, but now that it's gone, what do people use? Do people just wrap it in a pre now? How about code syntax highlighting? Keep up the good work! ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users