Wiki source code of XWiki HowTo’s

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

Hide last authors
Roman Friesen 1.1 1 = XWiki HowTo's =
2
3 {{toc start="2" numbered="true" depth="3"/}}
4
Roman Friesen 4.1 5 == General information ==
Roman Friesen 3.1 6 * [[Features / Applications >> http://enterprise.xwiki.org/xwiki/bin/view/Main/Features]]
Roman Friesen 4.1 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]]
Roman Friesen 1.1 12 * [[Developer guide >>http://dev.xwiki.org/xwiki/bin/view/Main/]]
13 * [[Code Zone >>http://code.xwiki.org/xwiki/bin/view/Main/]]
14
Roman Friesen 5.1 15 == Layout and Behaviour ==
Roman Friesen 3.1 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]]
Roman Friesen 5.1 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]]
Roman Friesen 1.1 21
Roman Friesen 3.1 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
Roman Friesen 2.1 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
Roman Friesen 3.1 45
Roman Friesen 4.1 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]]
Roman Friesen 5.1 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]]
Roman Friesen 4.1 67 * [[Writing Internationalized XWiki Applications >> http://platform.xwiki.org/xwiki/bin/view/DevGuide/InternationalizingApplications]]
68
Roman Friesen 3.1 69 === Translation of Panels ===
70 ==== With an if/else-block ====
71 1. Put the following velocity script into your panel
Roman Friesen 2.1 72 {{code}}
Roman Friesen 3.1 73 #panelheader('MyPanel')
74
Roman Friesen 2.1 75 #if ($context.language == "de")
Roman Friesen 3.1 76 My German translation
Roman Friesen 2.1 77 #elseif ($context.language == "fr")
Roman Friesen 3.1 78 My French translation
Roman Friesen 2.1 79 #else
Roman Friesen 3.1 80 My default translation
Roman Friesen 2.1 81 #end
Roman Friesen 3.1 82
83 #panelfooter()
Roman Friesen 2.1 84 {{/code}}
85
Roman Friesen 3.1 86 1. That is all :)
87 ==== Loading a translated page into the panel ====
Roman Friesen 4.1 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}}
Roman Friesen 3.1 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
Roman Friesen 4.1 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).
Roman Friesen 1.1 104
Roman Friesen 4.1 105 {{warning}} This workaround may work only with xwiki default skins {{/warning}}
Roman Friesen 1.1 106
Roman Friesen 4.1 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]]
Roman Friesen 6.1 123 ** [[Using Velocity Scripting >> http://platform.xwiki.org/xwiki/bin/view/DevGuide/Scripting#HControllingwhethertodisplayComments2FHistory2FAttachment2FInformationsectionsornot]]
Roman Friesen 4.1 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]]
Roman Friesen 5.1 126 * [[Admin Configuration guide >>http://platform.xwiki.org/xwiki/bin/view/AdminGuide/Configuration#HTurningoffcommentsorattachments]]
Roman Friesen 4.1 127
Roman Friesen 5.1 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".
137