1.1 --- a/examples/Common/Questionnaire/Resources/question_template.xhtml Sun Nov 16 01:19:33 2008 +0100
1.2 +++ b/examples/Common/Questionnaire/Resources/question_template.xhtml Mon Nov 17 01:50:18 2008 +0100
1.3 @@ -12,16 +12,30 @@
1.4 <body template:element="questionnaire">
1.5 <h1>Questionnaire Editor</h1>
1.6
1.7 -<p>Enter questions and possible responses below.</p>
1.8 +<form method="POST" action="" enctype="multipart/form-data">
1.9
1.10 -<form method="POST" action="">
1.11 +<p>
1.12 +Either import a previously generated XML file:
1.13 +<input type="file" name="importfile" />
1.14 +<input type="submit" value="Import" name="import" />
1.15 +</p>
1.16
1.17 <div class="questionnaire">
1.18
1.19 + <p>Or enter questions and possible responses below.</p>
1.20 +
1.21 <table class="questionnaire">
1.22 - <tbody template:element="question">
1.23 + <tbody template:element="question" template:init="no">
1.24 <tr>
1.25 - <th class="question">Question</th>
1.26 + <th class="question">
1.27 + Question #<span template:value="count(preceding-sibling::question) + 1">n</span><br/>
1.28 + <span class="control">
1.29 + <input type="submit" value="Move to..." name="..." template:selector-field="move-question" />
1.30 + <select template:attribute-field="destination">
1.31 + <option template:select="../question" template:value="position()" value="{position()}"></option>
1.32 + </select>
1.33 + </span>
1.34 + </th>
1.35 <td class="question">
1.36 <textarea cols="40" rows="4" template:attribute-area="question-text,insert"
1.37 name="...">Question</textarea>
1.38 @@ -33,16 +47,6 @@
1.39 <tr>
1.40 <th class="response">Response</th>
1.41 <td class="response">
1.42 - <input type="radio" template:attribute-button="text-response,none,checked"
1.43 - name="..." value="..." /> No text answer<br />
1.44 - <input type="radio" template:attribute-button="text-response,before,checked"
1.45 - name="..." value="..." /> Text before<br />
1.46 - </td>
1.47 - <td></td>
1.48 - </tr>
1.49 - <tr>
1.50 - <td class="response"></td>
1.51 - <td class="response">
1.52 <input type="checkbox" template:attribute-button="choice-response,multiple,checked"
1.53 name="..." value="choice" /> Allow multiple choices...
1.54 </td>
1.55 @@ -50,8 +54,12 @@
1.56 <input type="submit" value="Add choice" name="..." template:selector-field="add-choice,choice" />
1.57 </td>
1.58 </tr>
1.59 - <tr template:element="choice">
1.60 - <td class="response"></td>
1.61 + <tr template:element="choice" template:init="no">
1.62 + <td class="choice">
1.63 + <select template:multiple-choice-field="response-type,value" name="...">
1.64 + <option template:multiple-choice-value="response-type-enum,value,selected,text()"></option>
1.65 + </select>
1.66 + </td>
1.67 <td class="choice">
1.68 <input type="text" size="40" template:attribute-field="response-choice"
1.69 name="..." value="..." />
1.70 @@ -60,64 +68,73 @@
1.71 <input type="submit" value="Remove choice" name="..." template:selector-field="remove-choice" />
1.72 </td>
1.73 </tr>
1.74 - <tr>
1.75 - <td class="response"></td>
1.76 - <td class="response">
1.77 - <input type="radio" template:attribute-button="text-response,after,checked"
1.78 - name="..." value="..." /> Text after
1.79 - </td>
1.80 - <td></td>
1.81 - </tr>
1.82 </tbody>
1.83 </table>
1.84
1.85 +</div>
1.86 +
1.87 +<!-- Repeat the questionnaire in preview mode. -->
1.88 +
1.89 +<div class="preview">
1.90 +
1.91 + <p>The preview of your questionnaire is shown here:</p>
1.92 +
1.93 + <div class="shadow">
1.94 +
1.95 + <table class="preview">
1.96 + <tbody template:element="question" template:output="true" template:init="no">
1.97 + <tr>
1.98 + <th class="question">Question #<span template:value="count(preceding-sibling::question) + 1">n</span></th>
1.99 + <td class="question">
1.100 + <span template:value="@question-text">Question</span>
1.101 + </td>
1.102 + </tr>
1.103 + <tr>
1.104 + <th class="response">Response</th>
1.105 + <td class="response">
1.106 + <div template:element="choice" template:init="no">
1.107 + <p template:if="@response-choice != '' or not(response-type/@value = 'text')" xml:space="preserve">
1.108 + <input template:if="not(response-type/@value = 'text')"
1.109 + type="{template:choice(../@choice-response = 'multiple', 'checkbox', 'radio')}"
1.110 + name="_unused" value="..." />
1.111 + <span template:value="@response-choice">Choice</span>
1.112 + </p>
1.113 + <p template:if="response-type/@value and not(response-type/@value = 'choice')">
1.114 + <input type="text" size="40" name="_unused" />
1.115 + </p>
1.116 + </div>
1.117 + </td>
1.118 + </tr>
1.119 + </tbody>
1.120 + </table>
1.121 +
1.122 + </div>
1.123 +
1.124 +</div>
1.125 +
1.126 +<div class="operations">
1.127 +
1.128 <p>
1.129 <input type="submit" value="Add question" name="add-question" /> to make
1.130 the questionnaire longer.
1.131 </p>
1.132
1.133 <p>
1.134 + <input type="submit" value="Update" name="update" /> to refresh the preview.
1.135 + </p>
1.136 +
1.137 + <p>
1.138 + <input type="submit" value="Export" name="export" /> to produce an XML file
1.139 + containing the questions and responses.
1.140 + </p>
1.141 +
1.142 + <p>
1.143 <input type="submit" value="Finish" name="finish" /> when all the questions
1.144 and responses are ready.
1.145 </p>
1.146
1.147 </div>
1.148
1.149 -<!-- Repeat the questionnaire in preview mode. -->
1.150 -
1.151 -<div class="preview">
1.152 -
1.153 - <table class="preview">
1.154 - <tbody template:element="question">
1.155 - <tr>
1.156 - <th class="question">Question</th>
1.157 - <td class="question">
1.158 - <span template:value="@question-text">Question</span>
1.159 - </td>
1.160 - </tr>
1.161 - <tr>
1.162 - <th class="response">Response</th>
1.163 - <td class="response">
1.164 - <p template:if="@text-response = 'before'" class="text-before">
1.165 - <input type="text" size="40" template:attribute-field="response-text"
1.166 - name="..." value="..." />
1.167 - </p>
1.168 - <p template:element="choice" class="choice" xml:space="preserve">
1.169 - <input type="{template:choice(../@choice-response = 'multiple', 'checkbox', 'radio')}"
1.170 - template:attribute-button="selected,true,checked" name="..." value="..." />
1.171 - <span template:value="@response-choice">Choice</span>
1.172 - </p>
1.173 - <p template:if="@text-response = 'after'" class="text-after">
1.174 - <input type="text" size="40" template:attribute-field="response-text"
1.175 - name="..." value="..." />
1.176 - </p>
1.177 - </td>
1.178 - </tr>
1.179 - </tbody>
1.180 - </table>
1.181 -
1.182 -</div>
1.183 -
1.184 </form>
1.185
1.186 </body>