Wiki source code of XWiki HowTo’s

Last modified by Roman Friesen on 2009/10/03 10:51

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 == Layout and Behaviour ==
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 * [[Configure the WYSIWYG editor >> http://platform.xwiki.org/xwiki/bin/view/AdminGuide/Configuration#HConfiguretheWYSIWYGeditor]]
19 * [[Configure edit comment behavior>>http://platform.xwiki.org/xwiki/bin/view/AdminGuide/Configuration#HConfigureeditcommentbehavior]]
20 * [[Configuring Wiki Syntaxes and default Syntax >> http://platform.xwiki.org/xwiki/bin/view/AdminGuide/Configuration#HConfiguringWikiSyntaxesanddefaultSyntax]]
21
22 == Velocity Scripting ==
23
24 * [[XWiki Velocity API >>http://platform.xwiki.org/xwiki/bin/view/DevGuide/Scripting]]
25 * [[Velocity Macros >>http://code.xwiki.org/xwiki/bin/view/Macros/]]
26 * [[Velocity User Guide >>http://velocity.apache.org/engine/releases/velocity-1.5/user-guide.html]]
27 * [[Include the Velocity code of another XWiki page >> http://platform.xwiki.org/xwiki/bin/view/DevGuide/IncludeInVelocity]]
28
29 === Privileges ===
30
31 * Admin rights
32 {{code}}
33 #if ($xwiki.hasAdminRights())
34 The current user has admin rights
35 #end
36 {{/code}}
37
38 * Edit rights
39 {{code}}
40 #if($hasEdit)
41 The current user has edit rights
42 #end
43 {{/code}}
44
45
46 === Create Velocity Macro ===
47
48 {{warning}}A write access to your XWiki installation directory is required!{{/warning}}
49
50 1. Add a new macro to the file "macros.vm"
51 1*. see "<xwiki-installation-root>/xwiki/templates"
52 1*. add at the end of the file your new macro, for example:
53 {{code}}#macro(myMacroName)
54 Hello World!
55 #end{{/code}}
56 1. Register the new macro in the file "macros.txt"
57 1*. see "<xwiki-installation-root>/xwiki/templates"
58 1*. add at the end of the file the line, for example:
59 {{code}}myMacroName=velocity:myMacroName:{{/code}}
60 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/]].
61
62
63 == Translations ==
64 * [[Internationalization feature >> http://platform.xwiki.org/xwiki/bin/view/Features/I18N]]
65 * [[Language settings >> http://platform.xwiki.org/xwiki/bin/view/AdminGuide/Configuration#HLanguagesettings]]
66 ** [[Date format >> http://platform.xwiki.org/xwiki/bin/view/AdminGuide/Configuration#HDateformat]]
67 * [[Writing Internationalized XWiki Applications >> http://platform.xwiki.org/xwiki/bin/view/DevGuide/InternationalizingApplications]]
68
69 === Translation of Panels ===
70 ==== With an if/else-block ====
71 1. Put the following velocity script into your panel
72 {{code}}
73 #panelheader('MyPanel')
74
75 #if ($context.language == "de")
76 My German translation
77 #elseif ($context.language == "fr")
78 My French translation
79 #else
80 My default translation
81 #end
82
83 #panelfooter()
84 {{/code}}
85
86 1. That is all :)
87 ==== Loading a translated page into the panel ====
88 {{warning}}Maybe the macro "includeForm()" is not the best choice here, see [[including macros>> http://platform.xwiki.org/xwiki/bin/view/DevGuide/IncludeInVelocity]].{{/warning}}
89
90 1. Creates a new wiki page with translated content, for example 'Main.MyMenu'.
91 1. Include this page in your panel, for example:
92 {{code}}
93 #panelheader('MyPanel')
94
95 #includeForm('Main.MyMenu')
96
97 #panelfooter()
98 {{/code}}
99
100 1. That is all :)
101
102 == Disabling comments, attacments, history and information ==
103 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).
104
105 {{warning}} This workaround may work only with xwiki default skins {{/warning}}
106
107 1. Change to the Administration page of you xwiki
108 1. Call the class editor (<server>/xwiki/bin/edit/XWiki/XWikiPreferences?editor=class)
109 11. Add the following properties (type Boolean)
110 11*. showcomments
111 11*. showattachments
112 11*. showhistory
113 11*. showinformation
114 11. Save changes
115 1. Call the object editor (<server>/xwiki/bin/edit/XWiki/XWikiPreferences?editor=object)
116 11. Expand "Objects of type XWiki.XWikiPreferences / XWikiPreferences"
117 11. Change the values for all new properties to "No"
118 11. Save changes
119 1. The bottom tabbed pane will disappear, but you can still access this informations through the menu "Show".
120
121 See also:
122 * [[Disabling at the page or space level >>http://osdir.com/ml/web.wiki.xwiki.user/2008-01/msg00055.html]]
123 ** [[Using Velocity Scripting >> http://platform.xwiki.org/xwiki/bin/view/DevGuide/Scripting#HControllingwhethertodisplayComments2FHistory2FAttachment2FInformationsectionsornot]]
124 * [[related jira task "XWIKI-3027" >>http://jira.xwiki.org/jira/browse/XWIKI-3027]]
125 * [[related FAQ >> http://www.xwiki.org/xwiki/bin/view/FAQ/Howtodisablecommentsandattachments]]
126 * [[Admin Configuration guide >>http://platform.xwiki.org/xwiki/bin/view/AdminGuide/Configuration#HTurningoffcommentsorattachments]]
127
128 == Security & Performance ==
129 * [[Security configuration>>http://platform.xwiki.org/xwiki/bin/view/AdminGuide/Security]]
130 ** [[Superadmin account >> http://platform.xwiki.org/xwiki/bin/view/AdminGuide/Configuration#HEnablesuperadminaccount]]
131 ** [[Disabling WebDAV >> http://platform.xwiki.org/xwiki/bin/view/AdminGuide/Configuration#HDisablingWebDAV]]
132 * [[Performance >> http://platform.xwiki.org/xwiki/bin/view/AdminGuide/Performances]]
133 ** [[Disabling attachment versioning >> http://platform.xwiki.org/xwiki/bin/view/AdminGuide/Configuration#HOptionalStoreFeatures]]
134 ** [[Disabling statistics >> http://platform.xwiki.org/xwiki/bin/view/AdminGuide/Configuration#HEnabling2FDisablingStatistics]]
135
136 See also "xwiki.cfg" and "xwiki.properties" under "<xwiki-installation>/WEB-INF".