1 | <% |
---|
2 | /** |
---|
3 | * Template Editor compare template |
---|
4 | * |
---|
5 | * @author Robert Horlings (robert@isdat.nl) |
---|
6 | * @since 20101026 |
---|
7 | * @package wizard |
---|
8 | * @see dbnp.studycapturing.TemplateEditorController |
---|
9 | * |
---|
10 | * Revision information: |
---|
11 | * $Rev: 996 $ |
---|
12 | * $Author: robert@isdat.nl $ |
---|
13 | * $Date: 2010-10-26 15:19:22 +0200 (Tue, 26 Oct 2010) $ |
---|
14 | */ |
---|
15 | %> |
---|
16 | <%@ page contentType="text/html;charset=UTF-8" %> |
---|
17 | <html> |
---|
18 | <head> |
---|
19 | <meta name="layout" content="${layout}"/> |
---|
20 | <title>Compare templates</title> |
---|
21 | <script src="${createLinkTo(dir: 'js', file: 'templateEditor.js')}" type="text/javascript"></script> |
---|
22 | <link rel="stylesheet" href="${createLinkTo(dir: 'css', file: 'templateEditor.css')}" /> |
---|
23 | |
---|
24 | <script src="${createLinkTo(dir: 'js', file: 'jquery.dataTables.min.js')}" type="text/javascript"></script> |
---|
25 | |
---|
26 | <style type="text/css"> |
---|
27 | #content .templateEditorStep { font-size: 0.8em; } |
---|
28 | </style> |
---|
29 | |
---|
30 | <script type="text/javascript" language="javascript"> |
---|
31 | var standalone = ${extraparams?.standalone ? 'true' : 'false'}; |
---|
32 | |
---|
33 | $(document).ready(function() { |
---|
34 | $('#compare_templates').dataTable( { |
---|
35 | "sPaginationType": "full_numbers" |
---|
36 | } ); |
---|
37 | } ); |
---|
38 | |
---|
39 | |
---|
40 | function toggleColumns() |
---|
41 | { |
---|
42 | var columns = new Array( 1, 2, 3, 4); |
---|
43 | |
---|
44 | /* Get the DataTables object again - this is not a recreation, just a get of the object */ |
---|
45 | var oTable = $('#compare_templates').dataTable(); |
---|
46 | |
---|
47 | /* Toggle column visibility */ |
---|
48 | var bVis = oTable.fnSettings().aoColumns[ columns[ 0 ] ].bVisible; |
---|
49 | $.each( columns, function(index, col) { |
---|
50 | oTable.fnSetColumnVis( col, bVis ? false : true ); |
---|
51 | }); |
---|
52 | |
---|
53 | /* Show large or small titles */ |
---|
54 | if( bVis ) { |
---|
55 | // If the columns were visible, they are hidden now and large titles should be shown |
---|
56 | $( '.shortTitle' ).hide(); |
---|
57 | $( '.longTitle' ).show(); |
---|
58 | } else { |
---|
59 | $( '.longTitle' ).hide(); |
---|
60 | $( '.shortTitle' ).show(); |
---|
61 | } |
---|
62 | } |
---|
63 | </script> |
---|
64 | |
---|
65 | |
---|
66 | |
---|
67 | </head> |
---|
68 | <body> |
---|
69 | <h1>Template fields for templates of entity |
---|
70 | <select onChange="location.href = '<g:createLink action="compare" params="${extraparams + [ extra: 'true' ]}" />&entity=' + $(this).val();"> |
---|
71 | <g:each in="${templateEntities}" var="ent"> |
---|
72 | <option <g:if test="${ent.entity == entity.toString().replaceAll(/^class /, '')}">selected</g:if> value="${ent.encoded}">${ent.name}</option> |
---|
73 | </g:each> |
---|
74 | </select> |
---|
75 | </h1> |
---|
76 | |
---|
77 | <p> |
---|
78 | If you want more space or more information, try to <a class="toggle" href="#" onClick="toggleColumns(); return false;">toggle columns</a>. |
---|
79 | </p> |
---|
80 | |
---|
81 | <table id="list"></table> |
---|
82 | <div id="pager"></div> |
---|
83 | |
---|
84 | <% /* Length of long titles depends on the number of templates. |
---|
85 | We've got about 90 characters to show in total */ |
---|
86 | def numCharsLongTitle = Math.floor( 90 / templates.size() ).intValue(); |
---|
87 | %> |
---|
88 | <table id="compare_templates"> |
---|
89 | <thead> |
---|
90 | <tr> |
---|
91 | <th>Name</th> |
---|
92 | <th>Type</th> |
---|
93 | <th>Unit</th> |
---|
94 | <th>Comment</th> |
---|
95 | <th>Required</th> |
---|
96 | <g:each in="${templates}" var="currentTemplate"> |
---|
97 | <th title="${currentTemplate.name}"> |
---|
98 | <span class="shortTitle"> |
---|
99 | <g:if test="${currentTemplate.name.size() > 5}"> |
---|
100 | ${currentTemplate.name.substring(0,3)}... |
---|
101 | </g:if> |
---|
102 | <g:else> |
---|
103 | ${currentTemplate.name} |
---|
104 | </g:else> |
---|
105 | </span> |
---|
106 | <span class="longTitle"> |
---|
107 | <g:if test="${currentTemplate.name.size() > numCharsLongTitle}"> |
---|
108 | ${currentTemplate.name.substring(0, numCharsLongTitle - 3)}... |
---|
109 | </g:if> |
---|
110 | <g:else> |
---|
111 | ${currentTemplate.name} |
---|
112 | </g:else> |
---|
113 | </span> |
---|
114 | </th> |
---|
115 | </g:each> |
---|
116 | </tr> |
---|
117 | </thead> |
---|
118 | |
---|
119 | <g:each in="${allFields}" var="field"> |
---|
120 | <tr> |
---|
121 | <td>${field.name}</td> |
---|
122 | <td>${field.type}</td> |
---|
123 | <td>${field.unit}</td> |
---|
124 | <td>${field.comment}</td> |
---|
125 | <td>${field.required}</td> |
---|
126 | <g:each in="${templates}" var="currentTemplate"> |
---|
127 | <td style="text-align: center;" align="center"> |
---|
128 | <g:if test="${currentTemplate.fields.contains(field)}"> |
---|
129 | <img align="center" src="${createLinkTo( dir: 'images/icons', file: 'tick.png', plugin: 'famfamfam' )}" alt="X" /> |
---|
130 | </g:if> |
---|
131 | </td> |
---|
132 | </g:each> |
---|
133 | </tr> |
---|
134 | </g:each> |
---|
135 | </table> |
---|
136 | <div style="clear: both;"></div> |
---|
137 | </body> |
---|
138 | </html> |
---|