Изменения документа User Directory Macros

Редактировал(а) Андрей Ганьков 2023/04/03 09:30

От версии 1.1
отредактировано Андрей Ганьков
на 2020/03/30 19:09
Изменить комментарий: Install extension [org.xwiki.platform:xwiki-platform-user-directory-ui/12.1]
К версии 4.1
отредактировано Андрей Ганьков
на 2023/04/03 09:30
Изменить комментарий: Install extension [org.xwiki.platform:xwiki-platform-user-directory-ui/15.2]

Сводка

Подробности

Свойства страницы
Содержимое
... ... @@ -238,8 +238,7 @@
238 238  #macro (displayProperty $propertyName $object $action)
239 239   #set ($propertyClass = $object.xWikiClass.get($propertyName))
240 240   #set ($isCheckbox = $propertyClass.getValue('displayFormType') == 'checkbox')
241 - #set ($fieldDisplay = $stringtool.removeEnd($stringtool.removeStart($object.display($propertyName, $action),
242 - '{{html clean="false" wiki="false"}}'), '{{/html}}'))
241 + #set ($fieldDisplay = "#unwrapXPropertyDisplay($object.display($propertyName, $action))")
243 243   <dt>
244 244   <label #if ($action == 'edit' && !$isCheckbox)
245 245   for="$escapetool.xml("${object.xWikiClass.name}_${object.number}_$propertyName")"#end>
... ... @@ -271,7 +271,8 @@
271 271   $escapetool.url({
272 272   'customize': true,
273 273   'action': 'reset',
274 - 'xredirect': $xredirect
273 + 'xredirect': $xredirect,
274 + 'form_token': $services.csrf.token
275 275   }),
276 276   "$doc.fullName",
277 277   'customize=true'
XWiki.JavaScriptExtension[0]
Код
... ... @@ -25,7 +25,7 @@
25 25   /**
26 26   * Live preview when the User Directory settings are modified.
27 27   */
28 - $('form.user-directory-settings').change(function(event) {
28 + $('form.user-directory-settings').on('change', function(event) {
29 29   // Default on user-level configuration.
30 30   var configDocument = XWiki.currentDocument;
31 31   if (configDocument.page !== 'UserDirectory' || configDocument.space !== 'Main') {
... ... @@ -36,9 +36,10 @@
36 36   var data = $(this).serialize();
37 37   var oldLiveTableContainer = $('.xwiki-livetable-container').addClass('loading');
38 38   // We can't use load() here because the live table has in-line script tags that have to be evaluated.
39 - $.get(url, data).done(function(html) {
39 + $.get(url, data).then(html => {
40 40   var newLiveTableContainer = $('<div/>').html(html).find('.xwiki-livetable-container');
41 41   oldLiveTableContainer.replaceWith(newLiveTableContainer);
42 + $(document).trigger('xwiki:dom:updated', {elements: newLiveTableContainer.toArray()});
42 42   });
43 43   });
44 44  
... ... @@ -45,7 +45,7 @@
45 45   /**
46 46   * User scope filtering (for sub-wikis).
47 47   */
48 - $('#userScopeFilter').change(function(event) {
49 + $('#userScopeFilter').on('change', function(event) {
49 49   var value = $(this).val();
50 50   // The live table is recreated when an user directory setting is changed (live preview) so we can't cache the
51 51   // reference to the live table instance.