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