CRM-12595 fix formatting in templates files (B)
[civicrm-core.git] / templates / CRM / Campaign / Form / Petition / Block.tpl
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 {* 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.groupTitle != $fieldset}
34 {if $fieldset != $zeroField}
35 {if $groupHelpPost && $action neq 4}
36 <div class="messages help">{$groupHelpPost}</div>
37 {/if}
38 {if $mode ne 8}
39 </fieldset>
40 {/if}
41 {/if}
42
43
44 {assign var=fieldset value=`$field.groupTitle`}
45 {assign var=groupHelpPost value=`$field.groupHelpPost`}
46 {if $field.groupHelpPre && $action neq 4 && $action neq 1028}
47 <div class="messages help">{$field.groupHelpPre}</div>
48 {/if}
49 {/if}
50
51 {assign var=n value=$field.name}
52
53 {if $field.options_per_line != 0}
54 <div class="crm-section {$form.$n.id}-section">
55 {* Show explanatory text for field if not in 'view' or 'preview' modes *}
56 {if $field.help_pre && $action neq 4 && $action neq 1028}
57 &nbsp;&nbsp;<span class="description">{$field.help_pre}</span>
58 {/if}
59 <div class="label option-label">{$form.$n.label}</div>
60 <div class="content 3">
61 {assign var="count" value="1"}
62 {strip}
63 <table class="form-layout-compressed">
64 <tr>
65 {* sort by fails for option per line. Added a variable to iterate through the element array*}
66 {assign var="index" value="1"}
67 {foreach name=outer key=key item=item from=$form.$n}
68 {if $index < 10}
69 {assign var="index" value=`$index+1`}
70 {else}
71 <td class="labels font-light">{$form.$n.$key.html}</td>
72 {if $count == $field.options_per_line}
73 </tr>
74 <tr>
75 {assign var="count" value="1"}
76 {else}
77 {assign var="count" value=`$count+1`}
78 {/if}
79 {/if}
80 {/foreach}
81 </tr>
82 </table>
83 {/strip}
84 {* Show explanatory text for field if not in 'view' or 'preview' modes *}
85 {if $field.help_post && $action neq 4 && $action neq 1028}
86 <span class="description">{$field.help_post}</span>
87 {/if}
88 </div>
89 <div class="clear"></div>
90 </div>
91 {else}
92 <div class="crm-section {$form.$n.id}-section">
93 {* Show explanatory text for field if not in 'view' or 'preview' modes *}
94 {if $field.help_pre && $action neq 4 && $action neq 1028}
95 &nbsp;&nbsp;<span class="description">{$field.help_pre}</span>
96 {/if}
97 <div class="label">{$form.$n.label}</div>
98 <div class="content">
99 {if $n|substr:0:3 eq 'im-'}
100 {assign var="provider" value=$n|cat:"-provider_id"}
101 {$form.$provider.html}&nbsp;
102 {/if}
103 {if $n eq 'email_greeting' or $n eq 'postal_greeting' or $n eq 'addressee'}
104 {include file="CRM/Profile/Form/GreetingType.tpl"}
105 {elseif $n eq 'group'}
106 <table id="selector" class="selector" style="width:auto;">
107 <tr><td>{$form.$n.html}{* quickform add closing </td> </tr>*}
108 </table>
109 {elseif ( $field.data_type eq 'Date' or
110 ( ( ( $n eq 'birth_date' ) or ( $n eq 'deceased_date' ) ) ) ) }
111 {include file="CRM/common/jcalendar.tpl" elementName=$n}
112 {else}
113 {$form.$n.html}
114 {if $n eq 'gender' && $form.$fieldName.frozen neq true}
115 <span class="crm-clear-link">(<a href="#" title="unselect" onclick="unselectRadio('{$n}', '{$form.formName}');return false;">{ts}clear{/ts}</a>)</span>
116 {/if}
117 {/if}
118 {*CRM-4564*}
119 {if $field.html_type eq 'Radio' && $form.$fieldName.frozen neq true && $field.is_required neq 1}
120 <span style="line-height: .75em; margin-top: 1px;">
121 <span class="crm-clear-link">(<a href="#" title="unselect" onclick="unselectRadio('{$n}', '{$form.formName}');return false;">{ts}clear{/ts}</a>)</span>
122 </span>
123 {elseif $field.html_type eq 'Autocomplete-Select'}
124 {if $field.data_type eq 'ContactReference'}
125 {include file="CRM/Custom/Form/ContactReference.tpl" element_name = $n}
126 {else}
127 {include file="CRM/Custom/Form/AutoComplete.tpl" element_name = $n}
128 {/if}
129 {/if}
130 {* Show explanatory text for field if not in 'view' or 'preview' modes *}
131 {if $field.help_post && $action neq 4 && $action neq 1028}
132 <br /><span class="description">{$field.help_post}</span>
133 {/if}
134 </div>
135 <div class="clear"></div>
136 </div>
137 {/if}
138 {/foreach}
139
140 {if $field.groupHelpPost && $action neq 4 && $action neq 1028}
141 <div class="messages help">{$field.groupHelpPost}</div>
142 {/if}
143
144 {if $mode eq 4}
145 <div class="crm-submit-buttons">
146 {$form.buttons.html}
147 </div>
148 {/if}
149
150
151 {if $help_post && $action neq 4}<br /><div class="messages help">{$help_post}</div>{/if}
152 {/strip}
153
154 {/if} {* fields array is not empty *}
155
156 {literal}
157 <script type="text/javascript">
158
159 cj(document).ready(function(){
160 cj('#selector tr:even').addClass('odd-row ');
161 cj('#selector tr:odd ').addClass('even-row');
162 });
163
164 </script>
165 {/literal}