<
From version < 29.3 >
edited by Vincent Massol
on 2010/10/28
To version < 30.1 >
edited by Caleb James DeLisle
on 2010/12/05
>
Change comment: newlines around code macros

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.VincentMassol
1 +XWiki.Caleb_James_DeLisle
Content
... ... @@ -31,6 +31,7 @@
31 31  You can also gain direct access to XWiki components using the following code snippet:
32 32  Also see: [[Accessing components from Groovy>>DevGuide.WritingComponents#HAccessingacomponentfromgroovy]]
33 33  Note: This snippet is written in Groovy and will have to be converted to your scripting language.
34 +
34 34  {{code language="java"}}{{groovy}}
35 35  def greeter = com.xpn.xwiki.web.Utils.getComponent(org.xwiki.component.HelloWorld.class);
36 36  println greeter.sayHello();
... ... @@ -39,11 +39,13 @@
39 39  == XWiki Core Access ==
40 40  
41 41  Sometimes the XWiki Api doesn't provide the methods which you need for your application. you can gain raw access the core of XWiki but it presents an increased security risk and requires programming rights to run. Using the core should be avoided if at all possible.
43 +
42 42  {{code language="java"}}{{groovy}}
43 43  def xc = xcontext.getContext();
44 44  def wiki = xc.getWiki();
45 45  def xdoc = doc.getDocument();
46 46  {{/groovy}}{{/code}}
49 +
47 47  After using this snippet, you will have 3 new objects:
48 48  
49 49  * [[The underlying XWikiContext behind the Context object>>http://maven.xwiki.org/site/xwiki-core-parent/xwiki-core/apidocs/com/xpn/xwiki/XWikiContext.html]]: **##xc##**
... ... @@ -133,6 +133,7 @@
133 133  * ##$isAdvancedUser##: advanced users: ##superadmin##, users with the ##usertype## property set to "Advanced", guest users with admin rights
134 134  
135 135  Example:
139 +
136 136  {{code}}{{velocity}}
137 137  #if ($hasAdmin)
138 138   ## This link will only be visible to users that have admin rights on this document
... ... @@ -163,6 +163,7 @@
163 163  
164 164  Using XWiki Syntax 2.0:
165 165  Objects can be passed back and forth between scripting languages by storing them in commonly available objects. One such commonly available object which only lasts the length of the request is the context object, known as xcontext.
170 +
166 166  {{code}}{{velocity}}
167 167  #set($hostname = "www.xwiki.org")
168 168  Host Name: $hostname
... ... @@ -181,6 +181,7 @@
181 181  
182 182  Using XWiki Syntax 1.0:
183 183  Because Groovy and Velocity code are parsed together, variables defined in Groovy can be used directly in velocity without storing in and retrieving from the context.
189 +
184 184  {{code}}#set ($hostname = "www.xwiki.org")
185 185  Host Name: $hostname
186 186  <%
... ... @@ -195,6 +195,7 @@
195 195  = Python Specific Information =
196 196  
197 197  You can run python code in XWiki just like velocity or groovy.
204 +
198 198  {{code language="python"}}{{python}}
199 199  print "The full name of this document is " + doc.getFullName()
200 200  {{/python}}{{/code}}

Get Connected