Wiki source code of XWiki HowTo’s

Version 4.1 by Roman Friesen on 2009/09/16 12:50

Show last authors
1 = XWiki HowTo's =
2
3 {{toc start="2" numbered="true" depth="3"/}}
4
5 == General information ==
6 * [[Features / Applications >> http://enterprise.xwiki.org/xwiki/bin/view/Main/Features]]
7 * [[Getting Started >>http://enterprise.xwiki.org/xwiki/bin/view/UserGuide/]]
8 ** [[First steps>>http://enterprise.xwiki.org/xwiki/bin/view/GettingStarted/]]
9 * [[Administrator Guide >>http://platform.xwiki.org/xwiki/bin/view/AdminGuide/]]
10 * [[Advanced User guide >>http://platform.xwiki.org/xwiki/bin/view/DevGuide/]]
11 ** [[Best Practices >> http://platform.xwiki.org/xwiki/bin/view/DevGuide/Best+Practices+XWiki+Application+Organization]]
12 * [[Developer guide >>http://dev.xwiki.org/xwiki/bin/view/Main/]]
13 * [[Code Zone >>http://code.xwiki.org/xwiki/bin/view/Main/]]
14
15 == Skin customizing ==
16 * [[Ad hoc CSS and JavaScript extensions >> http://platform.xwiki.org/xwiki/bin/view/DevGuide/SkinExtensionsTutorial]]
17 * [[Changing the skin >>http://platform.xwiki.org/xwiki/bin/view/AdminGuide/Skins]]
18
19
20 == Velocity Scripting ==
21
22 * [[XWiki Velocity API >>http://platform.xwiki.org/xwiki/bin/view/DevGuide/Scripting]]
23 * [[Velocity Macros >>http://code.xwiki.org/xwiki/bin/view/Macros/]]
24 * [[Velocity User Guide >>http://velocity.apache.org/engine/releases/velocity-1.5/user-guide.html]]
25 * [[Include the Velocity code of another XWiki page >> http://platform.xwiki.org/xwiki/bin/view/DevGuide/IncludeInVelocity]]
26
27 === Privileges ===
28
29 * Admin rights
30 {{code}}
31 #if ($xwiki.hasAdminRights())
32 The current user has admin rights
33 #end
34 {{/code}}
35
36 * Edit rights
37 {{code}}
38 #if($hasEdit)
39 The current user has edit rights
40 #end
41 {{/code}}
42
43
44 === Create Velocity Macro ===
45
46 {{warning}}A write access to your XWiki installation directory is required!{{/warning}}
47
48 1. Add a new macro to the file "macros.vm"
49 1*. see "<xwiki-installation-root>/xwiki/templates"
50 1*. add at the end of the file your new macro, for example:
51 {{code}}#macro(myMacroName)
52 Hello World!
53 #end{{/code}}
54 1. Register the new macro in the file "macros.txt"
55 1*. see "<xwiki-installation-root>/xwiki/templates"
56 1*. add at the end of the file the line, for example:
57 {{code}}myMacroName=velocity:myMacroName:{{/code}}
58 1. After XWiki restart the new velocity macro can be used in a common way: either using the WYSIWYG editor or [[text mode>>http://code.xwiki.org/xwiki/bin/view/Macros/]].
59
60
61 == Translations ==
62 * [[Internationalization feature >> http://platform.xwiki.org/xwiki/bin/view/Features/I18N]]
63 * [[Writing Internationalized XWiki Applications >> http://platform.xwiki.org/xwiki/bin/view/DevGuide/InternationalizingApplications]]
64
65 === Translation of Panels ===
66 ==== With an if/else-block ====
67 1. Put the following velocity script into your panel
68 {{code}}
69 #panelheader('MyPanel')
70
71 #if ($context.language == "de")
72 My German translation
73 #elseif ($context.language == "fr")
74 My French translation
75 #else
76 My default translation
77 #end
78
79 #panelfooter()
80 {{/code}}
81
82 1. That is all :)
83 ==== Loading a translated page into the panel ====
84 {{warning}}Maybe the macro "includeForm()" is not the best choice here, see [[including macros>> http://platform.xwiki.org/xwiki/bin/view/DevGuide/IncludeInVelocity]].{{/warning}}
85
86 1. Creates a new wiki page with translated content, for example 'Main.MyMenu'.
87 1. Include this page in your panel, for example:
88 {{code}}
89 #panelheader('MyPanel')
90
91 #includeForm('Main.MyMenu')
92
93 #panelfooter()
94 {{/code}}
95
96 1. That is all :)
97
98 == Disabling comments, attacments, history and information ==
99 Currently (xwiki-2.0) there is no way to disable this parts from viewing. This parts can be only made invisible at the bottom of pages (tabbed pane).
100
101 {{warning}} This workaround may work only with xwiki default skins {{/warning}}
102
103 1. Change to the Administration page of you xwiki
104 1. Call the class editor (<server>/xwiki/bin/edit/XWiki/XWikiPreferences?editor=class)
105 11. Add the following properties (type Boolean)
106 11*. showcomments
107 11*. showattachments
108 11*. showhistory
109 11*. showinformation
110 11. Save changes
111 1. Call the object editor (<server>/xwiki/bin/edit/XWiki/XWikiPreferences?editor=object)
112 11. Expand "Objects of type XWiki.XWikiPreferences / XWikiPreferences"
113 11. Change the values for all new properties to "No"
114 11. Save changes
115 1. The bottom tabbed pane will disappear, but you can still access this informations through the menu "Show".
116
117 See also:
118 * [[Disabling at the page or space level >>http://osdir.com/ml/web.wiki.xwiki.user/2008-01/msg00055.html]]
119 * [[related jira task "XWIKI-3027" >>http://jira.xwiki.org/jira/browse/XWIKI-3027]]
120 * [[related FAQ >> http://www.xwiki.org/xwiki/bin/view/FAQ/Howtodisablecommentsandattachments]]
121 * [[Admin Configuration guide >>http://platform.xwiki.org/xwiki/bin/view/AdminGuide/Configuration]]