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 | </head> |
---|
24 | <body> |
---|
25 | |
---|
26 | <script type="text/javascript"> |
---|
27 | $(function() { |
---|
28 | // Enable sorting of template fields |
---|
29 | $("#selectedTemplateFields").sortable({ |
---|
30 | placeholder: 'ui-state-highlight', |
---|
31 | cancel: '.empty, input, select, button, textarea, form, label', |
---|
32 | connectWith: '.templateFields', |
---|
33 | update: updateTemplateFieldPosition, |
---|
34 | remove: removeTemplateFieldEvent, |
---|
35 | receive: addTemplateFieldEvent |
---|
36 | }).disableSelection(); |
---|
37 | |
---|
38 | |
---|
39 | $("#availableTemplateFields").sortable({ |
---|
40 | placeholder: 'ui-state-highlight', |
---|
41 | cancel: '.empty, input, select, button, textarea, form, label', |
---|
42 | connectWith: '.templateFields' |
---|
43 | }).disableSelection(); |
---|
44 | |
---|
45 | }); |
---|
46 | </script> |
---|
47 | |
---|
48 | <g:form action="template" name="templateChoice"> |
---|
49 | <g:hiddenField name="entity" value="${encryptedEntity}" /> |
---|
50 | <input type="hidden" name="template" id="templateSelect" value="${template?.id}"> |
---|
51 | </g:form> |
---|
52 | |
---|
53 | <g:if test="${template}"> |
---|
54 | <div class="templateEditorStep" id="step2_selectedFields"> |
---|
55 | <h3 class="templateName">${template.name} (<a class="switch" href="${createLink(action:'index')}?entity=${encryptedEntity}">switch</a>)</h3> |
---|
56 | |
---|
57 | <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> |
---|
58 | <ol id="selectedTemplateFields" class="templateFields"> |
---|
59 | <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> |
---|
60 | <g:render template="elements/selected" collection="${template.fields}" model="['template':template]"/> |
---|
61 | </ol> |
---|
62 | </div> |
---|
63 | <div class="templateEditorStep" id="step3_availableFields"> |
---|
64 | <h3>Available fields</h3> |
---|
65 | |
---|
66 | <p>These fields are available for adding to the template. Drag a field to the template to add it.</p> |
---|
67 | <ol id="availableTemplateFields" class="templateFields"> |
---|
68 | <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> |
---|
69 | <g:render template="elements/available" collection="${allFields - template.fields}" /> |
---|
70 | </ol> |
---|
71 | |
---|
72 | <div id="addNew"> |
---|
73 | <a href="#" onClick="showTemplateFieldForm( 'templateField_new' ); this.blur(); return false;"> |
---|
74 | <b>Create new field</b> |
---|
75 | </a> |
---|
76 | |
---|
77 | <form class="templateField_form" id="templateField_new_form" action="createField"> |
---|
78 | <g:hiddenField name="entity" value="${encryptedEntity}" /> |
---|
79 | <g:render template="elements/fieldForm" model="['templateField': null, 'fieldTypes': fieldTypes]"/> |
---|
80 | <div class="templateFieldButtons"> |
---|
81 | <input type="button" value="Save" onClick="createTemplateField( 'new' );"> |
---|
82 | <input type="button" value="Cancel" onClick="hideTemplateFieldForm( 'new' );"> |
---|
83 | </div> |
---|
84 | </form> |
---|
85 | </div> |
---|
86 | </div> |
---|
87 | </g:if> |
---|
88 | |
---|
89 | |
---|
90 | </body> |
---|
91 | </html> |
---|