1 | <% |
---|
2 | /** |
---|
3 | * Events page |
---|
4 | * |
---|
5 | * @author Jeroen Wesbeek |
---|
6 | * @since 20100212 |
---|
7 | * @package wizard |
---|
8 | * @see dbnp.studycapturing.WizardTagLib::previousNext |
---|
9 | * @see dbnp.studycapturing.WizardController |
---|
10 | * |
---|
11 | * Revision information: |
---|
12 | * $Rev: 510 $ |
---|
13 | * $Author: duh $ |
---|
14 | * $Date: 2010-06-02 14:38:09 +0000 (wo, 02 jun 2010) $ |
---|
15 | */ |
---|
16 | %> |
---|
17 | <wizard:pageContent> |
---|
18 | <span class="info"> |
---|
19 | <span class="title">Define all events that occur in your study</span> |
---|
20 | An event is any change âforcedâ upon a subject, such as treatment, challenge, sampling. Choose an event type an define the different parameters of the event. |
---|
21 | </span> |
---|
22 | |
---|
23 | <wizard:radioElement name="eventType" description="Type" elements="['event','sample']" value="${values?.eventType}"> |
---|
24 | Type of event |
---|
25 | </wizard:radioElement> |
---|
26 | <wizard:templateElement name="eventTemplate" elementId="eventTemplate" description="Event Template" value="${event?.template}" entity="${dbnp.studycapturing.Event}" addDummy="true" ajaxOnChange="switchTemplate" url="[controller:'wizard',action:'pages']" update="[success:'wizardPage',failure:'wizardError']" afterSuccess="onWizardPage()" > |
---|
27 | The template to use for this study |
---|
28 | </wizard:templateElement> |
---|
29 | <wizard:templateElement name="sampleTemplate" elementId="sampleTemplate" description="Sample Template" value="${event?.template}" entity="${dbnp.studycapturing.SamplingEvent}" addDummy="true" ajaxOnChange="switchTemplate" url="[controller:'wizard',action:'pages']" update="[success:'wizardPage',failure:'wizardError']" afterSuccess="onWizardPage()" > |
---|
30 | The template to use for this study |
---|
31 | </wizard:templateElement> |
---|
32 | <g:if test="${event?.template}"> |
---|
33 | <div id="${values?.eventType}TemplateFields"> |
---|
34 | <g:if test="${event?.template}"><wizard:templateElements entity="${event}" /></g:if> |
---|
35 | <g:if test="${event?.template}"><wizard:buttonElement name="add" value="Add" url="[controller:'wizard',action:'pages']" update="[success:'wizardPage',failure:'wizardError']" afterSuccess="onWizardPage()"/></g:if> |
---|
36 | </div> |
---|
37 | </g:if> |
---|
38 | |
---|
39 | <script type="text/javascript"> |
---|
40 | function swapTemplate(value,refresh) { |
---|
41 | $("div[id$='Template'],div[id$='TemplateFields']").each(function() { |
---|
42 | var e = $(this); |
---|
43 | if (e.attr('id').match("^"+value) != null) { |
---|
44 | e.show(); |
---|
45 | } else { |
---|
46 | e.hide(); |
---|
47 | } |
---|
48 | }); |
---|
49 | |
---|
50 | if(refresh) { |
---|
51 | } |
---|
52 | } |
---|
53 | |
---|
54 | // handle template selectors |
---|
55 | $(document).ready(function() { |
---|
56 | // bind event handlers |
---|
57 | $("input[name=eventType]").click(function() { |
---|
58 | swapTemplate($(this).val(),true); |
---|
59 | }); |
---|
60 | |
---|
61 | // handle selects |
---|
62 | swapTemplate($('input:radio[name=eventType]:checked').val(),false); |
---|
63 | }); |
---|
64 | </script> |
---|
65 | |
---|
66 | <g:if test="${events}"> |
---|
67 | <g:each var="eventTemplate" in="${eventTemplates}"> |
---|
68 | <g:set var="showHeader" value="${true}" /> |
---|
69 | <h1>${eventTemplate.getValue().name}</h1> |
---|
70 | <div class="table"> |
---|
71 | <g:each var="eventId" in="${eventTemplate.getValue().events}"> |
---|
72 | <g:if test="${showHeader}"> |
---|
73 | <g:set var="showHeader" value="${false}" /> |
---|
74 | <div class="header"> |
---|
75 | <div class="firstColumn">#</div> |
---|
76 | <div class="firstColumn"></div> |
---|
77 | <g:if test="${eventGroups}"><g:each var="eventGroup" status="g" in="${eventGroups}"> |
---|
78 | <div class="column"> |
---|
79 | <g:textField name="eventGroup_${g}_name" value="${eventGroup.name}" /> |
---|
80 | <wizard:ajaxButton name="deleteEventGroup" src="../images/icons/famfamfam/delete.png" alt="delete this eventgroup" class="famfamfam" value="-" url="[controller:'wizard',action:'pages']" update="[success:'wizardPage',failure:'wizardError']" before="\$(\'input[name=do]\').val(${g});" afterSuccess="onWizardPage()" /> |
---|
81 | </div> |
---|
82 | </g:each></g:if> |
---|
83 | <div class="firstColumn"> |
---|
84 | <wizard:ajaxButton name="addEventGroup" src="../images/icons/famfamfam/add.png" alt="add a new eventgroup" class="famfamfam" value="+" url="[controller:'wizard',action:'pages']" update="[success:'wizardPage',failure:'wizardError']" afterSuccess="onWizardPage()" /> |
---|
85 | </div> |
---|
86 | <wizard:templateColumnHeaders entity="${events[ eventId ]}" class="column"/> |
---|
87 | </div> |
---|
88 | </g:if> |
---|
89 | <div class="row"> |
---|
90 | <div class="firstColumn">${eventId + 1}</div> |
---|
91 | <div class="firstColumn"> |
---|
92 | <wizard:ajaxButton name="deleteEvent" src="../images/icons/famfamfam/delete.png" alt="delete this subject" class="famfamfam" value="-" url="[controller:'wizard',action:'pages']" update="[success:'wizardPage',failure:'wizardError']" before="\$(\'input[name=do]\').val(${eventId});" afterSuccess="onWizardPage()"/> |
---|
93 | </div> |
---|
94 | <g:if test="${eventGroups}"><g:each var="eventGroup" status="j" in="${eventGroups}"> |
---|
95 | <div class="column"> |
---|
96 | <g:if test="${eventGroup.events.find{ it == events[ eventId ] } }"> |
---|
97 | <input type="checkbox" name="event_${eventId}_group_${j}" checked="checked" /> |
---|
98 | </g:if><g:else> |
---|
99 | <input type="checkbox" name="event_${eventId}_group_${j}"/> |
---|
100 | </g:else> |
---|
101 | </div> |
---|
102 | </g:each></g:if> |
---|
103 | <div class="firstColumn"></div> |
---|
104 | <wizard:templateColumns id="${eventId}" entity="${events[ eventId ]}" template="${events[ eventId ].template}" name="event_${eventId}" class="column" /> |
---|
105 | </div> |
---|
106 | </g:each> |
---|
107 | </div> |
---|
108 | <div class="sliderContainer"> |
---|
109 | <div class="slider"></div> |
---|
110 | </div> |
---|
111 | </g:each> |
---|
112 | </g:if> |
---|
113 | |
---|
114 | </wizard:pageContent> |
---|