Re: [xwiki-users] Using a local class within a wiki page

2014-12-19 Thread vinc...@massol.net
Ok I’ve discussed with Guillaume Laforge from Groovy fame and here are more 
details:

* In our code we capture the output of the script and use it to display the 
rendered page so any println located directly in the script will work.
* However for a println in a Class, Groovy call System.out.println(…) - which 
is why it goes in the xwiki logs - and we would need to capture that in a 
thread safe way to redirect it to the page rendering this is a bit more 
involved:
** Use System.set(PrintStream) with a custom PrintStream that would use for 
example a threadlocal variable to direct the content to our page being rendered
** Use Groovy’s runtime metaprogramming feature, for example: 
PrintStream.metaClass.println = { String s - ...handle thread safety here.. }.
** Use Groovy’s compile-time metaprogramming feature and implement a Groovy AST 
Transformation to transform all println calls into something else. For example 
by adding a binding to the ScriptContext and using that binding instead of 
println. This requires using a CompilationCustomizer (we already do that in 
XWiki btw) which returns an ASTTransformationCustomizer to do the work.

Thanks
-Vincent


On 19 Dec 2014 at 00:10:18, Bryn Jeffries 
(bryn.jeffr...@sydney.edu.au(mailto:bryn.jeffr...@sydney.edu.au)) wrote:

 Vincent Massol said:
  Ok I think I know...
  Actually the message is printed in the console.
  You see something in the page only if you print in the global scope because
  this is what gets returned by script evaluation. Calling “println” in a 
  class
  doesn’t return anything in the evaluation and thus you don’t see anything.
  That’s why the examples at 
  http://extensions.xwiki.org/xwiki/bin/view/Extension/Groovy+Macro work.
 
  
 Right, makes sense. So looks like the best fix is to return the string and 
 print it from global (script) scope. This works:
  
 {{groovy}}
 class Callee {
 def hello() {
 return hello, world
 }
 }
 c = new Callee()
 println c.hello()
 {{/groovy}}
  

___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] Line wrapping in Code Macro

2014-12-19 Thread Thomas Mortagne
This is because that's actually what you asked with this syntax. To
customise the macro itself you can use cssClass parameter, see
http://extensions.xwiki.org/xwiki/bin/view/Extension/Box+Macro#HParametersdefinition
(code macro inherits box macro).

On Thu, Dec 18, 2014 at 10:14 PM, Jamal ram...@gmail.com wrote:
 Thanks for the reply, Vincent.

 That was my first thought, but here's the weird thing: when I add CSS styles
 that way, the code block ends up getting rendered as a paragraph (P tag)
 with the style applied in a SPAN, instead of being rendered in a DIV as it
 normally is.

 This changes the look completely, and with forced line breaks it gets quite
 messy.

 But since the macro has a place to specify a CSS class, I guess I could just
 create a class to handle the line breaking.

 I'm still pretty new to Xwiki, can you tell me what best place/way is to add
 a CSS class that I can use on any page?

 Thanks,

 Jamal



 --
 View this message in context: 
 http://xwiki.475771.n2.nabble.com/Line-wrapping-in-Code-Macro-tp7593495p7593510.html
 Sent from the XWiki- Users mailing list archive at Nabble.com.
 ___
 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] Query external MSSQL DB in a wiki page

2014-12-19 Thread vinc...@massol.net
Hi Bryn,


On 17 Dec 2014 at 22:49:26, Bryn Jeffries 
(bryn.jeffr...@sydney.edu.au(mailto:bryn.jeffr...@sydney.edu.au)) wrote:

 I wrote:
  I have managed the following with an external PostgreSQL server:
  Retrieve and display queried data in a page with Groovy; Write a Java
  component to perform query, call and display with Groovy or Velocity;
  Generate JSON data of query results with Groovy, call and display from
  LiveTable.
 
  Happy to share but not near my computer till later today, so let me know
  which of the above is closest to what you want to do and I'll post something
  when I can.
  
 I've put some examples into the following wiki page:
 http://platform.xwiki.org/xwiki/bin/view/DevGuide/ExternalDBAccess
  
 I hope that's the correct approach to sharing this kind of stuff - please 
 advise if not.

Thanks for this! :) It’s great to see participation in the wiki.

