Wiki source code of Livetable Results
Last modified by Thomas Mortagne on 2020/09/29 11:19
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | {{include reference="XWiki.LiveTableResultsMacros" /}} | ||
| 2 | |||
| 3 | {{velocity wiki="false"}} | ||
| 4 | ## the $extra variable is passed to the call to #gridresultwithfilter below and is used to perform some default | ||
| 5 | ## filtering on the LiveTable data even when the user has not performed any column filtering yet. | ||
| 6 | ## When users start using column filtering, the generated DB query will combine both the default filtering and what the | ||
| 7 | ## user has entered in the column filters. | ||
| 8 | #set ($extra = '') | ||
| 9 | #set ($params = {}) | ||
| 10 | #if ("$!request.space" != '') | ||
| 11 | #set ($extra = "${extra} AND doc.space = :doc_space") | ||
| 12 | #set ($discard = $params.put('doc_space', $request.space)) | ||
| 13 | #end | ||
| 14 | ## Use filterLocation since addLivetableLocationFilter is buggy when called several times (it'll add the | ||
| 15 | ## same HQL binding name every time it's called! See https://jira.xwiki.org/browse/XWIKI-17463). | ||
| 16 | ## Also note that we don't call addLocationFilter since we use a Map for $params. | ||
| 17 | #filterLocation($extra, $params, $!request.location, 'locationFilterValue1') | ||
| 18 | #if ("$!request.parent" != '') | ||
| 19 | #set ($extra = "${extra} and doc.parent = :doc_parent") | ||
| 20 | #set ($discard = $params.put('doc_parent', $request.parent)) | ||
| 21 | #end | ||
| 22 | #if ("$!request.orphaned" == '1') | ||
| 23 | #set ($homepage = $services.wiki.getById($services.wiki.currentWikiId).mainPageReference) | ||
| 24 | #set ($homepageFullName = $services.model.serialize($homepage, 'local')) | ||
| 25 | ## On Oracle the empty parent is actually null. | ||
| 26 | #set ($extra = "${extra} and (doc.parent = '' or doc.parent is null) and doc.fullName <> :homepageFullName") | ||
| 27 | #set ($discard = $params.put('homepageFullName', $homepageFullName)) | ||
| 28 | #end | ||
| 29 | #gridresultwithfilter("$!request.classname" $request.collist.split(',') '' "${extra}" $params) | ||
| 30 | {{/velocity}} |