Modifiche per il documento Utenti
Dalla versione 10.1
modificato da Andrea Omicini
il 2026/08/29 17:36
il 2026/08/29 17:36
Cambia il commento:
status recode: match the new lowercase values
Alla versione 5.1
modificato da Andrea Omicini
il 2026/08/29 00:50
il 2026/08/29 00:50
Cambia il commento:
Nessun commento per questa versione
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -5,33 +5,28 @@ 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 7 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. 8 +## up here; change someone's status and they move. 10 10 ## 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. 13 13 ################################################################################ 14 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 -#set( $people = {} ) 18 -#foreach( $s in $statusList ) 19 - #set( $discard = $people.put($s, []) ) 20 -#end 21 -## distinct: a user page with a translation (XWiki.AntonioNatali.it) returns one row per locale 22 -#set( $rows = $services.query.xwql("select distinct doc.fullName from Document doc, 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() ) 23 23 #set( $seen = [] ) 24 24 #foreach( $ref in $rows ) 25 25 #set( $uDoc = $xwiki.getDocument($ref) ) 26 - #set( $uObj = $uDoc.getObjec t('XWiki.XWikiUsers') )23 + #set( $uObj = $uDoc.getObjec 27 27 #set( $st = "$!uObj.getValue('status')" ) 28 - ## `active` is unset on most user objects, so only an explicit 0 counts as disabled 29 - #set( $isActive = ("$!uObj.getValue('active')" != '0') ) 30 - #if( $people.containsKey($st) && $isActive && !$seen.contains($ref) ) 25 + #if( $people.containsKey($st ) 31 31 #set( $discard = $seen.add($ref) ) 32 - ## sort key: surname, then given name, then thereference27 + ## sort key: surname, thenrence 33 33 #set( $last = "$!uObj.getValue('last_name')" ) 34 - #set( $first = "$!uObj.get Value('first_name')" )29 + #set( $first = "$!uObj.get 35 35 #set( $discard = $people.get($st).add("${last}|${first}|${ref}") ) 36 36 #end 37 37 #end ... ... @@ -39,18 +39,19 @@ 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 -[[${bits[1]} **${bits[0]}**>>$ {bits[2]}]]##37 +[[${bits[1]} **${bits[0]}**>>$ 43 43 #end 44 44 ## 45 45 ## a section, printed only when somebody is in it 46 46 #macro( apiceGroup $status ) 47 47 #set( $group = $people.get($status) ) 48 - #if( $group && !$group.isEmp ty() )43 + #if( $group && !$group.isEmp 49 49 #set( $group = $collectiontool.sort($group) ) 50 50 51 51 >$services.localization.render("XWiki.XWikiUsers_status_${status}") 47 +(%%)//($group.size())// 52 52 53 - #foreach( $entry in $group )#if( !$foreach.first )• #end#apicePerson($entry)#end49 + #foreach( $entry in $group• #end#apicePerson($entry)#end 54 54 55 55 #end 56 56 #end ... ... @@ -57,27 +57,26 @@ 57 57 ## 58 58 #### CURRENT PEOPLE — every status except students and past members 59 59 #foreach( $s in $statusList ) 60 - #if( $s != ' student' && $s != 'gone' )56 + #if( $s != 'Student' && $s != 'Gone' ) 61 61 #apiceGroup($s) 62 62 #end 63 63 #end 64 64 ## 65 65 #### PAST MEMBERS 66 -#apiceGroup(' gone')62 +#apiceGroup('Gone') 67 67 ## 68 68 #### anyone whose status is not among those declared by the class — should be empty 69 69 #set( $strays = [] ) 70 70 #foreach( $ref in $rows ) 71 - #set( $uObj = $xwiki.getDocu ment($ref).getObject('XWiki.XWikiUsers') )67 + #set( $uObj = $xwiki.getDocui.XWikiUsers') ) 72 72 #set( $st = "$!uObj.getValue('status')" ) 73 - #if( !$people.containsKey($s t) )#set( $discard = $strays.add("${ref} (${st})") )#end69 + #if( !$people.containsKey($sys.add("${ref} (${st})") )#end 74 74 #end 75 75 #if( !$strays.isEmpty() ) 76 76 77 ->{{stringEngIta eng="Unrecogni sedstatus" ita="Stato nonriconosciuto"/}}73 +>{{stringEngIta eng="Unrecogni riconosciuto"/}} 78 78 79 - #foreach( $stray in $strays )$stray#if(!$foreach.last) • #end#end75 + #foreach( $stray in $strays ) • #end#end 80 80 81 81 #end 82 82 {{/velocity}} 83 -