Now, I’ve done some gardening and since we already have a page about executing 
SQL (http://extensions.xwiki.org/xwiki/bin/view/Extension/Execute+SQL), I have 
merged your tutorial on this page.

Hope it’s fine with you!

Also note that you should use a connection pool and use a data source instead 
of defining the user/password/url directly.

Thanks!
-Vincent

___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


[xwiki-users] Migrate MediaWiki content to XWiki

2014-12-19 Thread Ilsa Loving
Hi all,

I’m trying to get us migrated from several installations of MediaWiki to one 
XWiki.  I have installed XWiki 6.3 just fine… but the big problem is migrating 
the data over.

So far all the options I’ve found have been sorely lacking.

-The method provided on the Encodo blog, uses the XMLRPC API which has since 
been deprecated
-The Mediawiki to Xwiki Migration Toolkit requires setting up an entire 
development environment with a special customized version of XWiki just to do 
the import, which is unnecessarily complex and error-prone.
-A few other methods which may work, but omit portions such as history.


Is there a relatively simple batch import mechanism that works with the current 
versions of xwiki, or am I relegated to importing stuff manually?  I *could* 
write my own import tool, but if I have to go that route we may as well just do 
it manually because we will need to audit and clean up the articles anyway.

Ilsa

___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


[xwiki-users] [myxwiki] new wiki request

2014-12-19 Thread Pierre-Antoine Grégoire
   - *subject*: [myxwiki] new wiki request
   - *description*: Wiki for YaJUG
   - *owner name*: zepag (Pierre-Antoine Grégoire)
   - *wiki name*: yajug
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] [myxwiki] new wiki request

2014-12-19 Thread vinc...@massol.net
Hi PAG,

On 19 Dec 2014 at 18:52:57, Pierre-Antoine Grégoire 
(pierreantoine.grego...@yajug.org(mailto:pierreantoine.grego...@yajug.org)) 
wrote:

 - *subject*: [myxwiki] new wiki request
 - *description*: Wiki for YaJUG
 - *owner name*: zepag (Pierre-Antoine Grégoire)
 - *wiki name*: yajug

http://yajug.myxwiki.org/

Enjoy!
-Vincent

PS: Remember the stability of myxwiki.org is not guaranteed! See 
http://myxwiki.org

___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] [myxwiki] new wiki request

2014-12-19 Thread Valdis Vītoliņš
 Enjoy!
 -Vincent
 
 PS: Remember the stability of myxwiki.org is not guaranteed! See 
 http://myxwiki.org

But usually it's not bad though. See for example:
http://stats.pingdom.com/n04jhbg6a16x/910468/2014/12
http://stats.pingdom.com/n04jhbg6a16x/910468/2014/11

Valdis

___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] Run external script to generate data for wiki page

2014-12-19 Thread Bryn Jeffries
I was thinking basic current side AJAX, rather than doing something server side 
in Velocity. It's not my area, but I'm sure it's possible. The idea is just too 
get your browser to call the CGI script.
- Reply message -
From: Jason Clemons jason.clem...@live.com
To: XWiki Users users@xwiki.org
Subject: Re: [xwiki-users] Run external script to generate data for wiki page
Date: Fri, Dec 19, 2014 12:02


I have control over the script..so it can be in the CGI bin...would I then be 
able to invoke it through velocity?



 On Dec 18, 2014, at 6:01 PM, Bryn Jeffries bryn.jeffr...@sydney.edu.au 
 wrote:

 How external is the external script? Couldn't you wrap the script into a 
 cgi script on the same server and invoke it from the client with an AJAX call?
 
 From: Jason Clemons [jason.clem...@live.com]
 Sent: 19 December 2014 10:00
 To: 'XWiki Users'
 Subject: Re: [xwiki-users] Run external script to generate data for wiki page

 Bump... :)

 Hello all,

 I'm wondering if anyone has done anything like this before so, I thought I'd
 ask it here.  Essentially, what I want to do is have a page / form that my
 users fill out and then submit.  Upon submit I need to invoke an external
 script (e.g..Perl, Python, VBScript, Batch etc...) that will do some quick
 data gathering then insert some data in a database.  Once the script
 generates the data the page will then retrieve it and render some results
 based on it.  Most of the mechanics I can figure out I think, but I wanted
 to get some tips on the best way to actually invoke the script from a page
 in Xwiki.
 Any ideas or suggestions are appreciated...
 ___
 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