/
overall.html
459 lines (417 loc) · 12.1 KB
/
overall.html
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
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
[set table_perms]survey[/set]
[if !cgi item_id]
[cgi name=item_id set="[cgi code]" hide=1]
[/if]
[cgi name=mv_data_table set=survey hide=1]
[tmp page_title]
Edit survey: [cgi item_id]
[/tmp]
[set ui_class]Admin[/set]
[calc]
#make absolutely sure
my $id = $CGI->{item_id};
$id = lc $id;
$id =~ s/\W+/_/g;
$CGI->{item_id} = $id;
return;
[/calc]
[if cgi survey_clone]
[flag type=write table=survey]
[perl tables=survey]
my $id = $CGI->{item_id};
$id = lc $id;
$id =~ s/\W+/_/g;
my $cid = $CGI->{survey_clone};
my $db = $Db{survey};
if($db->record_exists($id)) {
$Tag->error( {
name => 'survey_clone',
set => errmsg("will not clone over existing survey %s", $id),
});
return;
}
$db->clone_row($cid, $id);
my $ary = $db->query("select code from survey where code like '$cid:%'");
for(@$ary) {
my $old = $_->[0];
my $new = $old;
$new =~ s/^ $cid : /$id:/x
or do {
$Tag->warnings("Cannot clone row $old to $new");
next;
};
$db->clone_row($old, $new);
}
return;
[/perl]
[/if]
[set click_delete_survey]
[flag type=write table=survey]
[perl tables=survey]
my $id = $CGI->{item_id};
my $db = $Db{survey};
$db->delete_record($id);
my $ary = $db->query("select code from survey where code like '$id:%'");
for(@$ary) {
$db->delete_record($_->[0]);
}
$Tag->warnings(errmsg("Survey %s and all its questions deleted.", $id));
return;
[/perl]
mv_nextpage=admin/survey/index
[/set]
@_UI_STD_HEAD_@
[if cgi zero_out]
[calc] delete $Session->{surveys}; delete $Session->{auto_wizard}; return; [/calc]
[/if]
<blockquote>
[if !value formatter]
[page href=@@MV_PAGE@@
form=|
item_id=[cgi item_id]
mv_action=return
formatter=1
|]Use option formatter</A>
[tmpn options_extra]
ui_te_widget:options=textarea_12_80
ui_te_filter:options=line2options
ui_te_pre_filter:options=options2line
ui_te_help:options=One option per line, value to left of = sign.
ui_te_default:options==--select one--
[/tmpn]
[else]
[page href=@@MV_PAGE@@
form=|
item_id=[cgi item_id]
mv_action=return
formatter=0
|]Use freeform option type</A>
[tmpn options_extra]
ui_te_widget:options=option_format
ui_te_filter:options=option_format
ui_te_help:options=Value on left, label on right.
ui_te_default:options==--select one--
[/tmpn]
[/else]
[/if]
[page href=@@MV_PAGE@@ form="
item_id=[cgi item_id]
zero_out=1
"]Zero "already completed"</A>
<div style="font-size: larger">
Access URL:
[area no_session_id=1 no_count=1 href=survey/standard form="survey_start=[cgi item_id]"]
([page no_session_id=1 no_count=1 href=survey/standard form="survey_start=[cgi item_id]"]run</A>)
</div>
</blockquote>
[if type=data term="survey::code::[cgi item_id]"]
[tmpn survey_hide_key]1[/tmpn]
[tmp list_questions][data table=survey col=extended.ui_data_fields key="[cgi item_id]" serial=1][/tmp]
[calc]
my $string = $Scratch->{list_questions} or return;
#::logDebug("fields were=$opt->{ui_data_fields}");
my $ids = $CGI->{item_id} . '::';
$string =~ s/\r\n/\n/g;
$string =~ s/\r/\n/g;
$string =~ s/^[ \t]+//mg;
$string =~ s/[ \t]+$//mg;
my %break;
if($string =~ /\n\n/) {
my @breaks;
my @break_labels;
my $fstring = "\n\n$string";
while ($fstring =~ s/\n+(?:\n[ \t]*=(.*))?\n+[ \t]*(\w[:.\w]+)/\n$2/) {
$break{$2} = $1;
}
$breaks = join(" ", @breaks);
$breaks = join(",", @break_labels);
$string = $fstring;
}
$string =~ s/^[\s,\0]+//;
$string =~ s/[\s,\0]+$//;
$string =~ s/[,\0\s]+/ /g;
my @fields = split /\s+/, $string;
my @out = "code\tname\tlabel";
for(@fields) {
push @out, join "\t", "$ids$_", $_, $break{$_} || '';
}
$Scratch->{list_questions} = join "\n", @out;
return;
[/calc]
[/if]
[calc]
# init for use below
$survey_page_number = 1;
return;
[/calc]
<table>
<tr>
[loop lr=1 head-skip=1 list="[scratch list_questions]"]
[on-match]
<td valign=top>
<table>
<tr class=rmarq>
<td>
Question field
</td>
<td>
Question
</td>
</tr>
[/on-match]
[list]
[if-loop-param label]
<tr class=rbreak>
<td colspan=2 style="border: 1px solid #996633;">
[loop-param label]
[page href="__UI_BASE__/flex_editor"
form="
mv_data_table=survey
item_id=[cgi item_id]
ui_data_fields=code extended.page_template_[calc]$survey_page_number[/calc]
no_table_meta=1
ui_te_widget:extended.page_template_[calc]$survey_page_number[/calc]=textarea_40_80
ui_te_label:extended.page_template_[calc]$survey_page_number[/calc]=Custom page template
ui_return_to=@@MV_PAGE@@
tabbed=0
ui_return_to=item_id=[cgi item_id]
"]custom page</A>
[calc] $survey_page_number++; return; [/calc]
</td>
</tr>
[/if-loop-param]
<tr class="[item-alternate 2]rnorm[else]ralt[/else][/item-alternate]">
<td>
[page href="__UI_BASE__/flex_editor"
form="
mv_data_table=survey
item_id=[loop-code]
ui_te_override:name=[loop-param name]
[scratch options_extra]
ui_return_to=@@MV_PAGE@@
ui_return_to=item_id=[cgi item_id]
"][loop-param name]</A>
</td>
<td>
[if-loop-data survey label]
[loop-filter 30.][loop-data survey label][/loop-filter]
[else]
(not yet input)
[/else]
[/if-loop-data]
</td>
<td>
[page href=survey/graph arg="[loop-code]"]results</A>
</td>
</tr>
[/list]
[on-match]
</table>
<blockquote>
<a href="[area href=@@MV_PAGE@@
form="
mv_click=click_delete_survey
item_id=[cgi item_id]
mv_action=back
"
]"
onClick="confirm('Are you sure you want to delete [cgi item_id] and all its questions?')"
><img src="delete.gif" border=0> Delete survey [cgi item_id]</A>
</blockquote>
[/on-match]
</td>
[/loop]
<td>
[table-editor
table=survey
no-table-meta=1
tabbed=1
table_width=620
tab_width=100
output-map="[scratch ui_style_edit]"
ui_style="[scratch ui_style_edit]"
break_row_class=rmarq
panel_width=600
panel_height=500
no-meta=1
left_width=130
label_cell_valign=top
help_cell_width=150
start_at="[cgi start_at]"
item_id="[cgi item_id]"
ui_hide_key="[scratch survey_hide_key]"
ui_data_fields="
=General
code
label
type
extended.display_type
extended.intro_text
extended.file_upload
extended.attach_fields
=Questions
extended.ui_data_fields
=Display page
extended.bottom_buttons
extended.top_buttons
extended.table_width
extended.left_width
=HTML Classes
extended.data_row_class
extended.break_row_class
extended.title_row_class
extended.spacer_row_class
extended.combo_row_class
extended.border_cell_class
extended.label_cell_class
extended.data_cell_class
extended.widget_cell_class
extended.help_cell_class
=Survey Output
extended.output_type
extended.output_href
extended.output_parm
extended.output_email
extended.email_template
extended.email_from
extended.email_cc
extended.output_repeated
=Thanks
extended.thanks_title
extended.thanks_message
extended.already_title
extended.already_message
"
label=`{
code => 'Survey key',
label => 'Main title',
'extended.already_message' => 'Message to show when already completed',
'extended.already_title' => 'Title when already completed',
'extended.attach_fields' => 'Fields to attach',
'extended.border_cell_class' => 'Border cell class',
'extended.bottom_buttons' => 'Buttons only on bottom',
'extended.break_row_class' => 'Break row class',
'extended.combo_row_class' => 'User widget row class',
'extended.data_cell_class' => 'Data cell class (standard row)',
'extended.data_row_class' => 'Data row class',
'extended.display_type' => 'Display type',
'extended.email_cc' => 'Who to Cc: on email response',
'extended.email_from' => 'Address emailed response is from',
'extended.email_template' => 'Email template or file',
'extended.file_upload' => 'Allow file upload',
'extended.help_cell_class' => 'Help cell class (standard row)',
'extended.intro_text' => 'Intro Text',
'extended.label_cell_class' => 'Label cell class (standard row)',
'extended.left_width' => 'Width specification for label column',
'extended.other_fields' => 'Other information to collect',
'extended.output_email' => 'Target email address',
'extended.output_href' => 'Forward-to page or URL',
'extended.output_parm' => 'Forward-to extra parameters',
'extended.output_repeated' => 'Allow repeated survey?',
'extended.output_type' => 'Output Type',
'extended.restrict_allow' => 'Allow these ITL tags',
'extended.title_row_class' => 'Title row class',
'extended.spacer_row_class' => 'Spacer row class',
'extended.table_width' => 'Width specification for editor table',
'extended.thanks_message' => 'Body of finished page',
'extended.thanks_title' => 'Title for finished page',
'extended.top_buttons' => 'Buttons only on top',
'extended.ui_data_fields' => 'Question fields',
'extended.ui_display_only' => 'Fields for display only',
'extended.widget_cell_class' => 'Widget cell class (standard row)',
}`
help=`{
'extended.output_email' => 'Address for sending email fulfillment.',
'extended.email_template' => 'Template for email fulfillment. Looks for a file if one line, uses default template if empty.',
'extended.output_href' => 'Page base for forwarded URL, will have form paramters added. Use http:// only if outside IC catalog.',
'extended.output_parm' => 'Extra parameters for forwarded url, key=value, one per line.',
'extended.output_repeated' => 'Set to yes to allow more than one response per session or per user',
'extended.intro_text' => 'Introduction to survey (if any). Shown on first page only.',
'extended.ui_data_fields' => 'Page divisions can be embedded in the fields by placing "=Title String" on a line by itself and surrounding with blank lines.',
'extended.ui_display_only' => 'Will not be set, only shown.',
}`
widget=`{
code => 'text_20',
label => 'text_60',
type => 'hidden',
'extended.already_message' => 'textarea_4_60',
'extended.already_title' => 'text_60',
'extended.attach_fields' => 'text_60',
'extended.bottom_buttons' => 'yesno',
'extended.display_type' => 'select',
'extended.email_cc' => 'text_40',
'extended.email_from' => 'text_40',
'extended.email_template' => 'textarea_4_60',
'extended.file_upload' => 'yesno',
'extended.intro_text' => 'textarea_8_50',
'extended.left_width' => 'text_8',
'extended.output_email' => 'text_40',
'extended.output_href' => 'text_40',
'extended.output_parm' => 'textarea_2_40',
'extended.output_repeated' => 'yesno',
'extended.output_type' => 'select',
'extended.panel_height' => 'text_5',
'extended.panel_width' => 'text_5',
'extended.table_width' => 'text_8',
'extended.thanks_message' => 'textarea_4_60',
'extended.thanks_title' => 'text_60',
'extended.top_buttons' => 'yesno',
'extended.ui_data_fields' => 'textarea_20_60',
'extended.view_from' => 'select',
}`
override.type=master
filter=`{
height => 'digits',
}`
database=`{
'extended.ui_sort_field' => $CGI->{ui_table},
'extended.ui_show_fields' => $CGI->{ui_table},
'extended.ui_data_fields' => $CGI->{ui_table},
'extended.view_from' => $CGI->{ui_table},
'extended.spread_fields' => $CGI->{ui_table},
'extended.spread_meta' => $CGI->{ui_table},
'extended.spread_textarea' => $CGI->{ui_table},
}`
height=`{
'extended.ui_sort_field' => 8,
'extended.ui_show_fields' => 8,
'extended.ui_data_fields' => 16,
'extended.spread_fields' => 8,
}`
width=`{
'extended.ui_data_fields' => 30,
'extended.ui_show_fields' => 30,
}`
form=`{
fieldmeta => '',
}`
wid_href=`{
fieldmeta => 'meta_editor',
}`
options=`{
'extended.display_type' => q{
over_under=Question on one line, answer on line below,
0=Question in left column and answer in right column,
},
'extended.output_type' => q{
survey_log=Standard survey log,
email_only=Email response,
auto_bounce=Automatic bounce to page (requires page below),
0=none (use wizard default -- need page below),
},
}`
]
</td>
</tr>
<tr>
<td colspan=2>
Access URL:
[area no_session_id=1 no_count=1 href=survey/standard form="survey_start=[cgi item_id]"]
</td>
</tr>
</table>
@_UI_STD_FOOTER_@
<!-- page: @@MV_PAGE@@ -->