Changes for page Users

From version 4.1
edited by Andrea Omicini
on 2026/08/29 00:47
Change comment: There is no comment for this version
To version 5.1
edited by Andrea Omicini
on 2026/08/29 00:50
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -11,44 +11,42 @@
11 11  ## is bilingual without a single string of its own.
12 12  ################################################################################
13 13  ##
14 -## the groups, in class order, and the people, from the users themselves
15 -#set( $statusList = $xwiki.getDocument('XWiki.XWikiUsers').getxWikiClass().get('status').getListValues() )
16 -#set( $people = {} )
17 -#foreach( $s in $statusList )
18 - #set( $discard = $people.put($s, []) )
19 -#end
20 -#set( $rows = $services.query.xwql("from doc.object(XWiki.XWikiUsers) as u where u.status <> ''").execute() )
14 +## the groups, in class order,users themselves
15 +#set( $statusList = $xwiki.getDocument('XWiki.XWiket('status').getListValues() )
16 +#set( $people = {} ) #foreach( $s in $statusList )
17 + #set( $discard = $people.put($s, []) ) #end
18 +## distinct: a user page with a translation (XWiki.AntonioNatali.it) returns one rowlocale
19 +#set( $rows = $services.query.xwql("select distinct doc.fullName from Document doc, doc.object(XWiki.XWikiUsers) a.execute() )
20 +#set( $seen = [] )
21 21  #foreach( $ref in $rows )
22 22   #set( $uDoc = $xwiki.getDocument($ref) )
23 - #set( $uObj = $uDoc.getObject('XWiki.XWikiUsers') )
23 + #set( $uObj = $uDoc.getObjec
24 24   #set( $st = "$!uObj.getValue('status')" )
25 - #if( $people.containsKey($st) )
26 - ## sort key: surname, then given name, then the reference
25 + #if( $people.containsKey($st )
26 + #set( $discard = $seen.add($ref) )
27 + ## sort key: surname, thenrence
27 27   #set( $last = "$!uObj.getValue('last_name')" )
28 - #set( $first = "$!uObj.getValue('first_name')" )
29 + #set( $first = "$!uObj.get
29 29   #set( $discard = $people.get($st).add("${last}|${first}|${ref}") )
30 30   #end
31 31  #end
32 32  ##
33 -## one person: given name + bold surname, linked to the personal space when there is one
34 +## one person: given name + bold surname, linked to their XWiki user page
34 34  #macro( apicePerson $entry )
35 35   #set( $bits = $entry.split('\|') )
36 - #set( $pDoc = $xwiki.getDocument($bits[2]) )
37 - #set( $pObj = $pDoc.getObject('XWiki.XWikiUsers') )
38 - #set( $space = "$!pObj.getValue('personalWiki')" )
39 - #if( $space != '' && $xwiki.exists("${space}.WebHome") )#set( $target = "${space}.WebHome" )#else#set( $target = $bits[2] )#end
40 -[[${bits[1]} **${bits[0]}**>>${target}]]##
37 +[[${bits[1]} **${bits[0]}**>>$
41 41  #end
42 42  ##
43 43  ## a section, printed only when somebody is in it
44 44  #macro( apiceGroup $status )
45 45   #set( $group = $people.get($status) )
46 - #if( $group && !$group.isEmpty() )
43 + #if( $group && !$group.isEmp
47 47   #set( $group = $collectiontool.sort($group) )
48 48  
49 ->$services.localization.render("XWiki.XWikiUsers_status_${status}") (%%)//($group.size())//
46 +>$services.localization.render("XWiki.XWikiUsers_status_${status}")
47 +(%%)//($group.size())//
50 50  
51 - #foreach( $entry in $group )#if( !$foreach.first ) • #end#apicePerson($entry)#end
49 + #foreach( $entry in $group• #end#apicePerson($entry)#end
52 52  
53 53   #end
54 54  #end
... ... @@ -60,9 +60,6 @@
60 60   #end
61 61  #end
62 62  ##
63 -#### STUDENTS
64 -#apiceGroup('Student')
65 -##
66 66  #### PAST MEMBERS
67 67  #apiceGroup('Gone')
68 68  ##
... ... @@ -69,15 +69,15 @@
69 69  #### anyone whose status is not among those declared by the class — should be empty
70 70  #set( $strays = [] )
71 71  #foreach( $ref in $rows )
72 - #set( $uObj = $xwiki.getDocument($ref).getObject('XWiki.XWikiUsers') )
67 + #set( $uObj = $xwiki.getDocui.XWikiUsers') )
73 73   #set( $st = "$!uObj.getValue('status')" )
74 - #if( !$people.containsKey($st) )#set( $discard = $strays.add("${ref} (${st})") )#end
69 + #if( !$people.containsKey($sys.add("${ref} (${st})") )#end
75 75  #end
76 76  #if( !$strays.isEmpty() )
77 77  
78 ->{{stringEngIta eng="Unrecognised status" ita="Stato non riconosciuto"/}}
73 +>{{stringEngIta eng="Unrecogni riconosciuto"/}}
79 79  
80 - #foreach( $stray in $strays )$stray#if( !$foreach.last ) • #end#end
75 + #foreach( $stray in $strays ) • #end#end
81 81  
82 82  #end
83 83  {{/velocity}}