1 | <%@ page import="dbnp.studycapturing.Study" %> |
---|
2 | <html> |
---|
3 | <head> |
---|
4 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
---|
5 | <meta name="layout" content="main" /> |
---|
6 | <g:set var="entityName" value="${message(code: 'study.label', default: 'Study')}" /> |
---|
7 | <title><g:message code="default.list.label" args="[entityName]" /></title> |
---|
8 | |
---|
9 | <script type="text/javascript"> |
---|
10 | $(function() { |
---|
11 | $("#tabs").tabs(); |
---|
12 | }); |
---|
13 | </script> |
---|
14 | |
---|
15 | </head> |
---|
16 | <body> |
---|
17 | |
---|
18 | <% studyList = dbnp.studycapturing.Study.list() %> |
---|
19 | <% def att_list = ['template','startDate','events','samplingEvents','lastUpdated','readers','code','editors','ecCode','researchQuestion','title','description','owner','dateCreated'] %> |
---|
20 | <% def selectedStudies = [] %> |
---|
21 | <% def tmpList = [] %> |
---|
22 | |
---|
23 | |
---|
24 | <div class="nav"> |
---|
25 | <span class="menuButton"><a class="home" href="${createLink(uri: '/')}">Home</a></span> |
---|
26 | <span class="menuButton"><g:link class="list" action="list"><g:message code="default.list.label" args="[entityName]" /></g:link></span> |
---|
27 | <span class="menuButton"><g:link class="create" action="create"><g:message code="default.new.label" args="[entityName]" /></g:link></span> |
---|
28 | </div> |
---|
29 | |
---|
30 | <div class="body"> |
---|
31 | <h1>Studies Comparison</h1> |
---|
32 | <g:if test="${flash.message}"> |
---|
33 | <div class="message">${flash.message}</div> |
---|
34 | </g:if> |
---|
35 | |
---|
36 | <% params.each{key,values-> %> |
---|
37 | <% if (values=="on"){ %> |
---|
38 | <% tmpList.add(key) %> |
---|
39 | <% } }%> |
---|
40 | |
---|
41 | <% for (i in studyList) {%> |
---|
42 | <% if (tmpList.contains(i.getTitle())) { %> |
---|
43 | <% selectedStudies.add(i) %> |
---|
44 | <% }} %> |
---|
45 | |
---|
46 | <% |
---|
47 | /* Determine all template fields that are available in one or more templates used */ |
---|
48 | def allTemplateFields = [] |
---|
49 | selectedStudies.each { println it.giveFields(); allTemplateFields += it.giveFields() } |
---|
50 | allTemplateFields = allTemplateFields.unique(); |
---|
51 | %> |
---|
52 | <g:if test="${selectedStudies.size()>0}"> |
---|
53 | |
---|
54 | <div id="tabs"> |
---|
55 | <ul> |
---|
56 | <li><a href="#study">Study Information</a></li> |
---|
57 | <li><a href="#subjects">Subjects</a></li> |
---|
58 | <li><a href="#events">Events</a></li> |
---|
59 | <li><a href="#event-group">Event Groups</a></li> |
---|
60 | <li><a href="#assays">Assays</a></li> |
---|
61 | <li><a href="#persons">Persons</a></li> |
---|
62 | </ul> |
---|
63 | |
---|
64 | |
---|
65 | <div id="study"> |
---|
66 | <br> |
---|
67 | <table> |
---|
68 | <tr> |
---|
69 | <td></td> |
---|
70 | <g:each in="${selectedStudies}" status="j" var="studyIns"> |
---|
71 | <td width="50%"><b>${studyIns.title}</b></td> |
---|
72 | </g:each> |
---|
73 | </tr> |
---|
74 | <tr> |
---|
75 | <td><b>Id</b></td> |
---|
76 | <g:each in="${selectedStudies}" status="k" var="studyIns"> |
---|
77 | <td><g:link action="show" id="${studyIns.id}"> |
---|
78 | ${fieldValue(bean: studyIns, field: "id")}</g:link></td> |
---|
79 | </g:each> |
---|
80 | </tr> |
---|
81 | <tr> |
---|
82 | <td><b>Template</b></td> |
---|
83 | <g:each in="${selectedStudies}" status="k" var="studyIns"> |
---|
84 | <td><g:link controller="template" action="show" id="${studyIns.template?.id}"> |
---|
85 | ${studyInse?.template?.encodeAsHTML()}</g:link></td> |
---|
86 | </g:each> |
---|
87 | </tr> |
---|
88 | |
---|
89 | <tr> |
---|
90 | <td><b>Title</b></td> |
---|
91 | <g:each in="${selectedStudies}" status="k" var="studyIns"> |
---|
92 | <td>${fieldValue(bean: studyIns, field: "title")}</td> |
---|
93 | </g:each> |
---|
94 | </tr> |
---|
95 | <tr> |
---|
96 | <td><b>Start</b></td> |
---|
97 | <g:each in="${selectedStudies}" status="k" var="studyIns"> |
---|
98 | <td><g:formatDate date="${studyIns?.startDate}" /></td> |
---|
99 | </g:each> |
---|
100 | </tr> |
---|
101 | |
---|
102 | <tr> |
---|
103 | <td><b>Date Created</b></td> |
---|
104 | <g:each in="${selectedStudies}" status="k" var="studyIns"> |
---|
105 | <td><g:formatDate date="${studyIns?.dateCreated}" /></td> |
---|
106 | </g:each> |
---|
107 | </tr> |
---|
108 | <tr> |
---|
109 | <td><b>Last updated</b></td> |
---|
110 | <g:each in="${selectedStudies}" status="k" var="studyIns"> |
---|
111 | <td><g:formatDate date="${studyIns?.lastUpdated}" /></td> |
---|
112 | </g:each> |
---|
113 | </tr> |
---|
114 | |
---|
115 | <tr> |
---|
116 | <td><b>Events</b></td> |
---|
117 | <g:each in="${selectedStudies}" status="k" var="studyIns"> |
---|
118 | <td> |
---|
119 | <g:if test="${studyIns.giveEventTemplates().size()==0}"> |
---|
120 | - |
---|
121 | </g:if> |
---|
122 | <g:else> |
---|
123 | ${studyIns.giveEventTemplates().name} |
---|
124 | </g:else> |
---|
125 | </td> |
---|
126 | </g:each> |
---|
127 | </tr> |
---|
128 | <tr> |
---|
129 | <td><b>Sampling Events</b></td> |
---|
130 | <g:each in="${selectedStudies}" status="k" var="studyIns"> |
---|
131 | <td> |
---|
132 | <g:if test="${studyIns.giveSamplingEventTemplates().size()==0}"> |
---|
133 | - |
---|
134 | </g:if> |
---|
135 | <g:else> |
---|
136 | ${studyIns.giveSamplingEventTemplates().name} |
---|
137 | </g:else> |
---|
138 | </td> |
---|
139 | </g:each> |
---|
140 | </tr> |
---|
141 | <tr> |
---|
142 | <td><b>Owner</b></td> |
---|
143 | <g:each in="${selectedStudies}" status="k" var="studyIns"> |
---|
144 | <td> |
---|
145 | <g:link controller="user" action="show" id="${studyIns?.owner?.id}">${studyIns?.owner?.encodeAsHTML()}</g:link> |
---|
146 | </td> |
---|
147 | </g:each> |
---|
148 | </tr> |
---|
149 | |
---|
150 | <tr> |
---|
151 | <td><b>Readers</b></td> |
---|
152 | <g:each in="${selectedStudies}" status="k" var="studyIns"> |
---|
153 | <td> |
---|
154 | <g:if test="${studyIns.readers.size()==0}"> |
---|
155 | - |
---|
156 | </g:if> |
---|
157 | <g:else> |
---|
158 | <g:each in="${studyIns.readers}" var="r"> |
---|
159 | <li><g:link controller="user" action="show" id="${r.id}">${r?.encodeAsHTML()}</g:link></li> |
---|
160 | </g:each> |
---|
161 | </g:else> |
---|
162 | </td> |
---|
163 | </g:each> |
---|
164 | </tr> |
---|
165 | <tr> |
---|
166 | <td><b>Editors</b></td> |
---|
167 | <g:each in="${selectedStudies}" status="k" var="studyIns"> |
---|
168 | <td> |
---|
169 | <g:if test="${studyIns.editors.size()==0}"> |
---|
170 | - |
---|
171 | </g:if> |
---|
172 | <g:else> |
---|
173 | <g:each in="${studyIns.editors}" var="r"> |
---|
174 | <li><g:link controller="user" action="show" id="${r.id}">${r?.encodeAsHTML()}</g:link></li> |
---|
175 | </g:each> |
---|
176 | </g:else> |
---|
177 | </td> |
---|
178 | </g:each> |
---|
179 | </tr> |
---|
180 | |
---|
181 | <!-- All template fields --> |
---|
182 | <g:each in="${allTemplateFields}" var="field"> |
---|
183 | <tr> |
---|
184 | <td><b>${field.name}</b></td> |
---|
185 | <g:each in="${selectedStudies}" status="k" var="studyIns"> |
---|
186 | <td> |
---|
187 | <g:if test="${studyIns.fieldExists(field.name)}"> |
---|
188 | ${studyIns.getFieldValue(field.name)} |
---|
189 | </g:if> |
---|
190 | <g:else> |
---|
191 | - |
---|
192 | </g:else> |
---|
193 | </td> |
---|
194 | </g:each> |
---|
195 | </tr> |
---|
196 | </g:each> |
---|
197 | |
---|
198 | </table> |
---|
199 | </div> |
---|
200 | |
---|
201 | <div id="subjects"> |
---|
202 | |
---|
203 | <table border="2"> |
---|
204 | <tr> |
---|
205 | <g:each in="${selectedStudies}" var="study"> |
---|
206 | <td><center><b>${study.title}</b></center></td> |
---|
207 | </g:each> |
---|
208 | </tr> |
---|
209 | |
---|
210 | <tr> |
---|
211 | <g:each in="${selectedStudies}" var="stud"> |
---|
212 | <td> |
---|
213 | |
---|
214 | |
---|
215 | <g:each in="${stud.giveSubjectTemplates()}" var="template"> |
---|
216 | <table> |
---|
217 | <tr> |
---|
218 | <td><b>Id </b></td> |
---|
219 | <td><b>Species</b></td> |
---|
220 | <td><b>Name</b></td> |
---|
221 | <g:each in="${template.fields}" var="g"> |
---|
222 | <td><b> |
---|
223 | <g:link controller="templateField" action="show" id="${g.id}"> |
---|
224 | ${g}</b></td> |
---|
225 | </g:link> |
---|
226 | </g:each> |
---|
227 | </tr> |
---|
228 | |
---|
229 | <g:each in="${stud.subjects.findAll { it.template == template}}" var="s"> |
---|
230 | <tr> |
---|
231 | <td><g:link controller="subject" action="show" id="${s.id}">${s.id}</g:link></td> |
---|
232 | <td>${s.species}</td> |
---|
233 | <td>${s.name}</td> |
---|
234 | <g:each in="${template.fields}" var="g"> |
---|
235 | <td> |
---|
236 | <% print s.getFieldValue(g.toString()) %> |
---|
237 | </td> |
---|
238 | </g:each> |
---|
239 | </tr> |
---|
240 | </g:each> |
---|
241 | |
---|
242 | </table> |
---|
243 | |
---|
244 | </g:each> |
---|
245 | |
---|
246 | |
---|
247 | |
---|
248 | </td> |
---|
249 | </g:each> |
---|
250 | </tr> |
---|
251 | </table> |
---|
252 | |
---|
253 | </div> |
---|
254 | |
---|
255 | <div id="events"> |
---|
256 | <table border="2"> |
---|
257 | <tr> |
---|
258 | <g:each in="${selectedStudies}" var="study"> |
---|
259 | <td><center><b>${study.title}</b></center></td> |
---|
260 | </g:each> |
---|
261 | </tr> |
---|
262 | |
---|
263 | <tr> |
---|
264 | <g:each in="${selectedStudies}" var="study"> |
---|
265 | <td> |
---|
266 | |
---|
267 | <g:if test="${study.events.size()+study.samplingEvents.size()==0}"> |
---|
268 | No events in this study |
---|
269 | </g:if> |
---|
270 | <g:else> |
---|
271 | <table> |
---|
272 | <tr> |
---|
273 | <td><b>Id </b></td> |
---|
274 | <td><b>Start time</b></td> |
---|
275 | <td><b>Duration</b></td> |
---|
276 | <td><b>Type</b></td> |
---|
277 | <td><b>Sampling event</b></td> |
---|
278 | <td><b>Parameters</b></td> |
---|
279 | </tr> |
---|
280 | |
---|
281 | <g:each in="${study.events + study.samplingEvents}" var="event"> |
---|
282 | <tr> |
---|
283 | <td><g:link controller="event" action="show" id="${event.id}">${event.id}</g:link></td> |
---|
284 | <td>${event.getPrettyDuration(study.startDate,event.startTime)}</td> |
---|
285 | <td>${event.getPrettyDuration()}</td> |
---|
286 | <td>${event.template.name}</td> |
---|
287 | <td> |
---|
288 | <g:if test="${event instanceof dbnp.studycapturing.SamplingEvent}"> |
---|
289 | <g:checkBox name="samplingEvent" disabled="${true}" value="${true}"/> |
---|
290 | </g:if> |
---|
291 | <g:else> |
---|
292 | <g:checkBox name="event" disabled="${true}" value="${false}" /> |
---|
293 | </g:else> |
---|
294 | </td> |
---|
295 | <td> |
---|
296 | <g:set var="fieldCounter" value="${1}" /> |
---|
297 | <g:each in="${event.giveFields()}" var="field"> |
---|
298 | <g:if test="${event.getFieldValue(field.name)}"> |
---|
299 | <g:if test="${fieldCounter > 1}">, </g:if> |
---|
300 | ${field.name} = ${event.getFieldValue( field.name )} |
---|
301 | <g:set var="fieldCounter" value="${fieldCounter + 1}" /> |
---|
302 | </g:if> |
---|
303 | </g:each> |
---|
304 | </td> |
---|
305 | </tr> |
---|
306 | </g:each> |
---|
307 | </table> |
---|
308 | |
---|
309 | </g:else> |
---|
310 | |
---|
311 | </td> |
---|
312 | </g:each> |
---|
313 | </tr> |
---|
314 | </table> |
---|
315 | |
---|
316 | </div> |
---|
317 | |
---|
318 | <div id="event-group"> |
---|
319 | <table border="2"> |
---|
320 | <tr> |
---|
321 | <g:each in="${selectedStudies}" var="study"> |
---|
322 | <td><center><b>${study.title}</b></center></td> |
---|
323 | </g:each> |
---|
324 | </tr> |
---|
325 | |
---|
326 | <tr> |
---|
327 | <g:each in="${selectedStudies}" var="study"> |
---|
328 | |
---|
329 | <g:if test="${study.eventGroups.size()==0}"> |
---|
330 | No event groups in this study |
---|
331 | </g:if> |
---|
332 | <g:else> |
---|
333 | <table> |
---|
334 | <tr> |
---|
335 | <td><b>Name</b></td> |
---|
336 | <td colspan="${study.giveEventTemplates().size()}"><b>Events</b></td> |
---|
337 | <td><b>Subjects</b></td> |
---|
338 | </tr> |
---|
339 | <tr> |
---|
340 | <td></td> |
---|
341 | <g:each in="${study.giveEventTemplates()}" var="eventTemplate"> |
---|
342 | <td><b>${eventTemplate.name}</b></td> |
---|
343 | </g:each> |
---|
344 | <td></td> |
---|
345 | </tr> |
---|
346 | <g:each in="${study.eventGroups}" var="eventGroup"> |
---|
347 | <tr> |
---|
348 | <td>${eventGroup.name}</td> |
---|
349 | |
---|
350 | <g:each in="${study.giveEventTemplates()}" var="currentEventTemplate"> |
---|
351 | <td> |
---|
352 | <g:each in="${eventGroup.events}" var="event"> |
---|
353 | <g:if test="${event.template.name==currentEventTemplate.name}"> |
---|
354 | |
---|
355 | <g:set var="fieldCounter" value="${1}" /> |
---|
356 | <g:each in="${event.giveFields()}" var="field"> |
---|
357 | <g:if test="${event.getFieldValue(field.name)}"> |
---|
358 | <g:if test="${fieldCounter > 1}">, </g:if> |
---|
359 | ${field.name} = ${event.getFieldValue( field.name )} |
---|
360 | <g:set var="fieldCounter" value="${fieldCounter + 1}" /> |
---|
361 | </g:if> |
---|
362 | </g:each> |
---|
363 | </g:if> |
---|
364 | </g:each> |
---|
365 | </td> |
---|
366 | </g:each> |
---|
367 | <td>${eventGroup.subjects.name.join( ', ' )}</td> |
---|
368 | </tr> |
---|
369 | </g:each> |
---|
370 | </table> |
---|
371 | </g:else> |
---|
372 | |
---|
373 | </g:each> |
---|
374 | </tr> |
---|
375 | </table> |
---|
376 | </div> |
---|
377 | |
---|
378 | <div id="assays"> |
---|
379 | <table border="2"> |
---|
380 | <tr> |
---|
381 | <g:each in="${selectedStudies}" var="study"> |
---|
382 | <td><center><b>${study.title}</b></center></td> |
---|
383 | </g:each> |
---|
384 | </tr> |
---|
385 | <tr> |
---|
386 | <g:each in="${selectedStudies}" var="stud"> |
---|
387 | <td> |
---|
388 | <table> |
---|
389 | <tr><td> |
---|
390 | <g:if test="${stud.assays.size()==0}"> |
---|
391 | No assays in this study |
---|
392 | </g:if> |
---|
393 | <g:else> |
---|
394 | <table> |
---|
395 | <tr> |
---|
396 | |
---|
397 | <td width="100"><b>Assay Name</b></td> |
---|
398 | <td width="100"><b>Module</b></td> |
---|
399 | <td><b>Type</b></td> |
---|
400 | <td width="150"><b>Platform</b></td> |
---|
401 | <td><b>Url</b></td> |
---|
402 | <td><b>Samples</b></td> |
---|
403 | </tr> |
---|
404 | <g:each in="${stud.assays}" var="assay"> |
---|
405 | <tr> |
---|
406 | <td>${assay.name}</td> |
---|
407 | <td>${assay.module.name}</td> |
---|
408 | <td>${assay.module.type}</td> |
---|
409 | <td>${assay.module.platform}</td> |
---|
410 | <td>${assay.module.url}</td> |
---|
411 | <td> |
---|
412 | <g:each in="${assay.samples}" var="assaySample"> |
---|
413 | ${assaySample.name}<br> |
---|
414 | </g:each> |
---|
415 | </td> |
---|
416 | </tr> |
---|
417 | </g:each> |
---|
418 | </table> |
---|
419 | </g:else> |
---|
420 | |
---|
421 | |
---|
422 | </table> |
---|
423 | </td> |
---|
424 | </g:each> |
---|
425 | </tr> |
---|
426 | </table> |
---|
427 | |
---|
428 | </div> |
---|
429 | |
---|
430 | |
---|
431 | <div id="persons"> |
---|
432 | <table border="2"> |
---|
433 | <tr> |
---|
434 | <g:each in="${selectedStudies}" var="study"> |
---|
435 | <td><center><b>${study.title}</b></center></td> |
---|
436 | </g:each> |
---|
437 | </tr> |
---|
438 | <tr> |
---|
439 | <g:each in="${selectedStudies}" var="study"> |
---|
440 | <td> |
---|
441 | <g:if test="${study.persons.size()==0}"> |
---|
442 | No persons involved in this study |
---|
443 | </g:if> |
---|
444 | <g:else> |
---|
445 | <table> |
---|
446 | <tr> |
---|
447 | |
---|
448 | <td><b>Name</b></td> |
---|
449 | <td><b>Affiliations</b></td> |
---|
450 | <td><b>Role</b></td> |
---|
451 | <td><b>Phone</b></td> |
---|
452 | <td><b>Email</b></td> |
---|
453 | </tr> |
---|
454 | <g:each in="${study.persons}" var="studyperson"> |
---|
455 | <tr> |
---|
456 | <td>${studyperson.person.firstName} ${studyperson.person.prefix} ${studyperson.person.lastName}</td> |
---|
457 | <td> |
---|
458 | ${studyperson.person.affiliations.name.join(', ')} |
---|
459 | </td> |
---|
460 | <td>${studyperson.role.name}</td> |
---|
461 | <td>${studyperson.person.phone}</td> |
---|
462 | <td>${studyperson.person.email}</td> |
---|
463 | </tr> |
---|
464 | </g:each> |
---|
465 | </table> |
---|
466 | </g:else> |
---|
467 | </td> |
---|
468 | </g:each> |
---|
469 | </tr> |
---|
470 | </table> |
---|
471 | |
---|
472 | </div> |
---|
473 | |
---|
474 | </div> |
---|
475 | |
---|
476 | </g:if> |
---|
477 | |
---|
478 | <g:if test="${selectedStudies.size()==0}"> |
---|
479 | Please select studies to compare. |
---|
480 | </g:if> |
---|
481 | |
---|
482 | </div> |
---|
483 | |
---|
484 | |
---|
485 | </body> |
---|
486 | </html> |
---|