This repository has been archived by the owner on Feb 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 34
/
Widgets.xml
279 lines (279 loc) · 10.1 KB
/
Widgets.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
<?xml version="1.0"?>
<h:html xmlns="http://www.w3.org/2002/xforms" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:jr="http://openrosa.org/javarosa">
<h:head>
<h:title>Widgets</h:title>
<model>
<itext>
<translation lang="english">
<text id="hello">
<value>i speak english</value>
</text>
<text id="hint">
<value>menu button to change languages</value>
</text>
</translation>
<translation lang="italian">
<text id="hello">
<value>ciào</value>
</text>
<text id="hint">
<value>"hello" in italian</value>
</text>
</translation>
<translation lang="japanese">
<text id="hello">
<value>こんにちは。</value>
</text>
<text id="hint">
<value>"hello" in japanese</value>
</text>
</translation>
<translation lang="macedonian">
<text id="hello">
<value>Здраво</value>
</text>
<text id="hint">
<value>"hello" in macedonian</value>
</text>
</translation>
</itext>
<instance>
<widgets id="widgets">
<start/>
<end/>
<today/>
<deviceid/>
<subscriberid/>
<simid/>
<phonenumber/>
<string/>
<int/>
<decimal>18.31</decimal>
<date>2010-06-15</date>
<select>a c</select>
<select1>8</select1>
<branch>n</branch>
<language/>
<regex>test@test.com</regex>
<repeat_a jr:template="">
<item_string_a/>
<item_int>123456789</item_int>
<repeat_count>3</repeat_count>
<repeat_b jr:template="">
<item_string_b>this is a really long string where you can put lots of information to prepare a user for anything you would like.</item_string_b>
<language_b/>
</repeat_b>
<item_decimal>1234567890.1234567890</item_decimal>
</repeat_a>
<calculate/>
<trigger/>
<output/>
<geopoint/>
<barcode/>
<image/>
<audio/>
<video/>
</widgets>
</instance>
<bind nodeset="/widgets/start" type="dateTime" jr:preload="timestamp" jr:preloadParams="start"/>
<bind nodeset="/widgets/end" type="dateTime" jr:preload="timestamp" jr:preloadParams="end"/>
<bind nodeset="/widgets/today" type="date" jr:preload="date" jr:preloadParams="today"/>
<bind nodeset="/widgets/deviceid" type="string" jr:preload="property" jr:preloadParams="deviceid"/>
<bind nodeset="/widgets/subscriberid" type="string" jr:preload="property" jr:preloadParams="subscriberid"/>
<bind nodeset="/widgets/simid" type="string" jr:preload="property" jr:preloadParams="simserial"/>
<bind nodeset="/widgets/phonenumber" type="string" jr:preload="property" jr:preloadParams="phonenumber"/>
<bind nodeset="/widgets/string" type="string"/>
<bind nodeset="/widgets/int" type="int" constraint=". < 10" jr:constraintMsg="number must be less than 10"/>
<bind nodeset="/widgets/decimal" type="decimal" constraint=". > 10.51 and . < 18.39" jr:constraintMsg="number must be between 10.51 and 18.39"/>
<bind nodeset="/widgets/date" type="date" constraint=". >= today()" jr:constraintMsg="only future dates allowed"/>
<bind nodeset="/widgets/select" type="select" constraint="not(selected(., 'c') and selected(., 'd'))" jr:constraintMsg="option c and d cannot be selected together"/>
<bind nodeset="/widgets/select1" type="select1"/>
<bind nodeset="/widgets/branch" required="true()"/>
<bind nodeset="/widgets/language" type="string" relevant="selected(/widgets/branch, 'n')"/>
<bind nodeset="/widgets/regex" type="string" required="true()" constraint="regex(., '[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}')" jr:constraintMsg="this isn't a valid email address" relevant="selected(/widgets/branch, 'n')"/>
<bind nodeset="/widgets/geopoint" type="geopoint"/>
<bind nodeset="/widgets/barcode" type="barcode"/>
<bind nodeset="/widgets/image" type="binary"/>
<bind nodeset="/widgets/audio" type="binary"/>
<bind nodeset="/widgets/video" type="binary"/>
<bind nodeset="/widgets/trigger" type="string"/>
<bind nodeset="/widgets/calculate" type="string" calculate="if(../int > '5', 'greater than five', 'less than or equal to five')"/>
<bind nodeset="/widgets/output" type="string" readonly="true()" relevant="selected(/widgets/branch, 'n')"/>
<bind nodeset="/widgets/repeat_a"/>
<bind nodeset="/widgets/repeat_a/item_string_a" type="string" readonly="true()"/>
<bind nodeset="/widgets/repeat_a/item_int" type="int"/>
<bind nodeset="/widgets/repeat_a/repeat_count" type="int"/>
<bind nodeset="/widgets/repeat_a/item_decimal" type="decimal"/>
<bind nodeset="/widgets/repeat_a/repeat_b/item_string_b" type="string"/>
<bind nodeset="/widgets/repeat_a/repeat_b/language_b" type="string"/>
</model>
</h:head>
<h:body>
<input ref="string">
<label>string widget</label>
<hint>can be short or very long</hint>
</input>
<input ref="int">
<label>integer widget</label>
<hint>try entering a number > 10</hint>
</input>
<input ref="decimal">
<label>decimal widget</label>
<hint>only numbers > 10.51 and < 18.39</hint>
</input>
<input ref="date">
<label>date widget</label>
<hint>only future dates allowed</hint>
</input>
<select ref="select">
<label>select multiple widget</label>
<hint>don't pick c and d together</hint>
<item>
<label>option a</label>
<value>a</value>
</item>
<item>
<label>option b</label>
<value>b</value>
</item>
<item>
<label>option c</label>
<value>c</value>
</item>
<item>
<label>option d</label>
<value>d</value>
</item>
</select>
<select1 ref="select1">
<label>select one widget</label>
<hint>scroll down to see default selection</hint>
<item>
<label>option 1</label>
<value>1</value>
</item>
<item>
<label>option 2</label>
<value>2</value>
</item>
<item>
<label>option 3</label>
<value>3</value>
</item>
<item>
<label>option 4</label>
<value>4</value>
</item>
<item>
<label>option 5</label>
<value>5</value>
</item>
<item>
<label>option 6</label>
<value>6</value>
</item>
<item>
<label>option 7</label>
<value>7</value>
</item>
<item>
<label>option 8</label>
<value>8</value>
</item>
</select1>
<select1 ref="branch">
<label>branch widget</label>
<hint>yes to skip languages, validator, sections</hint>
<item>
<label>yes</label>
<value>y</value>
</item>
<item>
<label>no</label>
<value>n</value>
</item>
</select1>
<group>
<label>section a</label>
<group>
<label>section b</label>
<group>
<label>section c</label>
<input ref="language">
<label ref="jr:itext('hello')"/>
<hint ref="jr:itext('hint')"/>
</input>
</group>
</group>
</group>
<trigger ref="trigger">
<label>acknowledge widget</label>
<hint>need to push button</hint>
</trigger>
<input ref="regex">
<label>validate widget</label>
<hint>email validator</hint>
</input>
<input ref="geopoint">
<label>geopoint widget</label>
<hint>this will get gps location</hint>
</input>
<input ref="barcode">
<label>barcode widget</label>
<hint>scans multi-format 1d/2d barcodes</hint>
</input>
<upload ref="image" mediatype="image/*">
<hint>this will launch the camera</hint>
<label>image widget</label>
</upload>
<upload ref="audio" mediatype="audio/*">
<hint>this will launch the audio recorder</hint>
<label>audio widget</label>
</upload>
<upload ref="video" mediatype="video/*">
<label>video widget</label>
</upload>
<input ref="output">
<label>review widget. is your email still <output value="/widgets/regex"/>?</label>
<hint>long hint: there is an upcoming section.</hint>
</input>
<group>
<label>household</label>
<repeat nodeset="/widgets/repeat_a">
<input ref="item_int">
<label>household id</label>
<hint>largest integer (9 places)</hint>
</input>
<input ref="item_string_a">
<label>household description</label>
<hint>readonly and long string</hint>
</input>
<group>
<label>child</label>
<repeat nodeset="/widgets/repeat_a/repeat_b">
<input ref="item_string_b">
<label>child name</label>
</input>
<group>
<label>section a</label>
<group>
<label>section b</label>
<group>
<label>section c</label>
<input ref="language_b">
<label ref="jr:itext('hello')"/>
<hint ref="jr:itext('hint')"/>
</input>
</group>
</group>
</group>
</repeat>
</group>
<input ref="item_decimal">
<label>household notes</label>
<hint>readonly and long string</hint>
</input>
</repeat>
</group>
</h:body>
</h:html>