Changes for page Supervisors

From version 99.1
edited by Andrea Omicini
on 30/06/2023 00:44
Change comment: There is no comment for this version
To version 69.1
edited by Andrea Omicini
on 08/11/2021 01:51
Change comment: There is no comment for this version

Summary

Details

Page properties
Title
... ... @@ -1,1 +1,0 @@
1 -#if($request.tag)$services.localization.render('supervisor').toLowerCase() : $xwiki.getUserName($request.tag,false)#else$services.localization.render('supervisors')#end
Parent
... ... @@ -1,1 +1,1 @@
1 -Theses.Clouds.WebHome
1 +Theses.WebHome
Default language
... ... @@ -1,0 +1,1 @@
1 +en
Content
... ... @@ -1,87 +1,43 @@
1 -{{velocity}}
2 -{{html clean="false" wiki="true"}}
3 -#template('apice_theses.vm')
4 -##
5 -#### tag parameter possibly brings name to be used as tag
1 +{{include reference = "MacroSheet" /}}{{velocity}}
6 6  #if( !$request.tag )
7 -## no tag parameter --> just the cloud
8 -## set query
9 - #set( $query = ", BaseObject as objThesis, LargeStringProperty as propSupervisors, StringProperty as propStatus, DateProperty as propEnddate
10 - where objThesis.name = doc.fullName and objThesis.className = '${objectSpace}.${objectClass}' and objThesis.name <> '${objectSpace}.${objectTemplate}' and propSupervisors.id.id = objThesis.id and propStatus.id.id = objThesis.id and prop2.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" )
11 -## execute query
12 - #set( $itemFound = $xwiki.searchDocuments($query) )
13 - #set( $itemFoundNo = $itemFound.size() )
14 -## name-item map
15 - #set( $nameMap = {} )
16 -## START EACH ITEM IN MAP
17 - #foreach( $item in $itemFound )
18 -## set $doc & $obj
19 - #set( $itemDoc = $xwiki.getDocument($item) )
20 - #set( $nameList = $itemDoc.getValue("supervisors").split(",") )
21 -## set user-item map
22 - #foreach( $name in $nameList )
23 -#### build name lists
24 - #if( $nameMap.keySet().contains($name) )
25 -## nameMap already contains current name
26 -## add $item to nameMap for current name
27 - #set( $discard = $nameMap[$name].add($item) )
28 - #elseif( !$oneUser || $oneUser && $name != $userName )
29 -## nameMap does not contain name or selected user
30 -## add name / selected user to nameMap
31 - #set( $nameMap[$name] = [] )
32 - ## adding $item to nameMap for $name
33 - #set( $discard = $nameMap[$name].add($item) )
34 - #end
3 +## no tag specified in the query
4 +>**Tag Cloud** / {{stringEngIta eng="Theses" ita="Tesi" /}}
5 +
6 +#set( $from = ", BaseObject as obj0" )
7 +#set( $where = " obj0.name = doc.fullName and obj0.className = 'Theses.ThesisClass' and obj0.name <> 'Theses.ThesisClassTemplate' and obj0.name <> 'Theses.ThesisTemplate' " )
8 +#set( $tagCount = $xwiki.tag.getTagCountForQuery($from, $where) )
9 +(% style='text-align: center' %)(((
10 +#foreach( $thesisTag in $tagCount.keySet() )
11 + #set( $thesisCount = $tagCount.get($thesisTag) )
12 + #if( $thesisCount > 20 ) #set ( $tagSize = "140%" )
13 + #elseif( $thesisCount > 10 ) #set ( $tagSize = "130%" )
14 + #elseif( $thesisCount > 5 ) #set ( $tagSize = "120%" )
15 + #elseif( $thesisCount > 3 ) #set ( $tagSize = "110%" )
16 + #elseif( $thesisCount == 3 ) #set ( $tagSize = "105%" )
17 + #elseif( $thesisCount == 2 ) #set ( $tagSize = "100%" )
18 + #else#set ($tagSize = "90%" )
35 35   #end
36 -#### END / feed name list from each item
37 - #end
38 -## END EACH ITEM IN MAP
39 -## final values: $nameMap
40 - #set( $nameFoundNo = $nameMap.keySet().size() )
41 -### CLOUD PAGE / START
42 -<div class="mainheader">
43 - $services.localization.render('theses').toLowerCase()
44 -</div>
45 -<div style='text-align: center'>
46 - #foreach( $name in $nameMap.keySet() )
47 - #set( $nameItemNo = $nameMap[$name].size() )
48 - #if( $nameItemNo > 40 )#set( $tagSize = "140%" )
49 - #elseif( $nameItemNo > 30 )#set( $tagSize = "135%" )
50 - #elseif( $nameItemNo > 20 )#set( $tagSize = "130%" )
51 - #elseif( $nameItemNo > 10 )#set( $tagSize = "125%" )
52 - #elseif( $nameItemNo > 5 )#set( $tagSize = "120%" )
53 - #elseif( $nameItemNo > 3 )#set( $tagSize = "110%" )
54 - #elseif( $nameItemNo == 3 )#set( $tagSize = "105%" )
55 - #elseif( $nameItemNo == 2 )#set( $tagSize = "100%" )
56 - #else#set( $tagSize = "90%" )
57 - #end
58 -<span style='font-size:$tagSize; white-space: nowrap'>&ensp;[[#if( $name.startsWith("XWiki.") )$xwiki.getUserName($name,false)#else$name#end>>$doc]]</span><sub class='textprimary' style="font-size: .75em">$nameItemNo</sub>&ensp;
59 - #end
60 -</div>
61 -## cloud bottom
62 -<div class="menuqualifier" style="text-align: right">
63 -[ $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 ]
64 -</div>
65 -### CLOUD PAGE / END
20 + #set( $urlEscapedTag = $escapetool.url($thesisTag) )
21 + #set( $htmlEscapedTag = $escapetool.xml($thesisTag) )
22 +(% style='font-size:$tagSize' %) [[$thesisTag>>Theses.Tags||queryString="tag=$urlEscapedTag"]] (%%)#end
23 +)))
66 66  #else
67 -## yes tag parameter --> the item list
68 -##
69 -#### TAG PAGE / START
70 - #set( $query = ", BaseObject as objThesis, LargeStringProperty as propSupervisors, StringProperty as propStatus, DateProperty as propEnddate
71 - where objThesis.name = doc.fullName and objThesis.className = '${objectSpace}.${objectClass}' and objThesis.name <> '${objectSpace}.${objectTemplate}' 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" )
72 -## execute query
73 - #set( $itemFound = $xwiki.searchDocuments($query) )
74 - #set( $itemFoundNo = $itemFound.size() )
75 -## subtitle
76 ->$itemFoundNo #if( $itemFoundNo == 1 ){{stringEngIta eng="$objectEngSingular.toLowerCase()" ita="$objectItaSingular.toLowerCase()"/}}#else{{stringEngIta eng="$objectEngPlural.toLowerCase()" ita="$objectItaPlural.toLowerCase()"/}}#end#if( $request.user ) / {{namesFromUsers linked='false'}}$request.user{{/namesFromUsers}}#end#if( $request.name && $request.surname ) / {{namesFromUsers linked='false'}}$request.name $request.surname{{/namesFromUsers}}#end
77 -## talk list
25 +## one tag specified in the query
26 +>Tag “**$request.tag**” / {{stringEngIta eng = "Theses" ita = "Tesi" /}}
27 +
28 +#set( $from = ", BaseObject as obj0, DBStringListProperty as prop0 join prop0.list item, BaseObject as obj1, DateProperty as prop1, StringProperty as prop2" )
29 +#set( $where = "obj0.className = 'XWiki.TagClass' and obj0.name = doc.fullName and obj0.id = prop0.id.id and prop0.id.name = 'tags' and lower(item) = lower('$request.tag') and obj1.name = doc.fullName and obj1.className = 'Theses.ThesisClass' and obj1.name <> 'Theses.ThesisClassTemplate' and obj1.name <> 'Theses.ThesisTemplate' and prop1.id.id = obj1.id and prop2.id.id = obj1.id and prop1.name = 'endDate' and prop2.name = 'status' and lower(prop2.value) <> 'out-of-date' order by prop1.value desc" )
30 +#set( $sql = $from + " where " + $where )
31 +#set( $thesisFound = $xwiki.searchDocuments($sql) )
32 +## show tag
78 78  (((
79 - #foreach( $item in $itemFound )
80 -[[image:icon:book]] {{thesis linked="title"}}$item{{/thesis}}
81 - #end
34 +#foreach( $thesis in $thesisFound)
35 + #set($thesisDoc = $xwiki.getDocument($thesis) )
36 +* {{thesis}}$thesisDoc{{/thesis}}
37 +#end
82 82  )))
83 -## thesis list bottom
84 -(% style='font-style:oblique;font-size:smaller;text-align:right;color:$theme.textSecondaryColor' %)((([ [[{{stringEngIta eng="supervisor cloud" ita="nuvola supervisori" /}}>>$doc||]] / {{stringEngIta eng = "$objectEngPlural.toLowerCase()" ita = "$objectItaPlural.toLowerCase()"/}} ])))(%%)
39 +
40 +(% style='font-style:oblique;font-size:smaller;text-align:right;color:gray' %)((([ [[tag cloud>>Tags]] / {{stringEngIta eng = "theses" ita = "tesi"/}} ])))(%%)
41 +
85 85  #end
86 -{{/html}}
87 -{{/velocity}}{{pageDisplay sort="objectservice"/}}
43 +{{/velocity}}