Merge pull request #9968 from fuzionnz/remove_crm_core_form_generateid
[civicrm-core.git] / templates / CRM / Activity / Form / Search / Common.tpl
1 {*
2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.7 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2017 |
6 +--------------------------------------------------------------------+
7 | This file is a part of CiviCRM. |
8 | |
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. |
12 | |
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. |
17 | |
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 +--------------------------------------------------------------------+
25 *}
26 <tr>
27 <td colspan="2">
28 {$form.activity_role.html}
29 </span>
30 </td>
31 </tr>
32 <tr>
33 {if $form.activity_type_id}
34 <td><label>{$form.activity_type_id.label}</label>
35 <br />
36 {$form.activity_type_id.html}
37 </td>
38 {else}
39 <td>&nbsp;</td>
40 {/if}
41 {if $form.activity_survey_id || $buildEngagementLevel}
42 <td>
43 {if $form.activity_survey_id}
44 <label>{$form.activity_survey_id.label}</label>
45 <br/>
46 {$form.activity_survey_id.html}
47 {/if}
48 {if $buildEngagementLevel}
49 <br
50 / >
51 <br/>
52 <label>{$form.activity_engagement_level.label}</label>
53 <br/>
54 {$form.activity_engagement_level.html}
55 {/if}
56 </td>
57 {/if}
58
59 <td>
60 <table>
61 <tr><td>
62 {if $form.parent_id}
63 <label>{ts}Has a Followup Activity?{/ts}</label>
64 <br/>
65 {$form.parent_id.html}
66 {/if}
67 </td></tr>
68 <tr><td>
69 {if $form.followup_parent_id}
70 <label>{ts}Is a Followup Activity?{/ts}</label>
71 <br/>
72 {$form.followup_parent_id.html}
73 {/if}
74 </td></tr>
75 </table>
76 </td>
77 {if $form.activity_tags}
78 <td><label>{ts}Activity Tag(s){/ts}</label>
79 <div id="Tags" class="listing-box">
80 {foreach from=$form.activity_tags item="tag_val"}
81 <div class="{cycle values='odd-row,even-row'}">
82 {$tag_val.html}
83 </div>
84 {/foreach}
85 </td>
86 {else}
87 <td>&nbsp;</td>
88 {/if}
89 </tr>
90
91 <tr>
92 <td><label>{ts}Activity Dates{/ts}</label></td>
93 </tr>
94 <tr>
95 {include file="CRM/Core/DateRange.tpl" fieldName="activity_date" from='_low' to='_high'}
96 </tr>
97 <tr>
98 <td>
99 {$form.activity_text.label}<br/>
100 {$form.activity_text.html|crmAddClass:big}<br/>
101 {$form.activity_option.html}<br/>
102 </td>
103 <td colspan="2">
104 {$form.status_id.label}<br/>
105 {$form.status_id.html}
106 </td>
107 </tr>
108 <tr>
109 <td>
110 {$form.priority_id.label}<br />
111 {$form.priority_id.html}
112 </td>
113 <td colspan="2">
114 {$form.activity_test.label} {help id="is-test" file="CRM/Contact/Form/Search/Advanced"}
115 &nbsp; {$form.activity_test.html}
116 </td>
117 </tr>
118 {if $buildSurveyResult }
119 <tr>
120 <td id="activityResult">
121 <label>{$form.activity_result.label}</label><br />
122 {$form.activity_result.html}
123 </td>
124 <td colspan="2">{include file="CRM/common/Tagset.tpl" tagsetType='activity'}</td>
125 </tr>
126 {else}
127 <tr>
128 <td colspan="3">{include file="CRM/common/Tagset.tpl" tagsetType='activity'}</td>
129 </tr>
130 {/if}
131
132 {* campaign in activity search *}
133 {include file="CRM/Campaign/Form/addCampaignToComponent.tpl"
134 campaignContext="componentSearch" campaignTrClass='' campaignTdClass=''}
135
136 {if $activityGroupTree}
137 <tr id="activityCustom">
138 <td id="activityCustomData" colspan="2">
139 {include file="CRM/Custom/Form/Search.tpl" groupTree=$activityGroupTree showHideLinks=false}
140 </td>
141 </tr>
142 {/if}
143
144 {literal}
145 <script type="text/javascript">
146 CRM.$(function($) {
147 //Searchable activity custom fields which extend ALL activity types are always displayed in the form
148 //hence hide remaining activity custom data
149 $('#activityCustom').children( ).each( function( ) {
150 $('#'+$(this).attr('id')+' div').each( function( ) {
151 if ($(this).children( ).attr('id')) {
152 var activityCustomdataGroup = $(this).attr('id'); //div id
153 var fieldsetId = $(this).children( ).attr('id'); // fieldset id
154 var splitFieldsetId = fieldsetId.split("\ 1");
155 var splitFieldsetLength = splitFieldsetId.length; //length of fieldset
156 var show = 0;
157 //setdefault activity custom data group if corresponding activity type is checked
158 $('#Activity div').each(function( ) {
159 var checkboxId = $(this).children().attr('id'); //activity type element name
160 if (document.getElementById( checkboxId ).checked ) {
161 var element = checkboxId.split('[');
162 var splitElement = element[1].split(']'); // get activity type id
163 for (var i=0; i<splitFieldsetLength; i++) {
164 var singleFieldset = splitFieldsetId[i];
165 if (parseInt( singleFieldset)) {
166 if (singleFieldset == splitElement[0]) {
167 show++;
168 }
169 }
170 }
171 }
172 });
173 if (show < 1) {
174 $('#'+activityCustomdataGroup).hide( );
175 }
176 }
177 });
178 });
179 });
180
181 function showCustomData(chkbox) {
182 if (document.getElementById(chkbox).checked) {
183 //inject Searchable activity custom fields according to activity type selected
184 var element = chkbox.split("[");
185 var splitElement = element[1].split("]");
186 cj('#activityCustom').children().each(function( ) {
187 cj('#'+cj(this).attr( 'id' )+' div').each(function( ) {
188 if (cj(this).children().attr('id')) {
189 if (cj('#'+cj(this).attr('id')+(' fieldset')).attr('id')) {
190 var fieldsetId = cj('#' + cj(this).attr('id')+(' fieldset')).attr('id').split("\ 1");
191 var activityTypeId = jQuery.inArray(splitElement[0], fieldsetId);
192 if (fieldsetId[activityTypeId] == splitElement[0]) {
193 cj(this).show();
194 }
195 }
196 }
197 });
198 });
199 }
200 else {
201 //hide activity custom fields if the corresponding activity type is unchecked
202 var setcount = 0;
203 var element = chkbox.split( "[" );
204 var splitElement = element[1].split( "]" );
205 cj('#activityCustom').children().each( function( ) {
206 cj('#'+cj(this).attr( 'id' )+' div').each(function() {
207 if (cj(this).children().attr('id')) {
208 if (cj('#'+cj(this).attr('id')+(' fieldset')).attr('id')) {
209 var fieldsetId = cj( '#'+cj(this).attr('id')+(' fieldset')).attr('id').split("\ 1");
210 var activityTypeId = jQuery.inArray( splitElement[0],fieldsetId);
211 if (fieldsetId[activityTypeId] == splitElement[0]) {
212 cj('#'+cj(this).attr('id')).each( function() {
213 if (cj(this).children().attr('id')) {
214 //if activity custom data extends more than one activity types then
215 //hide that only when all the extended activity types are unchecked
216 cj('#'+cj(this).attr('id')+(' fieldset')).each( function( ) {
217 var splitFieldsetId = cj( this ).attr('id').split("\ 1");
218 var splitFieldsetLength = splitFieldsetId.length;
219 for( var i=0;i<splitFieldsetLength;i++ ) {
220 var setActivityTypeId = splitFieldsetId[i];
221 if (parseInt(setActivityTypeId)) {
222 var activityTypeId = 'activity_type_id['+setActivityTypeId+']';
223 if (document.getElementById(activityTypeId).checked) {
224 return false;
225 }
226 else {
227 setcount++;
228 }
229 }
230 }
231 if (setcount > 0) {
232 cj('#'+cj(this).parent().attr('id')).hide();
233 }
234 });
235 }
236 });
237 }
238 }
239 }
240 });
241 });
242 }
243 }
244 {/literal}
245 </script>