Merge pull request #583 from yashodha/CRM-12463
[civicrm-core.git] / templates / CRM / Contribute / Form / SoftCredit.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 {* template for adding form elements for soft credit form*}
27 <tr id="softCreditID" class="crm-contribution-form-block-soft_credit_to"><td class="label">{$form.soft_credit_to.label}</td>
28 <td {$valueStyle}>
29 {$form.soft_credit_to.html} {help id="id-soft_credit"}
30 {if $siteHasPCPs}
31 <div id="showPCPLink"><a href='#' onclick='showPCP(); return false;'>{ts}credit this contribution to a personal campaign page{/ts}</a>{help id="id-link_pcp"}</div>
32 {/if}
33 </td>
34 </tr>
35 {if $siteHasPCPs}{* Credit contribution to PCP. *}
36 <tr id="pcpID" class="crm-contribution-form-block-pcp_made_through_id">
37 <td class="label">{$form.pcp_made_through.label}</td>
38 <td>
39 {$form.pcp_made_through.html} &nbsp;
40 <span class="showSoftCreditLink">{ts}<a href="#" onclick='showSoftCredit(); return false;'>unlink from personal campaign page</a>{/ts}</span><br />
41 <span class="description">{ts}Search for the Personal Campaign Page by the fund-raiser's last name or email address.{/ts}</span>
42 <div class="spacer"></div>
43 <div class="crm-contribution-form-block-pcp_details">
44 <table class="crm-contribution-form-table-credit_to_pcp">
45 <tr id="pcpDisplayRollID" class="crm-contribution-form-block-pcp_display_in_roll"><td class="label">{$form.pcp_display_in_roll.label}</td>
46 <td>{$form.pcp_display_in_roll.html}</td>
47 </tr>
48 <tr id="nickID" class="crm-contribution-form-block-pcp_roll_nickname">
49 <td class="label">{$form.pcp_roll_nickname.label}</td>
50 <td>{$form.pcp_roll_nickname.html|crmAddClass:big}<br />
51 <span class="description">{ts}Name or nickname contributor wants to be displayed in the Honor Roll. Enter "Anonymous" for anonymous contributions.{/ts}</span></td>
52 </tr>
53 <tr id="personalNoteID" class="crm-contribution-form-block-pcp_personal_note">
54 <td class="label" style="vertical-align: top">{$form.pcp_personal_note.label}</td>
55 <td>{$form.pcp_personal_note.html}
56 <span class="description">{ts}Personal message submitted by contributor for display in the Honor Roll.{/ts}</span>
57 </td>
58 </tr>
59 </table>
60 </div>
61 </td>
62 </tr>
63 {/if}
64
65 {literal}
66 <script type="text/javascript">
67 var url = "{/literal}{$dataUrl}{literal}";
68
69 cj('#soft_credit_to').autocomplete( url, { width : 180, selectFirst : false, matchContains: true
70 }).result( function(event, data, formatted) {
71 cj( "#soft_contact_id" ).val( data[1] );
72 });
73 {/literal}
74
75 // load form during form rule.
76 {if $buildPriceSet}{literal}buildAmount( );{/literal}{/if}
77
78 {if $siteHasPCPs}
79 {literal}
80 var pcpUrl = "{/literal}{$pcpDataUrl}{literal}";
81
82 cj('#pcp_made_through').autocomplete( pcpUrl, { width : 360, selectFirst : false, matchContains: true
83 }).result( function(event, data, formatted) {
84 cj( "#pcp_made_through_id" ).val( data[1] );
85 });
86 {/literal}
87
88 {if $pcpLinked}
89 {literal}hideSoftCredit( );{/literal}{* hide soft credit on load if we have PCP linkage *}
90 {else}
91 {literal}cj('#pcpID').hide();{/literal}{* hide PCP section *}
92 {/if}
93
94 {literal}
95 function hideSoftCredit ( ){
96 cj("#softCreditID").hide();
97 }
98 function showPCP( ) {
99 cj('#pcpID').show();
100 cj("#softCreditID").hide();
101 }
102 function showSoftCredit( ) {
103 cj('#pcp_made_through_id').val('');
104 cj('#pcp_made_through').val('');
105 cj('#pcp_roll_nickname').val('');
106 cj('#pcp_personal_note').val('');
107 cj('#pcp_display_in_roll').attr('checked', false);
108 cj("#pcpID").hide();
109 cj('#softCreditID').show();
110 }
111 {/literal}
112 {/if}
113 </script>
114
115
116
117
118
119