[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]

> [if !value formatter] [page href=@@MV_PAGE@@ form=| item_id=[cgi item_id] mv_action=return formatter=1 |]Use option formatter [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 [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"
> 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)

[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]

[loop lr=1 head-skip=1 list="[scratch list_questions]"] [on-match]
Question field | Question
[/on-match] [list] [if-loop-param label]
[loop-param label]
[/if-loop-param]
[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] | [if-loop-data survey label] [loop-filter 30.][loop-data survey label][/loop-filter] [else] (not yet input) [/else] [/if-loop-data] | [page href=survey/graph arg="[loop-code]"]results
[/list] [on-match] Delete survey [cgi item_id] [/on-match] [/loop] | [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 =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.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.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.bottom_buttons' => 'yesno', 'extended.display_type' => 'select', 'extended.email_cc' => 'text_40', 'extended.email_from' => 'text_40', 'extended.email_template' => 'textarea_4_60', '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), }, }` ]
Access URL: [area no_session_id=1 no_count=1 href=survey/standard form="survey_start=[cgi item_id]"]

@_UI_STD_FOOTER_@