Merge pull request #3746 from eileenmcnaughton/prtest
[civicrm-core.git] / templates / CRM / Profile / Form / Dynamic.tpl
1 {*
2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.5 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2014 |
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 <span class="crm-button">{$form._qf_Edit_upload_delete.html}</span>
37 <div class="crm-submit-buttons" style='display:inline'>{include file="CRM/common/formButtons.tpl"}</div>
38 {else}
39 {if ! empty( $fields )}
40 {* Wrap in crm-container div so crm styles are used.*}
41 {* 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" *}
42
43 {if $action eq 1 or $action eq 2 or $action eq 4 }
44 <div id="crm-profile-block" class="crm-container-snippet crm-public">
45 {else}
46 <div id="crm-container" class="crm-container crm-public" lang="{$config->lcMessages|truncate:2:"":true}" xml:lang="{$config->lcMessages|truncate:2:"":true}">
47 {/if}
48
49 {if $isDuplicate and ( ($action eq 1 and $mode eq 4 ) or ($action eq 2) or ($action eq 8192) ) }
50 <div class="crm-submit-buttons">
51 <span class="crm-button">{$form._qf_Edit_upload_duplicate.html}</span>
52 </div>
53 {/if}
54 {if $mode eq 1 || $activeComponent neq "CiviCRM"}
55 {include file="CRM/Form/body.tpl"}
56 {/if}
57 {strip}
58 {if $help_pre && $action neq 4}
59 <div class="messages help">{$help_pre}</div>
60 {/if}
61
62 {include file="CRM/common/CMSUser.tpl"}
63
64 {if $action eq 2 and $multiRecordFieldListing}
65 <h1>{ts}Edit Details{/ts}</h1>
66 <div class="crm-submit-buttons" style='float:right'>
67 {include file="CRM/common/formButtons.tpl"}{if $isDuplicate}<span class="crm-button">{$form._qf_Edit_upload_duplicate.html}</span>{/if}
68 </div>
69 {/if}
70
71 {assign var=zeroField value="Initial Non Existent Fieldset"}
72 {assign var=fieldset value=$zeroField}
73 {foreach from=$fields item=field key=fieldName}
74 {if $field.skipDisplay}
75 {continue}
76 {/if}
77 {assign var="profileID" value=$field.group_id}
78 {assign var=n value=$field.name}
79 {if $field.groupTitle != $fieldset}
80 {if $mode neq 8 && $mode neq 4}
81 <div {if $context neq 'dialog'}id="profilewrap{$field.group_id}"{/if}>
82 <fieldset><legend>{$field.groupTitle}</legend>
83 {/if}
84 {assign var=fieldset value=`$field.groupTitle`}
85 {assign var=groupHelpPost value=`$field.groupHelpPost`}
86 {if $field.groupHelpPre}
87 <div class="messages help">{$field.groupHelpPre}</div>
88 {/if}
89 {/if}
90 {if $field.field_type eq "Formatting"}
91 {$field.help_pre}
92 {elseif $n}
93 {if $field.groupTitle != $fieldset}
94 {if $fieldset != $zeroField}
95 {if $groupHelpPost}
96 <div class="messages help">{$groupHelpPost}</div>
97 {/if}
98 {if $mode neq 8 && $mode neq 4}
99 </div><!-- end form-layout-compressed-div -->
100 </fieldset>
101 </div>
102 {/if}
103 {/if}
104 <div class="form-layout-compressed">
105 {/if}
106 {if $field.help_pre && $action neq 4 && $form.$n.html}
107 <div class="crm-section helprow-{$n}-section" id="helprow-{$n}">
108 <div class="content description">{$field.help_pre}</div>
109 </div>
110 {/if}
111 {if $field.options_per_line}
112 <div class="crm-section editrow_{$n}-section form-item" id="editrow-{$n}">
113 <div class="label">{$form.$n.label}</div>
114 <div class="content edit-value">
115 {assign var="count" value="1"}
116 {strip}
117 <table class="form-layout-compressed">
118 <tr>
119 {* sort by fails for option per line. Added a variable to iterate through the element array*}
120 {assign var="index" value="1"}
121 {foreach name=outer key=key item=item from=$form.$n}
122 {if $index < 10}
123 {assign var="index" value=`$index+1`}
124 {else}
125 <td class="labels font-light">{$form.$n.$key.html}</td>
126 {if $count == $field.options_per_line}
127 </tr>
128 <tr>
129 {assign var="count" value="1"}
130 {else}
131 {assign var="count" value=`$count+1`}
132 {/if}
133 {/if}
134 {/foreach}
135 </tr>
136 </table>
137 {/strip}
138 </div>
139 <div class="clear"></div>
140 </div>{* end of main edit section div*}
141 {else}
142 <div id="editrow-{$n}" class="crm-section editrow_{$n}-section form-item">
143 <div class="label">
144 {$form.$n.label}
145 </div>
146 <div class="edit-value content">
147 {if $n|substr:0:3 eq 'im-'}
148 {assign var="provider" value=$n|cat:"-provider_id"}
149 {$form.$provider.html}&nbsp;
150 {elseif $n|substr:0:4 eq 'url-'}
151 {assign var="websiteType" value=$n|cat:"-website_type_id"}
152 {$form.$websiteType.html}&nbsp;
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}
180 {if $field.html_type eq 'Autocomplete-Select'}
181 {if $field.data_type eq 'ContactReference'}
182 {include file="CRM/Custom/Form/ContactReference.tpl" element_name = $n}
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}
204
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}
221 {include file="CRM/Profile/Page/MultipleRecordFieldsListing.tpl" showListing=true}
222 {assign var=floatStyle value='float:right'}
223 {/if}
224 <div class="crm-submit-buttons" style='{$floatStyle}'>
225 {include file="CRM/common/formButtons.tpl"}{if $isDuplicate}<span class="crm-button">{$form._qf_Edit_upload_duplicate.html}</span>{/if}
226 </div>
227 {/if}
228 {if $help_post && $action neq 4}<br /><div class="messages help">{$help_post}</div>{/if}
229 {/strip}
230
231 </div> {* end crm-container div *}
232
233 <script type="text/javascript">
234 {if $drupalCms}
235 {literal}
236 if ( document.getElementsByName("cms_create_account")[0].checked ) {
237 cj('#details').show();
238 }
239 else {
240 cj('#details').hide();
241 }
242 {/literal}
243 {/if}
244 </script>
245 {/if} {* fields array is not empty *}
246 {if $multiRecordFieldListing and empty($fields)}
247 {include file="CRM/Profile/Page/MultipleRecordFieldsListing.tpl" showListing=true}
248 {/if}
249 {if $drupalCms}
250 {include file="CRM/common/showHideByFieldValue.tpl"
251 trigger_field_id ="create_account"
252 trigger_value =""
253 target_element_id ="details"
254 target_element_type ="block"
255 field_type ="radio"
256 invert = 0
257 }
258 {elseif $statusMessage}
259 <div class="messages status no-popup">
260 <div class="icon inform-icon"></div>
261 {$statusMessage}
262 </div>
263 {/if}
264 {/if} {*end of if for $deleteRecord*}
265 {literal}
266 <script type="text/javascript">
267
268 CRM.$(function($) {
269 cj('#selector tr:even').addClass('odd-row ');
270 cj('#selector tr:odd ').addClass('even-row');
271 });
272 {/literal}
273 </script>
274
275 {/crmRegion}
276 </div> {* end crm-profile-NAME *}