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