Changes for page Per Year
From version 20.5
edited by Andrea Omicini
on 25/10/2021 17:05
on 25/10/2021 17:05
Change comment:
There is no comment for this version
To version 103.1
edited by Andrea Omicini
on 30/10/2021 17:07
on 30/10/2021 17:07
Change comment:
There is no comment for this version
Summary
-
Page properties (2 modified, 0 added, 0 removed)
Details
- Page properties
-
- Title
-
... ... @@ -1,1 +1,1 @@ 1 -Theses per Status1 +#if($xcontext.language=='it')Tesi per anno#{else}Theses per Year#end - Content
-
... ... @@ -1,176 +1,133 @@ 1 1 {{include reference="Theses.Environment"/}}{{include reference="Environment"/}}{{velocity}} 2 2 #set( $thesisMenu = true ) 3 -#### get parameters 4 -## hypothesis: $thesisStatus set, default "Completed" 5 -## status parameter 6 -#set( $statusPar = $request.status.trim().toLowerCase() ) 7 -#if( $statusPar != '' && $allThesisStatuses.contains($statusPar) ) 8 - #set( $selectedStatus = $statusPar ) 3 +#set( $oneYear = false ) 4 +#set( $selectedYear = '' ) 5 +### START YEAR 6 +## year parameter 7 +#set( $yearPar = $mathtool.toInteger($request.year) ) 8 +#set( $fromPar = $mathtool.toInteger($request.from) ) 9 +#set( $toPar = $mathtool.toInteger($request.to) ) 10 +#set( $firstYear = $mathtool.toInteger($firstYearTh) ) 11 +#set( $lastYear = $mathtool.toInteger($lastYearTh) ) 12 +#set( $yearList = [$lastYear..$firstYear] ) 13 +#if( $yearPar > 0 ) 14 + #set( $oneYear = true ) 15 + #set( $firstYear = $yearPar ) 16 + #set( $lastYear = $yearPar ) 17 + #set( $selectedYear = $yearPar ) 18 + #set( $yearList = [$yearPar] ) 9 9 #else 10 - #set( $selectedStatus = 'all' ) 20 + #if( $fromPar != '' && ($fromPar > $firstYear) ) 21 + #set( $firstYear = $fromPar ) 22 + #set( $yearList = [$lastYear..$firstYear] ) 23 + #end 24 + #if( $toPar != '' && ($toPar < $lastYear) ) 25 + #set( $lastYear = $toPar ) 26 + #set( $yearList = [$lastYear..$firstYear] ) 27 + #end 28 + #if( $lastYear <= $firstYear ) 29 + #set( $oneYear = true ) 30 + #set( $lastYear = $firstYear ) 31 + #set( $selectedYear = $firstYear ) 32 + #set( $yearList = [$firstYear] ) 33 + #else 34 + #set( $yearList = [$lastYear..$firstYear] ) 35 + #end 11 11 #end 12 -##check velocity variable, takes precedence 13 -#if( $thesisStatus && $thesisStatus != '' && $allThesisStatuses.contains($thesisStatus.trim().toLowerCase()) ) 14 - #set( $selectedStatus = $thesisStatus.trim().toLowerCase() ) 15 -#end 16 -## set ordering field 17 -#if( $selectedStatus == "available" ) 18 - #set( $orderingDateFieldName = "availabilityDate" ) 19 -#elseif( $selectedStatus == "ongoing" ) 20 - #set( $orderingDateFieldName = "startDate" ) 21 -#else 22 - #set( $orderingDateFieldName = "endDate" ) 23 -#end 24 -## invariant: $thesisStatus set, $orderingDateFieldName set correspondingly 25 -## who 26 -#set( $userNamePar = $request.user ) 27 -#set( $supervisorNamePar = $request.supervisor ) 28 -#set( $cosupervisorNamePar = $request.cosupervisor ) 29 -#set( $contactNamePar = $request.contact ) 30 -#### set default values 31 -#set( $userSelected = false ) 32 -#set( $roleSelected = false ) 37 +### END YEAR 38 +## 39 +### START USER & CYCLE 40 +#set( $userNamePar = $request.user.trim() ) 41 +## default values 42 +#set( $oneUser = false ) 43 +#set( $oneCycle = false ) 33 33 #set( $userFirstName = "" ) 34 34 #set( $userLastName = "" ) 35 -#set( $supervisorName = "" ) 36 -#set( $supervisorFirstName = "" ) 37 -#set( $supervisorLastName = "" ) 38 -#set( $cosupervisorName = "" ) 39 -#set( $cosupervisorFirstName = "" ) 40 -#set( $cosupervisorLastName = "" ) 41 -#set( $contactName = "" ) 42 -#set( $contactFirstName = "" ) 43 -#set( $contactLastName = "" ) 44 -## 45 -#### handle who & roles 46 -## 47 -#if ( $userName || $userNamePar ) ## a user is specified for all roles 48 - #set( $userSelected = true ) 49 - #if ( !$userName )#set( $userName = "XWiki.$userNamePar" )#end 50 - #set( $userdoc = $xwiki.getDocument($userName) ) 51 - #set( $userFirstName = $userdoc.display("first_name") ) 52 - #set( $userLastName = $userdoc.display("last_name") ) 53 -#elseif ( $supervisorNamePar || $cosupervisorNamePar || $contactNamePar ) 54 - #set( $roleSelected = true ) 55 - #if ( $supervisorNamePar ) 56 - #set( $supervisorName = "XWiki.$supervisorNamePar" ) 57 - #set( $supervisordoc = $xwiki.getDocument($supervisorName) ) 58 - #set( $supervisorFirstName = $supervisordoc.display("first_name") ) 59 - #set( $supervisorLastName = $supervisordoc.display("last_name") ) 46 +#if( $userName || $userNamePar ) 47 +## a user is specified for all roles 48 + #if( !$userName ) 49 + #set( $selectedUser = "XWiki.$userNamePar" ) 50 + #else 51 + #set( $selectedUser = $userName ) 60 60 #end 61 - #if ( $cosupervisorNamePar ) 62 - #set( $cosupervisorName = "XWiki.$cosupervisorNamePar" ) 63 - #set( $cosupervisordoc = $xwiki.getDocument($cosupervisorName) ) 64 - #set( $cosupervisorFirstName = $cosupervisordoc.display("first_name") ) 65 - #set( $cosupervisorLastName = $cosupervisordoc.display("last_name") ) 53 + #if( $xwiki.exists($selectedUser) ) 54 + #set( $oneUser = true ) 55 + #set( $userdoc = $xwiki.getDocument($selectedUser) ) 56 + #set( $userFirstName = $userdoc.display("first_name") ) 57 + #set( $userLastName = $userdoc.display("last_name") ) 58 + #else 59 +{{warning}} $selectedUser is not an {{apice/}} user{{/warning}} 60 + #stop 66 66 #end 67 - #if ( $contactNamePar ) 68 - #set( $contactName = "XWiki.$contactNamePar" ) 69 - #set( $contactdoc = $xwiki.getDocument($contactName) ) 70 - #set( $contactFirstName = $contactdoc.display("first_name") ) 71 - #set( $contactLastName = $contactdoc.display("last_name") ) 62 +##user selected and existing user page 63 + #set( $cyclePar = $request.cycle.trim().toUpperCase() ) 64 + #set( $selectedCycle = '' ) 65 + #if( $cyclePar != '' && $allThesisCycles.contains($cyclePar) ) 66 + #set( $oneCycle = true ) 67 + #set( $selectedCycle = $cyclePar ) 72 72 #end 73 73 #end 74 -#if( $supervisor ) 75 - #set( $roleSelected = true ) 76 - #set( $supervisorName = $userName ) 77 - #set( $supervisordoc = $xwiki.getDocument($supervisorName) ) 78 - #set( $supervisorFirstName = $supervisordoc.display("first_name") ) 79 - #set( $supervisorLastName = $supervisordoc.display("last_name") ) 70 +## $oneUser and $oneCycle set properly 71 +#if( $oneYear ) 72 + $selectedYear 80 80 #end 81 -#if( $cosupervisor ) 82 - #set( $roleSelected = true ) 83 - #set( $cosupervisorName = $userName ) 84 - #set( $cosupervisordoc = $xwiki.getDocument($cosupervisorName) ) 85 - #set( $cosupervisorFirstName = $cosupervisordoc.display("first_name") ) 86 - #set( $cosupervisorLastName = $cosupervisordoc.display("last_name") ) 74 +#if( $oneUser ) 75 + $selectedUser 87 87 #end 88 -#if( $contact ) 89 - #set( $roleSelected = true ) 90 - #set( $contactName = $userName ) 91 - #set( $contactdoc = $xwiki.getDocument($contactName) ) 92 - #set( $contactFirstName = $contactdoc.display("first_name") ) 93 - #set( $contactLastName = $contactdoc.display("last_name") ) 77 +#if( $oneCycle ) 78 + $selectedCycle 94 94 #end 95 -$selectedStatus 96 - 97 -$userSelected 98 - 99 -$roleSelected 100 - 101 -$supervisor 102 - 103 -$cosupervisor 104 - 105 -$contact 106 - 107 -$userFirstName $userLastName 108 - 109 -$supervisorFirstName $supervisorLastName 110 - 111 -$cosupervisorFirstName $cosupervisorLastName 112 - 113 -$contactFirstName $contactLastName 80 +### END USER & CYCLE 114 114 ## 115 -## $userSelected true and $roleSelected false means one user for all roles 116 -## $userSelected true and $roleSelected true for one user with one specific role 117 -## if $userSelected false and $roleSelected true mean at least one role with an assigned user 118 -## both false means all theses 119 -#if( $userSelected ) 120 - #if( $roleSelected ) 121 ->{{thesisStatus plural='yes' uppercase='yes'}}$thesisStatus{{thesisStatus}} / $userFirstName $userLastName / #if( $supervisor ){{stringEngIta eng="Supervisor" ita="Relatore"/}}#end#if( $cosupervisor ){{stringEngIta eng="Co-supervisor" ita="Correlatore"/}}#end#if( $contact ){{stringEngIta eng="Contact" ita="Contatto"/}}#end 122 - 123 - #else 124 ->{{thesisStatus plural='yes' uppercase='yes'}}$thesisStatus{{thesisStatus}} / $userFirstName $userLastName 125 - 82 +## title 83 +>#if( $oneRole ){{thesisCycle short='no'}}$selecteCycle{{/thesisCycle}}#else{{stringEngIta eng="Theses" ita="Tesi"/}}#end / #if( $oneYear )$selectedYear#else$firstYear–$lastYear#end#if( $oneUser ) / $userFirstName **$userLastName**#end{{id name='top'/}} 84 +## index 85 +#if( !$oneYear ) 86 +(% style="font-size: smaller; padding:1em 1.5em 0.25em 1.5em; background-color:$theme.highlightColor" %)(((#foreach( $year in $yearList )#if ($velocityCount > 1) | #end[[$year>>||anchor="$year"]]#end))) 87 +###elseif( $oneUser && !$oneCycle ) 88 +#elseif( !$oneCycle ) 89 +(% style="font-size: smaller; padding:1em 1.5em 0.25em 1.5em; background-color:$theme.highlightColor" %)(((#foreach( $cycle in $allThesisCycles )#if ($velocityCount > 1) | #end [[{{thesisCycle}}$cycle{{/thesisCycle}}>>||anchor="$cycle"]]#end))) 90 +#end{{id name='index'/}} 91 +## search theses 92 +#set( $thesisNo = 0 ) 93 +#foreach( $year in $yearList ) 94 + #set( $thesisYearNo = 0 ) 95 + #if( !$oneYear ) 96 +(% style="border-style:solid hidden hidden solid; border-color:$theme.borderColor; text-align:left; font-style:oblique" %)|{{id name='$year'/}}$year 126 126 #end 127 -#else 128 - #if( $roleSelected ) 129 ->{{thesisStatus plural='yes' uppercase='yes'}}$thesisStatus{{thesisStatus}}#if( $supervisorLastName != "" ) / $supervisorFirstName $supervisorLastName //({{stringEngIta eng="supervisor" ita="relatore"/}})//#end#if( $cosupervisorLastName != "" ) / $cosupervisorFirstName $cosupervisorLastName //({{stringEngIta eng="co-supervisor" ita="correlatore"/}})//#end#if( $contactLastName != "" ) / $contactFirstName $contactLastName //({{stringEngIta eng="Contact" ita="Contatto"/}})//#end 98 +## some selected year or year list / now $year 99 + #foreach( $cycle in $allThesisCycles ) 100 + #set( $thesisYearCycleNo = 0 ) 101 + #if( !$oneCycle || $selectedCycle == $cycle ) 102 +## some selected cycle or all cycles / now $cycle 103 + #if( $oneUser) 104 + #set ($sql = ", BaseObject as obj, StringProperty as prop0, DateProperty as prop1, LargeStringProperty as prop2, LargeStringProperty as prop3, LargeStringProperty as prop4 105 + where obj.name = doc.fullName and obj.className = 'Theses.ThesisClass' and obj.name <> 'Theses.ThesisClassTemplate' and obj.name <> 'Theses.ThesisTemplate' 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 = 'cycle' and prop1.name = 'year' and prop2.name = 'supervisors' and prop3.name = 'cosupervisors' and prop4.name = 'contacts' and prop0.value = '$cycle' and year(prop1.value) = '$year' and ( prop2.value like '%$selectedUser%' or prop3.value like '%$selectedUser%' or prop4.value like '%$selectedUser%' ) order by prop1.value desc" ) 106 + #else 107 + #set ($sql = ", BaseObject as obj, StringProperty as prop0, DateProperty as prop1 108 + where obj.name = doc.fullName and obj.className = 'Theses.ThesisClass' and obj.name <> 'Theses.ThesisClassTemplate' and obj.name <> 'Theses.ThesisTemplate' and prop0.id.id = obj.id and prop1.id.id = obj.id and prop0.name = 'cycle' and prop1.name = 'year' and prop0.value = '$cycle' and year(prop1.value) = '$year' order by prop1.value desc" ) 109 + #end 110 + #set( $thesisFound = $xwiki.searchDocuments($sql) ) 111 + #set( $thesisFoundNo = $thesisFound.size() ) 112 + #set( $thesisYearCycleNo = $thesisYearCycleNo + $thesisFoundNo ) 113 + #if( $thesisFoundNo > 0 && !$oneCycle ) 114 +(% style="border-style:#if( $oneYear )solid hidden hidden solid#{else}hidden hidden hidden dotted#end; border-color:$theme.borderColor; text-align:left; font-style:oblique; font-size:smaller" %)|#if( $oneYear ){{id name='$cycle'/}}#else{{id name='$year-$cycle'/}}#end{{thesisCycle plural='no' uppercase='yes' short='yes'}}$cycle{{/thesisCycle}} 115 + #end 116 + #foreach( $thesis in $thesisFound ) 117 + #set( $thesisDoc = $xwiki.getDocument($thesis) ) 118 + #set( $thesisObj = $thesisDoc.getObject('Theses.ThesisClass') ) 119 +* [[$thesisObj.title>>$thesisDoc]]#if( $thesisObj.endDate != "" ) //($thesisObj.endDate)//#end#if( $thesisDoc.getValue('studentUserName') != "" ) [[$xwiki.getUserName($thesisDoc.getValue('studentUserName'), false)>>$thesisDoc.getValue('studentUserName')]]#elseif( $thesisObj.studentFirstName != "" && $thesisObj.studentLastName != "" ) $thesisObj.studentFirstName $thesisObj.studentLastName#end 130 130 131 - #else 132 ->{{thesisStatus plural='yes' uppercase='yes'}}$thesisStatus{{thesisStatus}} 133 - 134 - #end 135 -#end 136 -## 137 -#if( $cosupervisor ) 138 - #set( $roleSelectedFieldName = "coSupervisors" ) 139 -#elseif( $contact ) 140 - #set( $roleSelectedFieldName = "contact" ) 141 -#else 142 - #set( $roleSelectedFieldName = "supervisor" ) 143 -#end 144 -## 145 -#if( $selectedStatus == 'all' ) 146 - ALL STATUSES 147 -#else 148 -## some selected status 149 - #if( $userSelected ) 150 -## some user selected 151 - #if( $roleSelected ) 152 -## some specific role selected 153 - #set ($sql = ", BaseObject as obj, StringProperty as prop0, LargeStringProperty as prop1, DateProperty as prop2 154 - where obj.name = doc.fullName and obj.className = 'Theses.ThesisClass' and obj.name <> 'Theses.ThesisClassTemplate' and obj.name <> 'Theses.ThesisTemplate' and prop0.id.id = obj.id and prop1.id.id = obj.id and prop2.id.id = obj.id and prop0.name = 'status' and prop1.name = '$roleSelectedFieldName' and prop2.name = '$orderingDateFieldName' and prop0.value = '$thesisStatus' and prop1.value like '%$userName%' order by prop2.value desc" ) 155 - #else 156 -## no specific role selected 157 - #set ($sql = ", BaseObject as obj, StringProperty as prop0, LargeStringProperty as prop1, LargeStringProperty as prop2, LargeStringProperty as prop3, DateProperty as prop4 158 - where obj.name = doc.fullName and obj.className = 'Theses.ThesisClass' and obj.name <> 'Theses.ThesisClassTemplate' and obj.name <> 'Theses.ThesisTemplate' 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 = 'status' and prop1.name = 'supervisor' and prop2.name = 'coSupervisors' and prop3.name = 'contact' and prop4.name = '$orderingDateFieldName' and prop0.value = '$thesisStatus' and ( prop1.value like '%$userName%' or prop2.value like '%$userName%' or prop3.value like '%$userName%' ) order by prop4.value desc" ) 121 + #end 122 + #if( $thesisFoundNo > 0 && !$oneCycle ) 123 +(% style="border-style:#if( $oneYear )hidden solid solid hidden#{else}hidden dotted hidden hidden#end; border-color:$theme.borderColor; text-align:right; font-style:oblique; font-weight:normal; font-size:smaller; color:$theme.textSecondaryColor" %)|#if( $oneYear ){{id name='$cycle-bottom'/}}#else{{id name='$cycle-$year-bottom'/}}#end($thesisYearCycleNo #if( $thesisYearCycleNo == 1 ){{thesisCycle plural='no' uppercase='no' short='no'}}$cycle{{/thesisCycle}}#else{{thesisCycle plural='yes' uppercase='no' short='no'}}$cycle{{/thesisCycle}}#end {{stringEngIta eng='in' ita='nel'/}} $year [[[{{stringEngIta eng='top' ita='in cima'/}}]>>||anchor="top"]] [[[{{stringEngIta eng='bottom' ita='in fondo'/}}]>>||anchor="bottom"]] 124 + #end 159 159 #end 160 - #elseif( $roleSelected ) 161 -## no user selected, some role selected 162 - #set ($sql = ", BaseObject as obj, StringProperty as prop0, LargeStringProperty as prop1, LargeStringProperty as prop2, LargeStringProperty as prop3, DateProperty as prop4 163 - where obj.name = doc.fullName and obj.className = 'Theses.ThesisClass' and obj.name <> 'Theses.ThesisClassTemplate' and obj.name <> 'Theses.ThesisTemplate' 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 = 'status' and prop1.name = 'supervisor' and prop2.name = 'coSupervisors' and prop3.name = 'contact' and prop4.name = '$orderingDateFieldName' and prop1.value like '%$supervisorName%' and prop2.value like '%$cosupervisorName%' and prop3.value like '%$contactName%' order by prop4.value desc") 164 - #else 165 -## no user selected, some role selected 166 - #set ($sql = ", BaseObject as obj, StringProperty as prop0, DateProperty as prop1 167 - where obj.name = doc.fullName and obj.className = 'Theses.ThesisClass' and obj.name <> 'Theses.ThesisClassTemplate' and obj.name <> 'Theses.ThesisTemplate' and prop0.id.id = obj.id and prop1.id.id = obj.id and prop0.name = 'status' and prop1.name = '$orderingDateFieldName' and prop0.value = '$thesisStatus' order by prop1.value desc" ) 126 + #set( $thesisYearNo = $thesisYearNo + $thesisYearCycleNo ) 168 168 #end 128 + #if( !$oneYear ) 129 +(% style="border-style:hidden solid solid hidden; border-color:$theme.borderColor; text-align:right; font-style:oblique; font-weight:normal; font-size:smaller; color:$theme.textSecondaryColor" %)|($thesisYearNo #if($thesisYearNo == 1){{stringEngIta eng='thesis in' ita='tesi nel'/}}#else{{stringEngIta eng='theses in' ita='tesi nel'/}}#end$year{{id name='$year-bottom'/}}) [[[{{stringEngIta eng='top' ita='in cima'/}}]>>||anchor="top"]] [[[{{stringEngIta eng='bottom' ita='in fondo'/}}]>>||anchor="bottom"]] 130 + #end 169 169 #end 170 -#set( $thesisFound = $xwiki.searchDocuments($sql) ) 171 -## 172 -#foreach ($thesis in $thesisFound)#set($thesisDoc = $xwiki.getDocument($thesis)) 173 -##* #thesisTitleLink($thesis)#if( $thesisDoc.getValue("studentUserName") != "" || $thesisDoc.getValue("studentName") != "" || ( $thesisDoc.getValue("studentFirstName") != "" && $thesisDoc.getValue("studentLastName") != "" ) ) //(#thesisAuthorLink($thesis)#if( $thesisDoc.display("endDate") != "" ), #thesisYear($thesis)#end)//#end 174 -* $thesis 175 -#end 132 +{{id name='bottom'/}} 176 176 {{/velocity}}