Changes for page Per A.Y.

From version 48.1
edited by Andrea Omicini
on 20/07/2023 10:19
Change comment: There is no comment for this version
To version 51.14
edited by Andrea Omicini
on 27/08/2023 18:43
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -1,6 +1,8 @@
1 1  {{velocity}}
2 2  {{html clean="false" wiki="true"}}
3 3  #template('apice_macros.vm')
4 +#nodoclang()
5 +#nolangpar()
4 4  #setobjectspace("Courses")
5 5  #template('apice_course_macros.vm')
6 6  #template('apice_user_param.vm')
... ... @@ -7,7 +7,7 @@
7 7  ## years / personal
8 8  #if( $isUserSpace )
9 9   #set( $query = ", BaseObject as objPersonalCourse, LargeStringProperty as propUser
10 - where objPersonalCourse.name = doc.fullName and objPersonalCourse.className = '${objectSpace}.Class' and propUser.id.id = objPersonalCourse.id and propUser.name = 'user' and propUser.value = '$userName' " )
12 + where objPersonalCourse.name = doc.fullName and objPersonalCourse.className = '${mainSpace}.Personal.Class' and propUser.id.id = objPersonalCourse.id and propUser.name = 'user' and propUser.value = '$userName' " )
11 11   #set( $personalCourseDocs = $xwiki.searchDocuments($query) )
12 12   #if( $personalCourseDocs.size() > 0 )
13 13   #set( $personalCourseDoc = $xwiki.getDocument($personalCourseDocs[0]) )
... ... @@ -15,18 +15,18 @@
15 15   #stop
16 16   #end
17 17   #if( $personalCourseDoc.maxYears && $personalCourseDoc.maxYears != "" )
18 - #set( $maxCourseYears = $personalCourseDoc.display('maxYears','view') )
20 + #set( $maxCourseYears = $numbertool.toNumber($personalCourseDoc.display('maxYears','view')) )
19 19   #end
20 20   #if( $personalCourseDoc.firstYear && $personalCourseDoc.firstYear != "" )
21 - #set( $firstYearCourse = $personalCourseDoc.display('firstYear','view') )
23 + #set( $firstYearCourse = $numbertool.toNumber($personalCourseDoc.display('firstYear','view')) )
22 22   #end
23 23   #if( $personalCourseDoc.lastYear && $personalCourseDoc.lastYear != "" )
24 - #set( $lastYearCourse = $personalCourseDoc.display('lastYear','view') )
26 + #set( $lastYearCourse = $numbertool.toNumber($personalCourseDoc.display('lastYear','view')) )
25 25   #end
26 26  #end
27 27  ## years / parameters takes precedence
28 -#set( $firstYear = $firstYearCourse )
29 -#set( $lastYear = $lastYearCourse )
30 +#set( $firstYear = $numbertool.toNumber($firstYearCourse) )
31 +#set( $lastYear = $numbertool.toNumber($lastYearCourse) )
30 30  #template('apice_year_param.vm')
31 31  ##
32 32  ## DATA STRUCTURES / START
... ... @@ -33,11 +33,11 @@
33 33  #set( $itemMap = {} )
34 34  #set( $itemNo = 0 )
35 35  ## cycle over years
36 -#foreach( $year in $yearList)
38 +#foreach( $year in $yearList )
37 37   #set( $year1 = $year + 1 )
38 38   #set( $ayear = $year + "/" + $year1 )
39 - #set( $query = ", BaseObject as objCourse, StringProperty as propYear, LargeStringProperty as propProfessor, LargeStringProperty as propOtherprofessors, LargeStringProperty as propTutors
40 - where objCourse.name = doc.fullName and objCourse.className = '${mainSpace}.Class' and objCourse.name <> '${objectPool}.Template' and propYear.id.id = objCourse.id and propProfessor.id.id = objCourse.id and propOtherprofessors.id.id = objCourse.id and propTutors.id.id = objCourse.id and propYear.name = 'ay' and propProfessor.name = 'professor' and propOtherprofessors.name = 'otherProfessors' and propTutors.name = 'tutors' and propYear.value = '$ayear' #if( $oneUser )and ( propProfessor.value like '%$userName%' or propOtherprofessors.value like '%$userName%' or propTutors.value like '%$userName%' )#end ")
41 + #set( $query = ", BaseObject as objCourse, StringProperty as propName, StringProperty as propYear, LargeStringProperty as propProfessor, LargeStringProperty as propOtherprofessors, LargeStringProperty as propTutors
42 + where objCourse.name = doc.fullName and objCourse.className = '${mainSpace}.Class' and objCourse.name <> '${objectPool}.Template' and propName.id.id = objCourse.id and propYear.id.id = objCourse.id and propProfessor.id.id = objCourse.id and propOtherprofessors.id.id = objCourse.id and propTutors.id.id = objCourse.id and propName.name = #if( $services.localization.currentLocale == 'it' )'ita'#{else}'eng'#end and propYear.name = 'ay' and propProfessor.name = 'professor' and propOtherprofessors.name = 'otherProfessors' and propTutors.name = 'tutors' and propYear.value = '$ayear' #if( $oneUser )and ( propProfessor.value like '%$userName%' or propOtherprofessors.value like '%$userName%' or propTutors.value like '%$userName%' )#end order by propName.value asc")
41 41  ## execute query
42 42   #set( $itemFound = $xwiki.searchDocuments($query) )
43 43  ## set counters
... ... @@ -60,9 +60,15 @@
60 60  #end
61 61  <span class="textsecondary">&ensp;/&ensp;</span>
62 62  #if( $oneYear )
63 - $year
65 + #set( $year1 = $year + 1 )
66 + #set( $ayear = $year + "/" + $year1 )
67 + $ayear
64 64  #else
65 - $firstYear–$lastYear
69 + #set( $firstYear1 = $firstYear + 1 )
70 + #set( $lastYear1 = $lastYear + 1 )
71 + #set( $aFirstYear = $firstYear + "/" + $firstYear1 )
72 + #set( $aLastYear = $lastYear + "/" + $lastYear1 )
73 + $aFirstYear<span class="textsecondary">&ensp;&mdash;&ensp;</span>$aLastYear
66 66  #end
67 67  #if( $oneUser )
68 68   <span class="textsecondary">&ensp;/&ensp;</span>
... ... @@ -102,11 +102,22 @@
102 102  ## year top / end
103 103  ##
104 104  ## year display / start
105 -<div style="font-style: normal"><ul>
106 - #foreach( $item in $itemMap[$year] )
107 -<li>{{course}}$item{{/course}}</li>
108 - #end
113 + #if( $oneUser)
114 + <div class='menumainbody' style='margin-top: .25em'>
115 + #foreach( $item in $itemMap[$year] )
116 + #coursename($item)&ensp;(#coursecycle($item))
117 + #if( !$foreach.last )
118 + &ensp;&bull;&ensp;
119 + #end
120 + #end
121 + </div>
122 + #else
123 + <div style="font-style: normal"><ul>
124 + #foreach( $item in $itemMap[$year] )
125 + <li>#coursename($item)&ensp;<span class='textsecondary'>(#coursecycle($item)) &mdash; </span>#courseprofessor($item)</li>
126 + #end
109 109  </ul></div>
128 + #end
110 110  ## year display / end
111 111  ##
112 112  ## year bottom / start