Modifiche per il documento Utenti
Dalla versione 11.1
modificato da Andrea Omicini
il 2026/08/29 17:44
il 2026/08/29 17:44
Cambia il commento:
add the ?status= filter, validated against the class's own value list
Alla versione 3.1
modificato da Andrea Omicini
il 2026/05/19 21:04
il 2026/05/19 21:04
Cambia il commento:
Nessun commento per questa versione
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -1,105 +1,83 @@ 1 1 {{velocity}} 2 -################################################################################ 3 -## People — built from the `status` field of XWiki.XWikiUsers. 4 -## 5 -## Nothing is hand-maintained here: the groups are the values declared by 6 -## XWiki.XWikiUsers.status, in the class's own order, and every user carrying a 7 -## status appears in exactly one of them. Add a status to the class and it shows 8 -## up here; change someone's status and they move. Disabled accounts (active = 0) 9 -## are left out. 10 -## 11 -## Headings use the translation keys XWiki.XWikiUsers_status_<value>, so the page 12 -## is bilingual without a single string of its own. 13 -################################################################################ 14 -## 15 -## the groups, in class order, and the people, from the users themselves 16 -#set( $statusList = $xwiki.getDocument('XWiki.XWikiUsers').getxWikiClass().get('status').getListValues() ) 17 -## an optional ?status=<value> filter. The value is validated against the list the 18 -## class itself declares, so no status value is written down here: change the class 19 -## and both the grouping and the filter follow. 20 -#set( $wanted = "$!request.getParameter('status')" ) 21 -#set( $known = ( $wanted == '' || $statusList.contains($wanted) ) ) 22 -#set( $people = {} ) 23 -#foreach( $s in $statusList ) 24 - #set( $discard = $people.put($s, []) ) 2 +#### Set Users Lists 3 +#set($almamaterList = ['AntonioNatali']) 4 +#set($tenuredList = ['RobertaCalegari','RobyCasadei','GiovanniCiatto','EnricoDenti','SaraMontagna','GianlucaMoro','AndreaOmicini','DaniloPianini','NazzarenoPompei','ARicci','AndreaRoli','MirkoViroli']) 5 +#set($researchfellowList = ['FSabbatini']) 6 +#set($postdocList = ['AndreaAgiollo','MartinaBaiardi4','MatteoMagnini','GPisano','AndreaRafanelli']) 7 +#set($phdList = ['MattiaMatteini']) 8 +#set($grantList = []) 9 +#set($collaboratorList = ['ClaudiaCevenini','PierluigiContucci','SMariani','ACroatti','AmbraMolesini']) 10 +#set($guestList = []) 11 +#set($goneList = ['MarcoAlberti3','MattiaBargellini','StefanoBenedettini','StefanoBromuri', 'PietroBrunetti2','MicheleCabano','MCasadei','AlbertoCastori','MaurizioCimadamore','GiacomoDomeniconi','MarcoFabbri','PedroPabloGonzalezPerez','CesareMonti','GabrieleMonti4','ElenaNardini','EnricoOliva','AlexcarmineOlivieri','EmanuelePanzavolta','RobertoPasolini','GiulioPiancastelli','TommasoPirini','MichelePiunti','ASanti','MarcoSbaraglia','JoseSantiagoPerezSotelo','VisaraUrovi']) 12 + 13 +>{{stringEngIta eng="Alma Mater Honorary Professors" ita="Professori Alma Mater"/}} 14 + 15 +#foreach ($tipolosco in $almamaterList) 16 +#set($xwikiUserName = "XWiki." + $tipolosco)#set( $xwikiUserDoc = $xwiki.getDocument($xwikiUserName) ) 17 +[[$xwikiUserDoc.display('first_name') **$xwikiUserDoc.display('last_name')**>>$xwikiUserName]]#if( !$foreach.last ) • #end 25 25 #end 26 -## distinct: a user page with a translation (XWiki.AntonioNatali.it) returns one row per locale 27 -#set( $rows = $services.query.xwql("select distinct doc.fullName from Document doc, doc.object(XWiki.XWikiUsers) as u where u.status <> ''").execute() ) 28 -#set( $seen = [] ) 29 -#foreach( $ref in $rows ) 30 - #set( $uDoc = $xwiki.getDocument($ref) ) 31 - #set( $uObj = $uDoc.getObject('XWiki.XWikiUsers') ) 32 - #set( $st = "$!uObj.getValue('status')" ) 33 - ## `active` is unset on most user objects, so only an explicit 0 counts as disabled 34 - #set( $isActive = ("$!uObj.getValue('active')" != '0') ) 35 - #if( $people.containsKey($st) && $isActive && !$seen.contains($ref) ) 36 - #set( $discard = $seen.add($ref) ) 37 - ## sort key: surname, then given name, then the reference 38 - #set( $last = "$!uObj.getValue('last_name')" ) 39 - #set( $first = "$!uObj.getValue('first_name')" ) 40 - #set( $discard = $people.get($st).add("${last}|${first}|${ref}") ) 41 - #end 19 + 20 +>{{stringEngIta eng="Tenured" ita="Strutturati"/}} 21 + 22 +#foreach ($tipolosco in $tenuredList) 23 +#set($xwikiUserName = "XWiki." + $tipolosco)#set( $xwikiUserDoc = $xwiki.getDocument($xwikiUserName) ) 24 +[[$xwikiUserDoc.display('first_name') **$xwikiUserDoc.display('last_name')**>>$xwikiUserName]]#if( !$foreach.last ) • #end 42 42 #end 43 -## 44 -## one person: given name + bold surname, linked to their XWiki user page 45 -#macro( apicePerson $entry ) 46 - #set( $bits = $entry.split('\|') ) 47 -[[${bits[1]} **${bits[0]}**>>${bits[2]}]]## 48 -#end 49 -## 50 -## a section, printed only when somebody is in it 51 -#macro( apiceGroup $status ) 52 - #set( $group = $people.get($status) ) 53 - #if( $group && !$group.isEmpty() ) 54 - #set( $group = $collectiontool.sort($group) ) 55 55 56 -> $services.localization.render("XWiki.XWikiUsers_status_${status}")27 +>{{stringEngIta eng="Research Fellows" ita="Ricercatori"/}} 57 57 58 - #foreach( $entry in $group )#if( !$foreach.first ) • #end#apicePerson($entry)#end 29 +#foreach ($tipolosco in $researchfellowList) 30 +#set($xwikiUserName = "XWiki." + $tipolosco)#set( $xwikiUserDoc = $xwiki.getDocument($xwikiUserName) ) 31 +[[$xwikiUserDoc.display('first_name') **$xwikiUserDoc.display('last_name')**>>$xwikiUserName]]#if( !$foreach.last ) • #end 32 +#end 59 59 60 - #end 34 +#if( $postdocList != [] ) 35 +>{{stringEngIta eng="Post-Doc" ita="Post-dottorato"/}} 36 + 37 +#foreach ($tipolosco in $postdocList) 38 +#set($xwikiUserName = "XWiki." + $tipolosco)#set( $xwikiUserDoc = $xwiki.getDocument($xwikiUserName) ) 39 +[[$xwikiUserDoc.display('first_name') **$xwikiUserDoc.display('last_name')**>>$xwikiUserName]]#if( !$foreach.last ) • #end 61 61 #end 62 -## 63 -#if( !$known ) 64 -#### the class does not declare this value — say so, and show what it does declare 65 ->{{stringEngIta eng="Unknown status" ita="Stato sconosciuto"/}}: **$escapetool.xml($wanted)** 41 +#end 66 66 67 - #foreach( $sin$statusList)[[$services.localization.render("XWiki.XWikiUsers_status_${s}")>>||queryString="status=${s}"]]#if(!$foreach.last) • #end#end43 +>{{stringEngIta eng="PhD Students" ita="Studenti di dottorato"/}} 68 68 69 -#elseif( $wanted != '' ) 70 -#### ONE GROUP, ASKED FOR BY ?status= — students included, like any other value 71 - #if( $people.get($wanted).isEmpty() ) 45 +#foreach ($tipolosco in $phdList) 46 +#set($xwikiUserName = "XWiki." + $tipolosco)#set( $xwikiUserDoc = $xwiki.getDocument($xwikiUserName) ) 47 +[[$xwikiUserDoc.display('first_name') **$xwikiUserDoc.display('last_name')**>>$xwikiUserName]]#if( !$foreach.last ) • #end 48 +#end 72 72 73 ->{{stringEngIta eng="Nobody has this status" ita="Nessuno ha questo stato"/}} 50 +#if( $grantList != [] ) 51 +>{{stringEngIta eng="Grants" ita="Assegnisti e borsisti"/}} 74 74 75 - #else 76 - #apiceGroup($wanted) 77 - #end 78 -#else 79 -#### CURRENT PEOPLE — every status except students and past members 80 -#foreach( $s in $statusList ) 81 - #if( $s != 'student' && $s != 'gone' ) 82 - #apiceGroup($s) 83 - #end 53 +#foreach ($tipolosco in $grantList) 54 +#set($xwikiUserName = "XWiki." + $tipolosco)#set( $xwikiUserDoc = $xwiki.getDocument($xwikiUserName) ) 55 +[[$xwikiUserDoc.display('first_name') **$xwikiUserDoc.display('last_name')**>>$xwikiUserName]]#if( !$foreach.last ) • #end 84 84 #end 85 -## 86 -#### PAST MEMBERS 87 -#apiceGroup('gone') 88 -## 89 -#### anyone whose status is not among those declared by the class — should be empty 90 -#set( $strays = [] ) 91 -#foreach( $ref in $rows ) 92 - #set( $uObj = $xwiki.getDocument($ref).getObject('XWiki.XWikiUsers') ) 93 - #set( $st = "$!uObj.getValue('status')" ) 94 - #if( !$people.containsKey($st) )#set( $discard = $strays.add("${ref} (${st})") )#end 95 95 #end 96 -#if( !$strays.isEmpty() ) 97 97 98 ->{{stringEngIta eng=" Unrecognised status" ita="Statononriconosciuto"/}}59 +>{{stringEngIta eng="Collaborators" ita="Collaboratori"/}} 99 99 100 - #foreach( $stray in $strays )$stray#if( !$foreach.last ) • #end#end 61 +#foreach ($tipolosco in $collaboratorList) 62 +#set($xwikiUserName = "XWiki." + $tipolosco)#set( $xwikiUserDoc = $xwiki.getDocument($xwikiUserName) ) 63 +[[$xwikiUserDoc.display('first_name') **$xwikiUserDoc.display('last_name')**>>$xwikiUserName]]#if( !$foreach.last ) • #end 64 +#end 101 101 66 +#if( $guestList != [] ) 67 +>{{stringEngIta eng="Guests, Visitors & External Collaborators" ita="Ospiti, visitatori e collaboratori esterni"/}} 68 + 69 +#foreach ($tipolosco in $guestList) 70 +#set($xwikiUserName = "XWiki." + $tipolosco)#set( $xwikiUserDoc = $xwiki.getDocument($xwikiUserName) ) 71 +#set($xwikiUserName = "XWiki." + $tipolosco)#set( $xwikiUserDoc = $xwiki.getDocument($xwikiUserName) ) 72 +[[$xwikiUserDoc.display('first_name') **$xwikiUserDoc.display('last_name')**>>$xwikiUserName]]#if( !$foreach.last ) • #end 102 102 #end 103 103 #end 104 -{{/velocity}} 105 105 76 +>{{stringEngIta eng="Gone" ita="Passati"/}} 77 + 78 +#foreach($tipolosco in $goneList) 79 +#set($xwikiUserName = "XWiki." + $tipolosco)#set( $xwikiUserDoc = $xwiki.getDocument($xwikiUserName) ) 80 +#set($xwikiUserName = "XWiki." + $tipolosco)#set( $xwikiUserDoc = $xwiki.getDocument($xwikiUserName) ) 81 +[[$xwikiUserDoc.display('first_name') **$xwikiUserDoc.display('last_name')**>>$xwikiUserName]]#if( !$foreach.last ) • #end 82 +#end 83 +{{/velocity}}