Changes for page Per Year
From version 17.3
edited by Andrea Omicini
on 25/10/2021 16:19
on 25/10/2021 16:19
Change comment:
There is no comment for this version
To version 102.2
edited by Andrea Omicini
on 30/10/2021 16:50
on 30/10/2021 16:50
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,196 +1,135 @@ 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 80 +### END USER & CYCLE 95 95 ## 96 -## $userSelected true and $roleSelected false means one user for all roles 97 -## $userSelected true and $roleSelected true for one user with one specific role 98 -## if $userSelected false and $roleSelected true mean at least one role with an assigned user 99 -## both false means all theses 100 -#if( $userSelected ) 101 - #if( $roleSelected ) // // 102 -> #FullThesisStatusesString($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 // // 103 - #else // // 104 -> #FullThesisStatusesString($thesisStatus) / $userFirstName $userLastName // // 105 - #end 106 -#else 107 - #if( $roleSelected ) // // 108 -> #FullThesisStatusesString($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 // // 109 - #else // // 110 -## > #FullThesisStatusesString($thesisStatus) // // 111 - #end 112 -#end 113 -## 114 -#if ( $cosupervisor ) 115 - #set ( $roleSelectedFieldName = "coSupervisors" ) 116 -#elseif ( $contact ) 117 - #set ( $roleSelectedFieldName = "contact" ) 118 -#else 119 - #set ( $roleSelectedFieldName = "supervisor" ) 120 -#end 121 -## 122 -#if ($userSelected) 123 - #if ( $roleSelected ) 124 - #set ($sql = ", BaseObject as obj, StringProperty as prop, LargeStringProperty as prop1, DateProperty as prop2 125 - where obj.name=doc.fullName and 126 - obj.className='Theses.ThesisClass' and 127 - obj.name<>'Theses.ThesisClassTemplate' and 128 - prop.id.id=obj.id and 129 - prop1.id.id=obj.id and 130 - prop2.id.id=obj.id and 131 - prop.name='status' and 132 - prop.value='$thesisStatus' and 133 - prop1.name='$roleSelectedFieldName' and 134 - prop2.name='$orderingDateFieldName' and 135 - prop1.value like '%$userName%' 136 - order by prop2.value desc") 137 - #else 138 - #set ($sql = ", BaseObject as obj, StringProperty as prop, LargeStringProperty as prop1, LargeStringProperty as prop2, LargeStringProperty as prop3, DateProperty as prop4 139 - where obj.name=doc.fullName and 140 - obj.className='Theses.ThesisClass' and 141 - obj.name<>'Theses.ThesisClassTemplate' and 142 - prop.id.id=obj.id and 143 - prop1.id.id=obj.id and 144 - prop2.id.id=obj.id and 145 - prop3.id.id=obj.id and 146 - prop4.id.id=obj.id and 147 - prop.name='status' and 148 - prop.value = '$thesisStatus' and 149 - prop1.name='supervisor' and 150 - prop2.name='coSupervisors' and 151 - prop3.name='contact' and 152 - prop4.name='$orderingDateFieldName' and 153 - ( prop1.value like '%$userName%' or 154 - prop2.value like '%$userName%' or 155 - prop3.value like '%$userName%') 156 - order by prop4.value desc") 157 - #end 158 -#elseif ( $roleSelected ) 159 - #set ($sql = ", BaseObject as obj, StringProperty as prop, LargeStringProperty as prop1, LargeStringProperty as prop2, LargeStringProperty as prop3, DateProperty as prop4 160 - where obj.name=doc.fullName and 161 - obj.className='Theses.ThesisClass' and 162 - obj.name<>'Theses.ThesisClassTemplate' and 163 - prop.id.id=obj.id and 164 - prop1.id.id=obj.id and 165 - prop2.id.id=obj.id and 166 - prop3.id.id=obj.id and 167 - prop4.id.id=obj.id and 168 - prop.name='status' and 169 - prop.value = '$thesisStatus' and 170 - prop1.name='supervisor' and 171 - prop2.name='coSupervisors' and 172 - prop3.name='contact' and 173 - prop4.name='$orderingDateFieldName' and 174 - prop1.value like '%$supervisorName%' and 175 - prop2.value like '%$cosupervisorName%' and 176 - prop3.value like '%$contactName%' 177 - order by prop4.value desc") 178 -#else 179 - #set ($sql = ", BaseObject as obj, StringProperty as prop, DateProperty as prop1 180 - where obj.name=doc.fullName and 181 - obj.className='Theses.ThesisClass' and 182 - obj.name<>'Theses.ThesisClassTemplate' and 183 - prop.id.id=obj.id and 184 - prop1.id.id=obj.id and 185 - prop.name='status' and 186 - prop.value = '$thesisStatus' and 187 - prop1.name='$orderingDateFieldName' 188 - order by prop1.value desc") 189 -#end 190 -#set($thesisFound = $xwiki.searchDocuments($sql)) 191 -## 192 -#foreach ($thesis in $thesisFound)#set($thesisDoc = $xwiki.getDocument($thesis)) 193 -* #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 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 + #if( !$oneYear || $selectedYear == $year ) 95 + #set( $thesisYearNo = 0 ) 96 + #if( !$oneYear ) 97 +(% style="border-style:solid hidden hidden solid; border-color:$theme.borderColor; text-align:left; font-style:oblique" %)|{{id name='$year'/}}$year 98 + #end 99 +## some selected year or year list / now $year 100 + #foreach( $cycle in $allThesisCycles ) 101 + #set( $thesisYearCycleNo = 0 ) 102 + #if( !$oneCycle || $selectedCycle == $cycle ) 103 +## some selected cycle or all cycles / now $cycle 104 + #if( $oneUser) 105 + #set ($sql = ", BaseObject as obj, StringProperty as prop0, DateProperty as prop1, LargeStringProperty as prop2, LargeStringProperty as prop3, LargeStringProperty as prop4 106 + 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 prop1.value = '$year' and ( prop2.value like '%$selectedUser%' or prop3.value like '%$selectedUser%' or prop4.value like '%$selectedUser%' ) order by prop1.value desc" ) 107 + #else 108 + #set ($sql = ", BaseObject as obj, StringProperty as prop0, DateProperty as prop1 109 + 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 prop1.value = '$year' order by prop1.value desc" ) 110 + #end 111 + #set( $thesisFound = $xwiki.searchDocuments($sql) ) 112 + #set( $thesisFoundNo = $thesisFound.size() ) 113 + #set( $thesisYearCycleNo = $thesisYearCycleNo + $thesisFoundNo ) 114 + #if( $thesisFoundNo > 0 && !$oneCycle ) 115 +(% 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}} 116 + #end 117 + #foreach( $thesis in $thesisFound ) 118 + #set( $thesisDoc = $xwiki.getDocument($thesis) ) 119 + #set( $thesisObj = $thesisDoc.getObject('Theses.ThesisClass') ) 120 +* [[$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 194 194 195 -#end 122 + #end 123 + #if( $thesisFoundNo > 0 && !$oneCycle ) 124 +(% 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"]] 125 + #end 126 + #end 127 + #set( $thesisYearNo = $thesisYearNo + $thesisYearCycleNo ) 128 + #end 129 + #end 130 + #if( !$oneYear ) 131 +(% 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"]] 132 + #end 133 + #end 134 +{{id name='bottom'/}} 196 196 {{/velocity}}