Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | {* |
2 | +--------------------------------------------------------------------+ | |
3 | | CiviCRM version 4.3 | | |
4 | +--------------------------------------------------------------------+ | |
5 | | Copyright CiviCRM LLC (c) 2004-2013 | | |
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 | {capture assign=infoTitle}{ts}Preview Mode{/ts}{/capture} | |
27 | {assign var="infoType" value="info"} | |
28 | {if $previewField} | |
29 | {capture assign=infoMessage}<strong>{ts}Profile Field Preview{/ts}</strong>{/capture} | |
30 | {else} | |
31 | {capture assign=infoMessage}<strong>{ts}Profile Preview{/ts}</strong>{/capture} | |
32 | {/if} | |
33 | {include file="CRM/common/info.tpl"} | |
34 | <div class="crm-form-block"> | |
35 | ||
36 | {if ! empty( $fields )} | |
37 | {if $viewOnly} | |
38 | {* wrap in crm-container div so crm styles are used *} | |
39 | <div id="crm-container-inner" lang="{$config->lcMessages|truncate:2:"":true}" xml:lang="{$config->lcMessages|truncate:2:"":true}"> | |
40 | {include file="CRM/common/CMSUser.tpl"} | |
41 | {strip} | |
42 | {if $help_pre && $action neq 4}<div class="messages help">{$help_pre}</div>{/if} | |
43 | {assign var=zeroField value="Initial Non Existent Fieldset"} | |
44 | {assign var=fieldset value=$zeroField} | |
45 | {foreach from=$fields item=field key=fieldName} | |
46 | {if $field.skipDisplay} | |
47 | {continue} | |
48 | {/if} | |
49 | {if $field.field_type eq "Formatting"} | |
50 | {$field.help_pre} | |
51 | {continue} | |
52 | {/if} | |
53 | {if $field.groupTitle != $fieldset} | |
54 | {if $fieldset != $zeroField} | |
55 | </table> | |
56 | {if $groupHelpPost} | |
57 | <div class="messages help">{$groupHelpPost}</div> | |
58 | {/if} | |
59 | {if $mode ne 8} | |
60 | </fieldset> | |
61 | {/if} | |
62 | {/if} | |
63 | {if $mode ne 8} | |
64 | <h3>{$field.groupTitle}</h3> | |
65 | {/if} | |
66 | {assign var=fieldset value=`$field.groupTitle`} | |
67 | {assign var=groupHelpPost value=`$field.groupHelpPost`} | |
68 | {if $field.groupHelpPre} | |
69 | <div class="messages help">{$field.groupHelpPre}</div> | |
70 | {/if} | |
71 | <table class="form-layout-compressed" id="table-1"> | |
72 | {/if} | |
73 | {* Show explanatory text for field if not in 'view' mode *} | |
74 | {if $field.help_pre && $action neq 4} | |
75 | <tr><td> </td><td class="description">{$field.help_pre}</td></tr> | |
76 | {/if} | |
77 | {assign var=n value=$field.name} | |
78 | {if $field.options_per_line } | |
79 | <tr> | |
80 | <td class="option-label">{$form.$n.label}</td> | |
81 | <td> | |
82 | {assign var="count" value="1"} | |
83 | {strip} | |
84 | <table class="form-layout-compressed"> | |
85 | <tr> | |
86 | {* sort by fails for option per line. Added a variable to iterate through the element array*} | |
87 | {assign var="index" value="1"} | |
88 | {foreach name=outer key=key item=item from=$form.$n} | |
89 | {if $index < 10} | |
90 | {assign var="index" value=`$index+1`} | |
91 | {else} | |
92 | <td class="labels font-light">{$form.$n.$key.html}</td> | |
93 | {if $count == $field.options_per_line} | |
94 | </tr> | |
95 | {assign var="count" value="1"} | |
96 | {else} | |
97 | {assign var="count" value=`$count+1`} | |
98 | {/if} | |
99 | {/if} | |
100 | {/foreach} | |
101 | </table> | |
102 | {if $field.html_type eq 'Radio' and $form.formName eq 'Preview'} | |
103 | <span class="crm-clear-link">(<a href="#" title="unselect" onclick="unselectRadio('{$n}', '{$form.formName}'); return false;">{ts}clear{/ts}</a>)</span> | |
104 | {/if} | |
105 | {/strip} | |
106 | </td> | |
107 | </tr> | |
108 | {else} | |
109 | <tr> | |
110 | <td class="label"> | |
111 | {$form.$n.label} | |
112 | </td> | |
113 | <td> | |
114 | {if $n eq 'group' && $form.group || ( $n eq 'tag' && $form.tag )} | |
115 | {include file="CRM/Contact/Form/Edit/TagsAndGroups.tpl" type=$n} | |
116 | {elseif $n eq 'email_greeting' or $n eq 'postal_greeting' or $n eq 'addressee'} | |
117 | {include file="CRM/Profile/Form/GreetingType.tpl"} | |
118 | {elseif ( $field.data_type eq 'Date' AND $element.skip_calendar NEQ true ) or | |
119 | ( $n|substr:-5:5 eq '_date' ) or ( $field.name eq 'activity_date_time' ) } | |
120 | {include file="CRM/common/jcalendar.tpl" elementName=$form.$n.name} | |
121 | {elseif $n|substr:0:5 eq 'phone'} | |
122 | {assign var="phone_ext_field" value=$n|replace:'phone':'phone_ext'} | |
123 | {$form.$n.html} | |
124 | {if $form.$phone_ext_field.html} | |
125 | {$form.$phone_ext_field.html} | |
126 | {/if} | |
127 | {else} | |
128 | {if $n|substr:0:4 eq 'url-'} | |
129 | {assign var="websiteType" value=$n|cat:"-website_type_id"} | |
130 | {$form.$websiteType.html} | |
131 | {elseif $n|substr:0:3 eq 'im-'} | |
132 | {assign var="provider" value=$n|cat:"-provider_id"} | |
133 | {$form.$provider.html} | |
134 | {/if} | |
135 | {$form.$n.html} | |
136 | {if $field.is_view eq 0} | |
137 | {if ( $field.html_type eq 'Radio' or $n eq 'gender') and $form.formName eq 'Preview'} | |
138 | <span class="crm-clear-link">(<a href="#" title="unselect" onclick="unselectRadio('{$n}', '{$form.formName}'); return false;">{ts}clear{/ts}</a>)</span> | |
139 | {elseif $field.html_type eq 'Autocomplete-Select'} | |
140 | {if $field.data_type eq 'ContactReference'} | |
141 | {include file="CRM/Custom/Form/ContactReference.tpl" element_name = $n} | |
142 | {else} | |
143 | {include file="CRM/Custom/Form/AutoComplete.tpl" element_name = $n} | |
144 | {/if} | |
145 | {/if} | |
146 | {/if} | |
147 | {/if} | |
148 | </td> | |
149 | </tr> | |
150 | {/if} | |
151 | {* Show explanatory text for field if not in 'view' mode *} | |
152 | {if $field.help_post && $action neq 4} | |
153 | <tr><td> </td><td class="description">{$field.help_post}</td></tr> | |
154 | {/if} | |
155 | {/foreach} | |
156 | ||
157 | {if $addCAPTCHA } | |
158 | {include file='CRM/common/ReCAPTCHA.tpl'} | |
159 | {/if} | |
160 | </table> | |
161 | {if $field.groupHelpPost} | |
162 | <div class="messages help">{$field.groupHelpPost}</div> | |
163 | {/if} | |
164 | {/strip} | |
165 | </div> {* end crm-container div *} | |
166 | {else} | |
167 | {capture assign=infoMessage}{ts}This CiviCRM profile field is view only.{/ts}{/capture} | |
168 | {include file="CRM/common/info.tpl"} | |
169 | {/if} | |
170 | {/if} {* fields array is not empty *} | |
171 | ||
172 | <div class="crm-submit-buttons"> | |
173 | {include file="CRM/common/formButtons.tpl"} | |
174 | </div> | |
175 | </div> |