Wiki source code of ConfigurationDisplayer

Last modified by superadmin on 2025/05/22 17:45

Hide last authors
superadmin 1.1 1 {{velocity}}
2 {{html clean="false"}}
3 #set ($configPropertyValue = $NULL)
4 ## Remove non-word characters from the property name in order to prevent code injection when evaluating the property
5 ## value below.
6 #set ($configPropertyGetter = $name.replace('xwiki', 'xWiki').replaceAll('\W', ''))
7 #if ("$!configPropertyGetter" != '')
8 #set ($getConfigPropertyValue = '#set ($configPropertyValue = $services.export.pdf.configuration.' +
9 $configPropertyGetter + ')')
10 #evaluate($getConfigPropertyValue)
11 #end
12 #set ($escapedName = $escapetool.xml("$!{prefix}$!{name}"))
13 #set ($escapedId = $escapetool.xml("$!{prefix}$!{name}$!{options.idSuffix}"))
14 #set ($escapedValue = $escapetool.xml($value))
15 #if ($type == 'edit' || $type == 'search')
16 #set ($placeholder = '')
17 #if ("$!value" == '')
18 ## We show the inherited / default value as placeholder only when there's no value set, because we can't get the
19 ## inherited / default value when the value is set (the "default" value would be the actual value set).
20 #set ($placeholder = $configPropertyValue)
21 #end
22 #set ($inputType = 'text')
23 #if ($field.type == 'NumberClass')
24 #set ($inputType = 'number')
25 #end
26 #set ($pattern = $field.getProperty('validationRegExp').value)
27 <input type="$escapetool.xml($inputType)" id="$!escapedId" name="$!escapedName" value="$!escapedValue"
28 #if ("$!placeholder" != '') placeholder="$!escapetool.xml($placeholder)"#end
29 #if ($options.required) required#end
30 #if ($options.min) min="$!escapetool.xml($options.min)"#end
31 #if ($options.max) max="$!escapetool.xml($options.max)"#end
32 #if ("$!pattern" != '') pattern="$escapetool.xml($pattern)"#end />
33 #elseif ($type == 'view' || $type == 'rendered')
34 #if ("$!value" == '')
35 #set ($escapedValue = $escapetool.xml($configPropertyValue))
36 #end
37 <span
38 #if ("$!value" == '')
39 data-default-label="$!escapetool.xml($services.localization.render('export.pdf.config.default'))"
40 #if ("$!configPropertyValue" == '')
41 data-empty-label="$!escapetool.xml($services.localization.render('export.pdf.config.empty'))"
42 #end
43 #end
44 >$!escapedValue</span>
45 #elseif ($type == 'hidden')
46 <input type="hidden" id="$!escapedId" name="$!escapedName" value="$!escapedValue" />
47 #else
48 ## In order for the custom displayer to be taken into account, the result of its evaluation with an unknown display
49 ## mode must not be empty. Let's output something.
50 Unknown display mode.
51 #end
52 {{/html}}
53 {{/velocity}}