Merge pull request #12639 from aniesshsethh/issue_314
[civicrm-core.git] / templates / CRM / Profile / Form / Dynamic.tpl
1 {*
2 +--------------------------------------------------------------------+
3 | CiviCRM version 5 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2019 |
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 <div class="crm-profile-name-{$ufGroupName}">
27 {crmRegion name=profile-form-`$ufGroupName`}
28
29 {* Profile forms when embedded in CMS account create (mode=1) or
30 cms account edit (mode=8) or civicrm/profile (mode=4) pages *}
31 {if $deleteRecord}
32 <div class="messages status no-popup">
33 <div class="icon inform-icon"></div>&nbsp;
34 {ts}Are you sure you want to delete this record?{/ts}
35 </div>
36
37 <div class="crm-submit-buttons">
38 <span class="crm-button">{$form._qf_Edit_upload_delete.html}</span>
39 {if $includeCancelButton}
40 <a class="button cancel" href="{$cancelURL}">{$cancelButtonText}</a>
41 {/if}
42 </div>
43 {else}
44 {if ! empty( $fields )}
45 {* Wrap in crm-container div so crm styles are used.*}
46 {* Replace div id "crm-container" only when profile is not loaded in civicrm container, i.e for profile shown in my account and in profile standalone mode otherwise id should be "crm-profile-block" *}
47
48 {if $action eq 1 or $action eq 2 or $action eq 4 }
49 <div id="crm-profile-block" class="crm-container crm-public">
50 {else}
51 <div id="crm-container" class="crm-container crm-public" lang="{$config->lcMessages|truncate:2:"":true}" xml:lang="{$config->lcMessages|truncate:2:"":true}">
52 {/if}
53
54 {if $isDuplicate and ( ($action eq 1 and $mode eq 4 ) or ($action eq 2) or ($action eq 8192) ) }
55 <div class="crm-submit-buttons">
56 <span class="crm-button">{$form._qf_Edit_upload_duplicate.html}</span>
57 </div>
58 {/if}
59 {if $mode eq 1 || $activeComponent neq "CiviCRM"}
60 {include file="CRM/Form/body.tpl"}
61 {/if}
62 {strip}
63 {if $help_pre && $action neq 4}
64 <div class="messages help">{$help_pre}</div>
65 {/if}
66
67 {include file="CRM/common/CMSUser.tpl"}
68
69 {if $action eq 2 and $multiRecordFieldListing}
70 <h1>{ts}Edit Details{/ts}</h1>
71 <div class="crm-submit-buttons" style='float:right'>
72 {include file="CRM/common/formButtons.tpl"}{if $isDuplicate}<span class="crm-button">{$form._qf_Edit_upload_duplicate.html}</span>{/if}
73 </div>
74 {/if}
75
76 {assign var=zeroField value="Initial Non Existent Fieldset"}
77 {assign var=fieldset value=$zeroField}
78 {foreach from=$fields item=field key=fieldName}
79 {if $field.skipDisplay}
80 {continue}
81 {/if}
82 {assign var="profileID" value=$field.group_id}
83 {assign var=n value=$field.name}
84 {if $field.groupTitle != $fieldset}
85 {if $mode neq 8 && $mode neq 4}
86 <div {if $context neq 'dialog'}id="profilewrap{$field.group_id}"{/if}>
87 <fieldset><legend>{$field.groupTitle}</legend>
88 {/if}
89 {assign var=fieldset value=`$field.groupTitle`}
90 {assign var=groupHelpPost value=`$field.groupHelpPost`}
91 {if $field.groupHelpPre}
92 <div class="messages help">{$field.groupHelpPre}</div>
93 {/if}
94 {/if}
95 {if $field.field_type eq "Formatting"}
96 {$field.help_pre}
97 {elseif $n}
98 {if $field.groupTitle != $fieldset}
99 {if $fieldset != $zeroField}
100 {if $groupHelpPost}
101 <div class="messages help">{$groupHelpPost}</div>
102 {/if}
103 {if $mode neq 8 && $mode neq 4}
104 </div><!-- end form-layout-compressed-div -->
105 </fieldset>
106 </div>
107 {/if}
108 {/if}
109 <div class="form-layout-compressed">
110 {/if}
111 {if $field.help_pre && $action neq 4 && $form.$n.html}
112 <div class="crm-section helprow-{$n}-section helprow-pre" id="helprow-{$n}">
113 <div class="content description">{$field.help_pre}</div>
114 </div>
115 {/if}
116 {if $field.options_per_line}
117 <div class="crm-section editrow_{$n}-section form-item" id="editrow-{$n}">
118 <div class="label">{$form.$n.label}</div>
119 <div class="content edit-value">
120 {assign var="count" value="1"}
121 {strip}
122 <table class="form-layout-compressed">
123 <tr>
124 {* sort by fails for option per line. Added a variable to iterate through the element array*}
125 {assign var="index" value="1"}
126 {foreach name=outer key=key item=item from=$form.$n}
127 {if $index < 10}
128 {assign var="index" value=`$index+1`}
129 {else}
130 <td class="labels font-light">{$form.$n.$key.html}</td>
131 {if $count == $field.options_per_line}
132 </tr>
133 <tr>
134 {assign var="count" value="1"}
135 {else}
136 {assign var="count" value=`$count+1`}
137 {/if}
138 {/if}
139 {/foreach}
140 </tr>
141 </table>
142 {/strip}
143 </div>
144 <div class="clear"></div>
145 </div>{* end of main edit section div*}
146 {else}
147 <div id="editrow-{$n}" class="crm-section editrow_{$n}-section form-item">
148 <div class="label">
149 {$form.$n.label}
150 </div>
151 <div class="edit-value content">
152 {if $n|substr:0:3 eq 'im-'}
153 {assign var="provider" value=$n|cat:"-provider_id"}
154 {$form.$provider.html}&nbsp;
155 {/if}
156 {if $n eq 'email_greeting' or $n eq 'postal_greeting' or $n eq 'addressee'}
157 {include file="CRM/Profile/Form/GreetingType.tpl"}
158 {elseif ( $n eq 'group' && $form.group ) || ( $n eq 'tag' && $form.tag )}
159 {include file="CRM/Contact/Form/Edit/TagsAndGroups.tpl" type=$n context="profile" tableLayout=1}
160 {elseif ( $form.$n.name eq 'image_URL' )}
161 {$form.$n.html}
162 {if !empty($imageURL)}
163 <div class="crm-section contact_image-section">
164 <div class="content">
165 {include file="CRM/Contact/Page/ContactImage.tpl"}
166 </div>
167 </div>
168 {/if}
169 {elseif $n|substr:0:5 eq 'phone'}
170 {assign var="phone_ext_field" value=$n|replace:'phone':'phone_ext'}
171 {$form.$n.html}
172 {if $form.$phone_ext_field.html}
173 &nbsp;{$form.$phone_ext_field.html}
174 {/if}
175 {else}
176 {$form.$n.html}
177 {if $field.html_type eq 'Autocomplete-Select'}
178 {if $field.data_type eq 'ContactReference'}
179 {include file="CRM/Custom/Form/ContactReference.tpl" element_name = $n}
180 {/if}
181 {/if}
182 {/if}
183 </div>
184 <div class="clear"></div>
185 </div>
186
187 {if $form.$n.type eq 'file'}
188 <div class="crm-section file_displayURL-section file_displayURL{$n}-section"><div class="content">{$customFiles.$n.displayURL}</div></div>
189 <div class="crm-section file_deleteURL-section file_deleteURL{$n}-section"><div class="content">{$customFiles.$n.deleteURL}</div></div>
190 {/if}
191 {/if}
192
193 {* Show explanatory text for field if not in 'view' mode *}
194 {if $field.help_post && $action neq 4 && $form.$n.html}
195 <div class="crm-section helprow-{$n}-section helprow-post" id="helprow-{$n}">
196 <div class="content description">{$field.help_post}</div>
197 </div>
198 {/if}
199 {/if}{* end of main if field name if *}
200 {/foreach}
201
202 {if $isCaptcha && ( $mode eq 8 || $mode eq 4 || $mode eq 1 ) }
203 {include file='CRM/common/ReCAPTCHA.tpl'}
204 <script type="text/javascript">cj('.recaptcha_label').attr('width', '140px');</script>
205 {/if}
206
207 {if $field.groupHelpPost}
208 <div class="messages help">{$field.groupHelpPost}</div>
209 {/if}
210
211 {if $mode neq 8 && $mode neq 4}
212 </fieldset>
213 </div>
214 {/if}
215
216 {if ($action eq 1 and $mode eq 4 ) or ($action eq 2) or ($action eq 8192)}
217 {if $action eq 2 and $multiRecordFieldListing}
218 {include file="CRM/Profile/Page/MultipleRecordFieldsListing.tpl" showListing=true}
219 {assign var=floatStyle value='float:right'}
220 {/if}
221 <div class="crm-submit-buttons" style='{$floatStyle}'>
222 {include file="CRM/common/formButtons.tpl"}{if $isDuplicate}<span class="crm-button">{$form._qf_Edit_upload_duplicate.html}</span>{/if}
223 {if $includeCancelButton}
224 <a class="button cancel" href="{$cancelURL}">
225 <span>
226 <i class="crm-i fa-times"></i>
227 {$cancelButtonText}
228 </span>
229 </a>
230 {/if}
231 </div>
232 {/if}
233 {if $help_post && $action neq 4}<br /><div class="messages help">{$help_post}</div>{/if}
234 {/strip}
235
236 </div> {* end crm-container div *}
237
238 <script type="text/javascript">
239 {if $drupalCms}
240 {literal}
241 if ( document.getElementsByName("cms_create_account")[0].checked ) {
242 cj('#details').show();
243 }
244 else {
245 cj('#details').hide();
246 }
247 {/literal}
248 {/if}
249 </script>
250 {/if} {* fields array is not empty *}
251 {if $multiRecordFieldListing and empty($fields)}
252 {include file="CRM/Profile/Page/MultipleRecordFieldsListing.tpl" showListing=true}
253 {/if}
254 {if $drupalCms}
255 {include file="CRM/common/showHideByFieldValue.tpl"
256 trigger_field_id ="create_account"
257 trigger_value =""
258 target_element_id ="details"
259 target_element_type ="block"
260 field_type ="radio"
261 invert = 0
262 }
263 {elseif $statusMessage}
264 <div class="messages status no-popup">
265 <div class="icon inform-icon"></div>
266 {$statusMessage}
267 </div>
268 {/if}
269 {/if} {*end of if for $deleteRecord*}
270 {literal}
271 <script type="text/javascript">
272
273 CRM.$(function($) {
274 cj('#selector tr:even').addClass('odd-row ');
275 cj('#selector tr:odd ').addClass('even-row');
276 });
277 {/literal}
278 </script>
279
280 {/crmRegion}
281 </div> {* end crm-profile-NAME *}