1 | <% |
---|
2 | /** |
---|
3 | * Template Editor overview template |
---|
4 | * |
---|
5 | * @author Jeroen Wesbeek |
---|
6 | * @since 20100422 |
---|
7 | * @package wizard |
---|
8 | * @see dbnp.studycapturing.TemplateEditorController |
---|
9 | * |
---|
10 | * Revision information: |
---|
11 | * $Rev: 428 $ |
---|
12 | * $Author: duh $ |
---|
13 | * $Date: 2010-05-18 11:09:55 +0200 (di, 18 mei 2010) $ |
---|
14 | */ |
---|
15 | %> |
---|
16 | <%@ page contentType="text/html;charset=UTF-8" %> |
---|
17 | <html> |
---|
18 | <head> |
---|
19 | <meta name="layout" content="dialog"/> |
---|
20 | <title>template editor</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 | <g:if env="production"> |
---|
24 | <script type="text/javascript" src="${resource(dir: 'js', file: 'ontology-chooser.min.js')}"></script> |
---|
25 | </g:if><g:else> |
---|
26 | <script type="text/javascript" src="${resource(dir: 'js', file: 'ontology-chooser.js')}"></script> |
---|
27 | </g:else> |
---|
28 | </head> |
---|
29 | <body> |
---|
30 | |
---|
31 | <script type="text/javascript"> |
---|
32 | $(function() { |
---|
33 | // Enable sorting of template fields |
---|
34 | $("#selectedTemplateFields").sortable({ |
---|
35 | placeholder: 'ui-state-highlight', |
---|
36 | items: 'li:not(.domain)', |
---|
37 | cancel: '.empty, input, select, button, textarea, form, label', |
---|
38 | connectWith: '.templateFields', |
---|
39 | update: updateTemplateFieldPosition, |
---|
40 | receive: addTemplateFieldEvent, |
---|
41 | remove: removeTemplateFieldEvent, |
---|
42 | start: savePosition |
---|
43 | }).disableSelection(); |
---|
44 | |
---|
45 | |
---|
46 | $("#availableTemplateFields").sortable({ |
---|
47 | placeholder: 'ui-state-highlight', |
---|
48 | cancel: '.empty, input, select, button, textarea, form, label', |
---|
49 | connectWith: '.templateFields', |
---|
50 | start: savePosition |
---|
51 | }).disableSelection(); |
---|
52 | |
---|
53 | |
---|
54 | $("#ontologyDialog").dialog({ |
---|
55 | autoOpen: false, |
---|
56 | title: 'Search for ontology', |
---|
57 | height: 290, |
---|
58 | width: 350, |
---|
59 | modal: true, |
---|
60 | buttons: { |
---|
61 | 'Add': addOntology, |
---|
62 | Cancel: function() { |
---|
63 | $(this).dialog('close'); |
---|
64 | } |
---|
65 | }, |
---|
66 | close: function() { |
---|
67 | } |
---|
68 | |
---|
69 | }); |
---|
70 | |
---|
71 | }); |
---|
72 | </script> |
---|
73 | |
---|
74 | <g:form action="template" name="templateChoice"> |
---|
75 | <g:hiddenField name="entity" value="${encryptedEntity}" /> |
---|
76 | <input type="hidden" name="template" id="templateSelect" value="${template?.id}"> |
---|
77 | </g:form> |
---|
78 | |
---|
79 | <g:if test="${template}"> |
---|
80 | <div class="templateEditorStep" id="step2_selectedFields"> |
---|
81 | <h3 class="templateName">${template.name} (<a class="switch" href="${createLink(action:'index')}?entity=${encryptedEntity}">switch</a>)</h3> |
---|
82 | |
---|
83 | <p>Currently, this template contains the following fields. Drag fields to reorder. Drag fields to the list of available fields to remove the field from the template.</p> |
---|
84 | <ol id="domainFields" class="templateFields <g:if test="${template.inUse()}">inUse</g:if>"> |
---|
85 | <g:render template="elements/domainField" var="domainField" collection="${domainFields}" model="['template':template]"/> |
---|
86 | </ol> |
---|
87 | <ol id="selectedTemplateFields" class="templateFields <g:if test="${template.inUse()}">inUse</g:if>"> |
---|
88 | <g:render template="elements/selected" var="templateField" collection="${template.fields}" model="['template':template]"/> |
---|
89 | <li class="empty ui-state-default" <g:if test="${template.fields?.size() > 0 }">style='display: none;'</g:if>>This template does not yet contain any fields. Drag a field to this list or use the 'Add field button'.</li> |
---|
90 | </ol> |
---|
91 | </div> |
---|
92 | <div class="templateEditorStep" id="step3_availableFields"> |
---|
93 | <h3>Available fields</h3> |
---|
94 | |
---|
95 | <p>These fields are available for adding to the template. Drag a field to the template to add it.</p> |
---|
96 | <ol id="availableTemplateFields" class="templateFields"> |
---|
97 | <li class="empty ui-state-default" <g:if test="${allFields.size() > template.fields.size()}">style='display: none;'</g:if>>There are no additional fields that can be added. Use the 'Create new field' button to create new fields.</li> |
---|
98 | <g:render template="elements/available" var="templateField" collection="${allFields - template.fields}" /> |
---|
99 | </ol> |
---|
100 | |
---|
101 | <div id="addNew"> |
---|
102 | <a href="#" onClick="showTemplateFieldForm( 'templateField_new' ); this.blur(); return false;"> |
---|
103 | <b>Create new field</b> |
---|
104 | </a> |
---|
105 | |
---|
106 | <form class="templateField_form" id="templateField_new_form" action="createField"> |
---|
107 | <g:hiddenField name="entity" value="${encryptedEntity}" /> |
---|
108 | <g:render template="elements/fieldForm" model="['templateField': null, 'fieldTypes': fieldTypes]"/> |
---|
109 | <div class="templateFieldButtons"> |
---|
110 | <input type="button" value="Save" onClick="createTemplateField( 'new' );"> |
---|
111 | <input type="button" value="Cancel" onClick="hideTemplateFieldForm( 'new' );"> |
---|
112 | </div> |
---|
113 | </form> |
---|
114 | </div> |
---|
115 | </div> |
---|
116 | </g:if> |
---|
117 | |
---|
118 | <div id="ontologyDialog"> |
---|
119 | <g:render template="ontologyDialog" /> |
---|
120 | </div> |
---|
121 | |
---|
122 | </body> |
---|
123 | </html> |
---|