1 | <html> |
---|
2 | <head> |
---|
3 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> |
---|
4 | <meta name="layout" content="main"/> |
---|
5 | <title>Query results</title> |
---|
6 | <link rel="stylesheet" href="<g:resource dir="css" file="advancedQuery.css" />" type="text/css"/> |
---|
7 | <g:javascript src="advancedQueryResults.js" /> |
---|
8 | </head> |
---|
9 | <body> |
---|
10 | |
---|
11 | <h1>Query results</h1> |
---|
12 | |
---|
13 | <div class="searchoptions"> |
---|
14 | ${search.getNumResults()} <g:if test="${search.getNumResults() == 1}">study</g:if><g:else>studies</g:else> found |
---|
15 | <g:render template="criteria" model="[criteria: search.getCriteria()]" /> |
---|
16 | </div> |
---|
17 | <g:if test="${search.getNumResults() > 0}"> |
---|
18 | <% |
---|
19 | def resultFields = search.getShowableResultFields(); |
---|
20 | def extraFields = search.getShowableResultFieldNames(resultFields); |
---|
21 | %> |
---|
22 | <table id="searchresults" class="paginate"> |
---|
23 | <thead> |
---|
24 | <tr> |
---|
25 | <th class="nonsortable"><input type="checkbox" id="checkAll" onClick="checkAllPaginated(this);" /></th> |
---|
26 | <th>Title</th> |
---|
27 | <th>Code</th> |
---|
28 | <th>Subjects</th> |
---|
29 | <th>Events</th> |
---|
30 | <th>Assays</th> |
---|
31 | <g:each in="${extraFields}" var="fieldName"> |
---|
32 | <th>${fieldName}</th> |
---|
33 | </g:each> |
---|
34 | </tr> |
---|
35 | </thead> |
---|
36 | <tbody> |
---|
37 | <g:each in="${search.getResults()}" var="studyInstance" status="i"> |
---|
38 | <tr class="${(i % 2) == 0 ? 'odd' : 'even'}"> |
---|
39 | <td width="3%"> |
---|
40 | <% /* |
---|
41 | The value of this checkbox will be moved to the form (under this table) with javascript. This |
---|
42 | way the user can select items from multiple pages of the paginated result list correctly. See |
---|
43 | also http://datatables.net/examples/api/form.html and advancedQueryResults.js |
---|
44 | */ %> |
---|
45 | <g:checkBox name="id" value="${studyInstance.id}" checked="${false}" onClick="updateCheckAll(this);" /> |
---|
46 | </td> |
---|
47 | <td> |
---|
48 | <g:link controller="study" action="show" id="${studyInstance?.id}">${fieldValue(bean: studyInstance, field: "title")}</g:link> |
---|
49 | |
---|
50 | </td> |
---|
51 | <td>${fieldValue(bean: studyInstance, field: "code")}</td> |
---|
52 | <td> |
---|
53 | <g:if test="${studyInstance.subjects.species.size()==0}"> |
---|
54 | - |
---|
55 | </g:if> |
---|
56 | <g:else> |
---|
57 | <g:each in="${studyInstance.subjects.species.unique()}" var="currentSpecies" status="j"> |
---|
58 | <g:if test="${j > 0}">,</g:if> |
---|
59 | <%=studyInstance.subjects.findAll { return it.species == currentSpecies; }.size()%> |
---|
60 | ${currentSpecies} |
---|
61 | </g:each> |
---|
62 | </g:else> |
---|
63 | </td> |
---|
64 | |
---|
65 | <td> |
---|
66 | <g:if test="${studyInstance.giveEventTemplates().size()==0}"> |
---|
67 | - |
---|
68 | </g:if> |
---|
69 | <g:else> |
---|
70 | ${studyInstance.giveEventTemplates().name.join(', ')} |
---|
71 | </g:else> |
---|
72 | </td> |
---|
73 | |
---|
74 | <td> |
---|
75 | <g:if test="${studyInstance.assays.size()==0}"> |
---|
76 | - |
---|
77 | </g:if> |
---|
78 | <g:else> |
---|
79 | ${studyInstance.assays.module.platform.unique().join(', ')} |
---|
80 | </g:else> |
---|
81 | </td> |
---|
82 | <g:each in="${extraFields}" var="fieldName"> |
---|
83 | <td> |
---|
84 | <% |
---|
85 | def fieldValue = resultFields[ studyInstance.id ]?.get( fieldName ); |
---|
86 | if( fieldValue ) { |
---|
87 | if( fieldValue instanceof Collection ) { |
---|
88 | fieldValue = fieldValue.collect { it.toString() }.findAll { it }.unique().join( ', ' ); |
---|
89 | } else { |
---|
90 | fieldValue = fieldValue.toString(); |
---|
91 | } |
---|
92 | } else { |
---|
93 | fieldValue = ""; |
---|
94 | } |
---|
95 | %> |
---|
96 | ${fieldValue} |
---|
97 | </td> |
---|
98 | </g:each> |
---|
99 | </tr> |
---|
100 | </g:each> |
---|
101 | </tbody> |
---|
102 | </table> |
---|
103 | <g:render template="resultsform" /> |
---|
104 | |
---|
105 | </g:if> |
---|
106 | <g:render template="resultbuttons" model="[queryId: queryId]" /> |
---|
107 | </body> |
---|
108 | </html> |
---|