Re: [xwiki-users] Create Javascript application in XWiki
Thanks for all your replies, Vincent and Thomas. I'm quite ... worried by the fact to directly put my webjars dependencies in WEB-INF/lib, directly or through Advanced Search, as it would prevent me to have explicit link between the JS lib and the place where it is used. What I fear is the WEB-INF/lib folder becoming kind of messy, with all JS dependencies dropped there without proper usage identification, and a zealous sysadmin coming there and purging the folder aggresively. Have you got any kind of best practices to avoid that ? Le 24/03/2015 11:16, vinc...@massol.net a écrit : On 24 Mar 2015 at 11:12:54, vinc...@massol.net (vinc...@massol.net(mailto:vinc...@massol.net)) wrote: Hi Nicolas, On 23 Mar 2015 at 16:33:55, Nicolas Delsaux (nicolas.dels...@gmx.fr(mailto:nicolas.dels...@gmx.fr)) wrote: I would like to create a Javascript application in XWiki. My precise goal is to go get some content from Jenkins (build status) and render it over a static image using d3.js or any other rich rendering framework. I suppose the only way to implement that is to write my webpage as HTML. But, then, how will I use external frameworks ? (typically d3.js) Regarding D3js you have an example here: http://extensions.xwiki.org/xwiki/bin/view/Extension/D3+Example And there’s even a macro here (not tried it myself): http://extensions.xwiki.org/xwiki/bin/view/Extension/d3js Just a note: these examples were written prior to us having the webjar integration support. So with webjars, it’s even easier and you don’t need to include d3js in an XWiki Object anymore. You can just put the webjar in WEB-INF/lib and it’ll be usable. See http://extensions.xwiki.org/xwiki/bin/view/Extension/WebJars+Integration Thanks -Vincent Hope it helps -Vincent Thanks -- Nicolas Delsaux ___ 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] Create Javascript application in XWiki
Le 24/03/2015 11:24, vinc...@massol.net a écrit : If you’re doing dev and writing an extension for your code then all you need is add a dependency to the webjar in your extension’s POM and then install it through the Extension Manager and it won’t go in WEB-INF/lib :) Oh, I see, you're enforcing good practices by making sure any other practice will be a tremendous pain. Nicely done ;-) (I'm not joking on you, I really find it is the right way) -- Nicolas Delsaux ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] Defining dependencies was Re: Create Javascript application in XWiki
On Tue, Mar 24, 2015 at 10:59 AM, Nicolas Delsaux nicolas.dels...@gmx.fr wrote: OK I however have another question on that topic. As a Java dev, I'm quite fond of Webjars as they provide me a way to make sure which version of a Javascript I use. I've seen that XWiki can integrate webjars (http://extensions.xwiki.org/xwiki/bin/view/Extension/WebJars+Integration) but, as far as I understand, it's only available when writing extensions ... Not really, it's mostly used as extension dependency but you can install any jar you want. It's just that the simple search is supported only with XWiki repositories like http://extensions.xwiki.org. If you want to install a jar from any of the maven repositories registered you can use Advanced Search and indicate the exact id and version you want to install it. When writing that, I realize the same question can be asked about Groovy : if I try to use a dependency using Groovy grapes, will it work ? It seems to me it won't work, but can anyone confirm ? As far as I know Groovy grapes automatically download and load jar you declare as long as ivy is provided and XWiki embeds Ivy (it's actually embedding it only for this reason since we don't use it directly). Not sure where it search by default but I guess it should find any Maven Central jar. Le 23/03/2015 17:09, Eduard Moraru a écrit : Hi Nicolas, Typically, the flow is the following: 1. You create a page and the markup (wiki syntax + additional HTML if you need form UI elements or if you can not reuse property displayers from velocity, e.g. $doc.display('someProperty', 'edit') [1] ) 2. You add a skin extension [2] object to that document where you add your CSS and JS needs 3. Inside that JSX object you can depend on 3rd party libraries using the recommended require.js approach [3] or anything else that suites you 4. Profit More such information is available on the dev guide's tutorials and resources page [4]. Hope this helps, Eduard P.S.: Regarding javascript, be aware that we are currently moving away from Prototype.js and towards jQuery, but a lot of documentation still talks about how to do things with Prototype.js, you just need to digg deep enough to find the jQuery alternatives, figure them out, ask people for help and, document back your findings (on xwiki.org pages) so that you can help others in your same situation :) -- [1] http://platform.xwiki.org/xwiki/bin/view/DevGuide/API [2] http://extensions.xwiki.org/xwiki/bin/view/Extension/Skin+Extension+Plugin [3] http://platform.xwiki.org/xwiki/bin/view/DevGuide/JavaScriptAPI#HRequireJSandjQueryAPIs [4] http://platform.xwiki.org/xwiki/bin/view/DevGuide/ On Mon, Mar 23, 2015 at 5:33 PM, Nicolas Delsaux nicolas.dels...@gmx.fr wrote: I would like to create a Javascript application in XWiki. My precise goal is to go get some content from Jenkins (build status) and render it over a static image using d3.js or any other rich rendering framework. I suppose the only way to implement that is to write my webpage as HTML. But, then, how will I use external frameworks ? (typically d3.js) Thanks -- Nicolas Delsaux ___ 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 -- Thomas Mortagne ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] Create Javascript application in XWiki
Hi Nicolas, On 23 Mar 2015 at 16:33:55, Nicolas Delsaux (nicolas.dels...@gmx.fr(mailto:nicolas.dels...@gmx.fr)) wrote: I would like to create a Javascript application in XWiki. My precise goal is to go get some content from Jenkins (build status) and render it over a static image using d3.js or any other rich rendering framework. I suppose the only way to implement that is to write my webpage as HTML. But, then, how will I use external frameworks ? (typically d3.js) Regarding D3js you have an example here: http://extensions.xwiki.org/xwiki/bin/view/Extension/D3+Example And there’s even a macro here (not tried it myself): http://extensions.xwiki.org/xwiki/bin/view/Extension/d3js Hope it helps -Vincent Thanks -- Nicolas Delsaux ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] Defining dependencies was Re: Create Javascript application in XWiki
Hi Nicolas, On 24 Mar 2015 at 11:07:45, Thomas Mortagne (thomas.morta...@xwiki.com(mailto:thomas.morta...@xwiki.com)) wrote: On Tue, Mar 24, 2015 at 10:59 AM, Nicolas Delsaux wrote: OK I however have another question on that topic. As a Java dev, I'm quite fond of Webjars as they provide me a way to make sure which version of a Javascript I use. I've seen that XWiki can integrate webjars (http://extensions.xwiki.org/xwiki/bin/view/Extension/WebJars+Integration) but, as far as I understand, it's only available when writing extensions ... Not really, it's mostly used as extension dependency but you can install any jar you want. It's just that the simple search is supported only with XWiki repositories like http://extensions.xwiki.org. If you want to install a jar from any of the maven repositories registered you can use Advanced Search and indicate the exact id and version you want to install it. When writing that, I realize the same question can be asked about Groovy : if I try to use a dependency using Groovy grapes, will it work ? It seems to me it won't work, but can anyone confirm ? As far as I know Groovy grapes automatically download and load jar you declare as long as ivy is provided and XWiki embeds Ivy (it's actually embedding it only for this reason since we don't use it directly). Not sure where it search by default but I guess it should find any Maven Central jar. Yes Groovy Grapes work inside groovy script in wiki pages. For example: http://extensions.xwiki.org/xwiki/bin/view/Extension/Twitter+Search Thanks -Vincent Le 23/03/2015 17:09, Eduard Moraru a écrit : Hi Nicolas, Typically, the flow is the following: 1. You create a page and the markup (wiki syntax + additional HTML if you need form UI elements or if you can not reuse property displayers from velocity, e.g. $doc.display('someProperty', 'edit') [1] ) 2. You add a skin extension [2] object to that document where you add your CSS and JS needs 3. Inside that JSX object you can depend on 3rd party libraries using the recommended require.js approach [3] or anything else that suites you 4. Profit More such information is available on the dev guide's tutorials and resources page [4]. Hope this helps, Eduard P.S.: Regarding javascript, be aware that we are currently moving away from Prototype.js and towards jQuery, but a lot of documentation still talks about how to do things with Prototype.js, you just need to digg deep enough to find the jQuery alternatives, figure them out, ask people for help and, document back your findings (on xwiki.org pages) so that you can help others in your same situation :) -- [1] http://platform.xwiki.org/xwiki/bin/view/DevGuide/API [2] http://extensions.xwiki.org/xwiki/bin/view/Extension/Skin+Extension+Plugin [3] http://platform.xwiki.org/xwiki/bin/view/DevGuide/JavaScriptAPI#HRequireJSandjQueryAPIs [4] http://platform.xwiki.org/xwiki/bin/view/DevGuide/ On Mon, Mar 23, 2015 at 5:33 PM, Nicolas Delsaux wrote: I would like to create a Javascript application in XWiki. My precise goal is to go get some content from Jenkins (build status) and render it over a static image using d3.js or any other rich rendering framework. I suppose the only way to implement that is to write my webpage as HTML. But, then, how will I use external frameworks ? (typically d3.js) Thanks -- Nicolas Delsaux ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] Create Javascript application in XWiki
On 24 Mar 2015 at 11:22:52, Nicolas Delsaux (nicolas.dels...@gmx.fr(mailto:nicolas.dels...@gmx.fr)) wrote: Thanks for all your replies, Vincent and Thomas. I'm quite ... worried by the fact to directly put my webjars dependencies in WEB-INF/lib, directly or through Advanced Search, as it would prevent me to have explicit link between the JS lib and the place where it is used. What I fear is the WEB-INF/lib folder becoming kind of messy, with all JS dependencies dropped there without proper usage identification, and a zealous sysadmin coming there and purging the folder aggresively. Have you got any kind of best practices to avoid that ? If you’re doing dev and writing an extension for your code then all you need is add a dependency to the webjar in your extension’s POM and then install it through the Extension Manager and it won’t go in WEB-INF/lib :) Thanks -Vincent Le 24/03/2015 11:16, vinc...@massol.net a écrit : On 24 Mar 2015 at 11:12:54, vinc...@massol.net (vinc...@massol.net(mailto:vinc...@massol.net)) wrote: Hi Nicolas, On 23 Mar 2015 at 16:33:55, Nicolas Delsaux (nicolas.dels...@gmx.fr(mailto:nicolas.dels...@gmx.fr)) wrote: I would like to create a Javascript application in XWiki. My precise goal is to go get some content from Jenkins (build status) and render it over a static image using d3.js or any other rich rendering framework. I suppose the only way to implement that is to write my webpage as HTML. But, then, how will I use external frameworks ? (typically d3.js) Regarding D3js you have an example here: http://extensions.xwiki.org/xwiki/bin/view/Extension/D3+Example And there’s even a macro here (not tried it myself): http://extensions.xwiki.org/xwiki/bin/view/Extension/d3js Just a note: these examples were written prior to us having the webjar integration support. So with webjars, it’s even easier and you don’t need to include d3js in an XWiki Object anymore. You can just put the webjar in WEB-INF/lib and it’ll be usable. See http://extensions.xwiki.org/xwiki/bin/view/Extension/WebJars+Integration Thanks -Vincent Hope it helps -Vincent Thanks -- Nicolas Delsaux ___ 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] Defining dependencies was Re: Create Javascript application in XWiki
OK I however have another question on that topic. As a Java dev, I'm quite fond of Webjars as they provide me a way to make sure which version of a Javascript I use. I've seen that XWiki can integrate webjars (http://extensions.xwiki.org/xwiki/bin/view/Extension/WebJars+Integration) but, as far as I understand, it's only available when writing extensions ... When writing that, I realize the same question can be asked about Groovy : if I try to use a dependency using Groovy grapes, will it work ? It seems to me it won't work, but can anyone confirm ? Le 23/03/2015 17:09, Eduard Moraru a écrit : Hi Nicolas, Typically, the flow is the following: 1. You create a page and the markup (wiki syntax + additional HTML if you need form UI elements or if you can not reuse property displayers from velocity, e.g. $doc.display('someProperty', 'edit') [1] ) 2. You add a skin extension [2] object to that document where you add your CSS and JS needs 3. Inside that JSX object you can depend on 3rd party libraries using the recommended require.js approach [3] or anything else that suites you 4. Profit More such information is available on the dev guide's tutorials and resources page [4]. Hope this helps, Eduard P.S.: Regarding javascript, be aware that we are currently moving away from Prototype.js and towards jQuery, but a lot of documentation still talks about how to do things with Prototype.js, you just need to digg deep enough to find the jQuery alternatives, figure them out, ask people for help and, document back your findings (on xwiki.org pages) so that you can help others in your same situation :) -- [1] http://platform.xwiki.org/xwiki/bin/view/DevGuide/API [2] http://extensions.xwiki.org/xwiki/bin/view/Extension/Skin+Extension+Plugin [3] http://platform.xwiki.org/xwiki/bin/view/DevGuide/JavaScriptAPI#HRequireJSandjQueryAPIs [4] http://platform.xwiki.org/xwiki/bin/view/DevGuide/ On Mon, Mar 23, 2015 at 5:33 PM, Nicolas Delsaux nicolas.dels...@gmx.fr wrote: I would like to create a Javascript application in XWiki. My precise goal is to go get some content from Jenkins (build status) and render it over a static image using d3.js or any other rich rendering framework. I suppose the only way to implement that is to write my webpage as HTML. But, then, how will I use external frameworks ? (typically d3.js) Thanks -- Nicolas Delsaux ___ 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
Re: [xwiki-users] Create Javascript application in XWiki
Extensions don't go in WEB-INF/lib, they go in a special local repository in the configured permanent directory. On Tue, Mar 24, 2015 at 11:24 AM, vinc...@massol.net vinc...@massol.net wrote: On 24 Mar 2015 at 11:22:52, Nicolas Delsaux (nicolas.dels...@gmx.fr(mailto:nicolas.dels...@gmx.fr)) wrote: Thanks for all your replies, Vincent and Thomas. I'm quite ... worried by the fact to directly put my webjars dependencies in WEB-INF/lib, directly or through Advanced Search, as it would prevent me to have explicit link between the JS lib and the place where it is used. What I fear is the WEB-INF/lib folder becoming kind of messy, with all JS dependencies dropped there without proper usage identification, and a zealous sysadmin coming there and purging the folder aggresively. Have you got any kind of best practices to avoid that ? If you’re doing dev and writing an extension for your code then all you need is add a dependency to the webjar in your extension’s POM and then install it through the Extension Manager and it won’t go in WEB-INF/lib :) Thanks -Vincent Le 24/03/2015 11:16, vinc...@massol.net a écrit : On 24 Mar 2015 at 11:12:54, vinc...@massol.net (vinc...@massol.net(mailto:vinc...@massol.net)) wrote: Hi Nicolas, On 23 Mar 2015 at 16:33:55, Nicolas Delsaux (nicolas.dels...@gmx.fr(mailto:nicolas.dels...@gmx.fr)) wrote: I would like to create a Javascript application in XWiki. My precise goal is to go get some content from Jenkins (build status) and render it over a static image using d3.js or any other rich rendering framework. I suppose the only way to implement that is to write my webpage as HTML. But, then, how will I use external frameworks ? (typically d3.js) Regarding D3js you have an example here: http://extensions.xwiki.org/xwiki/bin/view/Extension/D3+Example And there’s even a macro here (not tried it myself): http://extensions.xwiki.org/xwiki/bin/view/Extension/d3js Just a note: these examples were written prior to us having the webjar integration support. So with webjars, it’s even easier and you don’t need to include d3js in an XWiki Object anymore. You can just put the webjar in WEB-INF/lib and it’ll be usable. See http://extensions.xwiki.org/xwiki/bin/view/Extension/WebJars+Integration Thanks -Vincent Hope it helps -Vincent Thanks -- Nicolas Delsaux ___ 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 -- Thomas Mortagne ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
[xwiki-users] Synchronize two XWiki installations
Hi, As I tried XWiki, I used my laptop as server with the Windows standalone install. Now, I want to have XWiki installed on a standard server with a standard DB/web server using the XWiki RPM (I guess this RPM will not install Jetty/SQLite, but Tomcat/??). But, I would better not have to reinstall the various extensions, recreate the users (with the same login/passwords) and rewrite the pages I already have. Is there any synchronisation mechanism available that would allow me to give the official XWiki my prototype one as a kind of upstream server and make sure their content and config is synchronized ? Thanks -- Nicolas Delsaux ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] Create Javascript application in XWiki
On 24 Mar 2015 at 11:12:54, vinc...@massol.net (vinc...@massol.net(mailto:vinc...@massol.net)) wrote: Hi Nicolas, On 23 Mar 2015 at 16:33:55, Nicolas Delsaux (nicolas.dels...@gmx.fr(mailto:nicolas.dels...@gmx.fr)) wrote: I would like to create a Javascript application in XWiki. My precise goal is to go get some content from Jenkins (build status) and render it over a static image using d3.js or any other rich rendering framework. I suppose the only way to implement that is to write my webpage as HTML. But, then, how will I use external frameworks ? (typically d3.js) Regarding D3js you have an example here: http://extensions.xwiki.org/xwiki/bin/view/Extension/D3+Example And there’s even a macro here (not tried it myself): http://extensions.xwiki.org/xwiki/bin/view/Extension/d3js Just a note: these examples were written prior to us having the webjar integration support. So with webjars, it’s even easier and you don’t need to include d3js in an XWiki Object anymore. You can just put the webjar in WEB-INF/lib and it’ll be usable. See http://extensions.xwiki.org/xwiki/bin/view/Extension/WebJars+Integration Thanks -Vincent Hope it helps -Vincent Thanks -- Nicolas Delsaux ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] Fight with ActivityStreamPluginApi
Another simpler (depending from where you stand, it's certainly cleaner at least) possibility is to make activity stream ignore whatever you are planning to do by indicating it that you are going to are subtask of another one (for example when you import a XAR you don't get the document in the activity stream). This is done by sending an event implementing org.observation.event.BeginFoldEvent (and then send a corresponding EndFoldEvent when you are done). But it's not the kind of thing you can do in velocity since you need to create two new events and send them. On Tue, Mar 24, 2015 at 4:11 PM, Pascal BASTIEN pbasnews-xw...@yahoo.fr wrote: Hello, A user want to rename lot of page in Xwiki and I don't want this op displayed on WebHome Activity Stream. Then, I found these API to use: http://tiny.cc/2fb0vx public void deleteActivityEvent(ActivityEvent event) Delete the passed event form the database. and http://tiny.cc/gkb0vx public ListActivityEvent getEventsForUser(String streamName, String user, boolean filter, int nb, int start) throws ActivityStreamException Return the latest events recorded for the given stream name and the given user. Unfortunaly, my code return only old activity events (probably some old events before my Xwiki upgrade ... I guess?). I obtain this XWiki.MyUser - 2014/09/24 13:27 - 2014-09-24 13:27:44.0 - update - 20 MySpace.MyPage - 2014/09/22 17:14 - 2014-09-22 17:14:17.0 - deleteAttachment - 20 BacASable.Tableau filtré - 2014/09/19 15:37 - 2014-09-19 15:37:31.0 - update - 20 Here my code: {{velocity}} #set ($MonStream=$xwiki.activitystream.getStreamName(Encyclopédie)) #foreach ($MonEvent in $xwiki.activitystream.getEventsForUser($MonStream, XWiki.christianchambon, false, 1500, 0)) 1. $MonEvent.getPage() - $MonEvent.getDisplayDate() - $MonEvent.getDate() - $MonEvent.getType() - $MonEvent.getPriority() #end {{/velocity}} With this, it is the same thing :#foreach ($MonEvent in $xwiki.activitystream.getEventsForUser(XWiki.christianchambon, false, 1500, 0)): only old events :-( Activity stream working well on my Xwiki WebHome Thxs for any helps Pascal B ___ 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
[xwiki-users] [ANN] XWiki 7.0 Release Candidate 1 released
The XWiki development team is proud to announce the availability of XWiki 7.0 Release Candidate 1. The version is mostly about stabilization before 7.0 final. It contains diff UI improvements, Extension Repository improvements, a new component based watchlist module, a new application to edit wiki skins. XWiki also moved to Servlet 3.0.1 which means various old application servers versions are not supported anymore. You can download it here: http://www.xwiki.org/xwiki/bin/view/Main/Download Make sure to review the release notes: http://www.xwiki.org/xwiki/bin/view/ReleaseNotes/ReleaseNotesXWiki70RC1 Thanks -The XWiki dev team ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] ajax example
Some comments: For step 1: Don't print the JSON directly. You'll have escaping issues. In order to ensure the generated JSON is valid you should build the JSON in memory (using Velocity/Java maps, arrays and basic types) and then serialize it: $jsontool.serialize({ greeting: Hello, location: World }) For step 4: Don't hard-code the page URL and use the 'get' action instead of 'view' to avoid adding view statistics entries. var url = new XWiki.Document('JsonHello', 'Sandbox').getURL('get'); Also, to avoid the need to URL-encode the request parameters you should pass them using an object not a string. var params = { 'xpage': 'plain', 'outputSyntax': 'plain' }; $.get(url, params, function(data) { ... }); Hope this helps, Marius On Fri, Mar 20, 2015 at 8:26 PM, Pascal BASTIEN pbasnews-xw...@yahoo.fr wrote: Hello, Here, I provided an simple Ajax example to use in xwiki application: http://extensions.xwiki.org/xwiki/bin/view/Extension/AJAX+example#Attachments This mail on this list to validate that what I wrote is the best way (like suggest Vincent) Thxs. Pascal BASTIEN ___ 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] Fight with ActivityStreamPluginApi
On Tue, Mar 24, 2015 at 5:22 PM, Pascal BASTIEN pbasnews-xw...@yahoo.fr wrote: Your method seem to complex (for me). Thanks anyway :-) Do you mean $xwiki.activitystream. API is broken? I don't remember talking about the activity stream API :) I don't really know it well enough to give advices on it. I tested it on fresh jetty xwiki 6.4.3 and $xwiki.activitystream.getEventsForUser show nothing. And, if I use true on $xwiki.activitystream.getEventsForUser(XWiki.Admin, true, 1500, 0)) (filter - if true, group the matched events by priority) I obtain this error: Caused by: com.xpn.xwiki.plugin.activitystream.api.ActivityStreamException: Error number 3223 in 3: Error number 3223 in 3: Exception while searching documents with sql select act from ActivityEventImpl as act, ActivityEventImpl as act2 where act.eventId=act2.eventId and (act.hidden true or act.hidden is null) and act.user=XWiki.Admin group by act.requestId having (act.priority)=max(act2.priority) order by act.date desc En date de : Mar 24.3.15, Thomas Mortagne thomas.morta...@xwiki.com a écrit : Objet: Re: [xwiki-users] Fight with ActivityStreamPluginApi À: Pascal BASTIEN pbasnews-xw...@yahoo.fr, XWiki Users users@xwiki.org Date: Mardi 24 mars 2015, 17h07 Another simpler (depending from where you stand, it's certainly cleaner at least) possibility is to make activity stream ignore whatever you are planning to do by indicating it that you are going to are subtask of another one (for example when you import a XAR you don't get the document in the activity stream). This is done by sending an event implementing org.observation.event.BeginFoldEvent (and then send a corresponding EndFoldEvent when you are done). But it's not the kind of thing you can do in velocity since you need to create two new events and send them. On Tue, Mar 24, 2015 at 4:11 PM, Pascal BASTIEN pbasnews-xw...@yahoo.fr wrote: Hello, A user want to rename lot of page in Xwiki and I don't want this op displayed on WebHome Activity Stream. Then, I found these API to use: http://tiny.cc/2fb0vx public void deleteActivityEvent(ActivityEvent event) Delete the passed event form the database. and http://tiny.cc/gkb0vx public ListActivityEvent getEventsForUser(String streamName, String user, boolean filter, int nb, int start) throws ActivityStreamException Return the latest events recorded for the given stream name and the given user. Unfortunaly, my code return only old activity events (probably some old events before my Xwiki upgrade ... I guess?). I obtain this XWiki.MyUser - 2014/09/24 13:27 - 2014-09-24 13:27:44.0 - update - 20 MySpace.MyPage - 2014/09/22 17:14 - 2014-09-22 17:14:17.0 - deleteAttachment - 20 BacASable.Tableau filtré - 2014/09/19 15:37 - 2014-09-19 15:37:31.0 - update - 20 Here my code: {{velocity}} #set ($MonStream=$xwiki.activitystream.getStreamName(Encyclopédie)) #foreach ($MonEvent in $xwiki.activitystream.getEventsForUser($MonStream, XWiki.christianchambon, false, 1500, 0)) 1. $MonEvent.getPage() - $MonEvent.getDisplayDate() - $MonEvent.getDate() - $MonEvent.getType() - $MonEvent.getPriority() #end {{/velocity}} With this, it is the same thing :#foreach ($MonEvent in $xwiki.activitystream.getEventsForUser(XWiki.christianchambon, false, 1500, 0)): only old events :-( Activity stream working well on my Xwiki WebHome Thxs for any helps Pascal B ___ 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
[xwiki-users] Fw : Re: ajax example
Some comments: Thxs For step 1: Don't print the JSON directly. You'll have escaping issues. In order to ensure the generated JSON is valid you should build the JSON in memory (using Velocity/Java maps, arrays and basic types) and then serialize it: $jsontool.serialize({ greeting: Hello, location: World }) I agree but the purpose was to use Vincent example on this page: http://extensions.xwiki.org/xwiki/bin/view/Extension/Output+JSON Perhaps we (who?) need to modify both pages? For step 4: Don't hard-code the page URL and use the 'get' action instead of 'view' to avoid adding view statistics entries. var url = new XWiki.Document('JsonHello', 'Sandbox').getURL('get'); Thxs I was too lazy to take too long time to find JS function. :-) Also, to avoid the need to URL-encode the request parameters you should pass them using an object not a string. var params = { 'xpage': 'plain', 'outputSyntax': 'plain' }; $.get(url, params, function(data) { ... }); Yes thxs you = I uploaded/update my page (The worst is that I hate JS) :-) Pascal B Hope this helps, Marius On Fri, Mar 20, 2015 at 8:26 PM, Pascal BASTIEN pbasnews-xw...@yahoo.fr wrote: Hello, Here, I provided an simple Ajax example to use in xwiki application: http://extensions.xwiki.org/xwiki/bin/view/Extension/AJAX+example#Attachments This mail on this list to validate that what I wrote is the best way (like suggest Vincent) Thxs. Pascal BASTIEN ___ 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] Fight with ActivityStreamPluginApi
Hello, A user want to rename lot of page in Xwiki and I don't want this op displayed on WebHome Activity Stream. Then, I found these API to use: http://tiny.cc/2fb0vx public void deleteActivityEvent(ActivityEvent event) Delete the passed event form the database. and http://tiny.cc/gkb0vx public ListActivityEvent getEventsForUser(String streamName, String user, boolean filter, int nb, int start) throws ActivityStreamException Return the latest events recorded for the given stream name and the given user. Unfortunaly, my code return only old activity events (probably some old events before my Xwiki upgrade ... I guess?). I obtain this XWiki.MyUser - 2014/09/24 13:27 - 2014-09-24 13:27:44.0 - update - 20 MySpace.MyPage - 2014/09/22 17:14 - 2014-09-22 17:14:17.0 - deleteAttachment - 20 BacASable.Tableau filtré - 2014/09/19 15:37 - 2014-09-19 15:37:31.0 - update - 20 Here my code: {{velocity}} #set ($MonStream=$xwiki.activitystream.getStreamName(Encyclopédie)) #foreach ($MonEvent in $xwiki.activitystream.getEventsForUser($MonStream, XWiki.christianchambon, false, 1500, 0)) 1. $MonEvent.getPage() - $MonEvent.getDisplayDate() - $MonEvent.getDate() - $MonEvent.getType() - $MonEvent.getPriority() #end {{/velocity}} With this, it is the same thing :#foreach ($MonEvent in $xwiki.activitystream.getEventsForUser(XWiki.christianchambon, false, 1500, 0)): only old events :-( Activity stream working well on my Xwiki WebHome Thxs for any helps Pascal B ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
[xwiki-users] Fw : Re: Fight with ActivityStreamPluginApi
Do you mean $xwiki.activitystream. API is broken? I don't remember talking about the activity stream API :) I probably because you didn't talk about it :-)) don't really know it well enough to give advices on it. Finally, I used another method who's working like I want: {{velocity}} #set ($MonStream=$xwiki.activitystream.getStreamName(Sandbox)) ##foreach ($MonEvent in $xwiki.activitystream.getEventsForUser(XWiki.Admin, false, 1500, 0)) #foreach ($MonEvent in $xwiki.activitystream.getEvents($MonStream, false, 1500, 0)) 1. $MonEvent.getPage() - $MonEvent.getDisplayDate() - $MonEvent.getDate() - $MonEvent.getType() - $MonEvent.getPriority() #if ($MonEvent.getPage() == Sandbox.test3) * Je supprime l'event $xwiki.activitystream.deleteActivityEvent($MonEvent) #end #end {{/velocity}} Like I chatted with Vincent I know groovy is powerfull (except the fact that With great power comes great responsibility ;-) ), full example application in groovy missing (because required PR) and templates contains tons of nice velocity code. :-) Thxs for your help / works :-) ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
[xwiki-users] Fw : Fw : Re: ajax example
For step 1: Don't print the JSON directly. You'll have escaping issues. In order to ensure the generated JSON is valid you should build the JSON in memory (using Velocity/Java maps, arrays and basic types) and then serialize it: $jsontool.serialize({ greeting: Hello, location: World }) I agree but one* purpose was to use Vincent example on this page: http://extensions.xwiki.org/xwiki/bin/view/Extension/Output+JSON Perhaps we (who?) need to modify both pages? Anyway, do you prefer this code? {{velocity wiki=false}} ## If AJAX call #if($!request.outputSyntax != '') $response.setContentType('application/json') #end #set($MyJsonData = {'greeting': 'Hello', 'location': 'World'}) $jsontool.serialize($MyJsonData) {{/velocity}} For step 4: Don't hard-code the page URL and use the 'get' action instead of 'view' to avoid adding view statistics entries. var url = new XWiki.Document('JsonHello', 'Sandbox').getURL('get'); Thxs I was too lazy to take too long time to find JS function. :-) Also, to avoid the need to URL-encode the request parameters you should pass them using an object not a string. var params = { 'xpage': 'plain', 'outputSyntax': 'plain' }; $.get(url, params, function(data) { ... }); Yes thxs you = I uploaded/update my page (The worst is that I hate JS) :-) Pascal B Hope this helps, Marius On Fri, Mar 20, 2015 at 8:26 PM, Pascal BASTIEN pbasnews-xw...@yahoo.fr wrote: Hello, Here, I provided an simple Ajax example to use in xwiki application: http://extensions.xwiki.org/xwiki/bin/view/Extension/AJAX+example#Attachments This mail on this list to validate that what I wrote is the best way (like suggest Vincent) Thxs. Pascal BASTIEN ___ 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