Changes for page Per Year
From version 38.1
edited by Andrea Omicini
on 25/10/2021 19:55
on 25/10/2021 19:55
Change comment:
There is no comment for this version
To version 8.1
edited by Andrea Omicini
on 18/06/2021 00:22
on 18/06/2021 00:22
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 per1 +SelectPerStatus - Content
-
... ... @@ -1,114 +1,199 @@ 1 -{{include reference="Theses.Environment"/}}{{include reference="Environment"/}}{{velocity}} 2 -#set( $thesisMenu = true ) 3 -### START STATUS 4 -## hypothesis: $thesisStatus set, default "Completed" 5 -## status parameter 6 -#set( $statusPar = $request.status.trim().toLowerCase() ) 7 -#set( $statusSelected = false ) 8 -#if( $statusPar != '' && $allThesisStatuses.contains($statusPar) ) 9 - #set( $statusSelected = true ) 10 - #set( $selectedStatus = $statusPar ) 11 -#end 12 -##check velocity variable, takes precedence 13 -#if( $thesisStatus && $thesisStatus != '' && $allThesisStatuses.contains($thesisStatus.trim().toLowerCase()) ) 14 - #set( $statusSelected = true ) 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 -## default for no selected status, too 24 - #set( $orderingDateFieldName = "endDate" ) 25 -#end 26 -## invariant: $statusSelected set, $selectedStatus & $orderingDateFieldName set accordingly 27 -### END STATUS 28 -## 29 -### START USER & ROLE 30 -#set( $userNamePar = $request.user.trim() ) 31 -## default values 1 +{{include document="Main.MacroSheet"/}}{{include document="Theses.MacroSheet"/}}{{velocity filter="none"}} 2 +#### get parameters 3 +## who 4 +#set( $userNamePar = $context.getRequest().getParameter("user") ) 5 +#set( $supervisorNamePar = $context.getRequest().getParameter("supervisor") ) 6 +#set( $cosupervisorNamePar = $context.getRequest().getParameter("cosupervisor") ) 7 +#set( $contactNamePar = $context.getRequest().getParameter("contact") ) 8 +#### set default values 32 32 #set( $userSelected = false ) 10 +#set( $roleSelected = false ) 33 33 #set( $userFirstName = "" ) 34 34 #set( $userLastName = "" ) 35 -#if( $userName || $userNamePar ) 36 -## a user is specified for all roles 37 - #if( !$userName ) 38 - #set( $selectedUser = "XWiki.$userNamePar" ) 39 - #else 40 - #set( $selectedUser = $userName ) 13 +#set( $supervisorName = "" ) 14 +#set( $supervisorFirstName = "" ) 15 +#set( $supervisorLastName = "" ) 16 +#set( $cosupervisorName = "" ) 17 +#set( $cosupervisorFirstName = "" ) 18 +#set( $cosupervisorLastName = "" ) 19 +#set( $contactName = "" ) 20 +#set( $contactFirstName = "" ) 21 +#set( $contactLastName = "" ) 22 +## 23 +#### handle who & roles 24 +## 25 +#if ( $userName || $userNamePar ) ## a user is specified for all roles 26 + #set( $userSelected = true ) 27 + #if ( !$userName )#set( $userName = "XWiki.$userNamePar" )#end 28 + #set( $userdoc = $xwiki.getDocument($userName) ) 29 + #set( $userFirstName = $userdoc.display("first_name") ) 30 + #set( $userLastName = $userdoc.display("last_name") ) 31 +#elseif ( $supervisorNamePar || $cosupervisorNamePar || $contactNamePar ) 32 + #set( $roleSelected = true ) 33 + #if ( $supervisorNamePar ) 34 + #set( $supervisorName = "XWiki.$supervisorNamePar" ) 35 + #set( $supervisordoc = $xwiki.getDocument($supervisorName) ) 36 + #set( $supervisorFirstName = $supervisordoc.display("first_name") ) 37 + #set( $supervisorLastName = $supervisordoc.display("last_name") ) 41 41 #end 42 - #if( $xwiki.exists($selectedUser) ) 43 - #set( $userSelected = true ) 44 - #set( $userdoc = $xwiki.getDocument($selectedUser) ) 45 - #set( $userFirstName = $userdoc.display("first_name") ) 46 - #set( $userLastName = $userdoc.display("last_name") ) 47 - #else 48 -{{warning}} $selectedUser is not an {{apice/}} user{{/warning}} 49 - #stop 39 + #if ( $cosupervisorNamePar ) 40 + #set( $cosupervisorName = "XWiki.$cosupervisorNamePar" ) 41 + #set( $cosupervisordoc = $xwiki.getDocument($cosupervisorName) ) 42 + #set( $cosupervisorFirstName = $cosupervisordoc.display("first_name") ) 43 + #set( $cosupervisorLastName = $cosupervisordoc.display("last_name") ) 50 50 #end 51 -##user selected and existing user page 52 - #set( $rolePar = $request.role.trim().toLowerCase() ) 53 - #set( $roleSelected = false ) 54 - #set( $selectedRole = '' ) 55 - #if( $rolePar != '' && $allThesisRoles.contains($rolePar) ) 56 - #set( $roleSelected = true ) 57 - #set( $selectedRole = $rolePar ) 45 + #if ( $contactNamePar ) 46 + #set( $contactName = "XWiki.$contactNamePar" ) 47 + #set( $contactdoc = $xwiki.getDocument($contactName) ) 48 + #set( $contactFirstName = $contactdoc.display("first_name") ) 49 + #set( $contactLastName = $contactdoc.display("last_name") ) 58 58 #end 59 59 #end 60 -## $userselected and $roleSelected set properly, other related variables set accordingly 61 -## $roleSelected has meaning only if $userSelected 62 -## if $userSelected, $roleSelected false means one user for all roles 63 -## if $userSelected, $roleSelected true means one specific role for one user selected 64 -## if $userSelected is false, $roleSelected means nothing -- so all users, all roles / just status 52 +#if( $supervisor ) 53 + #set( $roleSelected = true ) 54 + #set( $supervisorName = $userName ) 55 + #set( $supervisordoc = $xwiki.getDocument($supervisorName) ) 56 + #set( $supervisorFirstName = $supervisordoc.display("first_name") ) 57 + #set( $supervisorLastName = $supervisordoc.display("last_name") ) 58 +#end 59 +#if( $cosupervisor ) 60 + #set( $roleSelected = true ) 61 + #set( $cosupervisorName = $userName ) 62 + #set( $cosupervisordoc = $xwiki.getDocument($cosupervisorName) ) 63 + #set( $cosupervisorFirstName = $cosupervisordoc.display("first_name") ) 64 + #set( $cosupervisorLastName = $cosupervisordoc.display("last_name") ) 65 +#end 66 +#if( $contact ) 67 + #set( $roleSelected = true ) 68 + #set( $contactName = $userName ) 69 + #set( $contactdoc = $xwiki.getDocument($contactName) ) 70 + #set( $contactFirstName = $contactdoc.display("first_name") ) 71 + #set( $contactLastName = $contactdoc.display("last_name") ) 72 +#end 65 65 ## 66 -## title 67 ->#if( $statusSelected ){{thesisStatus plural='yes' uppercase='yes'}}$selectedStatus{{/thesisStatus}}#else{{stringEngIta eng="Theses" ita="Tesi"/}}#end#if( $userSelected ) / $userFirstName **$userLastName**#end 74 +## $userSelected true means one user for all roles 75 +## $userSelected true and $roleSelected true for one user with one specific role 76 +## if $userSelected false and $roleSelected true mean at least one role with an assigned user 77 +## both false means all theses 68 68 69 -## search theses 70 -#foreach( $status in $allThesisStatuses ) 71 - #if( !$statusSelected || $selectedStatus == $status ) 72 -= $status = 73 -## some selected status or all statuses / now $status 74 - #if( $userSelected ) 75 -== $selectedUser == 76 -## some user selected 77 - #foreach( $role in $allThesisRoles ) 78 - #if( !$roleSelected || $selectedRole == $role ) 79 - #if( $role == "contact" ) 80 - #set( $roleSelectedFieldName = "contact" ) 81 - #elseif( $role == "cosupervisor" ) 82 - #set( $roleSelectedFieldName = "coSupervisors" ) 83 - #else 84 - #set( $roleSelectedFieldName = "supervisor" ) 85 - #end 86 -## some selected role or all roles / now $role 87 -=== $role === 88 - #set ($sql = ", BaseObject as obj, StringProperty as prop0, LargeStringProperty as prop1, DateProperty as prop2 89 - 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 lower(prop0.value) = '$status' and prop1.value like '%$selectedUser%' order by prop2.value desc" ) 90 - #set( $thesisFound = $xwiki.searchDocuments($sql) ) 91 - #foreach( $thesis in $thesisFound ) 92 -* $thesis 93 - #end 94 - #end 95 - #end 96 -## no user selected, no role selected 97 - #else 98 - #set ($sql = ", BaseObject as obj, StringProperty as prop0, DateProperty as prop1 99 - 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 lower(prop0.value) = '$status' order by prop1.value desc" ) 100 - #set( $thesisFound = $xwiki.searchDocuments($sql) ) 101 - #foreach( $thesis in $thesisFound ) 102 -* $thesis 103 - #end 79 +== #if( $userSelected )$userFirstName $userLastName / #end#stringEnIt("Theses ","Tesi") / #ThesisStatusesString($thesisStatus) == 80 + 81 +#if( $roleSelected ) 82 + #if( $userSelected ) 83 + #if( $supervisor ) 84 +* #stringEnIt("as a supervisor","come relatore") 104 104 #end 86 + #if( $cosupervisor ) 87 +* #stringEnIt("as a co-supervisor","come correlatore") 88 + #end 89 + #if( $contact ) 90 +* #stringEnIt("as a contact","come contatto") 91 + #end 92 + #else 93 + #if( $supervisorLastName != "" ) 94 +* #stringEnIt("supervised by","con relatore") $supervisorFirstName $supervisorLastName 95 + #end 96 + #if( $cosupervisorLastName != "" ) 97 +* #stringEnIt("co-supervised by","con correlatore") $cosupervisorFirstName $cosupervisorLastName 98 + #end 99 + #if( $contactLastName != "" ) 100 +* #stringEnIt("with contact","con contatto") $contactFirstName $contactLastName 101 +<p/> 102 + #end 105 105 #end 104 +#end 106 106 ## 107 -## #set( $thesisFound = $xwiki.searchDocuments($sql) ) 108 -## #set( $thesisFoundNo = $thesisFound.size() ) 109 -## #set($thesisDoc = $xwiki.getDocument($thesis)) 110 -## #set($thesisObj = $thesisDoc.getObject('Theses.ThesisClass')) 111 -##* [[$thesisObj.title>>$thesisDoc]] #if( $thesisDoc.getValue('studentUserName') != "" )//$thesisDoc.getValue('studentUserName')//#elseif( $thesisObj.studentFirstName != "" && $thesisObj.studentLastName != "" )//$thesisObj.studentFirstName $thesisObj.studentLastName//#end#if( $thesisObj.endDate != "" ) ($thesisObj.endDate)#end 112 -## #end 106 +## hypothesis: $thesisStatus set, default "Completed" 107 +## to do: get from parameter 108 +#if ($thesisStatus == "Available") 109 + #set ($orderingDateFieldName = "availabilityDate") 110 +#elseif ($thesisStatus == "Ongoing") 111 + #set ($orderingDateFieldName = "startDate") 112 +#else 113 + #set ($thesisStatus = "Completed") 114 + #set ($orderingDateFieldName = "endDate") 113 113 #end 116 +## 117 +#if ( $cosupervisor ) 118 + #set ( $roleSelectedFieldName = "coSupervisors" ) 119 +#elseif ( $contact ) 120 + #set ( $roleSelectedFieldName = "contact" ) 121 +#else 122 + #set ( $roleSelectedFieldName = "supervisor" ) 123 +#end 124 +## 125 +#if ($userSelected) 126 + #if ( $roleSelected ) 127 + #set ($sql = ", BaseObject as obj, StringProperty as prop, LargeStringProperty as prop1, DateProperty as prop2 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 + prop.name='status' and 135 + prop.value='$thesisStatus' and 136 + prop1.name='$roleSelectedFieldName' and 137 + prop2.name='$orderingDateFieldName' and 138 + prop1.value like '%$userName%' 139 + order by prop2.value desc") 140 + #else 141 + #set ($sql = ", BaseObject as obj, StringProperty as prop, LargeStringProperty as prop1, LargeStringProperty as prop2, LargeStringProperty as prop3, DateProperty as prop4 142 + where obj.name=doc.fullName and 143 + obj.className='Theses.ThesisClass' and 144 + obj.name<>'Theses.ThesisClassTemplate' and 145 + prop.id.id=obj.id and 146 + prop1.id.id=obj.id and 147 + prop2.id.id=obj.id and 148 + prop3.id.id=obj.id and 149 + prop4.id.id=obj.id and 150 + prop.name='status' and 151 + prop.value = '$thesisStatus' and 152 + prop1.name='supervisor' and 153 + prop2.name='coSupervisors' and 154 + prop3.name='contact' and 155 + prop4.name='$orderingDateFieldName' and 156 + ( prop1.value like '%$userName%' or 157 + prop2.value like '%$userName%' or 158 + prop3.value like '%$userName%') 159 + order by prop4.value desc") 160 + #end 161 +#elseif ( $roleSelected ) 162 + #set ($sql = ", BaseObject as obj, StringProperty as prop, LargeStringProperty as prop1, LargeStringProperty as prop2, LargeStringProperty as prop3, DateProperty as prop4 163 + where obj.name=doc.fullName and 164 + obj.className='Theses.ThesisClass' and 165 + obj.name<>'Theses.ThesisClassTemplate' and 166 + prop.id.id=obj.id and 167 + prop1.id.id=obj.id and 168 + prop2.id.id=obj.id and 169 + prop3.id.id=obj.id and 170 + prop4.id.id=obj.id and 171 + prop.name='status' and 172 + prop.value = '$thesisStatus' and 173 + prop1.name='supervisor' and 174 + prop2.name='coSupervisors' and 175 + prop3.name='contact' and 176 + prop4.name='$orderingDateFieldName' and 177 + prop1.value like '%$supervisorName%' and 178 + prop2.value like '%$cosupervisorName%' and 179 + prop3.value like '%$contactName%' 180 + order by prop4.value desc") 181 +#else 182 + #set ($sql = ", BaseObject as obj, StringProperty as prop, DateProperty as prop1 183 + where obj.name=doc.fullName and 184 + obj.className='Theses.ThesisClass' and 185 + obj.name<>'Theses.ThesisClassTemplate' and 186 + prop.id.id=obj.id and 187 + prop1.id.id=obj.id and 188 + prop.name='status' and 189 + prop.value = '$thesisStatus' and 190 + prop1.name='$orderingDateFieldName' 191 + order by prop1.value desc") 192 +#end 193 +#set($thesisFound = $xwiki.searchDocuments($sql)) 194 + 195 +#foreach ($thesis in $thesisFound)#set($thesisDoc = $xwiki.getDocument($thesis)) 196 +* #thesisTitleLink($thesis)#if( $thesisDoc.getValue("studentUserName") != "" || $thesisDoc.getValue("studentName") != "" ) //(#thesisAuthorLink($thesis))// #end 197 + 198 +#end 114 114 {{/velocity}}