Merge pull request #1632 from totten/master-ufgroup-upgrade-error
[civicrm-core.git] / templates / CRM / UF / Form / Block.tpl
CommitLineData
6a488035
TO
1{*
2 +--------------------------------------------------------------------+
232624b1 3 | CiviCRM version 4.4 |
6a488035
TO
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{* Edit or display Profile fields, when embedded in an online contribution or event registration form. *}
27{if ! empty( $fields )}
28 {strip}
29 {if $help_pre && $action neq 4}<div class="messages help">{$help_pre}</div>{/if}
30 {assign var=zeroField value="Initial Non Existent Fieldset"}
31 {assign var=fieldset value=$zeroField}
32 {foreach from=$fields item=field key=fieldName}
33 {if $field.skipDisplay}
34 {continue}
35 {/if}
36 {if $field.groupTitle != $fieldset}
37 {if $fieldset != $zeroField}
38 {if $groupHelpPost && $action neq 4}
39 <div class="messages help">{$groupHelpPost}</div>
40 {/if}
41 {if $mode ne 8}
42 </fieldset>
43 {/if}
44 {/if}
45
46 {if $mode ne 8 && $action ne 1028 && $action ne 4}
4a1143a1 47 <fieldset class="crm-profile crm-profile-id-{$field.group_id} crm-profile-name-{$field.groupName}"><legend>{$field.groupTitle}</legend>
6a488035
TO
48 {/if}
49
50 {if $form.formName eq 'Confirm' OR $form.formName eq 'ThankYou'}
51 <div class="header-dark">{$field.groupTitle} </div>
52 {/if}
53 {assign var=fieldset value=`$field.groupTitle`}
54 {assign var=groupHelpPost value=`$field.groupHelpPost`}
55 {if $field.groupHelpPre && $action neq 4 && $action neq 1028}
56 <div class="messages help">{$field.groupHelpPre}</div>
57 {/if}
58 {/if}
59
60 {assign var=n value=$field.name}
61
62 {if $field.field_type eq "Formatting"}
63 {if $action neq 4 && $action neq 1028}
64 {$field.help_pre}
65 {/if}
66 {elseif $field.options_per_line != 0}
67 <div class="crm-section {$n}-section">
68 {* Show explanatory text for field if not in 'view' or 'preview' modes *}
69 {if $field.help_pre && $action neq 4 && $action neq 1028}
70 &nbsp;&nbsp;<span class="description">{$field.help_pre}</span>
71 {/if}
72 <div class="label option-label">{$form.$n.label}</div>
73 <div class="content 3">
74 {assign var="count" value="1"}
75 {strip}
76 <table class="form-layout-compressed">
77 <tr>
78 {* sort by fails for option per line. Added a variable to iterate through the element array*}
79 {assign var="index" value="1"}
80 {foreach name=outer key=key item=item from=$form.$n}
81 {if $index < 10}
82 {assign var="index" value=`$index+1`}
83 {else}
84 <td class="labels font-light">{$form.$n.$key.html}</td>
85 {if $count == $field.options_per_line}
86 </tr>
87 <tr>
88 {assign var="count" value="1"}
89 {else}
90 {assign var="count" value=`$count+1`}
91 {/if}
92 {/if}
93 {/foreach}
94 </tr>
95 </table>
96 {/strip}
97 {* Show explanatory text for field if not in 'view' or 'preview' modes *}
98 {if $field.help_post && $action neq 4 && $action neq 1028}
99 <span class="description">{$field.help_post}</span>
100 {/if}
101 </div>
102 <div class="clear"></div>
103 </div>
104 {else}
105 <div class="crm-section {$n}-section">
106 {* Show explanatory text for field if not in 'view' or 'preview' modes *}
107 {if $field.help_pre && $action neq 4 && $action neq 1028}
108 &nbsp;&nbsp;<span class="description">{$field.help_pre}</span>
109 {/if}
110 <div class="label">
111 {$form.$n.label}
112 </div>
113 <div class="content">
114 {if $n|substr:0:3 eq 'im-'}
115 {assign var="provider" value=$n|cat:"-provider_id"}
116 {$form.$provider.html}&nbsp;
117 {elseif $n|substr:0:4 eq 'url-'}
118 {assign var="websiteType" value=$n|cat:"-website_type_id"}
119 {$form.$websiteType.html}&nbsp;
120 {/if}
121
122 {if $n eq 'email_greeting' or $n eq 'postal_greeting' or $n eq 'addressee'}
123 {include file="CRM/Profile/Form/GreetingType.tpl"}
124 {elseif ($n eq 'group' && $form.group) || ($n eq 'tag' && $form.tag)}
125 {include file="CRM/Contact/Form/Edit/TagsAndGroups.tpl" type=$n title=null context="profile"}
126 {elseif ( ( $field.data_type eq 'Date' ) or
127 ( $n|substr:-5:5 eq '_date' ) ) AND
128 ( $form.formName neq 'Confirm' ) AND
129 ( $form.formName neq 'ThankYou' ) }
130 {include file="CRM/common/jcalendar.tpl" elementName=$n}
131 {elseif $n|substr:0:5 eq 'phone'}
132 {assign var="phone_ext_field" value=$n|replace:'phone':'phone_ext'}
133 {$form.$n.html}
134 {if $form.$phone_ext_field.html}
135 &nbsp;{$form.$phone_ext_field.html}
136 {/if}
137 {else}
138 {$form.$n.html}
139 {if $n eq 'gender' && $form.$fieldName.frozen neq true}
140 <span class="crm-clear-link">(<a href="#" title="unselect" onclick="unselectRadio('{$n}', '{$form.formName}');return false;">{ts}clear{/ts}</a>)</span>
141 {/if}
142 {/if}
143
144 {*CRM-4564*}
145 {if $field.html_type eq 'Radio' && $form.$fieldName.frozen neq true && $field.is_required neq 1}
146 <span style="line-height: .75em; margin-top: 1px;">
147 <span class="crm-clear-link">(<a href="#" title="unselect" onclick="unselectRadio('{$n}', '{$form.formName}');return false;">{ts}clear{/ts}</a>)</span>
148 </span>
149 {elseif $field.html_type eq 'Autocomplete-Select'}
150 {if $field.data_type eq 'ContactReference'}
151 {include file="CRM/Custom/Form/ContactReference.tpl" element_name = $n}
152 {else}
153 {include file="CRM/Custom/Form/AutoComplete.tpl" element_name = $n}
154 {/if}
155 {/if}
156
157 {* Show explanatory text for field if not in 'view' or 'preview' modes *}
158 {if $field.help_post && $action neq 4 && $action neq 1028}
159 <br /><span class="description">{$field.help_post}</span>
160 {/if}
161 </div>
162 <div class="clear"></div>
163 </div>
164 {/if}
165 {/foreach}
166
167 {if $field.groupHelpPost && $action neq 4 && $action neq 1028}
168 <div class="messages help">{$field.groupHelpPost}</div>
169 {/if}
170
171 {if $mode eq 4}
172 <div class="crm-submit-buttons">
173 {$form.buttons.html}
174 </div>
175 {/if}
176
177 {if $mode ne 8 && $action neq 1028}
178 </fieldset>
179 {/if}
180
181 {if $help_post && $action neq 4}<br /><div class="messages help">{$help_post}</div>{/if}
182 {/strip}
183
184{/if} {* fields array is not empty *}
185
186{literal}
187<script type="text/javascript">
188 cj(function(){
189 cj('#selector tr:even').addClass('odd-row ');
190 cj('#selector tr:odd ').addClass('even-row');
191 });
192</script>
232624b1 193{/literal}