Modifications pour le document Macros de résultats Livetable

Modifié par Florent Charton le 2026/03/13 11:03

Depuis la version 3.1
modifié par Florent Charton
sur 2025/07/04 23:28
Commentaire de modification : Install extension [org.xwiki.platform:xwiki-platform-livetable-ui/16.10.9]
À la version 1.1
modifié par superadmin
sur 2022/06/20 08:48
Commentaire de modification : Install extension [org.xwiki.platform:xwiki-platform-livetable-ui/13.10.6]

Résumé

Détails

Propriétés de la Page
Auteur du document
... ... @@ -1,1 +1,1 @@
1 -xwiki:XWiki.fcharton
1 +XWiki.superadmin
Contenu
... ... @@ -35,18 +35,7 @@
35 35   ##
36 36   #set($tablelist = [])
37 37   #foreach($colname in $collist)
38 - ## If a classname is defined and the class field corresponding to the column name,
39 - ## we check the type of the field and skip it if it's Password.
40 - #if ($className != '' && $class.get($colname))
41 - #set ($isPasswordType = $class.get($colname).classType == 'Password')
42 - #set ($isEmailType = $class.get($colname).classType == 'Email')
43 - #set ($emailObfuscated = $services.mail.general.shouldObfuscate())
44 - #if (!($isPasswordType || ($isEmailType && $emailObfuscated)))
45 - #livetable_addColumnToQuery($colname)
46 - #end
47 - #else
48 - #livetable_addColumnToQuery($colname)
49 - #end
38 + #livetable_addColumnToQuery($colname)
50 50   #end
51 51   ##
52 52   ## Tag filtering
... ... @@ -100,8 +100,6 @@
100 100   #set($order = "$!request.sort")
101 101   #if ($order == 'doc.location')
102 102   #set ($order = 'doc.fullName')
103 - #elseif ($order == 'email' && $services.mail.general.shouldObfuscate())
104 - #set ($order = '')
105 105   #end
106 106   #set ($orderSql = '')
107 107   #if($order != '')
... ... @@ -276,13 +276,7 @@
276 276   ##
277 277   ## TagCloud matching all the documents used by the live table
278 278   ##
279 - ## If all the query parameters are the same as for $tagsMatchingFilters, no need to run the query again.
280 - ## This optimization allows to divide the time to compute the tagcloud by 2 when the table has no filters applied.
281 - #if ($allMatchingTagsFrom.trim() != $tagsMatchingFiltersFrom.trim() || $allMatchingTagsWhere.trim() != $tagsMatchingFiltersWhere.trim() || $tagsMatchingParams != $allMatchingParams)
282 - #set($allMatchingTags = $xwiki.tag.getTagCountForQuery($allMatchingTagsFrom, $allMatchingTagsWhere, $allMatchingParams))
283 - #else
284 - #set($allMatchingTags = $tagsMatchingFilters)
285 - #end
266 + #set($allMatchingTags = $xwiki.tag.getTagCountForQuery($allMatchingTagsFrom, $allMatchingTagsWhere, $allMatchingParams))
286 286   ## FIXME: We use a list of maps just because the client expects an array, but we should simply return $allMatchingTags..
287 287   #set($tags = [])
288 288   #foreach($tag in $allMatchingTags.keySet())
... ... @@ -317,12 +317,7 @@
317 317   #set ($query = $query.setLimit($limit).setOffset($offset).bindValues($sqlParams))
318 318   #set($items = $query.execute())
319 319   #set($discard = $map.put('totalrows', $query.count()))
320 - #if ($limit > 0)
321 - #set($discard = $map.put('returnedrows', $mathtool.min($items.size(), $limit)))
322 - #else
323 - ## When the limit is 0, it's equivalent to no limit at all and the actual number of returned results can be used.
324 - #set($discard = $map.put('returnedrows', $items.size()))
325 - #end
301 + #set($discard = $map.put('returnedrows', $mathtool.min($items.size(), $limit)))
326 326   #set($discard = $map.put('offset', $mathtool.add($offset, 1)))
327 327   #set($rows = [])
328 328   #foreach($item in $items)
... ... @@ -401,6 +401,7 @@
401 401   #set($discard = $itemDoc.use($className))
402 402   #set($discard = $row.put('doc_objectCount', $itemDoc.getObjectNumbers($className)))
403 403   #set($discard = $row.put('doc_edit_url', $itemDoc.getURL($itemDoc.defaultEditMode)))
380 + #set($discard = $row.put('doc_author_url', $xwiki.getURL($translatedDoc.author)))
404 404   #set($discard = $row.put('doc_date', $xwiki.formatDate($translatedDoc.date)))
405 405   #set($discard = $row.put('doc_title', $translatedDoc.plainTitle))
406 406   #set($rawTitle = $translatedDoc.title)
... ... @@ -407,15 +407,7 @@
407 407   #if($rawTitle != $row['doc_title'])
408 408   #set($discard = $row.put('doc_title_raw', $rawTitle))
409 409   #end
410 - #set ($metadataAuthor = $translatedDoc.authors.originalMetadataAuthor)
411 - #if ($metadataAuthor == $services.user.getGuestUserReference())
412 - ## Special handling for guest so that it displays unknown user.
413 - #set($discard = $row.put('doc_author', $xwiki.getPlainUserName($NULL)))
414 - #else
415 - #set($discard = $row.put('doc_author', $xwiki.getPlainUserName($metadataAuthor)))
416 - #end
417 -
418 - #set($discard = $row.put('doc_author_url', $xwiki.getURL($metadataAuthor)))
387 + #set($discard = $row.put('doc_author', $xwiki.getPlainUserName($translatedDoc.authorReference)))
419 419   #set($discard = $row.put('doc_creationDate', $xwiki.formatDate($translatedDoc.creationDate)))
420 420   #set($discard = $row.put('doc_creator', $xwiki.getPlainUserName($translatedDoc.creatorReference)))
421 421   #set($discard = $row.put('doc_hidden', $translatedDoc.isHidden()))
... ... @@ -468,12 +468,10 @@
468 468   #set($fieldProperty = $fieldObject.getProperty($colname))
469 469   #if ($fieldProperty.getPropertyClass().classType == 'Password')
470 470   #set($fieldValue = '********')
471 - #elseif ($fieldProperty.getPropertyClass().classType == 'Email' && $services.mail.general.shouldObfuscate())
472 - #set ($fieldValue = $services.mail.general.obfuscate("$!fieldProperty.getValue()"))
473 473   #else
474 474   #set($fieldValue = "$!fieldProperty.getValue()")
475 475   #end
476 - #set($fieldDisplayValue = "#unwrapXPropertyDisplay($itemDoc.display($colname, 'view'))")
443 + #set($fieldDisplayValue = "$!itemDoc.display($colname, 'view')")
477 477   #if($fieldDisplayValue == '')
478 478   #set($fieldDisplayValue = $services.localization.render("${request.transprefix}emptyvalue"))
479 479   #end
... ... @@ -485,7 +485,7 @@
485 485   #set($fieldUrl = '')
486 486   #end
487 487   #end
488 - #set($discard = $row.put($colname, $fieldDisplayValue))
455 + #set($discard = $row.put($colname, $fieldDisplayValue.replaceFirst($regextool.quote('{{html clean="false" wiki="false"}}'), '').replaceAll("$regextool.quote('{{/html}}')$", '')))
489 489   #set($discard = $row.put("${colname}_value", $fieldValue))
490 490   #set($discard = $row.put("${colname}_url", $fieldUrl))
491 491   ## Reset to the default class
... ... @@ -506,9 +506,7 @@
506 506   #set($discard = $map.put('params', $sqlParams))
507 507   #end
508 508   #set($discard = $map.put('reqNo', $numbertool.toNumber($request.reqNo).intValue()))
509 - #if("$!request.tagcloud" == 'true')
510 - #gridresult_buildTagCloudJSON($map)
511 - #end
476 + #gridresult_buildTagCloudJSON($map)
512 512   #gridresult_buildRowsJSON($map)
513 513  #end
514 514