Changes for page Users

From version 16.1
edited by Andrea Omicini
on 2026/08/29 18:27
Change comment: house layout: mainheader, index bar and per-group separators
To version 1.1
edited by Andrea Omicini
on 2026/02/11 18:08
Change comment: Imported from XAR

Summary

Details

Page properties
Content
... ... @@ -1,144 +1,83 @@
1 1  {{velocity}}
2 -################################################################################
3 -## Users — 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 -## ?status=<value> narrows the page to that one group. The value is checked
12 -## against the list the class itself declares, so no status value is written
13 -## down here: change the class and grouping, filter and bar all follow.
14 -##
15 -## Headings use the translation keys XWiki.XWikiUsers_status_<value>, so the page
16 -## is bilingual without a single string of its own.
17 -##
18 -## Layout follows the house pattern of Talks.PerYear.Showcase: mainheader,
19 -## mainselectbar index, then one mainselectseparator / mainselectbottom per group.
20 -################################################################################
21 -##
22 -## the groups, in class order, and the people, from the users themselves
23 -#set( $statusList = $xwiki.getDocument('XWiki.XWikiUsers').getxWikiClass().get('status').getListValues() )
24 -## an optional ?status=<value> filter. The value is validated against the list the
25 -## class itself declares, so no status value is written down here: change the class
26 -## and both the grouping and the filter follow.
27 -#set( $wanted = "$!request.getParameter('status')" )
28 -#set( $known = ( $wanted == '' || $statusList.contains($wanted) ) )
29 -#set( $people = {} )
30 -#foreach( $s in $statusList )
31 - #set( $discard = $people.put($s, []) )
2 +#### Set Users Lists
3 +#set($almamaterList = ['AntonioNatali'])
4 +#set($tenuredList = ['RobyCasadei','EnricoDenti','SaraMontagna','GianlucaMoro','AndreaOmicini','DaniloPianini','NazzarenoPompei','ARicci','AndreaRoli','MirkoViroli'])
5 +#set($researchfellowList = ['RobertaCalegari','GiovanniCiatto'])
6 +#set($postdocList = [])
7 +#set($phdList = ['AndreaAgiollo','MartinaBaiardi4','MatteoMagnini','GPisano','AndreaRafanelli'])
8 +#set($grantList = [])
9 +#set($collaboratorList = ['ClaudiaCevenini','PierluigiContucci','MCasadei','SMariani','ACroatti','AmbraMolesini','FSabbatini'])
10 +#set($guestList = [])
11 +#set($goneList = ['MarcoAlberti3','MattiaBargellini','StefanoBenedettini','StefanoBromuri', 'PietroBrunetti2','MicheleCabano','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
32 32  #end
33 -## distinct: a user page with a translation (XWiki.AntonioNatali.it) returns one row per locale
34 -#set( $rows = $services.query.xwql("select distinct doc.fullName from Document doc, doc.object(XWiki.XWikiUsers) as u where u.status <> ''").execute() )
35 -#set( $seen = [] )
36 -#foreach( $ref in $rows )
37 - #set( $uDoc = $xwiki.getDocument($ref) )
38 - #set( $uObj = $uDoc.getObject('XWiki.XWikiUsers') )
39 - #set( $st = "$!uObj.getValue('status')" )
40 - ## `active` is unset on most user objects, so only an explicit 0 counts as disabled
41 - #set( $isActive = ("$!uObj.getValue('active')" != '0') )
42 - #if( $people.containsKey($st) && $isActive && !$seen.contains($ref) )
43 - #set( $discard = $seen.add($ref) )
44 - ## sort key: surname, then given name, then the reference
45 - #set( $last = "$!uObj.getValue('last_name')" )
46 - #set( $first = "$!uObj.getValue('first_name')" )
47 - #set( $discard = $people.get($st).add("${last}|${first}|${ref}") )
48 - #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
49 49  #end
50 -##
51 -## the groups actually on this page, in class order, and the head count
52 -#set( $shown = [] )
53 -#set( $total = 0 )
54 -#foreach( $s in $statusList )
55 - #if( ( $wanted == '' || $s == $wanted ) && !$people.get($s).isEmpty() )
56 - #set( $discard = $shown.add($s) )
57 - #set( $total = $total + $people.get($s).size() )
58 - #end
26 +
27 +>{{stringEngIta eng="Research Fellows" ita="Ricercatori"/}}
28 +
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
59 59  #end
60 -##
61 -## one person: given name + bold surname, linked to their XWiki user page
62 -#macro( apicePerson $entry )
63 - #set( $bits = $entry.split('\|') )
64 -[[${bits[1]} **${bits[0]}**>>${bits[2]}]]##
33 +
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
65 65  #end
66 -##
67 -## how many, spelled for one or many
68 -#macro( apiceCount $n )
69 -$n #if( $n == 1 )$services.localization.render('user').toLowerCase()#else$services.localization.render('users').toLowerCase()#end##
70 70  #end
71 -##
72 -{{html clean="false" wiki="true"}}
73 -#template('apice_macros.vm')
74 -##
75 -#if( !$known )
76 -#### the class does not declare this value — say so, and show what it does declare
77 -<div class="mainheader">
78 -{{stringEngIta eng="Unknown status" ita="Stato sconosciuto"/}}
79 -<span class="textsecondary">&ensp;/&ensp;</span>
80 -$escapetool.xml($wanted)
81 -</div>
82 -<div class="mainselectbar">
83 -#foreach( $s in $statusList )#if( !$foreach.first )&ensp;&bull;&ensp;#end[[$services.localization.render("XWiki.XWikiUsers_status_${s}")>>path:$doc.getURL('view', "status=${s}")]]#end
84 -</div>
85 -#else
86 -#### page subtitle: how many people, and over what
87 -<div class="mainheader">
88 -#apiceCount($total)
89 -#if( $wanted != '' )
90 -<span class="textsecondary">&ensp;/&ensp;</span>
91 -$services.localization.render("XWiki.XWikiUsers_status_${wanted}")
42 +
43 +>{{stringEngIta eng="PhD Students" ita="Studenti di dottorato"/}}
44 +
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
92 92  #end
93 -</div>
94 -#if( $shown.isEmpty() )
95 -<div class="mainselectbar">
96 -{{stringEngIta eng="Nobody has this status" ita="Nessuno ha questo stato"/}}
97 -</div>
49 +
50 +#if( $grantList != [] )
51 +>{{stringEngIta eng="Grants" ita="Assegnisti e borsisti"/}}
52 +
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
98 98  #end
99 -#### the index bar, only when the page carries more than one group
100 -#if( $shown.size() > 1 )
101 -<div class="mainselectbar" id="index">
102 -#foreach( $s in $shown )#if( !$foreach.first )&ensp;&bull;&ensp;#end[[$services.localization.render("XWiki.XWikiUsers_status_${s}")>>||anchor="$s"]]#end
103 -</div>
104 104  #end
105 -#### one block per group: separator, the people, footer
106 -#foreach( $s in $shown )
107 -<div class="mainselectseparator">
108 - <a class="mainselectseparatorlink" id="$s" href=$doc.getURL('view', "status=${s}")>
109 - $services.localization.render("XWiki.XWikiUsers_status_${s}")
110 - </a>
111 -</div>
112 -<div style="font-style: normal">
113 -#set( $group = $collectiontool.sort($people.get($s)) )
114 -#foreach( $entry in $group )#if( !$foreach.first )&ensp;&bull;&ensp;#end#apicePerson($entry)#end
115 -</div>
116 -<div #if( $foreach.last )id="bottom"#end class="mainselectbottom">
117 -#apiceCount($people.get($s).size())
118 -<span class="textsecondary">&ensp;/&ensp;</span>
119 -$services.localization.render("XWiki.XWikiUsers_status_${s}")
120 -&ensp;&bull;&ensp;
121 -#anchorlinks()
122 -</div>
58 +
59 +>{{stringEngIta eng="Collaborators" ita="Collaboratori"/}}
60 +
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
123 123  #end
124 -#### anyone whose status is not among those declared by the class — should be empty
125 -#if( $wanted == '' )
126 -#set( $strays = [] )
127 -#foreach( $ref in $rows )
128 - #set( $uObj = $xwiki.getDocument($ref).getObject('XWiki.XWikiUsers') )
129 - #set( $st = "$!uObj.getValue('status')" )
130 - #if( !$people.containsKey($st) )#set( $discard = $strays.add("${ref} (${st})") )#end
65 +
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
131 131  #end
132 -#if( !$strays.isEmpty() )
133 -<div class="mainselectseparator">
134 -{{stringEngIta eng="Unrecognised status" ita="Stato non riconosciuto"/}}
135 -</div>
136 -<div style="font-style: normal">
137 -#foreach( $stray in $strays )$stray#if( !$foreach.last )&ensp;&bull;&ensp;#end#end
138 -</div>
139 139  #end
75 +
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
140 140  #end
141 -#end
142 -{{/html}}
143 143  {{/velocity}}
144 -