Update version numbers to 4.4 and lint php
[civicrm-core.git] / templates / CRM / Contribute / Form / Contribution / Main.tpl
1 {*
2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.4 |
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
27 {* Callback snippet: Load payment processor *}
28 {if $snippet}
29 {include file="CRM/Core/BillingBlock.tpl" context="front-end"}
30 {if $is_monetary}
31 {* Put PayPal Express button after customPost block since it's the submit button in this case. *}
32 {if $paymentProcessor.payment_processor_type EQ 'PayPal_Express'}
33 <div id="paypalExpress">
34 {assign var=expressButtonName value='_qf_Main_upload_express'}
35 <fieldset class="crm-group paypal_checkout-group">
36 <legend>{ts}Checkout with PayPal{/ts}</legend>
37 <div class="section">
38 <div class="crm-section paypalButtonInfo-section">
39 <div class="content">
40 <span class="description">{ts}Click the PayPal button to continue.{/ts}</span>
41 </div>
42 <div class="clear"></div>
43 </div>
44 <div class="crm-section {$expressButtonName}-section">
45 <div class="content">
46 {$form.$expressButtonName.html} <span class="description">Checkout securely. Pay without sharing your financial information. </span>
47 </div>
48 <div class="clear"></div>
49 </div>
50 </div>
51 </fieldset>
52 </div>
53 {/if}
54 {/if}
55
56 {* Main Form *}
57 {else}
58 {literal}
59 <script type="text/javascript">
60
61 // Putting these functions directly in template so they are available for standalone forms
62 function useAmountOther() {
63 var priceset = {/literal}{if $contriPriceset}'{$contriPriceset}'{else}0{/if}{literal};
64
65 for( i=0; i < document.Main.elements.length; i++ ) {
66 element = document.Main.elements[i];
67 if ( element.type == 'radio' && element.name == priceset ) {
68 if (element.value == '0' ) {
69 element.click();
70 }
71 else {
72 element.checked = false;
73 }
74 }
75 }
76 }
77
78 function clearAmountOther() {
79 var priceset = {/literal}{if $priceset}'#{$priceset}'{else}0{/if}{literal}
80 if( priceset ){
81 cj(priceset).val('');
82 cj(priceset).blur();
83 }
84 if (document.Main.amount_other == null) return; // other_amt field not present; do nothing
85 document.Main.amount_other.value = "";
86 }
87
88 </script>
89 {/literal}
90
91 {if $action & 1024}
92 {include file="CRM/Contribute/Form/Contribution/PreviewHeader.tpl"}
93 {/if}
94
95 {include file="CRM/common/TrackingFields.tpl"}
96
97 {capture assign='reqMark'}<span class="marker" title="{ts}This field is required.{/ts}">*</span>{/capture}
98 <div class="crm-contribution-page-id-{$contributionPageID} crm-block crm-contribution-main-form-block">
99 <div id="intro_text" class="crm-section intro_text-section">
100 {$intro_text}
101 </div>
102 {if $islifetime or $ispricelifetime }
103 <div id="help">{ts}You have a current Lifetime Membership which does not need to be renewed.{/ts}</div>
104 {/if}
105
106 {if !empty($useForMember)}
107 {include file="CRM/Contribute/Form/Contribution/MembershipBlock.tpl" context="makeContribution"}
108 {else}
109 <div id="priceset-div">
110 {include file="CRM/Price/Form/PriceSet.tpl" extends="Contribution"}
111 </div>
112 {/if}
113
114 {if $pledgeBlock}
115 {if $is_pledge_payment}
116 <div class="crm-section {$form.pledge_amount.name}-section">
117 <div class="label">{$form.pledge_amount.label}&nbsp;<span class="marker">*</span></div>
118 <div class="content">{$form.pledge_amount.html}</div>
119 <div class="clear"></div>
120 </div>
121 {else}
122 <div class="crm-section {$form.is_pledge.name}-section">
123 <div class="label">&nbsp;</div>
124 <div class="content">
125 {$form.is_pledge.html}&nbsp;
126 {if $is_pledge_interval}
127 {$form.pledge_frequency_interval.html}&nbsp;
128 {/if}
129 {$form.pledge_frequency_unit.html}<span id="pledge_installments_num">&nbsp;{ts}for{/ts}&nbsp;{$form.pledge_installments.html}&nbsp;{ts}installments.{/ts}</span>
130 </div>
131 <div class="clear"></div>
132 </div>
133 {/if}
134 {/if}
135
136 {if $form.is_recur}
137 <div class="crm-section {$form.is_recur.name}-section">
138 <div class="label">&nbsp;</div>
139 <div class="content">
140 {$form.is_recur.html} {$form.is_recur.label} {ts}every{/ts}
141 {if $is_recur_interval}
142 {$form.frequency_interval.html}
143 {/if}
144 {if $one_frequency_unit}
145 {$frequency_unit}
146 {else}
147 {$form.frequency_unit.html}
148 {/if}
149 {if $is_recur_installments}
150 {ts}for{/ts} {$form.installments.html} {$form.installments.label}
151 {/if}
152 </div>
153 <div class="clear"></div>
154 </div>
155 {/if}
156 {if $pcpSupporterText}
157 <div class="crm-section pcpSupporterText-section">
158 <div class="label">&nbsp;</div>
159 <div class="content">{$pcpSupporterText}</div>
160 <div class="clear"></div>
161 </div>
162 {/if}
163 {assign var=n value=email-$bltID}
164 <div class="crm-section {$form.$n.name}-section">
165 <div class="label">{$form.$n.label}</div>
166 <div class="content">
167 {$form.$n.html}
168 </div>
169 <div class="clear"></div>
170 </div>
171
172 {if $form.is_for_organization}
173 <div class="crm-section {$form.is_for_organization.name}-section">
174 <div class="label">&nbsp;</div>
175 <div class="content">
176 {$form.is_for_organization.html}&nbsp;{$form.is_for_organization.label}
177 </div>
178 <div class="clear"></div>
179 </div>
180 {/if}
181
182 {if $is_for_organization}
183 <div id='onBehalfOfOrg' class="crm-section">
184 {include file=CRM/Contribute/Form/Contribution/OnBehalfOf.tpl}
185 </div>
186 {/if}
187
188 {* User account registration option. Displays if enabled for one of the profiles on this page. *}
189 {include file="CRM/common/CMSUser.tpl"}
190 {include file="CRM/Contribute/Form/Contribution/PremiumBlock.tpl" context="makeContribution"}
191
192 {if $honor_block_is_active}
193 <fieldset class="crm-group honor_block-group">
194 <legend>{$honor_block_title}</legend>
195 <div class="crm-section honor_block_text-section">
196 {$honor_block_text}
197 </div>
198 {if $form.honor_type_id.html}
199 <div class="crm-section {$form.honor_type_id.name}-section">
200 <div class="content" >
201 {$form.honor_type_id.html}
202 <span class="crm-clear-link">(<a href="#" title="unselect" onclick="unselectRadio('honor_type_id', '{$form.formName}');enableHonorType(); return false;">{ts}clear{/ts}</a>)</span>
203 <div class="description">{ts}Select an option to reveal honoree information fields.{/ts}</div>
204 </div>
205 </div>
206 {/if}
207 <div id="honorType" class="honoree-name-email-section">
208 <div class="crm-section {$form.honor_prefix_id.name}-section">
209 <div class="content">{$form.honor_prefix_id.html}</div>
210 </div>
211 <div class="crm-section {$form.honor_first_name.name}-section">
212 <div class="label">{$form.honor_first_name.label}</div>
213 <div class="content">
214 {$form.honor_first_name.html}
215 </div>
216 <div class="clear"></div>
217 </div>
218 <div class="crm-section {$form.honor_last_name.name}-section">
219 <div class="label">{$form.honor_last_name.label}</div>
220 <div class="content">
221 {$form.honor_last_name.html}
222 </div>
223 <div class="clear"></div>
224 </div>
225 <div id="honorTypeEmail" class="crm-section {$form.honor_email.name}-section">
226 <div class="label">{$form.honor_email.label}</div>
227 <div class="content">
228 {$form.honor_email.html}
229 </div>
230 <div class="clear"></div>
231 </div>
232 </div>
233 </fieldset>
234 {/if}
235
236 <div class="crm-group custom_pre_profile-group">
237 {include file="CRM/UF/Form/Block.tpl" fields=$customPre}
238 </div>
239
240 {if $pcp}
241 <fieldset class="crm-group pcp-group">
242 <div class="crm-section pcp-section">
243 <div class="crm-section display_in_roll-section">
244 <div class="content">
245 {$form.pcp_display_in_roll.html} &nbsp;
246 {$form.pcp_display_in_roll.label}
247 </div>
248 <div class="clear"></div>
249 </div>
250 <div id="nameID" class="crm-section is_anonymous-section">
251 <div class="content">
252 {$form.pcp_is_anonymous.html}
253 </div>
254 <div class="clear"></div>
255 </div>
256 <div id="nickID" class="crm-section pcp_roll_nickname-section">
257 <div class="label">{$form.pcp_roll_nickname.label}</div>
258 <div class="content">{$form.pcp_roll_nickname.html}
259 <div class="description">{ts}Enter the name you want listed with this contribution. You can use a nick name like 'The Jones Family' or 'Sarah and Sam'.{/ts}</div>
260 </div>
261 <div class="clear"></div>
262 </div>
263 <div id="personalNoteID" class="crm-section pcp_personal_note-section">
264 <div class="label">{$form.pcp_personal_note.label}</div>
265 <div class="content">
266 {$form.pcp_personal_note.html}
267 <div class="description">{ts}Enter a message to accompany this contribution.{/ts}</div>
268 </div>
269 <div class="clear"></div>
270 </div>
271 </div>
272 </fieldset>
273 {/if}
274
275 {if $form.payment_processor.label}
276 {* PP selection only works with JS enabled, so we hide it initially *}
277 <fieldset class="crm-group payment_options-group" style="display:none;">
278 <legend>{ts}Payment Options{/ts}</legend>
279 <div class="crm-section payment_processor-section">
280 <div class="label">{$form.payment_processor.label}</div>
281 <div class="content">{$form.payment_processor.html}</div>
282 <div class="clear"></div>
283 </div>
284 </fieldset>
285 {/if}
286
287 {if $is_pay_later}
288 <fieldset class="crm-group pay_later-group">
289 <legend>{ts}Payment Options{/ts}</legend>
290 <div class="crm-section pay_later_receipt-section">
291 <div class="label">&nbsp;</div>
292 <div class="content">
293 [x] {$pay_later_text}
294 </div>
295 <div class="clear"></div>
296 </div>
297 </fieldset>
298 {/if}
299
300 <div id="billing-payment-block">
301 {* If we have a payment processor, load it - otherwise it happens via ajax *}
302 {if $ppType}
303 {include file="CRM/Contribute/Form/Contribution/Main.tpl" snippet=4}
304 {/if}
305 </div>
306 {include file="CRM/common/paymentBlock.tpl"}
307
308 <div class="crm-group custom_post_profile-group">
309 {include file="CRM/UF/Form/Block.tpl" fields=$customPost}
310 </div>
311
312 {if $is_monetary and $form.bank_account_number}
313 <div id="payment_notice">
314 <fieldset class="crm-group payment_notice-group">
315 <legend>{ts}Agreement{/ts}</legend>
316 {ts}Your account data will be used to charge your bank account via direct debit. While submitting this form you agree to the charging of your bank account via direct debit.{/ts}
317 </fieldset>
318 </div>
319 {/if}
320
321 {if $isCaptcha}
322 {include file='CRM/common/ReCAPTCHA.tpl'}
323 {/if}
324 <div id="crm-submit-buttons" class="crm-submit-buttons">
325 {include file="CRM/common/formButtons.tpl" location="bottom"}
326 </div>
327 {if $footer_text}
328 <div id="footer_text" class="crm-section contribution_footer_text-section">
329 <p>{$footer_text}</p>
330 </div>
331 {/if}
332 </div>
333
334 <script type="text/javascript">
335 {if $pcp}
336 pcpAnonymous();
337 {/if}
338
339 {literal}
340 if ({/literal}"{$form.is_recur}"{literal}) {
341 if (document.getElementsByName("is_recur")[0].checked == true) {
342 window.onload = function() {
343 enablePeriod();
344 }
345 }
346 }
347
348 function enablePeriod ( ) {
349 var frqInt = {/literal}"{$form.frequency_interval}"{literal};
350 if ( document.getElementsByName("is_recur")[0].checked == true ) {
351 //get back to auto renew settings.
352 var allowAutoRenew = {/literal}'{$allowAutoRenewMembership}'{literal};
353 if ( allowAutoRenew && cj("#auto_renew") ) {
354 showHideAutoRenew( null );
355 }
356 }
357 else {
358 //disabled auto renew settings.
359 var allowAutoRenew = {/literal}'{$allowAutoRenewMembership}'{literal};
360 if ( allowAutoRenew && cj("#auto_renew") ) {
361 cj("#auto_renew").attr( 'checked', false );
362 cj('#allow_auto_renew').hide( );
363 }
364 }
365 }
366
367 {/literal}
368 {if $relatedOrganizationFound and $reset}
369 cj( "#is_for_organization" ).attr( 'checked', true );
370 showOnBehalf(false);
371 {elseif $onBehalfRequired}
372 showOnBehalf(true);
373 {/if}
374
375 {if $honor_block_is_active AND $form.honor_type_id.html}
376 enableHonorType();
377 {/if}
378 {literal}
379
380 function enableHonorType( ) {
381 var element = document.getElementsByName("honor_type_id");
382 for (var i = 0; i < element.length; i++ ) {
383 var isHonor = false;
384 if ( element[i].checked == true ) {
385 var isHonor = true;
386 break;
387 }
388 }
389 if ( isHonor ) {
390 cj('#honorType').show();
391 cj('#honorTypeEmail').show();
392 }
393 else {
394 document.getElementById('honor_first_name').value = '';
395 document.getElementById('honor_last_name').value = '';
396 document.getElementById('honor_email').value = '';
397 document.getElementById('honor_prefix_id').value = '';
398 cj('#honorType').hide();
399 cj('#honorTypeEmail').hide();
400 }
401 }
402
403 function pcpAnonymous( ) {
404 // clear nickname field if anonymous is true
405 if (document.getElementsByName("pcp_is_anonymous")[1].checked) {
406 document.getElementById('pcp_roll_nickname').value = '';
407 }
408 if (!document.getElementsByName("pcp_display_in_roll")[0].checked) {
409 cj('#nickID').hide();
410 cj('#nameID').hide();
411 cj('#personalNoteID').hide();
412 }
413 else {
414 if (document.getElementsByName("pcp_is_anonymous")[0].checked) {
415 cj('#nameID').show();
416 cj('#nickID').show();
417 cj('#personalNoteID').show();
418 }
419 else {
420 cj('#nameID').show();
421 cj('#nickID').hide();
422 cj('#personalNoteID').hide();
423 }
424 }
425 }
426
427 {/literal}
428 {if $form.is_pay_later and $paymentProcessor.payment_processor_type EQ 'PayPal_Express'}
429 showHidePayPalExpressOption();
430 {/if}
431 {literal}
432
433 function toggleConfirmButton() {
434 var payPalExpressId = "{/literal}{$payPalExpressId}{literal}";
435 var elementObj = cj('input[name="payment_processor"]');
436 if ( elementObj.attr('type') == 'hidden' ) {
437 var processorTypeId = elementObj.val( );
438 }
439 else {
440 var processorTypeId = elementObj.filter(':checked').val();
441 }
442
443 if (payPalExpressId !=0 && payPalExpressId == processorTypeId) {
444 cj("#crm-submit-buttons").hide();
445 }
446 else {
447 cj("#crm-submit-buttons").show();
448 }
449 }
450
451 cj('input[name="payment_processor"]').change( function() {
452 toggleConfirmButton();
453 });
454
455 cj(function() {
456 toggleConfirmButton();
457 });
458
459 function showHidePayPalExpressOption() {
460 if (cj('input[name="is_pay_later"]').is(':checked')) {
461 cj("#crm-submit-buttons").show();
462 cj("#paypalExpress").hide();
463 }
464 else {
465 cj("#paypalExpress").show();
466 cj("#crm-submit-buttons").hide();
467 }
468 }
469
470 cj(function(){
471 // highlight price sets
472 function updatePriceSetHighlight() {
473 cj('#priceset .price-set-row').removeClass('highlight');
474 cj('#priceset .price-set-row input:checked').parent().parent().addClass('highlight');
475 }
476 cj('#priceset input[type="radio"]').change(updatePriceSetHighlight);
477 updatePriceSetHighlight();
478 });
479 {/literal}
480 </script>
481 {/if}
482
483 {* jQuery validate *}
484 {* disabled because more work needs to be done to conditionally require credit card fields *}
485 {*include file="CRM/Form/validate.tpl"*}