Changes for page Spotlight

From version 1.1
edited by Andrea Omicini
on 12/11/2021 10:31
Change comment: There is no comment for this version
To version 3.1
edited by Andrea Omicini
on 02/01/2022 01:51
Change comment: There is no comment for this version

Summary

Details

Page properties
Title
... ... @@ -1,1 +1,0 @@
1 -Headline
Content
... ... @@ -1,0 +1,50 @@
1 += {{italiano}}Spotlight corsi{{/italiano}}{{english}}Course Spotlight{{/english}} =
2 +
3 +{{include reference="Courses.Environment" excludeFirstHeading="true"/}}{{include reference="Environment" excludeFirstHeading="true"/}}{{velocity}}
4 +#set( $courseMenu = true )
5 +## $spotCourseNo has to be an integer
6 +#if( $spotCourseNo )
7 + #set( $spotCourseNo = $util.parseInt($spotCourseNo) )
8 +#end
9 +## user or general spotlight?
10 +#if( !$userName || $userName == "" || !$userSpace || $userSpace == "" || !$userFullname || $userFullname == "" )
11 +#### START GENERAL SHOWCASE
12 + #if( $spotCourseNo && $spotCourseNo > 0 )
13 + #set ($sql = ", BaseObject as obj, StringProperty as prop where obj.name = doc.fullName and obj.className = 'Courses.CourseClass' and obj.name <> 'Courses.CourseTemplate' and prop.id.id = obj.id and prop.name = 'ay' order by prop.value desc")
14 + #set( $courseFound = $xwiki.searchDocuments($sql) )
15 + #set( $courseFoundNo = $courseFound.size() )
16 + #if( $courseFoundNo > 0 )
17 + #if( $courseFoundNo > $spotCourseNo )
18 + #set( $n = $spotCourseNo - 1 )
19 + #else
20 + #set( $n = $courseFoundNo - 1 )
21 + #end
22 +(% style='border-style:hidden solid solid hidden; border-color:$theme.borderColor' %)#foreach( $i in [0..$n] )|{{course linked='title'}}$courseFound.get($i){{/course}}#end(%%)
23 + #end
24 + #end
25 +#### END GENERAL SPOTLIGHT
26 +#else
27 +#### START USER SPOTLIGHT
28 +##
29 + #if( $spotCourses && $spotCourses != [] )
30 +(% style='border-style:hidden solid solid hidden; border-color:$theme.borderColor' %)#foreach( $course in $spotCourses )#if( $xwiki.exists( "Courses.$course") && ($velocityCount <= $maxCourseSpot) )|{{course linked='title'}}$course{{/course}}#end#end(%%)
31 + #elseif( $spotCourseNo && $spotCourseNo > 0 )
32 + #if( $spotCourseNo > $maxCourseSpot )
33 + #set( $spotCourseNo = $maxCourseSpot )
34 + #end
35 + #set ($sql = ", BaseObject as obj, DateProperty as prop0, StringProperty as prop1, LargeStringProperty as prop2, LargeStringProperty as prop3, LargeStringProperty as prop4
36 + where obj.name = doc.fullName and obj.className = 'Courses.CourseClass' and obj.name <> 'Courses.CourseTemplate' and prop0.id.id = obj.id and prop1.id.id = obj.id and prop2.id.id = obj.id and prop3.id.id = obj.id and prop4.id.id = obj.id and prop0.name = 'endDate' and prop1.name = 'status' and prop2.name = 'supervisors' and prop3.name = 'cosupervisors' and prop4.name = 'contacts' and prop1.value = 'Completed' and ( prop2.value like '%$userName%' or prop3.value like '%$userName%' or prop4.value like '%$userName%' ) order by prop0.value desc")
37 + #set( $courseFound = $xwiki.searchDocuments($sql) )
38 + #set( $courseFoundNo = $courseFound.size() )
39 + #if( $courseFoundNo > 0 )
40 + #if( $courseFoundNo > $spotCourseNo )
41 + #set( $n = $spotCourseNo - 1 )
42 + #else
43 + #set( $n = $courseFoundNo - 1 )
44 + #end
45 +(% style='border-style:hidden solid solid hidden; border-color:$theme.borderColor' %)#foreach( $i in [0..$n] )|{{course linked='title'}}$courseFound.get($i){{/course}}#end(%%)
46 + #end
47 + #end
48 +#### END USER SPOTLIGHT
49 +#end
50 +{{/velocity}}