Changes for page Supervisors

From version 91.1
edited by Andrea Omicini
on 29/01/2023 21:23
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
Parent
... ... @@ -1,1 +1,1 @@
1 -Theses.Clouds.WebHome
1 +Theses.WebHome
Content
... ... @@ -1,88 +1,43 @@
1 -= {{velocity}}#if( $request.tag )(% style="color:$theme.textSecondaryColor" %)supervisor : (%%){{namesFromUsers linked='false'}}$request.tag{{/namesFromUsers}}#{else}{{stringEngIta eng="Supervisors" ita= "Supervisori"/}}#{end}{{/velocity}} =
2 -
3 -{{include reference="Theses.Environment" excludeFirstHeading="true"/}}{{velocity}}
4 -## thesis page with menus
5 -#set( $thesisMenu = true )
6 -##
7 -#### tag parameter possibly brings name to be used as tag
8 -## no tag parameter --> just the cloud
9 -## yes tag parameter --> the item list
10 -##
11 -## NO TAG PARAMETER
1 +{{include reference = "MacroSheet" /}}{{velocity}}
12 12  #if( !$request.tag )
13 -## subtitle
14 ->{{stringEngIta eng="$objectEngPlural" ita= "$objectItaPlural"/}}#if( $oneUser ) / $userFirstName $userLastName#{end}
15 -## set query
16 - #set( $query = ", BaseObject as obj, LargeStringProperty as prop0, StringProperty as prop1, DateProperty as prop2
17 - where obj.name = doc.fullName and obj.className = '${objectSpace}.${objectClass}' and obj.name <> '${objectSpace}.${objectTemplate}' and prop0.id.id = obj.id and prop1.id.id = obj.id and prop2.id.id = obj.id and prop0.name = 'supervisors' #if( $oneUser )and prop0.value like '$userString'#end and prop1.name = 'status' and lower(prop1.value) = 'completed' and prop2.name = 'end' order by prop2.value desc" )
18 -## execute query
19 - #set( $itemFound = $xwiki.searchDocuments($query) )
20 - #set( $itemFoundNo = $itemFound.size() )
21 -## name-item map
22 - #set( $nameMap = {} )
23 -## START EACH ITEM IN MAP
24 - #foreach( $item in $itemFound )
25 -## set $doc & $obj
26 - #set( $itemDoc = $xwiki.getDocument($item) )
27 - #set( $itemObj = $itemDoc.getObject("${objectSpace}.${objectClass}") )
28 - #set( $nameList = $itemObj.getValue("supervisors").split(",") )
29 -## set user-item map
30 - #foreach( $name in $nameList )
31 -#### build name lists
32 - #if( $nameMap.keySet().contains($name) )
33 -## nameMap already contains current name
34 -## add $item to nameMap for current name
35 - #set( $discard = $nameMap[$name].add($item) )
36 - #elseif( !$oneUser || $oneUser && $name != $userName )
37 -## nameMap does not contain name or selected user
38 -## add name / selected user to nameMap
39 - #set( $nameMap[$name] = [] )
40 - ## adding $item to nameMap for $name
41 - #set( $discard = $nameMap[$name].add($item) )
42 - #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%" )
43 43   #end
44 -#### END / feed name list from each item
45 - #end
46 -## END EACH ITEM IN MAP
47 -## final values: $nameMap
48 - #set( $nameFoundNo = $nameMap.keySet().size() )
49 -## tag cloud
50 -(% style='text-align:center' %)(((
51 - #foreach( $name in $nameMap.keySet() )
52 - #set( $nameItemNo = $nameMap[$name].size() )
53 - #if( $nameItemNo > 40 )#set( $tagSize = "140%" )
54 - #elseif( $nameItemNo > 30 )#set( $tagSize = "135%" )
55 - #elseif( $nameItemNo > 20 )#set( $tagSize = "130%" )
56 - #elseif( $nameItemNo > 10 )#set( $tagSize = "125%" )
57 - #elseif( $nameItemNo > 5 )#set( $tagSize = "120%" )
58 - #elseif( $nameItemNo > 3 )#set( $tagSize = "110%" )
59 - #elseif( $nameItemNo == 3 )#set( $tagSize = "105%" )
60 - #elseif( $nameItemNo == 2 )#set( $tagSize = "100%" )
61 - #else#set( $tagSize = "90%" )
62 - #end
63 -[[(% style='font-size:$tagSize; white-space: nowrap' %){{namesFromUsers linked='false'}}$name{{/namesFromUsers}}(%%)>>$doc||queryString='tag=$name']](% style='font-style:normal;color:$theme.textPrimaryColor;font-size:75%' %),,$nameItemNo,, (%%) #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
64 64  )))
65 -## cloud bottom
66 -(% style='font-style:oblique;font-size:smaller;text-align:right;color:$theme.textSecondaryColor' %)(((
67 -[ $nameFoundNo #if( $nameFoundNo == 1 ){{stringEngIta eng="supervisor" ita="supervisore"/}}#else{{stringEngIta eng="supervisors" ita="supervisori"/}}#end / $itemFoundNo #if( $itemFoundNo == 1 ){{stringEngIta eng="$objectEngSingular.toLowerCase()" ita="$objectItaSingular.toLowerCase()"/}}#else{{stringEngIta eng = "$objectEngPlural.toLowerCase()" ita="$objectItaPlural.toLowerCase()"/}}#end ]
68 -)))
69 -#### YES TAG PARAMETER
70 70  #else
71 -## set query
72 - #set( $query = ", BaseObject as obj, LargeStringProperty as prop0, StringProperty as prop1, DateProperty as prop2
73 - where obj.name = doc.fullName and obj.className = '${objectSpace}.${objectClass}' and obj.name <> '${objectSpace}.${objectTemplate}' and prop0.id.id = obj.id and prop1.id.id = obj.id and prop2.id.id = obj.id and prop0.name = 'supervisors' and prop0.value like '%$request.tag%' and prop1.name = 'status' and lower(prop1.value) = 'completed' and prop2.name = 'end' order by prop2.value desc" )
74 -## execute query
75 - #set( $itemFound = $xwiki.searchDocuments($query) )
76 - #set( $itemFoundNo = $itemFound.size() )
77 -## subtitle
78 ->$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
79 -## 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
80 80  (((
81 - #foreach( $item in $itemFound )
82 -[[image:icon:book]] {{thesis}}$item{{/thesis}}
83 - #end
34 +#foreach( $thesis in $thesisFound)
35 + #set($thesisDoc = $xwiki.getDocument($thesis) )
36 +* {{thesis}}$thesisDoc{{/thesis}}
37 +#end
84 84  )))
85 -## thesis list bottom
86 -(% 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 +
87 87  #end
88 88  {{/velocity}}