Wiki source code of Spotlight

Hide last authors
Andrea Omicini 12.1 1 {{velocity}}
2 {{html clean="false" wiki="true"}}
3 #template('apice_macros.vm')
4 #objectspace()
5 #nolangpar()
6 #template('apice_course_macros.vm')
7 #isuserspace()
8 #if( $isUserSpace )
9 #setobjectsubspace("Courses","Personal")
10 #userspace()
11 ## user space variables
12 #set( $query = ", BaseObject as objPersonalCourse, LargeStringProperty as propUser
13 where objPersonalCourse.name = doc.fullName and objPersonalCourse.className = '${objectSpace}.Class' and propUser.id.id = objPersonalCourse.id and propUser.name = 'user' and propUser.value = '$userName' " )
14 #set( $personalCourseDocs = $xwiki.searchDocuments($query) )
Andrea Omicini 13.1 15 #if( $personalCourseDocs.size() > 0 )
16 #set( $personalCourseDoc = $xwiki.getDocument($personalCourseDocs[0]) )
17 #else
18 #stop
19 #end
20 #if( $personalCourseDoc.spotNo && $personalCourseDoc.spotNo != "" )
Andrea Omicini 14.2 21 #set( $spotCourseNo = $numbertool.toNumber($personalCourseDoc.spotNo).intValue() )
Andrea Omicini 13.1 22 #end
Andrea Omicini 12.1 23 ## USER SPOTLIGHT / START
24 #if( $personalCourseDoc.getValue('spotList').size() > 0 )
25 <table width="100%"><tr class='borderhalfbottom'>
26 #foreach( $item in $personalCourseDoc.getValue('spotList') )
27 #if( $foreach.count <= $maxCourseSpot )
Andrea Omicini 15.1 28 <td>#courselinked($item)</td>
Andrea Omicini 3.1 29 #end
30 #end
Andrea Omicini 12.1 31 </tr></table>
Andrea Omicini 3.1 32 #elseif( $spotCourseNo && $spotCourseNo > 0 )
33 #if( $spotCourseNo > $maxCourseSpot )
34 #set( $spotCourseNo = $maxCourseSpot )
35 #end
Andrea Omicini 12.1 36 #set( $query = ", BaseObject as objCourse, StringProperty as propYear, LargeStringProperty as propUser
37 where objCourse.name = doc.fullName and objCourse.className = '${mainSpace}.Class' and propYear.id.id = objCourse.id and propYear.name = 'ay' and propUser.id.id = objCourse.id and propUser.name = 'professor' and propUser.value like '%$userName%' order by propYear.value desc " )
38 #set( $itemFound = $xwiki.searchDocuments($query) )
39 #set( $itemFoundNo = $itemFound.size() )
40 #if( $itemFoundNo > 0 )
41 <table width="100%"><tr class='borderhalfbottom'>
42 #foreach( $item in $itemFound )
43 #if( $foreach.count > $spotCourseNo )
44 #break
45 #end
Andrea Omicini 15.1 46 <td>#courselinked($item)</td>
Andrea Omicini 3.1 47 #end
Andrea Omicini 12.1 48 </tr></table>
Andrea Omicini 3.1 49 #end
50 #end
51 #### END USER SPOTLIGHT
Andrea Omicini 12.1 52 #else
53 #### START GENERAL SPOTLIGHT
54 #if( $spotCourseNo && $spotCourseNo > 0 )
55 #set( $query = ", BaseObject as objCourse, StringProperty as propYear
56 where objCourse.name = doc.fullName and objCourse.className = '${mainSpace}.Class' and objCourse.name <> '${objectPool}.Template' and propYear.id.id = objCourse.id and propYear.name = 'ay' order by propYear.value desc" )
57 #set( $itemFound = $xwiki.searchDocuments($query) )
58 #set( $itemFoundNo = $itemFound.size() )
59 #if( $itemFoundNo > 0 )
60 <table width="100%"><tr class='borderhalfbottom'>
61 #foreach( $item in $itemFound )
62 #if( $foreach.count > $spotCourseNo )
63 #break
64 #end
Andrea Omicini 15.1 65 <td>#courselinked($item)</td>
Andrea Omicini 12.1 66 #end
67 </tr></table>
68 #end
69 #end
70 #### END GENERAL SPOTLIGHT
Andrea Omicini 3.1 71 #end
Andrea Omicini 12.1 72 {{/html}}
73 {{/velocity}}{{pageDisplay sort="objectservice"/}}