Wiki source code of Supervisors
author | version | line-number | content |
---|---|---|---|
![]() |
96.1 | 1 | {{velocity}} |
2 | {{html clean="false" wiki="true"}} | ||
![]() |
109.1 | 3 | #template('apice_macros.vm') |
![]() |
110.1 | 4 | #setobjectspace("Theses") |
![]() |
111.1 | 5 | #template('apice_thesis_macros.vm') |
![]() |
87.1 | 6 | #### tag parameter possibly brings name to be used as tag |
![]() |
96.1 | 7 | #if( !$request.tag ) |
![]() |
87.1 | 8 | ## no tag parameter --> just the cloud |
9 | ## set query | ||
![]() |
98.2 | 10 | #set( $query = ", BaseObject as objThesis, LargeStringProperty as propSupervisors, StringProperty as propStatus, DateProperty as propEnddate |
![]() |
111.1 | 11 | where objThesis.name = doc.fullName and objThesis.className = '${mainSpace}.Class' and objThesis.name <> '${objectPool}.Template' and propSupervisors.id.id = objThesis.id and propStatus.id.id = objThesis.id and propEnddate.id.id = objThesis.id and propSupervisors.name = 'supervisors' and propSupervisors.value <> '' and propStatus.name = 'status' and lower(propStatus.value) = 'completed' and propEnddate.name = 'end' order by propEnddate.value desc" ) |
![]() |
87.1 | 12 | ## execute query |
![]() |
89.1 | 13 | #set( $itemFound = $xwiki.searchDocuments($query) ) |
14 | #set( $itemFoundNo = $itemFound.size() ) | ||
15 | ## name-item map | ||
16 | #set( $nameMap = {} ) | ||
17 | ## START EACH ITEM IN MAP | ||
18 | #foreach( $item in $itemFound ) | ||
19 | ## set $doc & $obj | ||
20 | #set( $itemDoc = $xwiki.getDocument($item) ) | ||
![]() |
95.1 | 21 | #set( $nameList = $itemDoc.getValue("supervisors").split(",") ) |
![]() |
89.1 | 22 | ## set user-item map |
![]() |
95.1 | 23 | #foreach( $name in $nameList ) |
![]() |
89.1 | 24 | #### build name lists |
![]() |
95.1 | 25 | #if( $nameMap.keySet().contains($name) ) |
![]() |
89.1 | 26 | ## nameMap already contains current name |
27 | ## add $item to nameMap for current name | ||
![]() |
95.1 | 28 | #set( $discard = $nameMap[$name].add($item) ) |
29 | #elseif( !$oneUser || $oneUser && $name != $userName ) | ||
![]() |
89.1 | 30 | ## nameMap does not contain name or selected user |
31 | ## add name / selected user to nameMap | ||
![]() |
95.1 | 32 | #set( $nameMap[$name] = [] ) |
![]() |
89.1 | 33 | ## adding $item to nameMap for $name |
![]() |
95.1 | 34 | #set( $discard = $nameMap[$name].add($item) ) |
![]() |
89.1 | 35 | #end |
36 | #end | ||
37 | #### END / feed name list from each item | ||
38 | #end | ||
39 | ## END EACH ITEM IN MAP | ||
40 | ## final values: $nameMap | ||
41 | #set( $nameFoundNo = $nameMap.keySet().size() ) | ||
![]() |
99.1 | 42 | ### CLOUD PAGE / START |
43 | <div class="mainheader"> | ||
44 | $services.localization.render('theses').toLowerCase() | ||
45 | </div> | ||
46 | <div style='text-align: center'> | ||
![]() |
89.1 | 47 | #foreach( $name in $nameMap.keySet() ) |
48 | #set( $nameItemNo = $nameMap[$name].size() ) | ||
49 | #if( $nameItemNo > 40 )#set( $tagSize = "140%" ) | ||
50 | #elseif( $nameItemNo > 30 )#set( $tagSize = "135%" ) | ||
51 | #elseif( $nameItemNo > 20 )#set( $tagSize = "130%" ) | ||
52 | #elseif( $nameItemNo > 10 )#set( $tagSize = "125%" ) | ||
53 | #elseif( $nameItemNo > 5 )#set( $tagSize = "120%" ) | ||
54 | #elseif( $nameItemNo > 3 )#set( $tagSize = "110%" ) | ||
55 | #elseif( $nameItemNo == 3 )#set( $tagSize = "105%" ) | ||
56 | #elseif( $nameItemNo == 2 )#set( $tagSize = "100%" ) | ||
![]() |
69.3 | 57 | #else#set( $tagSize = "90%" ) |
![]() |
50.1 | 58 | #end |
![]() |
102.1 | 59 | #set( $urlEscapedName = $escapetool.url($name) ) |
![]() |
104.1 | 60 | <span style='font-size:$tagSize; white-space: nowrap'> [[#if( $name.startsWith("XWiki.") )$xwiki.getUserName($name,false)#else$name#end>>$doc||queryString="tag=$urlEscapedName"]]</span><sub class='textprimary' style="font-size: .75em">$nameItemNo</sub>  |
![]() |
99.1 | 61 | #end |
62 | </div> | ||
![]() |
87.1 | 63 | ## cloud bottom |
![]() |
99.1 | 64 | <div class="menuqualifier" style="text-align: right"> |
65 | [ $nameFoundNo #if( $nameFoundNo == 1 )$services.localization.render('supervisor').toLowerCase()#{else}$services.localization.render('supervisors').toLowerCase()#end / $itemFoundNo #if( $itemFoundNo == 1 )$services.localization.render('thesis').toLowerCase()#{else}$services.localization.render('theses').toLowerCase()#end ] | ||
66 | </div> | ||
67 | ### CLOUD PAGE / END | ||
![]() |
87.1 | 68 | #else |
![]() |
99.1 | 69 | ## yes tag parameter --> the item list |
70 | ## | ||
71 | #### TAG PAGE / START | ||
![]() |
98.2 | 72 | #set( $query = ", BaseObject as objThesis, LargeStringProperty as propSupervisors, StringProperty as propStatus, DateProperty as propEnddate |
![]() |
111.1 | 73 | where objThesis.name = doc.fullName and objThesis.className = '${mainSpace}.Class' and objThesis.name <> '${objectPool}.Template' and propSupervisors.id.id = objThesis.id and propStatus.id.id = objThesis.id and propEnddate.id.id = objThesis.id and propSupervisors.name = 'supervisors' and propSupervisors.value like '%$request.tag%' and propStatus.name = 'status' and lower(propStatus.value) = 'completed' and propEnddate.name = 'end' order by propEnddate.value desc" ) |
![]() |
89.1 | 74 | ## execute query |
![]() |
87.1 | 75 | #set( $itemFound = $xwiki.searchDocuments($query) ) |
![]() |
105.1 | 76 | #set( $itemNo = $itemFound.size() ) |
![]() |
87.1 | 77 | ## subtitle |
![]() |
101.1 | 78 | <div class="mainheader"> |
![]() |
108.1 | 79 | $itemNo |
80 | #if( $itemNo > 1) | ||
81 | $services.localization.render('theses').toLowerCase() | ||
82 | #else | ||
83 | $services.localization.render('thesis').toLowerCase() | ||
84 | #end | ||
![]() |
101.1 | 85 | </div> |
86 | ## thesis list | ||
![]() |
87.1 | 87 | #foreach( $item in $itemFound ) |
![]() |
101.1 | 88 | <div> |
89 | [[image:icon:book]] #thesislinked($item) | ||
90 | </div> | ||
![]() |
69.3 | 91 | #end |
![]() |
91.1 | 92 | ## thesis list bottom |
![]() |
101.1 | 93 | <div class="menuqualifier" style="text-align: right"> |
94 | [ [[{{stringEngIta eng="supervisor cloud" ita="nuvola relatori" /}}>>$doc.name]] / $services.localization.render('theses').toLowerCase() ] | ||
95 | </div> | ||
![]() |
55.1 | 96 | #end |
![]() |
96.1 | 97 | {{/html}} |
98 | {{/velocity}}{{pageDisplay sort="objectservice"/}} |