Wiki source code of Rendering Configuration Sheet
Last modified by Julien Fleury on 2020/12/12 16:56
Hide last authors
author | version | line-number | content |
---|---|---|---|
![]() |
1.1 | 1 | {{velocity output="false"}} |
2 | ## We can't use a single HTML form at the moment because the default syntax is saved in a different location. | ||
3 | #set ($params = { | ||
4 | 'general': ['core.defaultDocumentSyntax'] | ||
5 | }) | ||
6 | {{/velocity}} | ||
7 | |||
8 | {{include reference="XWiki.AdminFieldsDisplaySheet" /}} | ||
9 | |||
10 | {{velocity}} | ||
11 | #set ($configDocName = 'Rendering.RenderingConfig') | ||
12 | #set ($configDoc = $xwiki.getDocument($configDocName)) | ||
13 | #set ($configClassName = 'Rendering.RenderingConfigClass') | ||
14 | #set ($configObj = $configDoc.getObject($configClassName)) | ||
15 | ## ======================================================= | ||
16 | ## Step 1: Migrate Rendering config data | ||
17 | ## ======================================================= | ||
18 | ## We bundle Rendering.RenderingConfig without a Rendering.RenderingConfigClass xobject, allowing us to migrate Rendering configuration | ||
19 | ## that were previously stored in the xwiki.rendering.syntaxes property in xwiki.cfg. | ||
20 | #if ($xcontext.action == 'admin' && "$!configObj" == '') | ||
21 | ## Create the xobject | ||
22 | #set ($configObj = $configDoc.newObject($configClassName)) | ||
23 | ## Get the disabled syntaxes value from the old location and set them as the current disabled syntaxes | ||
24 | ## Also convert from Syntax to String | ||
25 | #set ($disabledSyntaxes = []) | ||
26 | #foreach ($disabledSyntax in $services.rendering.disabledSyntaxes) | ||
27 | #set ($discard = $disabledSyntaxes.add($disabledSyntax.toIdString())) | ||
28 | #end | ||
29 | #set ($discard = $configObj.set('disabledSyntaxes', $disabledSyntaxes)) | ||
30 | ## Save the new xobject! | ||
31 | #set ($discard = $configDoc.save('Migrated Rendering configuration found in xwiki.cfg (xwiki.rendering.syntaxes)', true)) | ||
32 | #end | ||
33 | ## ======================================================= | ||
34 | ## Step 2: Display form | ||
35 | ## ======================================================= | ||
36 | #set ($params = { | ||
37 | 'general': ['disabledSyntaxes'] | ||
38 | }) | ||
39 | #set ($paramDoc = $configDoc) | ||
40 | #set ($paramClass = $configClassName) | ||
41 | {{/velocity}} | ||
42 | |||
43 | {{include reference="XWiki.AdminFieldsDisplaySheet" /}} |