Wiki source code of Per Status

Show last authors
1 {{velocity}}
2 {{html wiki="true" clean="false"}}
3 #template('apice_macros.vm')
4 #setobjectspace("Theses")
5 #template('apice_thesis_macros.vm')
6 #### SET PARAMETERS / START
7 #template('apice_user_param.vm')
8 ##
9 #### STATUS / START
10 ## $statusList gets the list of statuses to be shown
11 ## $oneStatus true if just one status to be shown
12 #if( $request.status && $request.status.trim() != "" )
13 #set( $statusPar = $request.status.trim().toLowerCase() )
14 #if( $thesisStatuses.contains($statusPar) )
15 ## 'status' parameter is an admissible thesis status value
16 #set( $statusList = [$statusPar])
17 #set( $oneStatus = true )
18 #set( $status = $statusPar )
19 #else
20 ## 'status' parameter is not an admissible thesis status value
21 {{warning}}$statusPar is not an admissible status for APICe theses{{/warning}}
22 #stop
23 #end
24 #else
25 ## default: all statuses
26 #set( $statusList = $showcaseThesisStatuses )
27 #set( $oneStatus = false )
28 #set( $status = "" )
29 #end
30 ## set ordering field
31 #if( $status == "available" )
32 #set( $orderingDate = "available" )
33 #elseif( $status == "ongoing" )
34 #set( $orderingDate = "start" )
35 #else
36 ## default for no selected status, too
37 #set( $orderingDate = "end" )
38 #end
39 ## invariant: $oneStatus set, $status, $statusList & $orderingDate set accordingly
40 #### STATUS / END
41 ##
42 #### ROLE / START
43 ## $oneRole true if just one role to be shown
44 ## $oneRole has meaning only if $oneUser
45 ## if $oneUser, $oneRole false means one user for all roles
46 ## if $oneUser, $oneRole true means one specific role for one user selected
47 ## if $oneUser is false, $oneRole means nothing -- so all users, all roles / just status
48 #if( $oneUser && $request.role && $request.role.trim() != "" )
49 #set( $rolePar = $request.role.trim().toLowerCase() )
50 #if( $thesisRoles.contains($rolePar) )
51 ## 'role' parameter is an admissible thesis role value
52 #set( $roleList = [$rolePar])
53 #set( $oneRole = true )
54 #set( $role = $rolePar )
55 #else
56 ## 'role' parameter is not an admissible thesis role value
57 {{warning}}$rolePar is not an admissible role for APICe theses{{/warning}}
58 #stop
59 #end
60 #else
61 ## default: all roles
62 #set( $roleList = $thesisRoles )
63 #set( $oneRole = false )
64 #set( $role = "" )
65 #end
66 ## $oneUser and $oneRole set properly, other related variables set accordingly
67 #### SET PARAMETERS / END
68 ##
69 ## DATA STRUCTURES / START
70 #set( $itemMap = {} )
71 #set( $itemNo = 0 )
72 #foreach( $status in $statusList )
73 #set( $query = ", BaseObject as objThesis, DateProperty as propDate, StringProperty as propStatus, LargeStringProperty as propSupervisor, LargeStringProperty as propCosupervisor, LargeStringProperty as propContact
74 where objThesis.name = doc.fullName and objThesis.className = '${mainSpace}.Class' and objThesis.name <> '${objectPool}.Template' and propDate.id.id = objThesis.id and propStatus.id.id = objThesis.id and propSupervisor.id.id = objThesis.id and propCosupervisor.id.id = objThesis.id and propContact.id.id = objThesis.id and propStatus.name = 'status' and propStatus.value = '$status' and propSupervisor.name = 'supervisors' and propCosupervisor.name = 'cosupervisors' and propContact.name = 'contacts' #if( $role == 'supervisor' )and propSupervisor.value like '$userString'#end #if( $role == 'cosupervisor' )and propCosupervisor.value like '$userString'#end #if( $role == 'contact' ) and propContact.value like '$userString'#end #if( $oneUser && !$oneRole ) and ( propSupervisor.value like '$userString' or propCosupervisor.value like '$userString' or propContact.value like '$userString' )#end and propDate.name = '$orderingDate' order by propDate.value desc" )
75 ## do query
76 #set( $itemFound = $xwiki.searchDocuments($query) )
77 ## set counters
78 #set( $itemStatusNo = $itemFound.size() )
79 #if( $itemStatusNo > 0 )
80 #set( $itemMap[$status] = $itemFound )
81 #set( $itemNo = $itemNo + $itemStatusNo )
82 #end
83 #end
84 ## DATA STRUCTURES / END
85 ##
86 ## DISPLAY / START
87 ## page subtitle
88 <div class="mainheader">
89 $itemNo
90 #if( $itemNo == 1 )
91 #if( $oneStatus )
92 {{thesisStatus plural="false" uppercase="false"}}$status{{/thesisStatus}}
93 #else
94 $services.localization.render('thesis').toLowerCase()
95 #end
96 #else
97 #if( $oneStatus )
98 {{thesisStatus plural="true" uppercase="false"}}$status{{/thesisStatus}}
99 #else
100 $services.localization.render('theses').toLowerCase()
101 #end
102 #end
103 #if( $oneUser )
104 #if( $oneRole )
105 <span class="textsecondary">&ensp;/&ensp;</span>
106 {{thesisRole short="true" plural="false" uppercase="false" short="true"}}$role{{/thesisRole}}
107 #end
108 <span class="textsecondary">&ensp;/&ensp;</span>
109 $userFirstName $userLastName
110 #end
111 </div>
112 ## stop if no thesis is found
113 #if( $itemNo == 0 || $itemMap.keySet().size() == 0 )
114 ## redundant double check
115 #stop
116 #end
117 ## some theses found
118 ## page index
119 #if( $itemMap.keySet().size() > 1 )
120 ## found more than one status
121 <div class="mainselectbar" id="index">
122 #foreach( $status in $itemMap.keySet() )
123 #if( !$foreach.first )
124 &ensp;&bull;&ensp;
125 #end
126 [[{{thesisStatus plural="true" uppercase="false" short="true"}}$status{{/thesisStatus}}>>||anchor="$status"#if( $oneRole ) queryString="role=$role"#end]]
127 #end
128 </div>
129 #end
130 ## theses displayed per status
131 #foreach( $status in $itemMap.keySet() )
132 ## status top / start
133 <div class="mainselectseparator">
134 <a class="mainselectseparatorlink" id="$status" href=$xwiki.getURL($doc,"view","status=$status#if( $apiceUser )&user=$userName#elseif( $oneUser )&name=$userFirstName&surname=$userLastName#end#if( $oneRole )&role=$role#end")>
135 {{thesisStatus plural="true" uppercase="false"}}$status{{/thesisStatus}}
136 </a>
137 </div>
138 ## status top / end
139 ##
140 ## thesis display / start
141 <div style="font-style: normal"><ul>
142 #foreach( $item in $itemMap[$status] )
143 <li>#thesisyear($item)</li>
144 #end
145 </ul></div>
146 ## thesis display / end
147 ##
148 ## status bottom / start
149 <div #if( $foreach.last )id="bottom"#end class="mainselectbottom">
150 #set( $itemStatusNo = $itemMap[$status].size() )
151 $itemStatusNo
152 #if( $itemStatusNo == 1 )
153 $services.localization.render('thesis').toLowerCase()
154 #else
155 $services.localization.render('theses').toLowerCase()
156 #end
157 #if( $oneRole )
158 $services.localization.render('ascome').toLowerCase() {{thesisRole short="true" plural="false" uppercase="false"}}$role{{/thesisRole}}
159 #end
160 <span class="textsecondary">&ensp;/&ensp;</span>
161 {{thesisStatus short="true" plural="true" uppercase="false"}}$status{{/thesisStatus}}
162 &ensp;&bull;&ensp;
163 #anchorlinks()
164 </div>
165 ## status bottom / end
166 #end
167 ## DISPLAY / END
168 {{/html}}
169 {{/velocity}}{{pageDisplay sort="objectservice"/}}