Changes for page Per Year
From version 1.17
edited by Andrea Omicini
on 16/06/2021 11:13
on 16/06/2021 11:13
Change comment:
There is no comment for this version
To version 20.2
edited by Andrea Omicini
on 25/10/2021 17:00
on 25/10/2021 17:00
Change comment:
There is no comment for this version
Summary
-
Page properties (3 modified, 0 added, 0 removed)
Details
- Page properties
-
- Title
-
... ... @@ -1,1 +1,1 @@ 1 - SelectPerStatus1 +Theses per Status - Syntax
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki 1.01 +XWiki 2.1 - Content
-
... ... @@ -1,17 +1,36 @@ 1 -#includeMacros("Main.MacroSheet") 2 -#includeMacros("Theses.MacroSheet") 3 -#includeMacros("Theses.GlobalVars") 4 - 1 +{{include reference="Theses.Environment"/}}{{include reference="Environment"/}}{{velocity}} 2 +#set( $thesisMenu = true ) 5 5 #### 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 ) 9 +#else 10 + #set( $selectedStatus = 'all' ) 11 +#end 12 +$selectedStatus 13 +##check velocity variable, takes precedence 14 +#if( $thesisStatus && $thesisStatus != '' && $allThesisStatuses.contains($thesisStatus.trim().toLowerCase()) ) 15 + #set( $selectedStatus = $thesisStatus.trim().toLowerCase() ) 16 +#end 17 +## set ordering field 18 +#if( $selectedStatus == "available" ) 19 + #set( $orderingDateFieldName = "availabilityDate" ) 20 +#elseif( $selectedStatus == "ongoing" ) 21 + #set( $orderingDateFieldName = "startDate" ) 22 +#else 23 + #set( $orderingDateFieldName = "endDate" ) 24 +#end 25 +## invariant: $thesisStatus set, $orderingDateFieldName set correspondingly 6 6 ## who 7 -#set( $userNamePar = $context.getRequest().getParameter("user") ) 8 -#set( $supervisorNamePar = $context.getRequest().getParameter("supervisor") ) 9 -#set( $cosupervisorNamePar = $context.getRequest().getParameter("cosupervisor") ) 10 -#set( $contactNamePar = $context.getRequest().getParameter("contact") ) 11 - 27 +#set( $userNamePar = $request.user ) 28 +#set( $supervisorNamePar = $request.supervisor ) 29 +#set( $cosupervisorNamePar = $request.cosupervisor ) 30 +#set( $contactNamePar = $request.contact ) 12 12 #### set default values 13 13 #set( $userSelected = false ) 14 -#set( $roleSelected = false ) 33 +#set( $roleSelected = false ) 15 15 #set( $userFirstName = "" ) 16 16 #set( $userLastName = "" ) 17 17 #set( $supervisorName = "" ) ... ... @@ -23,7 +23,7 @@ 23 23 #set( $contactName = "" ) 24 24 #set( $contactFirstName = "" ) 25 25 #set( $contactLastName = "" ) 26 - 45 +## 27 27 #### handle who & roles 28 28 ## 29 29 #if ( $userName || $userNamePar ) ## a user is specified for all roles ... ... @@ -54,7 +54,7 @@ 54 54 #end 55 55 #end 56 56 #if( $supervisor ) 57 - #set( $roleSelected = true ) 76 + #set( $roleSelected = true ) 58 58 #set( $supervisorName = $userName ) 59 59 #set( $supervisordoc = $xwiki.getDocument($supervisorName) ) 60 60 #set( $supervisorFirstName = $supervisordoc.display("first_name") ) ... ... @@ -74,112 +74,73 @@ 74 74 #set( $contactFirstName = $contactdoc.display("first_name") ) 75 75 #set( $contactLastName = $contactdoc.display("last_name") ) 76 76 #end 77 - 78 -## $userSelected true means one user for all roles 96 +$supervisor 97 +$cosupervisor 98 +$contact 99 +$userFirstName $userLastName 100 +$supervisorFirstName $supervisorLastName 101 +$cosupervisorFirstName $cosupervisorLastName 102 +$contactFirstName $contactLastName 103 +## 104 +## $userSelected true and $roleSelected false means one user for all roles 79 79 ## $userSelected true and $roleSelected true for one user with one specific role 80 80 ## if $userSelected false and $roleSelected true mean at least one role with an assigned user 81 81 ## both false means all theses 82 -#if ($userSelected) 83 -1 #stringEnIt("Theses with ","Tesi con") $userFirstName $userLastName #if($supervisor)#stringEnIt("as a supervisor","come relatore")#end#if($cosupervisor)#stringEnIt("as a co-supervisor","come correlatore")#end#if($contact)#stringEnIt("as a contact","come contatto")#end #stringEnIt("in the #apice() space","nello spazio #apice()") 84 -#elseif ( $roleSelected ) 85 -1 #stringEnIt("Theses","Tesi") #if($supervisorLastName != "") #stringEnIt("supervised by","con relatore") $supervisorFirstName $supervisorLastName#if($cosupervisorLastName != "" || $contactLastName != ""), #end#end#if($cosupervisorLastName != "") #stringEnIt("co-supervised by","con correlatore") $cosupervisorFirstName $cosupervisorLastName#if($contactLastName != ""), #end#end #if($contactLastName != "") #stringEnIt("with contact","con contatto") $contactFirstName $contactLastName#end #stringEnIt("in the #apice() space","nello spazio #apice()") 86 -#else 87 - 1 #stringEnIt("Theses","Tesi") #stringEnIt("in the #apice() space","nello spazio #apice()") 88 -#end 108 +#if( $userSelected ) 109 + #if( $roleSelected ) 110 +>{{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 89 89 90 -## hypothesis: $thesisStatus set, default "Completed" 91 -## to do: get from parameter 92 -#if ($thesisStatus == "Available") 93 - #set ($orderingDateFieldName = "availabilityDate") 94 -#elseif ($thesisStatus == "Ongoing") 95 - #set ($orderingDateFieldName = "startDate") 112 + #else 113 +>{{thesisStatus plural='yes' uppercase='yes'}}$thesisStatus{{thesisStatus}} / $userFirstName $userLastName 114 + 115 + #end 96 96 #else 97 - #set ($thesisStatus = "Completed") 98 - #set ($orderingDateFieldName = "endDate") 117 + #if( $roleSelected ) 118 +>{{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 119 + 120 + #else 121 +>{{thesisStatus plural='yes' uppercase='yes'}}$thesisStatus{{thesisStatus}} 122 + 123 + #end 99 99 #end 100 -## 101 -#if 102 - #set 103 -#elseif 104 - #set 125 +## 126 +#if( $cosupervisor ) 127 + #set( $roleSelectedFieldName = "coSupervisors" ) 128 +#elseif( $contact ) 129 + #set( $roleSelectedFieldName = "contact" ) 105 105 #else 106 - #set 131 + #set( $roleSelectedFieldName = "supervisor" ) 107 107 #end 108 - 109 -1.1 #ThesisStatusesString($thesisStatus) 110 - 111 -#if ($userSelected) 112 - #if ( $roleSelected ) 113 - #set ($sql = ", BaseObject as obj, StringProperty as prop, LargeStringProperty as prop1, DateProperty as prop2 114 - where obj.name=doc.fullName and 115 - obj.className='Theses.ThesisClass' and 116 - obj.name<>'Theses.ThesisClassTemplate' and 117 - prop.id.id=obj.id and 118 - prop1.id.id=obj.id and 119 - prop2.id.id=obj.id and 120 - prop.name='status' and 121 - prop.value='$thesisStatus' and 122 - prop1.name='$roleSelectedFieldName' and 123 - prop2.name='$orderingDateFieldName' and 124 - prop1.value like '%$userName%' 125 - order by prop2.value desc") 133 +## 134 +#if( $selectedStatus == 'all' ) 135 + ALL STATUSES 136 +#else 137 +## some selected status 138 + #if( $userSelected ) 139 +## some user selected 140 + #if( $roleSelected ) 141 +## some specific role selected 142 + #set ($sql = ", BaseObject as obj, StringProperty as prop0, LargeStringProperty as prop1, DateProperty as prop2 143 + 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" ) 144 + #else 145 +## no specific role selected 146 + #set ($sql = ", BaseObject as obj, StringProperty as prop0, LargeStringProperty as prop1, LargeStringProperty as prop2, LargeStringProperty as prop3, DateProperty as prop4 147 + 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" ) 148 + #end 149 + #elseif( $roleSelected ) 150 +## no user selected, some role selected 151 + #set ($sql = ", BaseObject as obj, StringProperty as prop0, LargeStringProperty as prop1, LargeStringProperty as prop2, LargeStringProperty as prop3, DateProperty as prop4 152 + 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") 126 126 #else 127 - #set ($sql = ", BaseObject as obj, StringProperty as prop, LargeStringProperty as prop1, LargeStringProperty as prop2, LargeStringProperty as prop3, DateProperty as prop4 128 - where obj.name=doc.fullName and 129 - obj.className='Theses.ThesisClass' and 130 - obj.name<>'Theses.ThesisClassTemplate' and 131 - prop.id.id=obj.id and 132 - prop1.id.id=obj.id and 133 - prop2.id.id=obj.id and 134 - prop3.id.id=obj.id and 135 - prop4.id.id=obj.id and 136 - prop.name='status' and 137 - prop.value = '$thesisStatus' and 138 - prop1.name='supervisor' and 139 - prop2.name='coSupervisors' and 140 - prop3.name='contact' and 141 - prop4.name='$orderingDateFieldName' and 142 - ( prop1.value like '%$userName%' or 143 - prop2.value like '%$userName%' or 144 - prop3.value like '%$userName%') 145 - order by prop4.value desc") 154 +## no user selected, some role selected 155 + #set ($sql = ", BaseObject as obj, StringProperty as prop0, DateProperty as prop1 156 + 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" ) 146 146 #end 147 -#elseif ( $roleSelected ) 148 - #set ($sql = ", BaseObject as obj, StringProperty as prop, LargeStringProperty as prop1, LargeStringProperty as prop2, LargeStringProperty as prop3, DateProperty as prop4 149 - where obj.name=doc.fullName and 150 - obj.className='Theses.ThesisClass' and 151 - obj.name<>'Theses.ThesisClassTemplate' and 152 - prop.id.id=obj.id and 153 - prop1.id.id=obj.id and 154 - prop2.id.id=obj.id and 155 - prop3.id.id=obj.id and 156 - prop4.id.id=obj.id and 157 - prop.name='status' and 158 - prop.value = '$thesisStatus' and 159 - prop1.name='supervisor' and 160 - prop2.name='coSupervisors' and 161 - prop3.name='contact' and 162 - prop4.name='$orderingDateFieldName' and 163 - prop1.value like '%$supervisorName%' and 164 - prop2.value like '%$cosupervisorName%' and 165 - prop3.value like '%$contactName%' 166 - order by prop4.value desc") 167 -#else 168 - #set ($sql = ", BaseObject as obj, StringProperty as prop, DateProperty as prop1 169 - where obj.name=doc.fullName and 170 - obj.className='Theses.ThesisClass' and 171 - obj.name<>'Theses.ThesisClassTemplate' and 172 - prop.id.id=obj.id and 173 - prop1.id.id=obj.id and 174 - prop.name='status' and 175 - prop.value = '$thesisStatus' and 176 - prop1.name='$orderingDateFieldName' 177 - order by prop1.value desc") 178 178 #end 179 -#set($thesisFound = $xwiki.searchDocuments($sql)) 180 - 159 +#set( $thesisFound = $xwiki.searchDocuments($sql) ) 160 +## 181 181 #foreach ($thesis in $thesisFound)#set($thesisDoc = $xwiki.getDocument($thesis)) 182 -* [$thesisDoc.getValue('title') |$thesis]#if( $thesisDoc.getValue('studentUserName') != ""&&$xwiki.exists($thesisDoc.getValue('studentUserName')))~~(#thesisStudentUser($thesis))~~#elseif($thesisDoc.getValue('studentName') != "" )~~($thesisDoc.getValue('studentName'))~~#end183 - 162 +##* #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 163 +* $thesis 184 184 #end 185 - 165 +{{/velocity}}