2 +--------------------------------------------------------------------+
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2019 |
6 +--------------------------------------------------------------------+
7 | This file is a part of CiviCRM. |
9 | CiviCRM is free software; you can copy, modify, and distribute it |
10 | under the terms of the GNU Affero General Public License |
11 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13 | CiviCRM is distributed in the hope that it will be useful, but |
14 | WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
16 | See the GNU Affero General Public License for more details. |
18 | You should have received a copy of the GNU Affero General Public |
19 | License and the CiviCRM Licensing Exception along |
20 | with this program; if not, contact CiviCRM LLC |
21 | at info[AT]civicrm[DOT]org. If you have questions about the |
22 | GNU Affero General Public License or the licensing of CiviCRM, |
23 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
24 +--------------------------------------------------------------------+
28 <td class="label">{$form.option_type.label}</td>
29 <td class="html-adjust">{$form.option_type.html}<br />
30 <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>
34 <tr id="option_group" {if !$form.option_group_id}class="hiddenElement"{/if}>
35 <td class="label">{$form.option_group_id.label}</td>
36 <td class="html-adjust">{$form.option_group_id.html}</td>
40 <td colspan="2" class="html-adjust">
41 <fieldset><legend>{ts}Result Options{/ts}</legend>
42 <span class="description">
43 {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}
47 <table id="optionField">
50 <th> {ts}Default{/ts}</th>
51 <th> {ts}Label{/ts}</th>
52 <th> {ts}Value{/ts}</th>
53 <th> {ts}Recontact Interval{/ts}</th>
54 <th> {ts}Order{/ts}</th>
57 {section name=rowLoop start=1 loop=12}
58 {assign var=index value=$smarty.section.rowLoop.index}
59 <tr id="optionField_{$index}" class="form-item {cycle values="odd-row,even-row"}">
62 <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>
66 <div id="radio{$index}">
67 {$form.default_option[$index].html}
71 <td> {$form.option_label.$index.html}</td>
72 <td> {$form.option_value.$index.html}</td>
73 <td> {$form.option_interval.$index.html}</td>
74 <td> {$form.option_weight.$index.html}</td>
78 <div id="optionFieldLink" class="add-remove-link">
79 <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>
81 <span id="additionalOption" class="description">
82 {ts}If you need additional options - you can add them after you Save your current entries.{/ts}
90 <script type="text/javascript">
91 var showRows = [{$showBlocks}];
92 var hideBlocks = [{$hideBlocks}];
94 var surveyId = {if $surveyId}{$surveyId}{else}''{/if};
97 if (navigator.appName == "Microsoft Internet Explorer") {
98 for ( var count = 0; count < hideBlocks.length; count++ ) {
99 var r = document.getElementById(hideBlocks[count]);
100 r.style.display = 'none';
104 function showOptionSelect( ) {
105 if ( document.getElementsByName("option_type")[0].checked ) {
106 cj('#option_group').hide();
107 cj('#default_option').val('');
109 cj('#option_group').show();
114 function resetResultSet( ) {
115 for( i=1; i<=11; i++ ) {
116 cj('#option_label_'+ i).val('');
117 cj('#option_value_'+ i).val('');
118 cj('#option_weight_'+ i).val('');
119 cj('#option_interval_'+ i).val('');
126 function loadOptionGroup( ) {
127 var data = new Object;
130 if ( cj('#option_group_id').val() ) {
131 data['option_group_id'] = cj('#option_group_id').val();
132 data['survey_id'] = surveyId;
137 var dataUrl = {/literal}"{crmURL p='civicrm/ajax/rest' h=0 q='className=CRM_Campaign_Page_AJAX&fnName=loadOptionGroupDetails' }"{literal}
140 cj.post( dataUrl, data, function( opGroup ) {
141 if ( opGroup.status == 'success' ) {
142 var result = opGroup.result;
144 for( key in result ) {
145 cj('#option_label_'+ countRows).val( result[key].label);
146 cj('#option_value_'+ countRows).val( result[key].value);
147 cj('#option_weight_'+ countRows).val( result[key].weight);
149 if ( surveyId && result[key].interval ) {
150 cj('#option_interval_'+ countRows).val( result[key].interval);
153 if ( result[key].is_default == 1 ) {
154 cj('#radio'+countRows+' input').prop('checked', true);
157 if ( countRows > 1 ) {
171 on_load_init_blocks( showRows, hideBlocks, '' );