Changes for page Users
From version 9.1
edited by Andrea Omicini
on 2026/08/29 01:11
on 2026/08/29 01:11
Change comment:
There is no comment for this version
To version 16.1
edited by Andrea Omicini
on 2026/08/29 18:27
on 2026/08/29 18:27
Change comment:
house layout: mainheader, index bar and per-group separators
Summary
-
Page properties (1 modified, 0 added, 0 removed)
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,12 +8,24 @@ 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 16 16 #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) ) ) 17 17 #set( $people = {} ) 18 18 #foreach( $s in $statusList ) 19 19 #set( $discard = $people.put($s, []) ) ... ... @@ -36,6 +36,16 @@ 36 36 #end 37 37 #end 38 38 ## 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 +## 39 39 ## one person: given name + bold surname, linked to their XWiki user page 40 40 #macro( apicePerson $entry ) 41 41 #set( $bits = $entry.split('\|') ) ... ... @@ -42,30 +42,65 @@ 42 42 [[${bits[1]} **${bits[0]}**>>${bits[2]}]]## 43 43 #end 44 44 ## 45 -## a section, printed only when somebody is in it 46 -#macro( apiceGroup $status ) 47 - #set( $group = $people.get($status) ) 48 - #if( $group && !$group.isEmpty() ) 49 - #set( $group = $collectiontool.sort($group) ) 50 - 51 ->$services.localization.render("XWiki.XWikiUsers_status_${status}") 52 - 53 - #foreach( $entry in $group )#if( !$foreach.first ) • #end#apicePerson($entry)#end 54 - 55 - #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## 56 56 #end 57 57 ## 58 -#### CURRENT PEOPLE — every status except students and past members 59 -#foreach( $s in $statusList ) 60 - #if( $s != 'Student' && $s != 'Gone' ) 61 - #apiceGroup($s) 62 - #end 63 -#end 72 +{{html clean="false" wiki="true"}} 73 +#template('apice_macros.vm') 64 64 ## 65 -#### PAST MEMBERS 66 -#apiceGroup('Gone') 67 -## 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"> / </span> 80 +$escapetool.xml($wanted) 81 +</div> 82 +<div class="mainselectbar"> 83 +#foreach( $s in $statusList )#if( !$foreach.first ) • #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"> / </span> 91 +$services.localization.render("XWiki.XWikiUsers_status_${wanted}") 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> 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 ) • #end[[$services.localization.render("XWiki.XWikiUsers_status_${s}")>>||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 ) • #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"> / </span> 119 +$services.localization.render("XWiki.XWikiUsers_status_${s}") 120 + •  121 +#anchorlinks() 122 +</div> 123 +#end 68 68 #### anyone whose status is not among those declared by the class — should be empty 125 +#if( $wanted == '' ) 69 69 #set( $strays = [] ) 70 70 #foreach( $ref in $rows ) 71 71 #set( $uObj = $xwiki.getDocument($ref).getObject('XWiki.XWikiUsers') ) ... ... @@ -73,11 +73,15 @@ 73 73 #if( !$people.containsKey($st) )#set( $discard = $strays.add("${ref} (${st})") )#end 74 74 #end 75 75 #if( !$strays.isEmpty() ) 76 - 77 ->{{stringEngIta eng="Unrecognised status" ita="Stato non riconosciuto"/}} 78 - 79 - #foreach( $stray in $strays )$stray#if( !$foreach.last ) • #end#end 80 - 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 ) • #end#end 138 +</div> 81 81 #end 140 +#end 141 +#end 142 +{{/html}} 82 82 {{/velocity}} 83 83