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