1[%# config_common.tt2 ~%]
2[%# Block definitions ~%]
3
4[%~ BLOCK EditListHeading # (ppaths,pitem,helem) ~%]
5    [% IF helem.match('^h[1-7]$') ~%]
6        <[%helem%]>
7    [%~ ELSE ~%]
8        <label for="param.[% ppaths.join('.') %]">
9    [%~ END %]
10
11    [% IF pitem.title ~%]
12        [% pitem.title %]
13        [%~ IF is_listmaster %] ([% pitem.name %])[% END %]
14    [%~ ELSE ~%]
15        [% pitem.name %]
16    [%~ END %]
17    [%~IF is_listmaster && pitem.default_value~%] [%|loc%](default)[%END%][%~END%]
18
19    [% IF pitem.scenario && is_listmaster ~%]
20        &nbsp;<a class="input"
21           href="[% 'dump_scenario' | url_rel([list,pitem.scenario]) %]"
22           title="[%|loc%]scenario source[%END%]">
23            [%|loc%]scenario source[%END~%]
24        </a>
25    [%~ END %]
26
27    [%~ IF pitem.comment ~%]
28        <a href="#" class="accordionButton"
29           data-selector="#help\.[% ppaths.join('\\.') %]">
30            <i class="fa fa-question-circle" title="[%|loc%]Help[%END%]"></i>
31        </a>
32    [%~ END %]
33
34    [% IF helem.match('^h[1-7]$') ~%]
35        </[%helem%]>
36    [%~ ELSE ~%]
37        </label>
38    [%~ END %]
39
40    [% IF pitem.comment ~%]
41        <div id="help.[% ppaths.join('.') %]"
42             class="secondary callout" data-closable>
43            <p>[% pitem.comment.replace('\n', '</p><p>') %]</p>
44        </div>
45    [%~ END ~%]
46[%~END ~%]
47
48[%~ BLOCK EditListSet # (ppaths,pitem,val) ~%]
49    <!-- set -->
50    [% IF pitem.privilege == 'write' ~%]
51        <select name="multiple_param.[% ppaths.join('.') %]"
52                id="param.[% ppaths.join('.') %]"
53                multiple="multiple" size="[% pitem.format.size() %]"
54            [%~ IF pitem.field_type == 'lang' %] class="neutral"[% END %]>
55            [% FOREACH enum = pitem.format ~%]
56                <option value="[% enum %]"
57                    [%~ FOREACH v = val ~%]
58                        [%~ IF enum == v %]selected="selected"[% END %]
59                    [%~ END %]
60                    [%~ IF pitem.field_type == 'lang' %]
61                        lang="[% enum %]"
62                        xml:lang="[% enum %]"
63                    [% END %]>
64                    [%~ enum | optdesc(pitem.field_type,is_listmaster) ~%]
65                </option>
66            [% END %]
67        </select>
68    [%~ ELSE ~%]
69        [% FOREACH enum = pitem.format ~%]
70            [% FOREACH v = val ~%]
71                [% IF enum == v ~%]
72                    [%~ IF pitem.field_type == 'lang' ~%]
73                        <span class="neutral" lang="[% enum %]" xml:lang="[% enum %]">
74                    [%~ END ~%]
75                            [% enum | optdesc(pitem.field_type,is_listmaster) %]
76                    [%~ IF pitem.field_type == 'lang' ~%]
77                        </span>
78                    [%~ END %]
79
80                    [%~ LAST %]
81                [%~ END %]
82            [% END %]
83        [%~ END %]
84    [%~ END %]
85    <!-- end set -->
86[%~ END ~%]
87
88[%~ BLOCK EditListArrayDel # (ppaths,pitem,labelled,val) ~%]
89    <!-- del -->
90    [% IF pitem.privilege == 'write' ~%]
91        <input type="checkbox" name="deleted_param.[% ppaths.join('.') %]"
92               id="del.[% ppaths.join('.') %]"
93               class="fadeIfChecked" data-selector="#item\.[% ppaths.join('\\.') %]"
94               value="[% val || 'del' %]" />
95        [% IF labelled ~%]
96            <label for="del.[% ppaths.join('.') %]">[%|loc%]Delete[%END%]</label>
97        [%~ END %]
98    [%~ END %]
99    <!-- end del -->
100[%~ END ~%]
101
102[%~ BLOCK EditListLeaf # (ppaths,pitem,val) ~%]
103    [% IF pitem.enum ~%]
104        [% PROCESS EditListEnum %]
105    [%~ ELSIF pitem.scenario ~%]
106        [% PROCESS EditListScenario %]
107    [%~ ELSIF pitem.task ~%]
108        [% PROCESS EditListTask %]
109    [%~ ELSIF pitem.datasource ~%]
110        [% PROCESS EditListDatasource %]
111    [%~ ELSE ~%]
112        [% PROCESS EditListScalar %]
113    [%~ END %]
114[%~ END ~%]
115
116[%~ BLOCK EditListEnum # (ppaths,pitem,val) ~%]
117    <!-- enum -->
118    [% IF pitem.privilege == 'write' ~%]
119        <select name="single_param.[% ppaths.join('.') %]"
120                id="param.[% ppaths.join('.') %]"
121                [%~ IF pitem.field_type == 'lang' %] class="neutral"[% END %]>
122            [% IF pitem.occurrence.match('^0') || val.length() == 0 %][%# FIXME ~%]
123                <option value=""></option>
124            [%~ END %]
125            [% FOREACH enum = pitem.format ~%]
126                <option value="[% enum %]"
127                        [%~ IF enum == val %] selected="selected"[% END %]
128                        [%~ IF pitem.field_type == 'lang' %] lang="[% enum %]"
129                        xml:lang="[% enum %]"[%END%]>
130                    [%~ enum | optdesc(pitem.field_type,is_listmaster) ~%]
131                </option>
132            [% END %]
133        </select>
134    [%~ ELSE ~%]
135        [% FOREACH enum = pitem.format ~%]
136            [% IF enum == val ~%]
137                [% IF pitem.field_type == 'lang' ~%]
138                    <span class="neutral" lang="[% enum %]" xml:lang="[% enum %]">
139                [%~ END ~%]
140                [% enum | optdesc(pitem.field_type,is_listmaster) %]
141                [%~ IF pitem.field_type == 'lang' ~%]
142                    </span>
143                [%~ END %]
144
145                [%~ LAST %]
146            [%~ END %]
147        [%~ END %]
148    [%~ END %]
149    <!-- end enum -->
150[%~ END ~%]
151
152[%~ BLOCK EditListScenario # (ppaths,pitem,val) ~%]
153    <!-- scenario -->
154    [% IF pitem.privilege == 'write' ~%]
155        <select name="single_param.[% ppaths.join('.') %].name"
156                id="param.[% ppaths.join('.') %]">
157            [% FOREACH scenario = pitem.format ~%]
158                <option value="[% scenario.value.name %]"
159                        [%~ IF scenario.value.name == val.name %] selected="selected"[% END %]>
160                    [%~ scenario.value.title %]
161                    [%~ IF is_listmaster %] ([% scenario.value.name %])[% END ~%]
162                </option>
163            [% END %]
164        </select>
165    [%~ ELSE ~%]
166        [% FOREACH scenario = pitem.format ~%]
167            [% IF scenario.value.name == val.name ~%]
168                [% scenario.value.title %]
169                [%~ IF is_listmaster %]
170                    ([% scenario.value.name %])
171                [% END %]
172            [%~ END %]
173        [%~ END %]
174    [%~ END %]
175    <!-- end scenario -->
176[%~ END ~%]
177
178[%~ BLOCK EditListTask # (ppaths,pitem,val) ~%]
179    <!-- task -->
180    [% IF pitem.privilege == 'write' ~%]
181        <select name="single_param.[% ppaths.join('.') %].name"
182                id="param.[% ppaths.join('.') %]">
183            [% IF pitem.occurrence.match('^0') || val.length() == 0 %][%# FIXME ~%]
184                <option value=""></option>
185            [%~ END %]
186            [% FOREACH task = pitem.format ~%]
187                <option value="[% task.value.name %]"
188                        [%~ IF task.value.name == val.name %] selected="selected"[% END %]>
189                    [%~ task.value.title %]
190                    [%~ IF is_listmaster %] ([% task.value.name %])[% END ~%]
191                </option>
192            [% END %]
193        </select>
194    [%~ ELSE ~%]
195        [% FOREACH task = pitem.format ~%]
196            [% IF task.value.name == val.name ~%]
197                [% task.value.title %]
198                [%~ IF is_listmaster %] ([% task.value.name %])[% END %]
199            [%~ END %]
200        [%~ END %]
201    [%~ END %]
202    <!-- end task -->
203[%~ END ~%]
204
205[%~ BLOCK EditListDatasource # (ppaths,pitem,val) ~%]
206    <!-- datasource -->
207    [% IF pitem.privilege == 'write' ~%]
208        <select name="single_param.[% ppaths.join('.') %]"
209                id="param.[% ppaths.join('.') %]">
210            [% IF pitem.occurrence.match('^0') || val.length() == 0 %][%# FIXME ~%]
211                <option value=""></option>
212            [%~ END %]
213            [% FOREACH source = pitem.format ~%]
214                <option value="[% source.value.name %]"
215                        [%~ IF source.value.name == val %] selected="selected"[% END %]>
216                    [%~ source.value.title %]
217                    [%~ IF is_listmaster %] ([% source.value.name %])[% END ~%]
218                </option>
219            [% END %]
220        </select>
221    [%~ ELSE ~%]
222        [% FOREACH source = pitem.format ~%]
223            [% IF source.value.name == val ~%]
224                [% source.value.title %]
225                [%~ IF is_listmaster %] ([% source.value.name %])[% END %]
226            [%~ END %]
227        [%~ END %]
228    [%~ END %]
229    <!-- end datasource -->
230[%~ END ~%]
231
232[%~ BLOCK EditListScalar # (ppaths,pitem,val) ~%]
233    <!-- scalar -->
234    [% IF pitem.privilege == 'write' ~%]
235        [% IF pitem.unit ~%]
236            <span style="display:inline-block">[%# FIXME %]
237        [%~ END %]
238                <input name="single_param.[% ppaths.join('.') %]"
239                       id="param.[% ppaths.join('.') %]"
240                       value="[% val %]" size="[% pitem.length %]"
241                       [%~ IF pitem.field_type == 'password' %] type="password"
242                       [%~ ELSE %] type="text"
243                       [%~ END %]
244                       [%~ IF pitem.field_type == 'lang' %] class="neutral"[% END %] />
245        [% IF pitem.unit ~%]
246            </span>
247        [%~ END %]
248
249        [% pitem.unit %]
250    [%~ ELSE ~%]
251        [% IF pitem.field_type == 'lang' ~%]
252            <span class="neutral" lang="[% val %]" xml:lang="[% val %]">
253        [%~ END ~%]
254        [% IF pitem.field_type ~%]
255            [% val | optdesc(pitem.field_type,is_listmaster) %]
256        [%~ ELSE ~%]
257            [% val %]
258        [%~ END %]
259        [%~ IF pitem.field_type == 'lang' ~%]
260            </span>
261        [%~ END %]
262
263        [% IF val.length() ~%]
264            [% pitem.unit %]
265        [%~ END %]
266    [%~ END %]
267    <!-- end scalar -->
268[%~ END ~%]
269[%# end config_common.tt2 ~%]
270