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}">result</g:if><g:else>results</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>Type</th> |
---|
28 | <th>Id</th> |
---|
29 | <g:each in="${extraFields}" var="fieldName"> |
---|
30 | <th>${fieldName}</th> |
---|
31 | </g:each> |
---|
32 | </tr> |
---|
33 | </thead> |
---|
34 | <g:each in="${search.getResults()}" var="result"> |
---|
35 | <tr> |
---|
36 | <td width="3%"> |
---|
37 | <% /* |
---|
38 | The value of this checkbox will be moved to the form (under this table) with javascript. This |
---|
39 | way the user can select items from multiple pages of the paginated result list correctly. See |
---|
40 | also http://datatables.net/examples/api/form.html and advancedQueryResults.js |
---|
41 | */ %> |
---|
42 | <g:checkBox name="id" value="${result.id}" checked="${false}" onClick="updateCheckAll(this);" /> |
---|
43 | </td> |
---|
44 | <td>${search.entity}</td> |
---|
45 | <td>${result.id}</td> |
---|
46 | <g:each in="${extraFields}" var="fieldName"> |
---|
47 | <td> |
---|
48 | <% |
---|
49 | def fieldValue = resultFields[ result.id ]?.get( fieldName ); |
---|
50 | if( fieldValue ) { |
---|
51 | if( fieldValue instanceof Collection ) { |
---|
52 | fieldValue = fieldValue.collect { it.toString() }.findAll { it }.unique().join( ', ' ); |
---|
53 | } else { |
---|
54 | fieldValue = fieldValue.toString(); |
---|
55 | } |
---|
56 | } else { |
---|
57 | fieldValue = ""; |
---|
58 | } |
---|
59 | %> |
---|
60 | ${fieldValue} |
---|
61 | </td> |
---|
62 | </g:each> |
---|
63 | |
---|
64 | </tr> |
---|
65 | </g:each> |
---|
66 | </table> |
---|
67 | </g:if> |
---|
68 | <g:render template="resultbuttons" model="[queryId: queryId]" /> |
---|
69 | |
---|
70 | </body> |
---|
71 | </html> |
---|