Changes for page Supervisors

From version 79.2
edited by Andrea Omicini
on 20/01/2022 23:43
Change comment: There is no comment for this version
To version 101.1
edited by Andrea Omicini
on 30/06/2023 00:51
Change comment: There is no comment for this version

Summary

Details

Page properties
Title
... ... @@ -1,1 +1,1 @@
1 -#if($xcontext.language=="it")Nuvola dei tag delle tesi#{else}Thesis Tag Cloud#end
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.WebHome
1 +Theses.Clouds.WebHome
Default language
... ... @@ -1,1 +1,0 @@
1 -en
Content
... ... @@ -1,116 +1,92 @@
1 -{{include reference="Theses.Environment" excludeFirstHeading="true"/}}{{include reference="Environment" excludeFirstHeading="true"/}}{{velocity}}
2 -## thesis page with menus
3 -#set( $thesisMenu = true )
1 +{{velocity}}
2 +{{html clean="false" wiki="true"}}
3 +#template('apice_theses.vm')
4 4  ##
5 -#set( $userSelected = false )
6 -##
5 +#### tag parameter possibly brings name to be used as tag
7 7  #if( !$request.tag )
8 -## START NO TAG specified in the query
9 - #if( $userName )
10 - #if( $xwiki.exists($userName) )
11 - #set( $userDoc = $xwiki.getDocument($userName) )
12 - #set( $userFirstName = $userDoc.display("first_name") )
13 - #set( $userLastName = $userDoc.display("last_name") )
14 - #set( $userSelected = true )
15 - #else
16 -{{warning}}"$userName" looks not like any known APICe user{{/warning}}
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 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" )
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
17 17   #end
36 +#### END / feed name list from each item
18 18   #end
19 - #if( !$userSelected && $request.user )
20 - #if( $xwiki.exists("XWiki.$request.user") )
21 - #set( $userSelected = true )
22 - #set( $userName = "XWiki.$request.user" )
23 - #elseif( $xwiki.exists("$request.user") )
24 - #set( $userSelected = true )
25 - #set( $userName = "$request.user" )
26 - #else
27 -{{warning}}"$request.user" looks not like any known APICe user{{/warning}}
28 - #end
29 - #if( $userSelected )
30 - #set( $userDoc = $xwiki.getDocument($userName) )
31 - #set( $userFirstName = $userDoc.display("first_name") )
32 - #set( $userLastName = $userDoc.display("last_name") )
33 - #end
34 - #end
35 - #if( $userSelected )
36 -> **Tag Cloud** / {{stringEngIta eng = "Theses" ita = "tesi" /}} / $userFirstName **$userLastName**
37 -
38 - #set( $from = ", BaseObject as obj0, StringProperty as prop0, LargeStringProperty as prop1, LargeStringProperty as prop2, LargeStringProperty as prop3" )
39 - #set( $where = "obj0.name = doc.fullName and obj0.className = 'Theses.ThesisClass' and obj0.name <> 'Theses.ThesisTemplate' and prop0.id.id = obj0.id and prop1.id.id = obj0.id and prop2.id.id = obj0.id and prop3.id.id = obj0.id and prop0.name = 'status' and lower(prop0.value) = 'completed' and prop1.name = 'supervisors' and prop2.name = 'cosupervisors' and prop3.name = 'contacts' and ( prop1.value like '%$userName%' or prop2.value like '%$userName%' or prop3.value like '%$userName%' )" )
40 - #else
41 ->**Tag Cloud** / {{stringEngIta eng="Theses" ita="tesi" /}}
42 -
43 - #set( $from = ", BaseObject as obj0, StringProperty as prop0" )
44 - #set( $where = "obj0.name = doc.fullName and obj0.className = 'Theses.ThesisClass' and obj0.name <> 'Theses.ThesisTemplate' and prop0.id.id = obj0.id and prop0.name = 'status' and lower(prop0.value) = 'completed'" )
45 - #end
46 - ##
47 - #set( $tagCount = $xwiki.tag.getTagCountForQuery($from, $where) )
48 - #set( $tagInstanceNo = 0 )
49 - #set( $tagNo = 0 )
50 -(% style='text-align:center' %)(((
51 - #foreach( $thesisTag in $tagCount.keySet() )
52 - #set( $thesisCount = $tagCount.get($thesisTag) )
53 - #set( $tagInstanceNo = $tagInstanceNo + $thesisCount )
54 - #set( $tagNo = $tagNo + 1 )
55 - #if( $thesisCount > 40 )#set( $tagSize = "140%" )
56 - #elseif( $thesisCount > 30 )#set( $tagSize = "135%" )
57 - #elseif( $thesisCount > 20 )#set( $tagSize = "130%" )
58 - #elseif( $thesisCount > 10 )#set( $tagSize = "125%" )
59 - #elseif( $thesisCount > 5 )#set( $tagSize = "120%" )
60 - #elseif( $thesisCount > 3 )#set( $tagSize = "110%" )
61 - #elseif( $thesisCount == 3 )#set( $tagSize = "105%" )
62 - #elseif( $thesisCount == 2 )#set( $tagSize = "100%" )
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%" )
63 63   #else#set( $tagSize = "90%" )
64 64   #end
65 - #set($urlEscapedTag = $escapetool.url($thesisTag))
66 - #set($htmlEscapedTag = $escapetool.xml($thesisTag))
67 -(% style='font-size:$tagSize' %) [[$thesisTag>>$doc||queryString='tag=$urlEscapedTag#if( $userSelected )&user=$userName#end']](% style='font-style:normal;color:$theme.textPrimaryColor';font-size:75%' %),,$thesisCount,,(%%) (%%)#end
68 -)))
69 -(% style="font-style:oblique;font-size:smaller;text-align:right;color:$theme.textSecondaryColor" %)(((
70 - #if( $userSelected )
71 -[ $tagInstanceNo / $tagNo {{stringEngIta eng = "tags" ita = "tag"/}} ]
72 - #else
73 -[ $tagInstanceNo / $tagNo {{stringEngIta eng = "tags" ita = "tag"/}} ]
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;
74 74   #end
75 -)))
76 -## END NO TAG specified in the query
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
77 77  #else
78 -## START ONE TAG specified in the query
79 -## embodied page?
80 - #if( $userName && $userSpace )
81 - #set( $embodiedPage = true )
82 - #else
83 - #set( $embodiedPage = false )
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 +<div class="mainheader">
77 +$itemNo #if( $itemNo > 1)$services.localization.render('theses').toLowerCase()#{else}$services.localization.render('thesis').toLowerCase()#{end}
78 +</div>
79 +## thesis list
80 + #template('apice_thesis_macros.vm')
81 + #foreach( $item in $itemFound )
82 +<div>
83 +[[image:icon:book]] #thesislinked($item)
84 +</div>
84 84   #end
85 - #if( $request.user )
86 -> Tag “**$request.tag**” / {{stringEngIta eng = "Theses" ita = "tesi" /}} / $userFirstName **$userLastName**
87 -
88 - #set( $from = ", BaseObject as obj0, DBStringListProperty as prop0 join prop0.list item, BaseObject as obj1, StringProperty as prop1, LargeStringProperty as prop2, LargeStringProperty as prop3, LargeStringProperty as prop4, DateProperty as prop5" )
89 - #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.ThesisTemplate' and prop1.id.id = obj1.id and prop2.id.id = obj1.id and prop3.id.id = obj1.id and prop4.id.id = obj1.id and prop5.id.id = obj1.id and prop1.name = 'status' and prop2.name = 'supervisors' and prop3.name = 'cosupervisors' and prop4.name = 'contacts' and prop5.name = 'endDate' and lower(prop1.value) = 'completed' and ( prop2.value like '%$request.user%' or prop3.value like '%$request.user%' or prop4.value like '%$request.user%' ) order by prop5.value desc" )
90 - #else
91 ->Tag “**$request.tag**” / {{stringEngIta eng = "Theses" ita = "tesi" /}}
92 -
93 - #set( $from = ", BaseObject as obj0, DBStringListProperty as prop0 join prop0.list item, BaseObject as obj1, DateProperty as prop1, StringProperty as prop2" )
94 -#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.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) = 'completed' order by prop1.value desc" )
95 - #end
96 - #set( $sql = $from + " where " + $where )
97 - #set( $thesisFound = $xwiki.searchDocuments($sql) )
98 -## show tag
99 -(((
100 -#foreach( $thesis in $thesisFound)
101 - #set($thesisDoc = $xwiki.getDocument($thesis) )
102 -[[image:icon:book]] {{thesis}}$thesisDoc{{/thesis}}
86 +## thesis list bottom
87 +<div class="menuqualifier" style="text-align: right">
88 +[ [[{{stringEngIta eng="supervisor cloud" ita="nuvola relatori" /}}>>$doc.name]] / $services.localization.render('theses').toLowerCase() ]
89 +</div>
103 103  #end
104 -)))
105 - #if( $embodiedPage )
106 -(% style="font-style:oblique;font-size:smaller;text-align:right;color:$theme.textSecondaryColor" %)((([ [[{{stringEngIta eng="tag cloud" ita="nuvola tag" /}}>>$doc.name]] / {{stringEngIta eng = "theses" ita = "tesi"/}} ])))(%%)
107 - #else
108 - #if( $request.user )
109 -(% style="font-style:oblique;font-size:smaller;text-align:right;color:$theme.textSecondaryColor" %)((([ [[{{stringEngIta eng="tag cloud" ita="nuvola tag" /}}>>$doc.name||queryString="user=$request.user"]] / $userFirstName $userLastName / {{stringEngIta eng = "theses" ita = "tesi"/}} ])))(%%)
110 - #else
111 -(% style="font-style:oblique;font-size:smaller;text-align:right;color:$theme.textSecondaryColor" %)((([ [[{{stringEngIta eng="tag cloud" ita="nuvola tag" /}}>>$doc.name||]] / {{stringEngIta eng = "theses" ita = "tesi"/}} ])))(%%)
112 - #end
113 - #end
114 -
115 -#end
116 -{{/velocity}}
91 +{{/html}}
92 +{{/velocity}}{{pageDisplay sort="objectservice"/}}