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