Changes for page Users

From version 12.1
edited by Andrea Omicini
on 2026/08/29 17:48
Change comment: cleaner query links on the unknown-status notice
To version 18.1
edited by Andrea Omicini
on 2026/08/29 18:32
Change comment: lowercase the labels in the select bar

Summary

Details

Page properties
Content
... ... @@ -1,6 +1,6 @@
1 1  {{velocity}}
2 2  ################################################################################
3 -## People — built from the `status` field of XWiki.XWikiUsers.
3 +## Users — built from the `status` field of XWiki.XWikiUsers.
4 4  ##
5 5  ## Nothing is hand-maintained here: the groups are the values declared by
6 6  ## XWiki.XWikiUsers.status, in the class's own order, and every user carrying a
... ... @@ -8,8 +8,15 @@
8 8  ## up here; change someone's status and they move. Disabled accounts (active = 0)
9 9  ## are left out.
10 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 +##
11 11  ## Headings use the translation keys XWiki.XWikiUsers_status_<value>, so the page
12 12  ## 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.
13 13  ################################################################################
14 14  ##
15 15  ## the groups, in class order, and the people, from the users themselves
... ... @@ -41,6 +41,16 @@
41 41   #end
42 42  #end
43 43  ##
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
59 +#end
60 +##
44 44  ## one person: given name + bold surname, linked to their XWiki user page
45 45  #macro( apicePerson $entry )
46 46   #set( $bits = $entry.split('\|') )
... ... @@ -47,46 +47,66 @@
47 47  [[${bits[1]} **${bits[0]}**>>${bits[2]}]]##
48 48  #end
49 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 -
56 ->$services.localization.render("XWiki.XWikiUsers_status_${status}")
57 -
58 - #foreach( $entry in $group )#if( !$foreach.first ) • #end#apicePerson($entry)#end
59 -
60 - #end
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##
61 61  #end
62 62  ##
72 +{{html clean="false" wiki="true"}}
73 +#template('apice_macros.vm')
74 +##
63 63  #if( !$known )
64 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)**
66 -
67 - #foreach( $s in $statusList )[[$services.localization.render("XWiki.XWikiUsers_status_${s}")>>path:$doc.getURL('view', "status=${s}")]]#if( !$foreach.last ) • #end#end
68 -
69 -#elseif( $wanted != '' )
70 -#### ONE GROUP, ASKED FOR BY ?status= — students included, like any other value
71 - #if( $people.get($wanted).isEmpty() )
72 -
73 ->{{stringEngIta eng="Nobody has this status" ita="Nessuno ha questo stato"/}}
74 -
75 - #else
76 - #apiceGroup($wanted)
77 - #end
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}").toLowerCase()>>path:$doc.getURL('view', "status=${s}")]]#end
84 +</div>
78 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
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}")
84 84  #end
85 -##
86 -#### PAST MEMBERS
87 -#apiceGroup('gone')
88 -##
93 +</div>
94 +#if( $shown.isEmpty() )
95 +<div class="mainselectbar">
96 +{{stringEngIta eng="Nobody has this status" ita="Nessuno ha questo stato"/}}
97 +</div>
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}").toLowerCase()>>||anchor="$s"]]#end
103 +</div>
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 +#### the shared macro also offers the index; with one group there is no index bar
122 +#if( $shown.size() > 1 )#anchorlinks()#else[[$services.localization.render('top').toLowerCase()>>||anchor="top"]] &bull; [[$services.localization.render('bottom').toLowerCase()>>||anchor="bottom"]]#end
123 +</div>
124 +#end
89 89  #### anyone whose status is not among those declared by the class — should be empty
126 +#if( $wanted == '' )
90 90  #set( $strays = [] )
91 91  #foreach( $ref in $rows )
92 92   #set( $uObj = $xwiki.getDocument($ref).getObject('XWiki.XWikiUsers') )
... ... @@ -94,12 +94,15 @@
94 94   #if( !$people.containsKey($st) )#set( $discard = $strays.add("${ref} (${st})") )#end
95 95  #end
96 96  #if( !$strays.isEmpty() )
97 -
98 ->{{stringEngIta eng="Unrecognised status" ita="Stato non riconosciuto"/}}
99 -
100 - #foreach( $stray in $strays )$stray#if( !$foreach.last ) • #end#end
101 -
134 +<div class="mainselectseparator">
135 +{{stringEngIta eng="Unrecognised status" ita="Stato non riconosciuto"/}}
136 +</div>
137 +<div style="font-style: normal">
138 +#foreach( $stray in $strays )$stray#if( !$foreach.last )&ensp;&bull;&ensp;#end#end
139 +</div>
102 102  #end
103 103  #end
142 +#end
143 +{{/html}}
104 104  {{/velocity}}
105 105