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 | <link rel="stylesheet" href="${resource(dir: 'css/datatables', file: 'demo_table_jui.css')}"/> |
---|
9 | <script type="text/javascript" src="${resource(dir: 'js', file: 'jquery.dataTables.min.js')}"></script> |
---|
10 | <g:javascript src="advancedQueryResults.js" /> |
---|
11 | </head> |
---|
12 | <body> |
---|
13 | |
---|
14 | <h1>Query results: ${search.toString()}</h1> |
---|
15 | |
---|
16 | <div class="searchoptions"> |
---|
17 | ${search.getNumResults()} <g:if test="${search.getNumResults() == 1}">sample</g:if><g:else>samples</g:else> found |
---|
18 | <g:render template="criteria" model="[criteria: search.getCriteria()]" /> |
---|
19 | </div> |
---|
20 | <g:if test="${search.getNumResults() > 0}"> |
---|
21 | <% |
---|
22 | def resultFields = search.getShowableResultFields(); |
---|
23 | def extraFields = search.getShowableResultFieldNames(resultFields); |
---|
24 | %> |
---|
25 | <table id="searchresults" class="paginate"> |
---|
26 | <thead> |
---|
27 | <tr> |
---|
28 | <th class="nonsortable"><input type="checkbox" id="checkAll" onClick="checkAllPaginated(this);" /></th> |
---|
29 | <th>Name</th> |
---|
30 | <th>Study</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="sampleInstance" 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="uuid" value="${sampleInstance.giveUUID()}" checked="${false}" onClick="updateCheckAll(this);" /> |
---|
46 | </td> |
---|
47 | <td>${fieldValue(bean: sampleInstance, field: "name")}</td> |
---|
48 | <td><g:link controller="study" action="show" id="${sampleInstance?.parent?.id}">${sampleInstance?.parent?.title}</g:link></td> |
---|
49 | <g:each in="${extraFields}" var="fieldName"> |
---|
50 | <td> |
---|
51 | <% |
---|
52 | def fieldValue = resultFields[ sampleInstance.id ]?.get( fieldName ); |
---|
53 | if( fieldValue ) { |
---|
54 | if( fieldValue instanceof Collection ) { |
---|
55 | fieldValue = fieldValue.collect { it.toString() }.findAll { it }.unique().join( ', ' ); |
---|
56 | } else { |
---|
57 | fieldValue = fieldValue.toString(); |
---|
58 | } |
---|
59 | } else { |
---|
60 | fieldValue = ""; |
---|
61 | } |
---|
62 | %> |
---|
63 | ${fieldValue} |
---|
64 | </td> |
---|
65 | </g:each> |
---|
66 | </tr> |
---|
67 | </g:each> |
---|
68 | </tbody> |
---|
69 | </table> |
---|
70 | <g:render template="resultsform" /> |
---|
71 | |
---|
72 | </g:if> |
---|
73 | <g:render template="resultbuttons" model="[queryId: queryId]" /> |
---|
74 | </body> |
---|
75 | </html> |
---|