Changes for page Supervisors

From version 98.2
edited by Andrea Omicini
on 30/06/2023 00:35
Change comment: There is no comment for this version
To version 86.1
edited by Andrea Omicini
on 27/01/2023 17:24
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
Default language
... ... @@ -1,0 +1,1 @@
1 +en
Content
... ... @@ -1,82 +1,114 @@
1 -{{velocity}}
2 -{{html clean="false" wiki="true"}}
3 -#template('apice_theses.vm')
4 -#template('apice_user_param.vm')
1 += {{velocity}}#if( $request.tag )(% style="color:$theme.textSecondaryColor" %)tag : (%%)$request.tag#else{{stringEngIta eng="Tags" ita= "Tag"/}}#end{{/velocity}} =
2 +
3 +{{include reference="Theses.Environment" excludeFirstHeading="true"/}}{{velocity}}
4 +## thesis page with menus
5 +#set( $thesisMenu = true )
5 5  ##
6 -#### tag parameter possibly brings name to be used as tag
7 +#set( $userSelected = false )
8 +##
7 7  #if( !$request.tag )
8 -## no tag parameter --> just the cloud
9 -## set query
10 - #set( $query = ", BaseObject as objThesis, LargeStringProperty as propSupervisors, StringProperty as propStatus, DateProperty as propEnddate
11 - 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" )
12 -## execute query
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) )
21 - #set( $nameList = $itemDoc.getValue("supervisors").split(",") )
22 -## set user-item map
23 - #foreach( $name in $nameList )
24 -#### build name lists
25 - #if( $nameMap.keySet().contains($name) )
26 -## nameMap already contains current name
27 -## add $item to nameMap for current name
28 - #set( $discard = $nameMap[$name].add($item) )
29 - #elseif( !$oneUser || $oneUser && $name != $userName )
30 -## nameMap does not contain name or selected user
31 -## add name / selected user to nameMap
32 - #set( $nameMap[$name] = [] )
33 - ## adding $item to nameMap for $name
34 - #set( $discard = $nameMap[$name].add($item) )
35 - #end
10 +## START NO TAG specified in the query
11 + #if( $userName )
12 + #if( $xwiki.exists($userName) )
13 + #set( $userDoc = $xwiki.getDocument($userName) )
14 + #set( $userFirstName = $userDoc.display("first_name") )
15 + #set( $userLastName = $userDoc.display("last_name") )
16 + #set( $userSelected = true )
17 + #else
18 +{{warning}}"$userName" looks not like any known APICe user{{/warning}}
36 36   #end
37 -#### END / feed name list from each item
38 38   #end
39 -## END EACH ITEM IN MAP
40 -## final values: $nameMap
41 - #set( $nameFoundNo = $nameMap.keySet().size() )
42 -## tag cloud
21 + #if( !$userSelected && $request.user )
22 + #if( $xwiki.exists("XWiki.$request.user") )
23 + #set( $userSelected = true )
24 + #set( $userName = "XWiki.$request.user" )
25 + #elseif( $xwiki.exists("$request.user") )
26 + #set( $userSelected = true )
27 + #set( $userName = "$request.user" )
28 + #else
29 +{{warning}}"$request.user" looks not like any known APICe user{{/warning}}
30 + #end
31 + #if( $userSelected )
32 + #set( $userDoc = $xwiki.getDocument($userName) )
33 + #set( $userFirstName = $userDoc.display("first_name") )
34 + #set( $userLastName = $userDoc.display("last_name") )
35 + #end
36 + #end
37 + #if( $userSelected )
38 +>{{stringEngIta eng = "Theses" ita = "Tesi" /}} / **$userFirstName $userLastName**
39 + #set( $from = ", BaseObject as obj0, StringProperty as prop0, LargeStringProperty as prop1, LargeStringProperty as prop2, LargeStringProperty as prop3" )
40 + #set( $where = "obj0.name = doc.fullName and obj0.className = '${objectSpace}.${objectClass}' and obj0.name <> '${objectSpace}.${objectTemplate}' 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%' )" )
41 + #else
42 +>{{stringEngIta eng="Theses" ita="Tesi" /}}
43 + #set( $from = ", BaseObject as obj0, StringProperty as prop0" )
44 + #set( $where = "obj0.name = doc.fullName and obj0.className = '${objectSpace}.${objectClass}' and obj0.name <> '${objectSpace}.${objectTemplate}' 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 )
43 43  (% style='text-align:center' %)(((
44 - #foreach( $name in $nameMap.keySet() )
45 - #set( $nameItemNo = $nameMap[$name].size() )
46 - #if( $nameItemNo > 40 )#set( $tagSize = "140%" )
47 - #elseif( $nameItemNo > 30 )#set( $tagSize = "135%" )
48 - #elseif( $nameItemNo > 20 )#set( $tagSize = "130%" )
49 - #elseif( $nameItemNo > 10 )#set( $tagSize = "125%" )
50 - #elseif( $nameItemNo > 5 )#set( $tagSize = "120%" )
51 - #elseif( $nameItemNo > 3 )#set( $tagSize = "110%" )
52 - #elseif( $nameItemNo == 3 )#set( $tagSize = "105%" )
53 - #elseif( $nameItemNo == 2 )#set( $tagSize = "100%" )
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%" )
54 54   #else#set( $tagSize = "90%" )
55 55   #end
56 -[[(% 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
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
57 57  )))
58 -## cloud bottom
59 -(% style='font-style:oblique;font-size:smaller;text-align:right;color:$theme.textSecondaryColor' %)(((
60 -[ $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 ]
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"/}} ]
74 + #end
61 61  )))
62 -#### YES TAG PARAMETER
76 +## END NO TAG specified in the query
63 63  #else
64 -## set query
65 - #set( $query = ", BaseObject as objThesis, LargeStringProperty as propSupervisors, StringProperty as propStatus, DateProperty as propEnddate
66 - 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" )
67 -## execute query
68 - #set( $itemFound = $xwiki.searchDocuments($query) )
69 - #set( $itemFoundNo = $itemFound.size() )
70 -## subtitle
71 ->$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
72 -## talk list
73 -(((
74 - #foreach( $item in $itemFound )
75 -[[image:icon:book]] {{thesis linked="title"}}$item{{/thesis}}
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 )
76 76   #end
85 + #if( $request.user )
86 + #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" )
87 + #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 = '${objectSpace}.${objectClass}' and obj1.name <> '${objectSpace}.${objectTemplate}' 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 = 'end' 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" )
88 + #else
89 + #set( $from = ", BaseObject as obj0, DBStringListProperty as prop0 join prop0.list item, BaseObject as obj1, DateProperty as prop1, StringProperty as prop2" )
90 +#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 = '${objectSpace}.${objectClass}' and obj1.name <> '${objectSpace}.${objectTemplate}' and prop1.id.id = obj1.id and prop2.id.id = obj1.id and prop1.name = 'end' and prop2.name = 'status' and lower(prop2.value) = 'completed' order by prop1.value desc" )
91 + #end
92 + #set( $sql = $from + " where " + $where )
93 + #set( $thesisFound = $xwiki.searchDocuments($sql) )
94 + #set( $thesisFoundNo = $thesisFound.size() )
95 +>$thesisFoundNo #if( $thesisFoundNo == 1 ){{stringEngIta eng = "Thesis" ita = "tesi" /}}#else{{stringEngIta eng = "Theses" ita = "tesi" /}}#end#if( $request.user ) / **$userFirstName $userLastName**#end
96 +## show tag
97 +(((
98 +#foreach( $thesis in $thesisFound)
99 + #set($thesisDoc = $xwiki.getDocument($thesis) )
100 +[[image:icon:book]] {{thesis}}$thesisDoc{{/thesis}}
101 +#end
77 77  )))
78 -## thesis list bottom
79 -(% 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()"/}} ])))(%%)
103 + #if( $embodiedPage )
104 +(% 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"/}} ])))(%%)
105 + #else
106 + #if( $request.user )
107 +(% 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"/}} ])))(%%)
108 + #else
109 +(% 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"/}} ])))(%%)
110 + #end
111 + #end
112 +
80 80  #end
81 -{{/html}}
82 -{{/velocity}}{{pageDisplay sort="objectservice"/}}
114 +{{/velocity}}