Wiki source code of Configuration
Last modified by Eleni Cojocariu on 2026/05/28 16:03
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | {{box cssClass="floatinginfobox" title="**Contents**"}} | ||
| 2 | {{toc/}} | ||
| 3 | {{/box}} | ||
| 4 | |||
| 5 | {{warning}} | ||
| 6 | WIP: this page is being refactored on the [[Configuration>>documentation.xs.admin.configuration.WebHome]] topic in the new documentation location. | ||
| 7 | {{/warning}} | ||
| 8 | |||
| 9 | Once you have XWiki [[installed>>documentation.xs.admin.installation.WebHome]] you'll want to configure it. Configuration can be done in 2 ways: | ||
| 10 | |||
| 11 | * by stopping the XWiki instance and editing either the ##xwiki/WEB-INF/xwiki.cfg## file or the ##xwiki/WEB-INF/xwiki.properties## one, and then restarting XWiki. Note that ##xwiki.cfg## was the historical file containing the configuration option, but we're moving away from it, and in due time, all the XWiki configuration options will be found in ##xwiki.properties## | ||
| 12 | * by logging in as a user with admin rights and going to the administration page using the top level menu. You can also go directly to //{{{http://localhost:8080/xwiki/bin/admin/XWiki/XWikiPreferences}}}//. This allows the server to keep running while making the changes.((( | ||
| 13 | {{info}} | ||
| 14 | * Some configurations are only accessible from the ##xwiki.cfg## and ##xwiki.properties## files and have no equivalent on the administration page. | ||
| 15 | * If you're a developer and need to understand how Configuration works in XWiki, check the [[Configuration Module Documentation>>extensions:Extension.Configuration Module]]. | ||
| 16 | {{/info}} | ||
| 17 | )))You can verify some basic settings of your XWiki installation (on Tomcat, MySQL) using the [[Check Config and Indexes application>>extensions:Extension.Check Config And Indexes Application]]. | ||
| 18 | |||
| 19 | There are various things you can configure: | ||
| 20 | |||
| 21 | = Enable superadmin account = | ||
| 22 | |||
| 23 | Edit the ##xwiki.cfg## file and enable the ##xwiki.superadminpassword## property. For example: | ||
| 24 | |||
| 25 | {{code language="none"}} | ||
| 26 | # Enable to allow superadmin. It is disabled by default as this could be a security breach if | ||
| 27 | # it were set and you forgot about it. | ||
| 28 | xwiki.superadminpassword=system | ||
| 29 | {{/code}} | ||
| 30 | |||
| 31 | When logging in, the username will be "superadmin" and the password will be the one you set in the ##xwiki.superadminpassword## property. | ||
| 32 | |||
| 33 | = Language settings = | ||
| 34 | |||
| 35 | To define the default language for your wiki, go to the administration page, click on "Localization", locate the "Default Language" field and select the language you wish to use. | ||
| 36 | |||
| 37 | In addition, you can configure your wiki to be multilingual. See the [[I18 user page>>Documentation.UserGuide.Features.I18N]] for more information. | ||
| 38 | |||
| 39 | Last, you can force your wiki to display only in one of the languages specified in the settings by editing your ##WEB-INF/xwiki.cfg## file. Search for the "Internationalization" section, and you should see two commented settings that you can uncomment to fix their value (1 means true, 0 - false). | ||
| 40 | |||
| 41 | {{code language="none"}} | ||
| 42 | #-# By default, XWiki chooses the language specified by the client (browser) in the Accept-Language HTTP header. This | ||
| 43 | #-# allows to use the default language of the wiki when the user didn't manually choose a language. | ||
| 44 | # xwiki.language.preferDefault=0 | ||
| 45 | |||
| 46 | #-# Force only one of the supported languages to be accepted. Default is true. | ||
| 47 | # xwiki.language.forceSupported=1 | ||
| 48 | {{/code}} | ||
| 49 | |||
| 50 | Since {{version since="11.2RC"}} the option ##xwiki.language.forceSupported## is by default set to true. The option was by default set to false on prior versions.{{/version}} | ||
| 51 | |||
| 52 | == Algorithm == | ||
| 53 | |||
| 54 | The algorithm to find the locale to use is the following, in this order: | ||
| 55 | |||
| 56 | * If the wiki is not multilingual use the wiki default locale (##default_language## xproperty in ##XWikiPreferences## xobject or English if not found). | ||
| 57 | * If the wiki is multilingual | ||
| 58 | ** Try to get the locale passed in the request (looking for a ##language## query string parameter). | ||
| 59 | ** If the language value is ##default## use the wiki default locale. If a parameter is found, it sets a ##language## cookie to remember the language in use. | ||
| 60 | ** Try to get the locale from the ##language## cookie | ||
| 61 | ** If the default language is preferred (##xwiki.language.preferDefault## from ##xwiki.cfg## or ##preferDefaultLanguage## property from the space preferences (##WebPreferences## xobject) or wiki preferences (##XWikiPreferences## xobject})), and since the user didn't explicitly ask for a language already, then use the wiki default locale. | ||
| 62 | ** Try to use the browser's ##Accept-Language## header sent in HTTP request. | ||
| 63 | ** Fallback to the wiki default locale | ||
| 64 | |||
| 65 | In addition, the ##xwiki.language.forceSupported## configuration property (editable in ##xwiki.cfg##) is enabled by default. It means that if at any step above the locale found is not in the list of supported locales, then the locale is not set and the algorithm moves to the next step. | ||
| 66 | |||
| 67 | = Date format = | ||
| 68 | |||
| 69 | To define the date format used in the interfaces, go to //Wiki -> Administer Wiki -> Localization//, locate the "Date format" field and enter the date format you wish to use. Examples: | ||
| 70 | |||
| 71 | |=Format|=Result | ||
| 72 | |MMMM dd, HH:mm|January 27, 12:27 | ||
| 73 | |yyyy/MM/dd, HH:mm|2009/01/27, 12:27 | ||
| 74 | |dd/MM/yyyy, HH:mm|27/01/2009, 12:27 | ||
| 75 | |||
| 76 | [[More information about date formatting>>https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/text/SimpleDateFormat.html]]. | ||
| 77 | |||
| 78 | = Enabling/Disabling Statistics = | ||
| 79 | |||
| 80 | To disable [[the Statistics feature>>extensions:Extension.Statistics Application]], edit your ##xwiki.cfg## file and replace the following properties as shown here (to enable statistics, change ##0## to ##1##): | ||
| 81 | |||
| 82 | {{code}} | ||
| 83 | xwiki.stats=0 | ||
| 84 | xwiki.stats.default=0 | ||
| 85 | {{/code}} | ||
| 86 | |||
| 87 | where: | ||
| 88 | |||
| 89 | * ##xwiki.stats## controls whether statistics are on or off | ||
| 90 | * ##xwiki.stats.default## controls whether statistics are on or off by default for the current Wiki. This is useful in [[multi wiki mode>>Documentation.AdminGuide.Virtualization.WebHome]]. A wiki can decide whether statistics are on or off by setting the "statistics" field in ##XWiki.XWikiPreferences##. If no such field is defined, then the default value ##xwiki.stats.default## is used.((( | ||
| 91 | {{info}} | ||
| 92 | There's no UI to set the statistics on or off for a given subwiki. Thus at the moment you'll need to do 2 things: | ||
| 93 | * Edit ##XWiki.XWikiPreferences## to add a new boolean property to the class, by going to //{{{http://localhost:8080/xwiki/bin/edit/XWiki/XWikiPreferences?editor=class}}}// | ||
| 94 | * Set the ##statistics## property to true by going to //{{{http://localhost:8080/xwiki/bin/edit/XWiki/XWikiPreferences?editor=object}}}// and setting the ##statistics## property to ##true## | ||
| 95 | {{/info}} | ||
| 96 | ))) | ||
| 97 | |||
| 98 | = Optional Store Features = | ||
| 99 | |||
| 100 | == Document versioning == | ||
| 101 | |||
| 102 | One of the key features of a wiki engine is the ability to keep all the history of a document, allowing users to see the evolution of a document and revert changes. However, the history of an active wiki continuously grows and is usually much larger than the data version. It is possible to disable the versioning feature in XWiki, meaning less storage space will be used, although it will not be possible to revert the document in case of vandalism. | ||
| 103 | |||
| 104 | To disable versioning, edit ##xwiki.cfg## and add {{code}}xwiki.store.versioning=0{{/code}}. | ||
| 105 | |||
| 106 | [[Attachment versioning>>Documentation.AdminGuide.Attachments#HVersions]] is also available and turned on by default. | ||
| 107 | |||
| 108 | == Document recycle bin == | ||
| 109 | |||
| 110 | By default, deleted documents are not permanently removed, but are placed in a recycle bin, from which they can later be removed or restored. To disable it, edit ##xwiki.cfg## and add {{code}}xwiki.recyclebin=0{{/code}}. | ||
| 111 | |||
| 112 | {{info}} | ||
| 113 | Disabling the recycle bin will make it impossible to restore a deleted document, unless a database backup is available. | ||
| 114 | {{/info}} | ||
| 115 | |||
| 116 | == Attachment recycle bin == | ||
| 117 | |||
| 118 | See the [[Attachment recycle bin>>Documentation.AdminGuide.Attachments#HDeletion]]. | ||
| 119 | |||
| 120 | = Customizing error pages = | ||
| 121 | |||
| 122 | When an error occurs, the screen displayed to the user can be easily customized without modifying the skin in the following cases: when the wiki, document or attachment that is currently looked for does not exist, or when a denied access occurs. You need to create the following respective pages in your wiki: | ||
| 123 | |||
| 124 | * ##XWiki.WikiDoesNotExist##, | ||
| 125 | * ##XWiki.DocumentDoesNotExist##, | ||
| 126 | * ##XWiki.AttachmentDoesNotExist##, | ||
| 127 | * ##XWiki.AccessDenied## | ||
| 128 | |||
| 129 | Creating these pages rather than editing the skin's velocity files will save you time during upgrades since you won't need to merge the possibly updated skin files with yours. | ||
| 130 | |||
| 131 | = Customizing the Skin = | ||
| 132 | |||
| 133 | See the [[Skin Guide>>Documentation.AdminGuide.Skins]]. | ||
| 134 | |||
| 135 | = Security configuration = | ||
| 136 | |||
| 137 | See the [[Security Guide>>Documentation.AdminGuide.Security]]. | ||
| 138 | |||
| 139 | = HTTPS/SSL = | ||
| 140 | |||
| 141 | By default, the protocol to use to generate external URLs (HTTPS, HTTP) is extracted from requests to XWiki, so most of the time you don't have anything to do if you properly configure your proxy, but it's possible to force a specific protocol using ##xwiki.url.protocol## property in ##xwiki.cfg##. | ||
| 142 | |||
| 143 | To set up HTTPS/SSL, you may need to configure your Servlet Container and any front-end web server or proxy in front of XWiki. For example: | ||
| 144 | |||
| 145 | * [[Tomcat>>documentation.xs.admin.installation.methods.install-xwiki-war.configure-servlet-container.configure-tomcat.WebHome]] | ||
| 146 | * [[Jetty>>documentation.xs.admin.installation.methods.install-xwiki-war.configure-servlet-container.configure-jetty.WebHome]] | ||
| 147 | |||
| 148 | = Customizing Menus = | ||
| 149 | |||
| 150 | The first thing to understand is that menus depend on the skin you're using. If you're using the 1.0 skin you're likely using the [[Panels Application>>extensions:Extension.Panels Application]] to provide the different menu panels you see on the left or right of your wikis. Check the [[Panels Application>>extensions:Extension.Panels Application]] to know more on how to configure/modify them. | ||
| 151 | |||
| 152 | = Encoding = | ||
| 153 | |||
| 154 | See the [[Encoding Guide>>Documentation.AdminGuide.Configuration.Encoding.WebHome]]. | ||
| 155 | |||
| 156 | = User Authentication = | ||
| 157 | |||
| 158 | See the [[Authentication Guide>>Documentation.AdminGuide.Authentication.WebHome]]. | ||
| 159 | |||
| 160 | == Customizing the Verified Registration Page == | ||
| 161 | |||
| 162 | The Verified Registration Page is part of the [[Administration Application>>extensions:Extension.Administration Application]]. It allows you to require users to fill in a captcha and validates user input on both the server side and the client side using Javascript. The configuration allows you to add fields and validation constraints to the fields. | ||
| 163 | |||
| 164 | To enable captcha, see the [[Captcha configuration>>Documentation.AdminGuide.Access Rights.Captcha configuration.WebHome]]. | ||
| 165 | |||
| 166 | For more information about configuring the registration page, you can visit the page on the [[Administration Application>>extensions:Extension.Administration Application]]. | ||
| 167 | |||
| 168 | = Default User Preferences = | ||
| 169 | |||
| 170 | See the [[User Module documentation>>extensions:Extension.User Module.API.WebHome#HConfiguration]]. | ||
| 171 | |||
| 172 | = Initial Groups = | ||
| 173 | |||
| 174 | You can set the default groups to which new users will automatically be added by changing the ##xwiki.users.initialGroups## parameter in your [[xwiki.cfg>>Documentation.AdminGuide.Configuration#HSamplexwiki.cfg]] file. To make sure all new users be added to the groups **XWiki.CoolPeople** and **XWiki.CommunityMembers** you will have to set the ##initialGroups## parameter like this: | ||
| 175 | |||
| 176 | ((( | ||
| 177 | {{code language="none"}} | ||
| 178 | xwiki.users.initialGroups=XWiki.CoolPeople, XWiki.CommunityMembers | ||
| 179 | {{/code}} | ||
| 180 | ))) | ||
| 181 | |||
| 182 | * Current members will not be automatically be added to these groups, only new members. | ||
| 183 | * The groups have to be created before being specified as initial groups. | ||
| 184 | |||
| 185 | = Logging = | ||
| 186 | |||
| 187 | See the [[Logging page>>Documentation.AdminGuide.Logging]]. | ||
| 188 | |||
| 189 | = Configuring Interwiki links = | ||
| 190 | |||
| 191 | [[Interwiki linking>>http://en.wikipedia.org/wiki/InterWiki]] is a short hand syntax for linking to pages on other websites. For example, you could link to http://en.wikipedia.org/wiki/InterWiki just by typing ~[~[InterWiki@WikiPedia]]. | ||
| 192 | |||
| 193 | {{info}} | ||
| 194 | Note that different lists have to be maintained to support this function in XWiki Syntax 1.0 and 2.x. | ||
| 195 | {{/info}} | ||
| 196 | |||
| 197 | {{warning}} | ||
| 198 | The link notation for Interwiki links has changed in XWiki Syntax 2.1. Links should look like this in XWiki Syntax 2.1: ~[~[interwiki:WikiPedia:InterWiki]]. | ||
| 199 | {{/warning}} | ||
| 200 | |||
| 201 | == Interwiki links (XWiki Syntax 1.0) == | ||
| 202 | |||
| 203 | Since XWiki renders wiki syntax using the [[Radeox>>http://codemonkeyism.com/forking-radeox-a-new-wiki-render-engine/]] engine, it supports Interwiki links in [[much the same way as SnipSnap>>http://snipsnap.org/space/InterWiki+HowTo]]. | ||
| 204 | |||
| 205 | To configure Interwiki links on your wiki: | ||
| 206 | |||
| 207 | * Create a file named ##[location from where you start your container]/conf/**intermap.txt**## | ||
| 208 | * Fill ##intermap.txt## with content like:((( | ||
| 209 | {{code}} | ||
| 210 | IMDB http://us.imdb.com/Title? | ||
| 211 | OpenWiki http://openwiki.com/? | ||
| 212 | SourceForge http://sourceforge.net/ | ||
| 213 | TWiki http://twiki.org/cgi-bin/view/ | ||
| 214 | Why http://clublet.com/c/c/why? | ||
| 215 | Wiki http://c2.com/cgi/wiki? | ||
| 216 | WikiPedia http://www.wikipedia.com/wiki/ | ||
| 217 | {{/code}} | ||
| 218 | )))You can of course add your own entries. | ||
| 219 | |||
| 220 | {{warning}} | ||
| 221 | Radeox's parser for ##intermap.txt## is very fragile. A blank line at the bottom of the file is enough to make it fall over. | ||
| 222 | {{/warning}} | ||
| 223 | |||
| 224 | Restart XWiki (you'll need to restart XWiki every time you change ##intermap.txt##) and try out an Interwiki link. If it does not work, check your ##xwiki.log## file. You'll see if ##conf/intermap.txt## could not be found, or if there was an error parsing it. | ||
| 225 | |||
| 226 | == Interwiki links (XWiki Syntax 2.x) == | ||
| 227 | |||
| 228 | In order to use Interwiki links in the XWiki Syntax 2.x it is necessary to configure the appropriate list in your ##xwiki.properties## file. Look for the following section: | ||
| 229 | |||
| 230 | {{code language="none"}} | ||
| 231 | #-# InterWiki definitions in the format alias=URL | ||
| 232 | #-# See http://en.wikipedia.org/wiki/Interwiki_links for a definition of an InterWiki link | ||
| 233 | # Some examples: | ||
| 234 | # rendering.interWikiDefinitions = wikipedia = http://en.wikipedia.org/wiki/ | ||
| 235 | # rendering.interWikiDefinitions = definition = http://www.yourdictionary.com/ | ||
| 236 | {{/code}} | ||
| 237 | |||
| 238 | = Link URLs = | ||
| 239 | |||
| 240 | With parameters, you can specify what type of links XWiki will make. | ||
| 241 | |||
| 242 | == Reverse proxy setup == | ||
| 243 | |||
| 244 | XWiki can and does run behind reverse proxies such as Apache mod_proxy. Usually, the only thing needed is to have the ##X-Forwarded-Host## HTTP header set to the external URL, and XWiki will write links correctly. | ||
| 245 | |||
| 246 | Some reverse proxy software does not set this header, and with XWiki 3.0M3 or newer, you can use the ##xwiki.home## parameter in single wiki instances (non farm) to achieve the same result. | ||
| 247 | |||
| 248 | * **##xwiki.home##** - parameter in ##xwiki.cfg## will be used to make all links pointing to the main wiki on the server. If your main wiki is called "xwiki" but you want your users to access it by going to //www.yoursite.tld// instead of //xwiki.yoursite.tld//, you may set the ##xwiki.home## parameter to //{{{http://www.yoursite.tld/}}}// | ||
| 249 | This parameter will also work for single wiki instances and will be the final authority if the ##X-Forwarded-Host## parameter is not set. | ||
| 250 | |||
| 251 | * **##xwiki.url.protocol##** - with the ##xwiki.url.protocol## parameter in ##xwiki.cfg## you can explicitly specify the protocol as HTTPS. This is useful if you are running XWiki behind a reverse proxy which converts HTTPS into plain HTTP so XWiki only sees HTTP. | ||
| 252 | |||
| 253 | == Short URLs == | ||
| 254 | |||
| 255 | It's possible to [[configure XWiki to use shorter URLs>>Documentation.AdminGuide.ShortURLs]]. | ||
| 256 | |||
| 257 | = Configure the names of database schemas = | ||
| 258 | |||
| 259 | Sometimes, especially in a complex environment, we need to control the names of database schemas other than the default. | ||
| 260 | |||
| 261 | * **##xwiki.db##**: name of database schema for the main wiki (including the name of the wiki in a single-wiki environment, otherwise the database name comes from the Hibernate configuration file). | ||
| 262 | * **##xwiki.db.prefix##**: useful mainly for [[sub wikis>>Documentation.AdminGuide.Virtualization.WebHome]], where we have a separate database schema for each sub wiki. This prefix is added to the database schema name after usual mapping between wiki names and schemas. Note that this is also applied to the main wiki database name. | ||
| 263 | |||
| 264 | = Controlling Page Tabs = | ||
| 265 | |||
| 266 | You can do this from the [[Administration>>extensions:Extension.Administration Application#HPresentation]]. | ||
| 267 | |||
| 268 | If you wish to turn on/off comments/annotations/attachments/history/information tabs only for a single page you just need to [[define some properties in a script in the page>>Documentation.DevGuide.Scripting#HControllingPageTabs]]. | ||
| 269 | |||
| 270 | Last, suppose you wish to turn them off based on some programmatic rule (such as display them only for Administrators). In that case, you should define the properties in the ##layoutExtraVars.vm## template file from your XWiki installation. For example: | ||
| 271 | |||
| 272 | {{code language="none"}} | ||
| 273 | #if (!$hasAdmin) | ||
| 274 | ## Hide tabs | ||
| 275 | #set($displayDocExtra = false) | ||
| 276 | ## Hide viewer shortcuts in the menu | ||
| 277 | #set ($displayShortcuts = false) | ||
| 278 | #end | ||
| 279 | {{/code}} | ||
| 280 | |||
| 281 | = Configure "Version Summary" behavior = | ||
| 282 | |||
| 283 | When editing a page, you can add a brief description of your changes in the "Version Summary" field by default (look at [[Common edit actions>>xwiki:documentation.xs.user.base.page.edit-page.common-edit-actions.WebHome]]). You can disable this feature by setting ##xwiki.editcomment=0## in ##xwiki.cfg##. | ||
| 284 | |||
| 285 | When the "Version Summary" feature is enabled, you can also make "Version Summary" mandatory by setting ##xwiki.editcomment.mandatory=1## in ##xwiki.cfg##. This will show a pop-up window with the request to write a short comment if no comment is entered. It doesn't allow you to enter an empty comment. If you want a popup, but you also want to be able to enter an empty comment, set ##xwiki.editcomment.suggested=1## in ##xwiki.cfg##. | ||
| 286 | |||
| 287 | If you set "Version Summary" as mandatory or suggested, you can remove the "Version Summary" field and use only a pop-up window to write a comment. Set ##xwiki.editcomment.hidden=0## in ##xwiki.cfg## to do this. | ||
| 288 | |||
| 289 | You can use the special fields in the ##XWikiPreferences## object instead of editing ##xwiki.cfg##. These fields are: ##editcomment##, ##editcomment_mandatory##. | ||
| 290 | |||
| 291 | = Configuring Directories = | ||
| 292 | |||
| 293 | {{warning}} | ||
| 294 | WIP: content is being refactored at: [[XWiki Directories>>documentation.xs.admin.configuration.directories.WebHome]]. | ||
| 295 | {{/warning}} | ||
| 296 | |||
| 297 | See [[XWiki Directories>>documentation.xs.admin.configuration.directories.WebHome]]. | ||
| 298 | |||
| 299 | == Permanent Directory == | ||
| 300 | |||
| 301 | See [[Permanent Directory>>documentation.xs.admin.configuration.directories.permanent-directory.WebHome]]. | ||
| 302 | |||
| 303 | See [[Configure the Permanent Directory>>documentation.xs.admin.configuration.directories.permanent-directory.configure.WebHome]]. | ||
| 304 | |||
| 305 | See [[Find the Permanent Directory>>documentation.xs.admin.configuration.directories.permanent-directory.find-permanent-directory.WebHome]]. | ||
| 306 | |||
| 307 | See [[Sub-Directories in the Permanent Directory>>documentation.xs.admin.configuration.directories.permanent-directory.sub-directories.WebHome]]. | ||
| 308 | |||
| 309 | == Temporary Directory == | ||
| 310 | |||
| 311 | See [[Temporary Directory>>documentation.xs.admin.configuration.directories.temporary-directory.WebHome]]. | ||
| 312 | |||
| 313 | {{version since="17.10.0RC1"}} | ||
| 314 | = Configuring the Blob Store = | ||
| 315 | |||
| 316 | See the documentation about the [[configuration of the blob store>>documentation.xs.admin.store.blob.WebHome]] and [[how to configure the S3 blob store>>documentation.extensions.admin.s3-blob-store.configure-s3.WebHome]]. | ||
| 317 | {{/version}} | ||
| 318 | |||
| 319 | = Redirections = | ||
| 320 | |||
| 321 | XWiki supports defining redirections for incoming requests. To activate this feature, modify your ##xwiki.cfg## file and set the following property: {{code}}xwiki.preferences.redirect=1{{/code}}. | ||
| 322 | Then, for each redirection you want to add, add a ##XWiki.GlobalRedirect## object to your main wiki's ##XWiki.XWikiPreferences## document. The ##XWiki.GlobalRedirect## object has 2 fields: ##pattern## and ##destination##. The URL received is matched on ##pattern##, and if there's a match, it's replaced with the value from the ##destination##. XWiki then redirects to the new URL. | ||
| 323 | |||
| 324 | == Trusted domains == | ||
| 325 | |||
| 326 | By default, redirections are only allowed to the trusted domains of the wiki. Those trusted domains are coming from two sources: | ||
| 327 | - all domains used to access the wiki are trusted by definition, as well as the aliases used for subwikis, | ||
| 328 | - in ##xwiki.properties##, it's possible to specify the property ##url.trustedDomains## to specify other domains that should be trusted. | ||
| 329 | |||
| 330 | In case a redirection is attempted on a domain not trusted, a warning is displayed in logs, and the redirection is prevented. | ||
| 331 | Note that this whole mechanism can be switched off by setting ##url.trustedDomainsEnabled## to ##false## in ##xwiki.properties##. | ||
| 332 | |||
| 333 | {{version since="17.9.0RC1,16.10.13,17.4.6"}} | ||
| 334 | A new mechanisms ensure that users get asked before being driven to an untrusted domain when clicking on a link in the wiki. That mechanism reuses the configured list of trusted domain, but also a new configuration to allow specific URLs without allowing an entire domain: ##url.allowedFrontendUrls##. | ||
| 335 | |||
| 336 | It's possible to also disable this mechanism by using ##url.frontendUrlCheckEnabled=false## in ##xwiki.properties##. | ||
| 337 | {{/version}} | ||
| 338 | |||
| 339 | = Customizing the PDF export Look & Feel = | ||
| 340 | |||
| 341 | {{info}} | ||
| 342 | The default PDF export now uses the [[client-side PDF Export Application>>extensions:Extension.PDF Export Application.WebHome]]. The documentation below is for the older server-side PDF export (implemented with Apache FOP) | ||
| 343 | {{/info}} | ||
| 344 | |||
| 345 | == General Architecture == | ||
| 346 | |||
| 347 | Here's how the PDF and RTF exports currently work: | ||
| 348 | {{image reference="XWikiExport201010290119.png"/}} | ||
| 349 | |||
| 350 | As shown in the diagram, you can customize 4 parts: | ||
| 351 | |||
| 352 | * The templates, ##pdf.vm## and the referenced subparts, ##pdfhtmlheader.vm##, ##pdfheader.vm##, ##pdffooter.vm##, ##pdftoc.vm##, ##pdfcover.vm##, which can be overridden by a copy located in a custom skin | ||
| 353 | * The CSS is used to render the content as PDF/RTF. There is no ##pdf.css## by default. It could be created in ##/templates## or a skin; a copy in a skin, and override the one located in ##/templates## | ||
| 354 | * The XHTML2FO XSL transformation. The default one, ##{{scm project="xwiki-platform" path="xwiki-platform-core/xwiki-platform-oldcore/src/main/resources/xhtml2fo.xsl"}}xhtml2fo.xsl{{/scm}}##, is packed in a core jar, but could be overridden by a new one in a template or an ##xhtml2fo.xsl## file in ##WEB-INF/classes## directory, if customization needed. | ||
| 355 | * The FOP XSL transformation. The default ##fop.xsl## is also packed in a core jar. | ||
| 356 | |||
| 357 | After the export request triggers XWiki ExportAction, the content of your document is parsed by Velocity to get the initial XHTML content. **[[JTidy>>http://jtidy.sourceforge.net/]]**, a HTML/XHTML syntax checker and pretty printer, will clean the initial XHTML to make it XHTML compliant. No customization is possible in this step. | ||
| 358 | |||
| 359 | In order to provide your customization you need to start by tweaking the default templates (they can also be copied to a new skin) and/or by creating a new [[XWiki Class>>xwiki:documentation.xs.user.base.page.edit-page.edit-class-editor.WebHome]]. To do that, simply create a new page called //XWiki.PDFClass// and edit it in class mode (for ex. //{{{http://yourserver.com/xwiki/bin/edit/XWiki/PDFClass?editor=class}}}//). Add the following "Text Area" properties as needed (they are all optional, so you only need to define the ones you need to use): | ||
| 360 | |||
| 361 | * ##style##: contains the CSS information that will overwrite or complement the default ##pdf.css## values if they exist. **[[css4j>>https://css4j.github.io/]]**, a CSS API implementation for the Javaâ„¢ platform, will handle this. | ||
| 362 | * ##xhtmlxsl##: contains the XHTML to FO XSL overriding the default one. It is processed by **[[Apache Xalan>>http://xml.apache.org/xalan-j/]]**, a XSLT processor for transforming XML documents into HTML, text, or other XML document types. This field needs to be the actual content of the customized ##xhtml2fo.xsl##. Note that you can also use velocity in this field (useful to get the content of an attached .xsl file, which comes in very handy when you need to fill in a big file, since the limit of textarea properties is 60 000 characters) | ||
| 363 | * ##fopxsl##: contains the FOP to PDF/RTF XSL overriding the default one. It is processed by **[[Apache FOP>>http://xmlgraphics.apache.org/fop/]]**. | ||
| 364 | |||
| 365 | {{warning}} | ||
| 366 | The name of the class must be ##XWiki.PDFClass##. | ||
| 367 | {{/warning}} | ||
| 368 | |||
| 369 | The good thing about fop/xsl-fo is that the xsl-fo document is independent of the final result. So we can export the wiki documents into many formats. | ||
| 370 | |||
| 371 | Then create a new page (say ##XWiki.PDFTemplate##) and add the ##XWiki.PDFClass## object to it. | ||
| 372 | |||
| 373 | Last use that page when calling the PDF/RTF export using the ##pdftemplate## parameter as in //{{{http://yourserver/xwiki/bin/export/Space/Page?format=pdf&language=en&pdftemplate=XWiki.PDFTemplate}}}//. | ||
| 374 | |||
| 375 | {{warning}} | ||
| 376 | No template is used by default. | ||
| 377 | {{/warning}} | ||
| 378 | |||
| 379 | {{info}} | ||
| 380 | As mentioned, the ##style## property stores CSS code. The field is parsed by the Velocity engine, so you can use the [[current color theme>>extensions:Extension.Color Theme Application#HUsingColorThemesvariables]] to style your PDF. Also, you can insert a page break in a PDF file with the ##page-break-before## CSS instruction. For example: | ||
| 381 | |||
| 382 | {{code language="css"}} | ||
| 383 | #template('colorThemeInit.vm') | ||
| 384 | h2 { | ||
| 385 | color: $theme.titleColor; | ||
| 386 | } | ||
| 387 | |||
| 388 | td { | ||
| 389 | border-color: $theme.borderColor; | ||
| 390 | } | ||
| 391 | |||
| 392 | h1, .my_Page_break { | ||
| 393 | page-break-before:always; | ||
| 394 | } | ||
| 395 | |||
| 396 | {{/code}} | ||
| 397 | {{/info}} | ||
| 398 | |||
| 399 | == Override the PDF Templates == | ||
| 400 | |||
| 401 | === Customize the PDF Footer === | ||
| 402 | |||
| 403 | By default, the PDF footer will display the page number, the last author and the date the last modification was performed. In order to also display a customized message, the template ##pdffooter.vm## must be overridden. To do that, edit the skin class (e.g. //{{{http://yourserver/xwiki/bin/edit/XWiki/XWikiSkins?editor=class}}}//) and add a "TextArea" object named ##pdffooter.vm##: | ||
| 404 | |||
| 405 | {{image reference="OverridePDFFooter.png"/}} | ||
| 406 | |||
| 407 | After adding the ##pdffooter.vm##, you might want to edit it (clicking on it opens a detailed editor) and e.g. give it a "Pretty name". In this editor, also set the "Editor" property to "pure text" as otherwise the WYSIWYG-Editor will be used: | ||
| 408 | |||
| 409 | {{image reference="OverridePDFFooterEdit1.png"/}} | ||
| 410 | |||
| 411 | Next, edit the skin page (e.g. //{{{http://yourserver/xwiki/bin/edit/XWiki/DefaultSkin?editor=object}}}//) and add the following code to the ##pdffooter.vm## property: | ||
| 412 | |||
| 413 | {{code}} | ||
| 414 | $msg.Page <span class="page-number"></span> - $msg.get('lastmodifiedby') | ||
| 415 | $xwiki.getUserName($tdoc.author, false) | ||
| 416 | $msg.get('lastmodifiedon') | ||
| 417 | $!xwiki.formatDate($tdoc.date) | ||
| 418 | <div> | ||
| 419 | <p>CustomName SAS. All rights reserved. Confidential and proprietary document. Printed Copies are not controlled.</p> | ||
| 420 | </div> | ||
| 421 | {{/code}} | ||
| 422 | |||
| 423 | To see the changes, just export any wiki page: | ||
| 424 | |||
| 425 | {{image reference="OverridePDFFooterFinal.png"/}} | ||
| 426 | |||
| 427 | === Customize the PDF Cover === | ||
| 428 | |||
| 429 | For instance, this could be useful when you want to add the company's logo to the PDF cover. In order to do this, the template ##pdfcover.vm## must be overridden. Just like for the PDF header, a "TextArea" property named ##pdfcover.vm## must be added to the ##XWiki.XWikiSkins## class (e.g. //{{{http://yourserver/xwiki/bin/view/XWiki/XWikiSkins?editor=class}}}//). | ||
| 430 | |||
| 431 | {{image reference="OverridePDFCover.png"/}} | ||
| 432 | |||
| 433 | Next, edit the skin page (e.g. //{{{http://yourserver/xwiki/bin/edit/XWiki/DefaultSkin?editor=object}}}//) and add the following code to the ##pdfcover.vm## property: | ||
| 434 | |||
| 435 | {{code}} | ||
| 436 | <img src="$xwiki.getSkinFile("logo.png")"/> | ||
| 437 | |||
| 438 | <div style="text-align: center; width: 100%;"> | ||
| 439 | <h1> | ||
| 440 | #set($title = "$!pdfdoc.display('title', 'rendered')") | ||
| 441 | #if($title == '') | ||
| 442 | $escapetool.xml($!doc.displayTitle) | ||
| 443 | #else | ||
| 444 | $escapetool.xml($title) | ||
| 445 | #end | ||
| 446 | </h1> | ||
| 447 | <br /> | ||
| 448 | <br /> | ||
| 449 | $!xwiki.getUserName($tdoc.author, false) | ||
| 450 | <br /> | ||
| 451 | $!xwiki.formatDate($tdoc.date) | ||
| 452 | </div> | ||
| 453 | {{/code}} | ||
| 454 | |||
| 455 | The last step consists of attaching the image "logo.png" to the skin: | ||
| 456 | |||
| 457 | {{image reference="OverridePDFCoverFinal.png"/}} | ||
| 458 | |||
| 459 | === Override the CSS rules === | ||
| 460 | |||
| 461 | In order to use your template when exporting a page as PDF, you need to create a class in the XWiki space and name it PDFClass. Next, edit the page in "Class" mode (e.g. //{{{http://yourserver/xwiki/bin/edit/XWiki/PDFClass?editor=class}}}//) and add the following ##TextArea## properties: | ||
| 462 | |||
| 463 | * ##style##: contains the CSS rules that will override the default ##pdf.css## values; by default, there won't be a ##pdf.css## file on your filesystem, but you can create it in the folder ##\webapps\xwiki\templates\## or specify it in your skin page | ||
| 464 | * ##xhtmlxsl##: contains the XHTML2FO XSL transformation that will override the default one | ||
| 465 | * ##fopxsl##: contains the FOP XSL transformation that will override the default one | ||
| 466 | |||
| 467 | For each property added, make sure to set the ##Content## property metadata to ##PureText## in order not to get the WYSIWYG editor, which would make it complex to enter XML/XSL. | ||
| 468 | |||
| 469 | {{image reference="CreatePDFClass.png"/}} | ||
| 470 | |||
| 471 | Then, create the wiki page for which you want to customize the PDF export (e.g. ##XWiki.PDFTemplate##) and add a ##XWiki.PDFClass## object. | ||
| 472 | |||
| 473 | Supposing your wiki page ##Sandbox.TestPage1## contains a table, you have to edit it in "Wiki" mode and add a style parameter as shown below: | ||
| 474 | |||
| 475 | {{code}} | ||
| 476 | (% class="mytable" %) | ||
| 477 | |=Column 1|=Column 2 | ||
| 478 | | data|data | ||
| 479 | {{/code}} | ||
| 480 | |||
| 481 | Next, edit the template page (e.g. ##XWiki.PDFTemplate##) in "Objects" mode and write your own CSS rules in the ##style## property: | ||
| 482 | |||
| 483 | {{image reference="CreatePDFTemplate.png"/}} | ||
| 484 | |||
| 485 | Because no template is used by default, you need to specify the ##pdftemplate## parameter in the URL to use your template: //{{{http://yourserver/xwiki/bin/export/Sandbox/TestPage1/?format=pdf&pdftemplate=XWiki.PDFTemplate}}}//. | ||
| 486 | |||
| 487 | {{image reference="SandboxTestPage1PDF.png" width="700"/}} | ||
| 488 | |||
| 489 | **Tip**: download the [[PDF class>>attach:XWiki.PDFClass.xar]] and [[PDF template >>attach:XWiki.PDFTemplate.xar]]for this example and test them on your wiki. | ||
| 490 | |||
| 491 | {{info}} | ||
| 492 | Even though RTF export is expected to work the same way, there are still some issues to be solved affecting how CSS properties control the final layout. | ||
| 493 | {{/info}} | ||
| 494 | |||
| 495 | {{warning}} | ||
| 496 | If some CSS styling doesn't work on PDF export, you could check if CSS instruction is supported by XSL-FO on [[Apacheâ„¢ FOP Compliance Page>>https://xmlgraphics.apache.org/fop/compliance.html]]. | ||
| 497 | Furthermore, you can not use multiple attributes to select a CSS element (see issue: [[XWIKI-14653>>https://jira.xwiki.org/browse/XWIKI-14653]]). | ||
| 498 | {{/warning}} | ||
| 499 | |||
| 500 | === Override the xhtml2fo.xsl rules === | ||
| 501 | |||
| 502 | As explained above, the entire code of {{scm project="xwiki-platform" path="xwiki-platform-core/xwiki-platform-oldcore/src/main/resources/xhtml2fo.xsl"}}xhtml2fo.xsl{{/scm}} needs to be copied into the xhtmlxsl textarea and then customized. | ||
| 503 | |||
| 504 | For example, to disable the generation of clickable URLs in the PDF, modify the following section: | ||
| 505 | |||
| 506 | {{code}} | ||
| 507 | <xsl:template match="html:a[@href]" mode="transform"> | ||
| 508 | <fo:basic-link xsl:use-attribute-sets="a-link"> | ||
| 509 | <xsl:call-template name="process-a-link"></xsl:call-template> | ||
| 510 | </fo:basic-link> | ||
| 511 | </xsl:template> | ||
| 512 | {{/code}} | ||
| 513 | |||
| 514 | as | ||
| 515 | |||
| 516 | {{code}} | ||
| 517 | <xsl:template match="html:a[@href]" mode="transform"> | ||
| 518 | <fo:inline> | ||
| 519 | <xsl:call-template name="process-a-link"></xsl:call-template> | ||
| 520 | </fo:inline> | ||
| 521 | </xsl:template> | ||
| 522 | {{/code}} | ||
| 523 | |||
| 524 | or disable the generation of clickable URLs for some specific href links in the PDF | ||
| 525 | |||
| 526 | {{code}} | ||
| 527 | <xsl:template match="html:a[@href]" mode="transform"> | ||
| 528 | <xsl:choose> | ||
| 529 | <!-- disable these internal links ("data-parent" attribute start with "#accordion" or href is "#my_anchor") --> | ||
| 530 | <xsl:when test="starts-with(@data-parent,'#accordion') or @href = '#my_anchor'"> | ||
| 531 | <fo:inline> | ||
| 532 | <xsl:call-template name="process-a-link"></xsl:call-template> | ||
| 533 | </fo:inline> | ||
| 534 | </xsl:when> | ||
| 535 | <xsl:otherwise> | ||
| 536 | <fo:basic-link xsl:use-attribute-sets="a-link"> | ||
| 537 | <xsl:call-template name="process-a-link"></xsl:call-template> | ||
| 538 | </fo:basic-link> | ||
| 539 | </xsl:otherwise> | ||
| 540 | </xsl:choose> | ||
| 541 | </xsl:template> | ||
| 542 | {{/code}} | ||
| 543 | |||
| 544 | === Debugging PDF export === | ||
| 545 | |||
| 546 | To inspect the contents of the created XHTML file (and be able to style it) - turn on logging //{{{http://yourserver/xwiki/bin/view/AdminGuide/Logging}}}// and set ##com.xpn.xwiki## level to ##DEBUG##. After PDF export action, xwiki log file contains intermediates states XHTML code after these lines: | ||
| 547 | |||
| 548 | {{code language="none"}} | ||
| 549 | DEBUG c.x.x.p.i.PdfExportImpl - Cleaning HTML: //(show XHTML code without style)// | ||
| 550 | DEBUG c.x.x.p.i.PdfExportImpl - Cleaned XHTML: | ||
| 551 | DEBUG c.x.x.p.i.PdfExportImpl - Applying the following CSS: //(show CSS properties)// | ||
| 552 | DEBUG c.x.x.p.i.PdfExportImpl - HTML with CSS applied: //(show HTML code with CSS properties merged in tag with "style=" )// | ||
| 553 | DEBUG c.x.x.p.i.PdfExportImpl - Final XHTML for export: | ||
| 554 | DEBUG c.x.x.p.i.PdfExportImpl - Intermediary XSL-FO: //(show document with eXtensible Stylesheet Language - Formatting Objects used to generate PDF files)// | ||
| 555 | DEBUG c.x.x.p.i.PdfExportImpl - Final XSL-FO source: | ||
| 556 | and finally DEBUG c.x.x.p.i.PdfExportImpl - PageSequence x-page-sequence generated 3 pages. | ||
| 557 | {{/code}} | ||
| 558 | |||
| 559 | = Configuring Wiki Syntaxes and default Syntax = | ||
| 560 | |||
| 561 | To configure the [[Wiki syntaxes>>Documentation.UserGuide.Features.XWikiSyntax]] available to the user when writing wiki pages, check the [[Rendering Administration Application>>extensions:Extension.Rendering Administration Application]]. | ||
| 562 | |||
| 563 | = Title behavior = | ||
| 564 | |||
| 565 | The following configuration parameters (found in ##xwiki.cfg##) can be used to control title behavior: | ||
| 566 | |||
| 567 | {{code language="none"}} | ||
| 568 | #-# Defines whether title handling should be using the compatibility mode or not. When the compatibility | ||
| 569 | #-# mode is active, XWiki will try to extract a title from the document content. | ||
| 570 | #-# If the document's content first header (level 1 or level 2) matches the document's title | ||
| 571 | #-# the first header is stripped. | ||
| 572 | #-# The default value is 0. | ||
| 573 | # xwiki.title.compatibility=1 | ||
| 574 | |||
| 575 | #-# Defines the maximum header depth to look for when computing a document's title from its content. If no header | ||
| 576 | #-# equal or lower to the specified depth is found then the computed title falls back to the document name. | ||
| 577 | #-# The default value is 2. | ||
| 578 | # xwiki.title.headerdepth=2 | ||
| 579 | |||
| 580 | #-# Defines if setting the title field must be mandatory in the WYSIWYG and Wiki editors. It is mandatory when this | ||
| 581 | #-# property is set to 1. The default value is 0 (not mandatory). | ||
| 582 | # xwiki.title.mandatory=0 | ||
| 583 | {{/code}} | ||
| 584 | |||
| 585 | = Link Label Generation = | ||
| 586 | |||
| 587 | Starting with XWiki Syntax 2.0 it's possible to configure how labels are generated by the system when the user doesn't provide one (e.g. ##~[~[mywiki:Main.WebHome]]##). | ||
| 588 | |||
| 589 | Here's an extract from the ##xwiki.properties## file, which is where this feature is configurable: | ||
| 590 | |||
| 591 | {{code language="none"}} | ||
| 592 | #-# Specifies how links labels are displayed when the user doesn't specify the label explicitly. | ||
| 593 | #-# Valid values: | ||
| 594 | #-# %w: wiki name | ||
| 595 | #-# %s: full space name (e.g. space1.space2) | ||
| 596 | #-# Note: Prior to 7.4.2/8.0M2 this was only displaying the last space name | ||
| 597 | #-# %ls: last space name. New in 7.4.2/8.0M2 | ||
| 598 | #-# %p: page name | ||
| 599 | #-# %np: nested page name (i.e. will display the space name for Nested Pages). New in 7.4.2/8.0M2 | ||
| 600 | #-# %P: page name with spaces between camel case words, i.e. "My Page" if the page name is "MyPage" | ||
| 601 | #-# %NP: nested page name with spaces between camel case words, i.e. "My Page" if the page name is "MyPage". | ||
| 602 | #-# New in 7.4.2/8.0M2 | ||
| 603 | #-# %t: page title | ||
| 604 | #-# | ||
| 605 | #-# Note that if the page title is empty or not defined then it defaults to %np. This is also the case | ||
| 606 | #-# if the title cannot be retrieved for the document. | ||
| 607 | #-# | ||
| 608 | #-# The default is "%np". Some examples: "%s.%p", "%w:%s.%p". | ||
| 609 | # rendering.linkLabelFormat = %np | ||
| 610 | {{/code}} | ||
| 611 | |||
| 612 | = Rendering Cache = | ||
| 613 | |||
| 614 | See the [[Performance page>>Documentation.AdminGuide.Performances.WebHome#HRenderingcache]]. | ||
| 615 | |||
| 616 | = Allowed Pages for Inactive Users = | ||
| 617 | |||
| 618 | The ##xwiki.cfg## configuration file includes ##xwiki.inactiveuser.allowedpages##. This property can be used to build a whitelist of pages that can be read by inactive users. The format that should be used is a comma-separated list of pages that users marked as inactive can see. | ||
| 619 | |||
| 620 | This property is needed because in XWiki, some users can be marked inactive, for example, when enabling user email verification in the administration. An inactive user has an account, but the account needs to be validated for the user to be able to access the wiki. Access rights do not apply to inactive users (they are recognized neither as XWikiGuest nor as members of XWikiAllGroup). | ||
| 621 | |||
| 622 | {{info}} | ||
| 623 | Inactive users are always allowed to see the ##XWiki.AccountValidation## page is used to validate their account. | ||
| 624 | {{/info}} | ||
| 625 | |||
| 626 | = Rendering Transformations = | ||
| 627 | |||
| 628 | You can control which [[Transformations>>rendering:Main.Architecture]] are active (by default, the [[Macro>>rendering:Main.Architecture]] and [[Icon>>rendering:Main.Transformations#HIconTransformation]] ones are active) by editing ##xwiki.properties##: | ||
| 629 | |||
| 630 | {{code language="none"}} | ||
| 631 | #-# Controls what transformations will be executed when rendering content. | ||
| 632 | #-# A transformation modifies the parsed content. For example the Icon transformation replaces some characters with | ||
| 633 | #-# icons, a WikiWord transformation will automatically create links when it finds wiki words, etc. | ||
| 634 | #-# Note that the Macro transformation is a special transformation that replaces macro markers by the result of the | ||
| 635 | #-# macro execution. If you don't list it, macros won't get executed. | ||
| 636 | #-# The default value is: rendering.transformations = macro, icon | ||
| 637 | {{/code}} | ||
| 638 | |||
| 639 | For example, if you wish to turn off the Icon Transformation in order not to render emoticons, you'd have to define the following property: {{code language="none"}}rendering.transformations = macro{{/code}}. | ||
| 640 | |||
| 641 | = Macros categories and visibility = | ||
| 642 | |||
| 643 | You can override the default categories of a macro by editing ##xwiki.properties##. | ||
| 644 | |||
| 645 | {{code language="properties"}} | ||
| 646 | #-# Overrides default macro categories (Each macro has default categories already defined, for example | ||
| 647 | #-# "Navigation" for the Table of Contents Macro). | ||
| 648 | #-# Note: the categories are case sensitive. | ||
| 649 | #-# | ||
| 650 | #-# Ex: To redefine the macro categories for the TOC macro so that it'd be in the "My Category" and "Deprecated" | ||
| 651 | #-# categories + redefine the category for the Script Macro to be "My Other Category", you'd use: | ||
| 652 | # rendering.transformation.macro.categories = toc = My Category\,Deprecated | ||
| 653 | # rendering.transformation.macro.categories = script = My Other Category | ||
| 654 | {{/code}} | ||
| 655 | |||
| 656 | You can also configure the macro categories for which macros should be hidden by default, by editing ##xwiki.properties##: | ||
| 657 | |||
| 658 | {{code language="properties"}} | ||
| 659 | #-# Override the default hidden macro categories. | ||
| 660 | #-# Note: the categories are case sensitive. | ||
| 661 | #-# | ||
| 662 | #-# The default value is: | ||
| 663 | # rendering.transformation.macro.hiddenCategories = Internal,Deprecated | ||
| 664 | #-# | ||
| 665 | #-# For instance, to make the "Development" category hidden by default, in addition to the "Internal" and | ||
| 666 | #-# "Deprecated" categories, you'd use: | ||
| 667 | # rendering.transformation.macro.hiddenCategories = Development,Internal,Deprecated | ||
| 668 | {{/code}} | ||
| 669 | |||
| 670 | Note that these macros are still visible if your users have configured to show [[hidden pages>>xwiki:documentation.xs.user.base.page.view-page.hide-page.hidden-pages.WebHome]] by [[editing the profile preferences>>xwiki:documentation.xs.user.user.edit-profile.edit-profile-preferences.WebHome]]. | ||
| 671 | |||
| 672 | = Securing Groovy Scripts = | ||
| 673 | |||
| 674 | See: | ||
| 675 | |||
| 676 | * The [[Commons Groovy Module>>extensions:Extension.GroovyModuleCommons]] | ||
| 677 | * The [[Platform Groovy Module>>extensions:Extension.GroovyModulePlatform]] | ||
| 678 | |||
| 679 | = Lock Duration = | ||
| 680 | |||
| 681 | By default, when a user starts editing a page, a lock will be set on that page, see [[Page Editing>>Documentation.UserGuide.Features.PageEditing#HLocking]]. The lock is valid by default for 30 minutes, after which it gets invalidated. | ||
| 682 | |||
| 683 | In order to increase this duration, you have 2 options: | ||
| 684 | |||
| 685 | * Add a property named ##lock_Timeout## to your ##xwiki.cfg## configuration file, set the value in seconds (and restart XWiki). For example, for 15 minutes: ##lock_Timeout = 900##. | ||
| 686 | * Or add the configuration in the wiki itself: | ||
| 687 | ** Edit the ##XWiki.XWikiPreferences## document using the class editor | ||
| 688 | ** Add a Number property named ##lock_Timeout## (case sensitive) | ||
| 689 | ** Edit the ##XWiki.XWikiPreferences## document using the object editor | ||
| 690 | ** Find the ##lock_Timeout## property and put the desired number of *seconds* a lock should be valid for | ||
| 691 | ** Don't forget to save the document | ||
| 692 | |||
| 693 | = Editing = | ||
| 694 | |||
| 695 | == Default editor == | ||
| 696 | |||
| 697 | You can choose which default editor to use when editing wiki content (wiki or WYSIWYG editor). XWiki uses the following strategy when deciding which editor to use: | ||
| 698 | |||
| 699 | 1. If editing a [[TextArea object property>>xwiki:documentation.xs.dev.data-model.x-properties.WebHome]] and that property has explicitly specified a specific editor to be used to edit it, then that editor will be used. This is set when [[using the Class editor>>xwiki:documentation.xs.user.base.page.edit-page.edit-class-editor.WebHome]]. For example:((( | ||
| 700 | {{image reference="editor-class-property.png"/}} | ||
| 701 | ))) | ||
| 702 | 1. Then, if no property editor is defined, or if editing standard wiki content (like page content), XWiki will check if the [[current user has configured an editor for a given content type>>extensions:Extension.Edit Module#HConfiguretheDefaultEditor]]. If the current edited content is of that type, then that editor will be used. For example:((( | ||
| 703 | {{image reference="editor-content-user.png"/}} | ||
| 704 | ))) | ||
| 705 | 1. Then, if no property editor is defined, XWiki will check if the [[current (nested) page has configured an editor for a given content type>>extensions:Extension.Edit Module#HConfiguretheDefaultEditor]]. If the current edited content is of that type, then that editor will be used. For example:((( | ||
| 706 | {{image reference="editor-content-page.png"/}} | ||
| 707 | ))) | ||
| 708 | 1. Then, if no property editor is defined, XWiki will check if the [[current wiki has configured an editor for a given content type>>extensions:Extension.Edit Module#HConfiguretheDefaultEditor]]. If the current edited content is of that type, then that editor will be used. For example:((( | ||
| 709 | {{image reference="editor-content-wiki.png"/}} | ||
| 710 | ))) | ||
| 711 | 1. Then, if no property editor is defined, XWiki will check if there's a [[configuration in ##xwiki.properties## for a given content type>>extensions:Extension.Edit Module#HConfiguretheDefaultEditor]] and if the current edited content is of that type, then that editor will be used. For example:((( | ||
| 712 | {{code language="properties"}} | ||
| 713 | edit.defaultEditor.org.xwiki.rendering.syntax.SyntaxContent=text | ||
| 714 | {{/code}} | ||
| 715 | ))) | ||
| 716 | 1. Then, if no editor has been defined, XWiki will check if the current [[user has defined a preferred editor to use>>extensions:Extension.User Module.User Profile Application.WebHome#HEditPreferences]]. For example:((( | ||
| 717 | {{image reference="editor-user.png"/}} | ||
| 718 | ))) | ||
| 719 | 1. Then, if no preferred editor to use has been defined for the current user, XWiki will check the default editor set up in the Page Administration (XWiki.XWikiPreferences of the page) . Could be set because of [[XWIKI-17324>>https://jira.xwiki.org/browse/XWIKI-17324]]. For example:((( | ||
| 720 | {{image reference="editor-space-preference-object.png"/}} | ||
| 721 | ))) | ||
| 722 | 1. Then, if no editor has been defined, XWiki will check the [[default editor set up in the Administration UI>>extensions:Extension.Administration Application#HEditing]]. For example:((( | ||
| 723 | {{image reference="editor-admin.png"/}} | ||
| 724 | ))) | ||
| 725 | |||
| 726 | == Default WYSIWYG editor == | ||
| 727 | |||
| 728 | You can configure the [[default WYSIWYG editor to use>>extensions:Extension.CKEditor Integration.WebHome#HAdministrationSection]]. | ||
| 729 | |||
| 730 | See the [[WYSIWYG Editor Configuration>>extensions:Extension.CKEditor Integration.WebHome#HConfiguretheEditor]] page to find out how to enable or disable editing features. | ||
| 731 | |||
| 732 | == Section Editing == | ||
| 733 | |||
| 734 | By default, section editing is limited to level 1 and level 2 sections. This can be controlled by editing ##xwiki.cfg##: | ||
| 735 | |||
| 736 | {{code}} | ||
| 737 | #-# This parameter controls the depth of sections that have section editing. | ||
| 738 | #-# By default level 1 and level 2 sections have section editing. | ||
| 739 | xwiki.section.depth=2 | ||
| 740 | {{/code}} | ||
| 741 | |||
| 742 | You can also enable/disable section editing with: | ||
| 743 | |||
| 744 | {{code}} | ||
| 745 | #-# This parameter will activate the sectional editing. | ||
| 746 | xwiki.section.edit=1 | ||
| 747 | {{/code}} | ||
| 748 | |||
| 749 | == Editing Conflicts == | ||
| 750 | |||
| 751 | The [[Edit Conflict feature>>Documentation.UserGuide.Features.PageEditing#HEditconflict]] can be disabled since {{version since="11.3.1, 11.4RC1"}} from the ##xwiki.properties## file by setting ##edit.conflictChecking.enabled = false##: | ||
| 752 | |||
| 753 | {{code language="none"}} | ||
| 754 | #-# Indicate if the mechanism to detect and handle edition conflicts should be enabled or not. | ||
| 755 | #-# If disabled, it means that in case of edition conflicts, the latest save will be always take into account, and | ||
| 756 | #-# erase previous data (which can always be recovered in the history of the document). | ||
| 757 | #-# This option is provided because the feature is still experimental and it could be useful is some specific usecases | ||
| 758 | #-# to switch it off. However it is not recommended to do so. | ||
| 759 | #-# | ||
| 760 | #-# The default is: | ||
| 761 | # edit.conflictChecking.enabled = true | ||
| 762 | {{/code}} | ||
| 763 | |||
| 764 | == In-place Editing == | ||
| 765 | |||
| 766 | To disable the in-place WYSIWYG editing mode (and thus default to the Standalone WYSIWYG editing mode), modify the ##xwiki.properties## file and set ##edit.document.inPlaceEditing.enabled = false##: | ||
| 767 | |||
| 768 | {{code language="none"}} | ||
| 769 | #-# Indicate if the XWiki documents should be edited in-place, without leaving the view mode, whenever possible (e.g. if | ||
| 770 | #-# the default edit mode for that document and the preferred editor both support in-place editing). When enabled, | ||
| 771 | #-# clicking on the document Edit button makes the document title and content editable in-place, without leaving the | ||
| 772 | #-# view mode. When disabled, clicking on the document Edit button loads the default (stand-alone) edit mode for that | ||
| 773 | #-# document. | ||
| 774 | #-# | ||
| 775 | #-# The default is: | ||
| 776 | # edit.document.inPlaceEditing.enabled = true | ||
| 777 | {{/code}} | ||
| 778 | |||
| 779 | = Delete Pages = | ||
| 780 | |||
| 781 | This section is hidden when the [[recycle bin is not activated>>#HDocumentrecyclebin]]. | ||
| 782 | |||
| 783 | == Enabling Advanced users to skip the recycle bin == | ||
| 784 | |||
| 785 | Advanced users can choose to skip the recycle bin (and remove the pages permanently) when deleting pages. | ||
| 786 | |||
| 787 | To do so, search for the "Delete" section and set "can skip the recycle bin" to Yes. The default value is No. | ||
| 788 | |||
| 789 | {{image reference="skip_recycle_bin_admin_cropped.png"/}} | ||
| 790 | |||
| 791 | The configuration is resolved by looking in three locations, from the most specific to the least specific: | ||
| 792 | |||
| 793 | * In the configuration of the current wiki | ||
| 794 | * In the configuration of the main wiki | ||
| 795 | * In ##xwiki.properties## (see the property details below) | ||
| 796 | |||
| 797 | If the default value is found in one location, the next one is tried. If no value is found, the recycle bin skipping is not activated. | ||
| 798 | |||
| 799 | Details of the configuration on ##xwiki.properties##: | ||
| 800 | |||
| 801 | {{code language="none"}} | ||
| 802 | #-# Indicates whether skipping the recycle bin when deleting pages is allowed for Advanced users. | ||
| 803 | #-# It is disabled by default. | ||
| 804 | #-# This setting is only used if the wiki has a recycle bin activated (xwiki.recyclebin=1 in xwiki.cfg). | ||
| 805 | #-# This setting can be overloaded: | ||
| 806 | #-# * By the main wiki in the Refactoring.Code.RefactoringConfigurationClass class of the | ||
| 807 | #-# Refactoring.Code.RefactoringConfiguration document of the main wiki. | ||
| 808 | #-# * By sub-wikis in the Refactoring.Code.RefactoringConfigurationClass class of the | ||
| 809 | #-# Refactoring.Code.RefactoringConfiguration document of the sub-wikis (itself overloading the main wiki's | ||
| 810 | #-# configuration). | ||
| 811 | #-# | ||
| 812 | #-# The default value is: | ||
| 813 | # refactoring.isRecycleBinSkippingActivated = false | ||
| 814 | {{/code}} | ||
| 815 | |||
| 816 | = Readonly = | ||
| 817 | |||
| 818 | In order to configure your XWiki instance to be readonly (useful when doing an upgrade by setting up a new instance and you don't want new content to be created, for example). | ||
| 819 | |||
| 820 | To achieve this, you need to edit the ##xwiki.cfg## configuration file and set the ##xwiki.readonly## property to true and restart XWiki. | ||
| 821 | |||
| 822 | If you want to turn on the readonly mode live without a restart, you can also execute a small snippet with a user having programming rights (a restart of XWiki will remove the readonly mode in this case), while waiting for a future feature (see issue [[XWIKI-10119>>https://jira.xwiki.org/browse/XWIKI-10119]]): | ||
| 823 | |||
| 824 | {{code language="none"}} | ||
| 825 | {{groovy}} | ||
| 826 | def xwiki = xcontext.getXWiki() | ||
| 827 | xwiki.isReadOnly = true | ||
| 828 | {{/groovy}} | ||
| 829 | {{/code}} | ||
| 830 | |||
| 831 | Note that this flag doesn't prevent against any modifications in your wiki, there're still some places where it's not taken into account (see issue [[XWIKI-18437>>https://jira.xwiki.org/browse/XWIKI-18437]])). | ||
| 832 | |||
| 833 | = Sample ##xwiki.cfg## = | ||
| 834 | |||
| 835 | See {{scm path="xwiki-platform-tools/xwiki-platform-tool-configuration-resources/src/main/resources/xwiki.cfg.vm"}}xwiki.cfg.vm{{/scm}} | ||
| 836 | |||
| 837 | Note that we generate the default ##xwiki.cfg## file from this template file by applying Velocity during the build, so all ##$<something>## properties you see in this file are replaced at build time. | ||
| 838 | |||
| 839 | = Sample ##xwiki.properties## = | ||
| 840 | |||
| 841 | See {{scm path="xwiki-platform-tools/xwiki-platform-tool-configuration-resources/src/main/resources/xwiki.properties.vm"}}xwiki.properties.vm{{/scm}} | ||
| 842 | |||
| 843 | Note that we generate the default ##xwiki.properties## file from this template file by applying Velocity during the build, so all ##$<something>## properties that you see in this file are replaced at build time.{{/version}} | ||
| 844 | |||
| 845 | from the ##xwiki.properties## file by setting ##edit.conflictChecking.enabled = false##: | ||
| 846 | |||
| 847 | {{code language="none"}} | ||
| 848 | #-# Indicate if the mechanism to detect and handle edition conflicts should be enabled or not. | ||
| 849 | #-# If disabled, it means that in case of edition conflicts, the latest save will be always take into account, and | ||
| 850 | #-# erase previous data (which can always be recovered in the history of the document). | ||
| 851 | #-# This option is provided because the feature is still experimental and it could be useful is some specific usecases | ||
| 852 | #-# to switch it off. However it is not recommended to do so. | ||
| 853 | #-# | ||
| 854 | #-# The default is: | ||
| 855 | # edit.conflictChecking.enabled = true | ||
| 856 | {{/code}} | ||
| 857 | |||
| 858 | == In-place Editing == | ||
| 859 | |||
| 860 | To disable the in-place WYSIWYG editing mode (and thus default to the Standalone WYSIWYG editing mode), modify the ##xwiki.properties## file and set ##edit.document.inPlaceEditing.enabled = false##: | ||
| 861 | |||
| 862 | {{code language="none"}} | ||
| 863 | #-# Indicate if the XWiki documents should be edited in-place, without leaving the view mode, whenever possible (e.g. if | ||
| 864 | #-# the default edit mode for that document and the preferred editor both support in-place editing). When enabled, | ||
| 865 | #-# clicking on the document Edit button makes the document title and content editable in-place, without leaving the | ||
| 866 | #-# view mode. When disabled, clicking on the document Edit button loads the default (stand-alone) edit mode for that | ||
| 867 | #-# document. | ||
| 868 | #-# | ||
| 869 | #-# The default is: | ||
| 870 | # edit.document.inPlaceEditing.enabled = true | ||
| 871 | {{/code}} | ||
| 872 | |||
| 873 | = Delete Pages = | ||
| 874 | |||
| 875 | This section is hidden when the [[recycle bin is not activated>>#HDocumentrecyclebin]]. | ||
| 876 | |||
| 877 | == Enabling Advanced users to skip the recycle bin == | ||
| 878 | |||
| 879 | Advanced users can choose to skip the recycle bin (and remove the pages permanently) when deleting pages. | ||
| 880 | |||
| 881 | To do so, search for the "Delete" section and set "can skip the recycle bin" to Yes. The default value is No. | ||
| 882 | |||
| 883 | {{image reference="skip_recycle_bin_admin_cropped.png"/}} | ||
| 884 | |||
| 885 | The configuration is resolved by looking in three locations, from the most specific to the least specific: | ||
| 886 | |||
| 887 | * In the configuration of the current wiki | ||
| 888 | * In the configuration of the main wiki | ||
| 889 | * In ##xwiki.properties## (see the property details below) | ||
| 890 | |||
| 891 | If the default value is found in one location, the next one is tried. If no value is found, the recycle bin skipping is not activated. | ||
| 892 | |||
| 893 | Details of the configuration on ##xwiki.properties##: | ||
| 894 | |||
| 895 | {{code language="none"}} | ||
| 896 | #-# Indicates whether skipping the recycle bin when deleting pages is allowed for Advanced users. | ||
| 897 | #-# It is disabled by default. | ||
| 898 | #-# This setting is only used if the wiki has a recycle bin activated (xwiki.recyclebin=1 in xwiki.cfg). | ||
| 899 | #-# This setting can be overloaded: | ||
| 900 | #-# * By the main wiki in the Refactoring.Code.RefactoringConfigurationClass class of the | ||
| 901 | #-# Refactoring.Code.RefactoringConfiguration document of the main wiki. | ||
| 902 | #-# * By sub-wikis in the Refactoring.Code.RefactoringConfigurationClass class of the | ||
| 903 | #-# Refactoring.Code.RefactoringConfiguration document of the sub-wikis (itself overloading the main wiki's | ||
| 904 | #-# configuration). | ||
| 905 | #-# | ||
| 906 | #-# The default value is: | ||
| 907 | # refactoring.isRecycleBinSkippingActivated = false | ||
| 908 | {{/code}} | ||
| 909 | |||
| 910 | = Readonly = | ||
| 911 | |||
| 912 | In order to configure your XWiki instance to be readonly (useful when doing an upgrade by setting up a new instance and you don't want new content to be created, for example). | ||
| 913 | |||
| 914 | To achieve this, you need to edit the ##xwiki.cfg## configuration file and set the ##xwiki.readonly## property to true and restart XWiki. | ||
| 915 | |||
| 916 | If you want to turn on the readonly mode live without a restart, you can also execute a small snippet with a user having programming rights (a restart of XWiki will remove the readonly mode in this case), while waiting for a future feature (see issue [[XWIKI-10119>>https://jira.xwiki.org/browse/XWIKI-10119]]): | ||
| 917 | |||
| 918 | {{code language="none"}} | ||
| 919 | {{groovy}} | ||
| 920 | def xwiki = xcontext.getXWiki() | ||
| 921 | xwiki.isReadOnly = true | ||
| 922 | {{/groovy}} | ||
| 923 | {{/code}} | ||
| 924 | |||
| 925 | Note that this flag doesn't prevent against any modifications in your wiki, there're still some places where it's not taken into account (see issue [[XWIKI-18437>>https://jira.xwiki.org/browse/XWIKI-18437]])). | ||
| 926 | |||
| 927 | = Sample ##xwiki.cfg## = | ||
| 928 | |||
| 929 | See {{scm path="xwiki-platform-tools/xwiki-platform-tool-configuration-resources/src/main/resources/xwiki.cfg.vm"}}xwiki.cfg.vm{{/scm}} | ||
| 930 | |||
| 931 | Note that we generate the default ##xwiki.cfg## file from this template file by applying Velocity during the build, so all ##$<something>## properties you see in this file are replaced at build time. | ||
| 932 | |||
| 933 | = Sample ##xwiki.properties## = | ||
| 934 | |||
| 935 | See {{scm path="xwiki-platform-tools/xwiki-platform-tool-configuration-resources/src/main/resources/xwiki.properties.vm"}}xwiki.properties.vm{{/scm}} | ||
| 936 | |||
| 937 | Note that we generate the default ##xwiki.properties## file from this template file by applying Velocity during the build, so all ##$<something>## properties that you see in this file are replaced at build time. | ||
| 938 | |||
| 939 | |||
| 940 | from the ##xwiki.properties## file by setting ##edit.conflictChecking.enabled = false##: | ||
| 941 | |||
| 942 | {{code language="none"}} | ||
| 943 | #-# Indicate if the mechanism to detect and handle edition conflicts should be enabled or not. | ||
| 944 | #-# If disabled, it means that in case of edition conflicts, the latest save will be always take into account, and | ||
| 945 | #-# erase previous data (which can always be recovered in the history of the document). | ||
| 946 | #-# This option is provided because the feature is still experimental and it could be useful is some specific usecases | ||
| 947 | #-# to switch it off. However it is not recommended to do so. | ||
| 948 | #-# | ||
| 949 | #-# The default is: | ||
| 950 | # edit.conflictChecking.enabled = true | ||
| 951 | {{/code}} |