Wiki source code of UserDirectoryColumnsDisplayer

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

Hide last authors
superadmin 1.1 1 {{velocity}}
2 #if ($type == 'edit' || $type == 'search')
3 #set ($discard = $xwiki.linkx.use($services.webjars.url('selectize.js', 'css/selectize.bootstrap3.css'),
4 {'type': 'text/css', 'rel': 'stylesheet'}))
5 #set ($discard = $xwiki.ssfx.use('uicomponents/suggest/xwiki.selectize.css', true))
6 #set ($discard = $xwiki.jsfx.use('uicomponents/suggest/xwiki.selectize.js', true))
7 #set ($options = [])
8 #set ($xwikiUsersClass = $xwiki.getDocument('XWiki.XWikiUsers').xWikiClass)
9 #foreach ($propertyClass in $xwikiUsersClass.properties)
10 ## It doesn't make sense to show password columns in the User Directory.
11 #if ($propertyClass.classType != 'Password')
12 #set ($discard = $options.add({
13 'value': $propertyClass.name,
14 'label': $propertyClass.translatedPrettyName
15 }))
16 #end
17 #end
18 #set ($id = $escapetool.xml("${prefix}${name}"))
19 #set ($selectizeSettings = {
20 'options': $collectiontool.sort($options, 'label'),
21 'items': $value.split('\s+'),
22 'delimiter': ' '
23 })
24 {{html clean="false"}}
25 ## We don't use a select element because we need to submit the selected values concatenated (the 'columns' property
26 ## type is TextArea which reads only the first value that is submitted).
27 <input id="$id" class="xwiki-selectize" name="$id" type="text"
28 placeholder="$escapetool.xml($services.localization.render('userdirectory.configuration.columns.editHint'))"
29 data-xwiki-selectize="$escapetool.xml($jsontool.serialize($selectizeSettings))" />
30 {{/html}}
31 #elseif ($type == 'view')
32 $doc.displayView($field, $prefix, $object)
33 #elseif ($type == 'rendered')
34 $doc.displayRendered($field, $prefix, $object)
35 #elseif ($type == 'hidden')
36 $doc.displayHidden($field, $prefix, $object)
37 #else
38 ## In order for the custom displayer to be taken into account, the result of its evaluation with an unknown display
39 ## mode must not be empty. Let's output something.
40 Unknown display mode.
41 #end
42 {{/velocity}}