2 +--------------------------------------------------------------------+
3 | Copyright CiviCRM LLC. All rights reserved. |
5 | This work is published under the GNU AGPLv3 license with some |
6 | permitted exceptions and without any warranty. For full license |
7 | and copyright information, see https://civicrm.org/licensing |
8 +--------------------------------------------------------------------+
12 <td class="label">{$form.option_type.label}</td>
13 <td class="html-adjust">{$form.option_type.html}<br />
14 <span class="description">{ts}You can create new result options for this survey, or select an existing survey result set which you've already created for another survey.{/ts}</span>
18 <tr id="option_group" {if !$form.option_group_id}class="hiddenElement"{/if}>
19 <td class="label">{$form.option_group_id.label}</td>
20 <td class="html-adjust">{$form.option_group_id.html}</td>
24 <td colspan="2" class="html-adjust">
25 <fieldset><legend>{ts}Result Options{/ts}</legend>
26 <span class="description">
27 {ts}Enter up to ten (10) multiple choice options in this table (click 'another choice' for each additional choice).You can use existing result set options by selecting survey result set.{/ts}
31 <table id="optionField">
34 <th> {ts}Default{/ts}</th>
35 <th> {ts}Label{/ts}</th>
36 <th> {ts}Value{/ts}</th>
37 <th> {ts}Recontact Interval{/ts}</th>
38 <th> {ts}Order{/ts}</th>
41 {section name=rowLoop start=1 loop=12}
42 {assign var=index value=$smarty.section.rowLoop.index}
43 <tr id="optionField_{$index}" class="form-item {cycle values="odd-row,even-row"}">
46 <a onclick="showHideRow({$index}); return false;" name="optionField_{$index}" href="#" class="form-link"><i class="crm-i fa-trash" title="{ts}hide field or section{/ts}"></i></a>
50 <div id="radio{$index}">
51 {$form.default_option[$index].html}
55 <td> {$form.option_label.$index.html}</td>
56 <td> {$form.option_value.$index.html}</td>
57 <td> {$form.option_interval.$index.html}</td>
58 <td> {$form.option_weight.$index.html}</td>
62 <div id="optionFieldLink" class="add-remove-link">
63 <a onclick="showHideRow(); return false;" name="optionFieldLink" href="#" class="form-link"><i class="crm-i fa-plus-circle"></i> {ts}add another choice{/ts}</a>
65 <span id="additionalOption" class="description">
66 {ts}If you need additional options - you can add them after you Save your current entries.{/ts}
74 <script type="text/javascript">
75 var showRows = [{$showBlocks}];
76 var hideBlocks = [{$hideBlocks}];
78 var surveyId = {if $surveyId}{$surveyId}{else}''{/if};
81 if (navigator.appName == "Microsoft Internet Explorer") {
82 for ( var count = 0; count < hideBlocks.length; count++ ) {
83 var r = document.getElementById(hideBlocks[count]);
84 r.style.display = 'none';
88 function showOptionSelect( ) {
89 if ( document.getElementsByName("option_type")[0].checked ) {
90 cj('#option_group').hide();
91 cj('#default_option').val('');
93 cj('#option_group').show();
98 function resetResultSet( ) {
99 for( i=1; i<=11; i++ ) {
100 cj('#option_label_'+ i).val('');
101 cj('#option_value_'+ i).val('');
102 cj('#option_weight_'+ i).val('');
103 cj('#option_interval_'+ i).val('');
110 function loadOptionGroup( ) {
111 var data = new Object;
114 if ( cj('#option_group_id').val() ) {
115 data['option_group_id'] = cj('#option_group_id').val();
116 data['survey_id'] = surveyId;
121 var dataUrl = {/literal}"{crmURL p='civicrm/ajax/rest' h=0 q='className=CRM_Campaign_Page_AJAX&fnName=loadOptionGroupDetails' }"{literal}
124 cj.post( dataUrl, data, function( opGroup ) {
125 if ( opGroup.status == 'success' ) {
126 var result = opGroup.result;
128 for( key in result ) {
129 cj('#option_label_'+ countRows).val( result[key].label);
130 cj('#option_value_'+ countRows).val( result[key].value);
131 cj('#option_weight_'+ countRows).val( result[key].weight);
133 if ( surveyId && result[key].interval ) {
134 cj('#option_interval_'+ countRows).val( result[key].interval);
137 if ( result[key].is_default == 1 ) {
138 cj('#radio'+countRows+' input').prop('checked', true);
141 if ( countRows > 1 ) {
155 on_load_init_blocks( showRows, hideBlocks, '' );